summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-21 18:40:20 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-21 18:40:20 +0300
commit08507b9d5b3e16f8d40b32bb2540c0dbc31ff4f1 (patch)
tree8fa1b387091bb0b502325c9ba2845f456c80dd59
parentd8bd7fec4c21e4e4b19053153d5e3a271f3e0a42 (diff)
downloadmanaverse-08507b9d5b3e16f8d40b32bb2540c0dbc31ff4f1.tar.gz
manaverse-08507b9d5b3e16f8d40b32bb2540c0dbc31ff4f1.tar.bz2
manaverse-08507b9d5b3e16f8d40b32bb2540c0dbc31ff4f1.tar.xz
manaverse-08507b9d5b3e16f8d40b32bb2540c0dbc31ff4f1.zip
Move chat related actions into separate file.
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/Makefile.am2
-rw-r--r--src/actions/actions.cpp55
-rw-r--r--src/actions/actions.h6
-rw-r--r--src/actions/chat.cpp135
-rw-r--r--src/actions/chat.h40
-rw-r--r--src/input/inputactionmap.h1
7 files changed, 180 insertions, 61 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6bd09bf17..7f8feafc2 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -716,6 +716,8 @@ SET(SRCS
actions/actiondef.h
actions/actions.cpp
actions/actions.h
+ actions/chat.cpp
+ actions/chat.h
actions/windows.cpp
actions/windows.h
being/actor.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index 6e0255617..f625c8492 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -834,6 +834,8 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \
actions/actiondef.h \
actions/actions.cpp \
actions/actions.h \
+ actions/chat.cpp \
+ actions/chat.h \
actions/windows.cpp \
actions/windows.h \
being/actor.cpp \
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp
index 8e1293856..142eea6e1 100644
--- a/src/actions/actions.cpp
+++ b/src/actions/actions.cpp
@@ -268,41 +268,6 @@ impHandler(shortcut)
return false;
}
-impHandler0(toggleChat)
-{
- return chatWindow ? chatWindow->requestChatFocus() : false;
-}
-
-impHandler0(prevChatTab)
-{
- if (chatWindow)
- {
- chatWindow->prevTab();
- return true;
- }
- return false;
-}
-
-impHandler0(nextChatTab)
-{
- if (chatWindow)
- {
- chatWindow->nextTab();
- return true;
- }
- return false;
-}
-
-impHandler0(closeChatTab)
-{
- if (chatWindow)
- {
- chatWindow->closeTab();
- return true;
- }
- return false;
-}
-
impHandler0(prevSocialTab)
{
if (socialWindow)
@@ -323,26 +288,6 @@ impHandler0(nextSocialTab)
return false;
}
-impHandler0(scrollChatUp)
-{
- if (chatWindow && chatWindow->isWindowVisible())
- {
- chatWindow->scroll(-DEFAULT_CHAT_WINDOW_SCROLL);
- return true;
- }
- return false;
-}
-
-impHandler0(scrollChatDown)
-{
- if (chatWindow && chatWindow->isWindowVisible())
- {
- chatWindow->scroll(DEFAULT_CHAT_WINDOW_SCROLL);
- return true;
- }
- return false;
-}
-
impHandler0(quit)
{
if (!Game::instance())
diff --git a/src/actions/actions.h b/src/actions/actions.h
index a71eb22fb..eeafed50d 100644
--- a/src/actions/actions.h
+++ b/src/actions/actions.h
@@ -38,14 +38,8 @@ namespace Actions
decHandler(mouseClick);
decHandler(ok);
decHandler(shortcut);
- decHandler(toggleChat);
- decHandler(prevChatTab);
- decHandler(nextChatTab);
- decHandler(closeChatTab);
decHandler(prevSocialTab);
decHandler(nextSocialTab);
- decHandler(scrollChatUp);
- decHandler(scrollChatDown);
decHandler(quit);
decHandler(dropItem0);
decHandler(dropItem);
diff --git a/src/actions/chat.cpp b/src/actions/chat.cpp
new file mode 100644
index 000000000..5b70c2085
--- /dev/null
+++ b/src/actions/chat.cpp
@@ -0,0 +1,135 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2012-2014 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "actions/chat.h"
+
+#include "actormanager.h"
+#include "dropshortcut.h"
+#include "emoteshortcut.h"
+#include "game.h"
+#include "itemshortcut.h"
+#include "soundmanager.h"
+
+#include "actions/actiondef.h"
+
+#include "being/attributes.h"
+#include "being/localplayer.h"
+#include "being/playerinfo.h"
+#include "being/playerrelations.h"
+
+#include "gui/dialogsmanager.h"
+#include "gui/gui.h"
+#include "gui/popupmanager.h"
+#include "gui/sdlinput.h"
+#include "gui/viewport.h"
+
+#include "gui/popups/popupmenu.h"
+
+#include "gui/windows/skilldialog.h"
+#include "gui/windows/socialwindow.h"
+#include "gui/windows/statuswindow.h"
+#include "gui/windows/tradewindow.h"
+#include "gui/windows/questswindow.h"
+#include "gui/windows/quitdialog.h"
+#include "gui/windows/whoisonline.h"
+#include "gui/windows/botcheckerwindow.h"
+#include "gui/windows/buyselldialog.h"
+#include "gui/windows/chatwindow.h"
+#include "gui/windows/debugwindow.h"
+#include "gui/windows/didyouknowwindow.h"
+#include "gui/windows/equipmentwindow.h"
+#include "gui/windows/helpwindow.h"
+#include "gui/windows/inventorywindow.h"
+#include "gui/windows/killstats.h"
+#include "gui/windows/minimap.h"
+#include "gui/windows/npcdialog.h"
+#include "gui/windows/outfitwindow.h"
+#include "gui/windows/setupwindow.h"
+#include "gui/windows/shopwindow.h"
+#include "gui/windows/shortcutwindow.h"
+#include "gui/windows/updaterwindow.h"
+
+#include "gui/widgets/tabs/chattab.h"
+
+#include "debug.h"
+
+extern ShortcutWindow *spellShortcutWindow;
+extern std::string tradePartnerName;
+extern QuitDialog *quitDialog;
+
+namespace Actions
+{
+
+impHandler0(toggleChat)
+{
+ return chatWindow ? chatWindow->requestChatFocus() : false;
+}
+
+impHandler0(prevChatTab)
+{
+ if (chatWindow)
+ {
+ chatWindow->prevTab();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(nextChatTab)
+{
+ if (chatWindow)
+ {
+ chatWindow->nextTab();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(closeChatTab)
+{
+ if (chatWindow)
+ {
+ chatWindow->closeTab();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(scrollChatUp)
+{
+ if (chatWindow && chatWindow->isWindowVisible())
+ {
+ chatWindow->scroll(-DEFAULT_CHAT_WINDOW_SCROLL);
+ return true;
+ }
+ return false;
+}
+
+impHandler0(scrollChatDown)
+{
+ if (chatWindow && chatWindow->isWindowVisible())
+ {
+ chatWindow->scroll(DEFAULT_CHAT_WINDOW_SCROLL);
+ return true;
+ }
+ return false;
+}
+
+} // namespace Actions
diff --git a/src/actions/chat.h b/src/actions/chat.h
new file mode 100644
index 000000000..f57362b0e
--- /dev/null
+++ b/src/actions/chat.h
@@ -0,0 +1,40 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2014 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef ACTIONS_CHAT_H
+#define ACTIONS_CHAT_H
+
+#define decHandler(name) bool name(const InputEvent &event)
+
+struct InputEvent;
+
+namespace Actions
+{
+ decHandler(toggleChat);
+ decHandler(prevChatTab);
+ decHandler(nextChatTab);
+ decHandler(closeChatTab);
+ decHandler(scrollChatUp);
+ decHandler(scrollChatDown);
+} // namespace Actions
+
+#undef decHandler
+
+#endif // ACTIONS_CHAT_H
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index 3c3ba0ab9..0eee9176f 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -26,6 +26,7 @@
#include "sdlshared.h"
#include "actions/actions.h"
+#include "actions/chat.h"
#include "actions/windows.h"
#include "input/inputaction.h"