From 79e280817b91f4e9b67cc42a8abf5c49243f56a5 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 21 Aug 2014 18:56:18 +0300 Subject: Move tabs related actions into separate file. --- src/CMakeLists.txt | 2 + src/Makefile.am | 2 + src/actions/actions.cpp | 60 ----------------- src/actions/actions.h | 6 -- src/actions/tabs.cpp | 158 +++++++++++++++++++++++++++++++++++++++++++++ src/actions/tabs.h | 40 ++++++++++++ src/input/inputactionmap.h | 1 + 7 files changed, 203 insertions(+), 66 deletions(-) create mode 100644 src/actions/tabs.cpp create mode 100644 src/actions/tabs.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 75c5d3755..df29db9ac 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -720,6 +720,8 @@ SET(SRCS actions/chat.h actions/move.cpp actions/move.h + actions/tabs.cpp + actions/tabs.h actions/windows.cpp actions/windows.h being/actor.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 4dd6a8600..f1494b009 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -838,6 +838,8 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ actions/chat.h \ actions/move.cpp \ actions/move.h \ + actions/tabs.cpp \ + actions/tabs.h \ actions/windows.cpp \ actions/windows.h \ being/actor.cpp \ diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index 32bdd44ca..93294bfc0 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -189,26 +189,6 @@ impHandler(shortcut) return false; } -impHandler0(prevSocialTab) -{ - if (socialWindow) - { - socialWindow->prevTab(); - return true; - } - return false; -} - -impHandler0(nextSocialTab) -{ - if (socialWindow) - { - socialWindow->nextTab(); - return true; - } - return false; -} - impHandler0(quit) { if (!Game::instance()) @@ -675,46 +655,6 @@ impHandler0(showWindows) return false; } -impHandler0(nextShortcutsTab) -{ - if (itemShortcutWindow) - { - itemShortcutWindow->nextTab(); - return true; - } - return false; -} - -impHandler0(prevShortcutsTab) -{ - if (itemShortcutWindow) - { - itemShortcutWindow->prevTab(); - return true; - } - return false; -} - -impHandler0(nextCommandsTab) -{ - if (spellShortcutWindow) - { - spellShortcutWindow->nextTab(); - return true; - } - return false; -} - -impHandler0(prevCommandsTab) -{ - if (spellShortcutWindow) - { - spellShortcutWindow->prevTab(); - return true; - } - return false; -} - impHandler0(openTrade) { const Being *const being = localPlayer->getTarget(); diff --git a/src/actions/actions.h b/src/actions/actions.h index 866c0326c..da216deb5 100644 --- a/src/actions/actions.h +++ b/src/actions/actions.h @@ -32,8 +32,6 @@ namespace Actions decHandler(mouseClick); decHandler(ok); decHandler(shortcut); - decHandler(prevSocialTab); - decHandler(nextSocialTab); decHandler(quit); decHandler(dropItem0); decHandler(dropItem); @@ -76,10 +74,6 @@ namespace Actions decHandler(stopSit); decHandler(showKeyboard); decHandler(showWindows); - decHandler(nextShortcutsTab); - decHandler(prevShortcutsTab); - decHandler(nextCommandsTab); - decHandler(prevCommandsTab); decHandler(openTrade); } // namespace Actions diff --git a/src/actions/tabs.cpp b/src/actions/tabs.cpp new file mode 100644 index 000000000..c06c5ebe3 --- /dev/null +++ b/src/actions/tabs.cpp @@ -0,0 +1,158 @@ +/* + * 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 . + */ + +#include "actions/actions.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 "render/graphics.h" + +#include "net/net.h" +#include "net/playerhandler.h" +#include "net/tradehandler.h" + +#include "listeners/updatestatuslistener.h" + +#include "resources/map/map.h" + +#include "utils/gettext.h" + +#ifdef ANDROID +#ifndef USE_SDL2 +#include +#endif +#endif + +#include "debug.h" + +extern ShortcutWindow *spellShortcutWindow; +extern std::string tradePartnerName; +extern QuitDialog *quitDialog; + +namespace Actions +{ + +impHandler0(prevSocialTab) +{ + if (socialWindow) + { + socialWindow->prevTab(); + return true; + } + return false; +} + +impHandler0(nextSocialTab) +{ + if (socialWindow) + { + socialWindow->nextTab(); + return true; + } + return false; +} + +impHandler0(nextShortcutsTab) +{ + if (itemShortcutWindow) + { + itemShortcutWindow->nextTab(); + return true; + } + return false; +} + +impHandler0(prevShortcutsTab) +{ + if (itemShortcutWindow) + { + itemShortcutWindow->prevTab(); + return true; + } + return false; +} + +impHandler0(nextCommandsTab) +{ + if (spellShortcutWindow) + { + spellShortcutWindow->nextTab(); + return true; + } + return false; +} + +impHandler0(prevCommandsTab) +{ + if (spellShortcutWindow) + { + spellShortcutWindow->prevTab(); + return true; + } + return false; +} + +} // namespace Actions diff --git a/src/actions/tabs.h b/src/actions/tabs.h new file mode 100644 index 000000000..c0bb49c86 --- /dev/null +++ b/src/actions/tabs.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 . + */ + +#ifndef ACTIONS_TABS_H +#define ACTIONS_TABS_H + +#define decHandler(name) bool name(const InputEvent &event) + +struct InputEvent; + +namespace Actions +{ + decHandler(prevSocialTab); + decHandler(nextSocialTab); + decHandler(nextShortcutsTab); + decHandler(prevShortcutsTab); + decHandler(nextCommandsTab); + decHandler(prevCommandsTab); +} // namespace Actions + +#undef decHandler + +#endif // ACTIONS_TABS_H diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 0d731aefe..843dce5b5 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -28,6 +28,7 @@ #include "actions/actions.h" #include "actions/chat.h" #include "actions/move.h" +#include "actions/tabs.h" #include "actions/windows.h" #include "input/inputaction.h" -- cgit v1.2.3-60-g2f50