diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/actions/actions.cpp | 55 | ||||
-rw-r--r-- | src/actions/actions.h | 6 | ||||
-rw-r--r-- | src/actions/chat.cpp | 135 | ||||
-rw-r--r-- | src/actions/chat.h | 40 | ||||
-rw-r--r-- | src/input/inputactionmap.h | 1 |
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" |