diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-08-21 19:59:12 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-08-21 19:59:12 +0300 |
commit | 6bedc289455528fe609f492cd9f1a0c352d981bb (patch) | |
tree | 50c5ad4f8b8b4d6eca04141239a6a2e31e89bed8 | |
parent | 79e280817b91f4e9b67cc42a8abf5c49243f56a5 (diff) | |
download | manaverse-6bedc289455528fe609f492cd9f1a0c352d981bb.tar.gz manaverse-6bedc289455528fe609f492cd9f1a0c352d981bb.tar.bz2 manaverse-6bedc289455528fe609f492cd9f1a0c352d981bb.tar.xz manaverse-6bedc289455528fe609f492cd9f1a0c352d981bb.zip |
Move status bar (yellow bar) related actions into separate file.
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/actions/actions.cpp | 139 | ||||
-rw-r--r-- | src/actions/actions.h | 17 | ||||
-rw-r--r-- | src/actions/statusbar.cpp | 237 | ||||
-rw-r--r-- | src/actions/statusbar.h | 51 | ||||
-rw-r--r-- | src/input/inputactionmap.h | 1 |
7 files changed, 293 insertions, 156 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index df29db9ac..1850702d7 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/statusbar.cpp + actions/statusbar.h actions/tabs.cpp actions/tabs.h actions/windows.cpp diff --git a/src/Makefile.am b/src/Makefile.am index f1494b009..7a6eba376 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/statusbar.cpp \ + actions/statusbar.h \ actions/tabs.cpp \ actions/tabs.h \ actions/windows.cpp \ diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index 93294bfc0..926b0e48a 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -228,11 +228,6 @@ impHandler0(dropItem) return false; } -impHandler0(switchQuickDrop) -{ - callYellowBarCond(changeQuickDropCounter) -} - impHandler0(heal) { if (actorManager) @@ -271,16 +266,6 @@ impHandler0(itenplz) return false; } -impHandler0(changeCrazyMove) -{ - callYellowBar(changeCrazyMoveType); -} - -impHandler0(changePickupType) -{ - callYellowBar(changePickUpType); -} - impHandler0(setHome) { if (localPlayer) @@ -291,31 +276,6 @@ impHandler0(setHome) return false; } -impHandler0(changeMoveType) -{ - callYellowBar(changeMoveType); -} - -impHandler0(changeAttackWeaponType) -{ - callYellowBar(changeAttackWeaponType); -} - -impHandler0(changeAttackType) -{ - callYellowBar(changeAttackType); -} - -impHandler0(changeFollowMode) -{ - callYellowBar(changeFollowMode); -} - -impHandler0(changeImitationMode) -{ - callYellowBar(changeImitationMode); -} - impHandler0(magicAttack) { if (localPlayer) @@ -326,21 +286,6 @@ impHandler0(magicAttack) return false; } -impHandler0(changeMagicAttackType) -{ - callYellowBar(changeMagicAttackType); -} - -impHandler0(changePvpMode) -{ - callYellowBar(changePvpAttackType); -} - -impHandler0(changeMoveToTarget) -{ - callYellowBar(changeMoveToTargetType); -} - impHandler0(copyEquippedToOutfit) { if (outfitWindow) @@ -351,49 +296,6 @@ impHandler0(copyEquippedToOutfit) return false; } -impHandler0(changeGameModifier) -{ - if (localPlayer) - { - GameModifiers::changeGameModifiers(); - return true; - } - return false; -} - -impHandler0(changeAudio) -{ - soundManager.changeAudio(); - if (localPlayer) - localPlayer->updateMusic(); - return true; -} - -impHandler0(away) -{ - GameModifiers::changeAwayMode(); - if (localPlayer) - { - localPlayer->updateStatus(); - if (Game::instance()) - Game::instance()->setValidSpeed(); - return true; - } - return false; -} - -impHandler0(camera) -{ - if (viewport) - { - viewport->toggleCameraMode(); - if (Game::instance()) - Game::instance()->setValidSpeed(); - return true; - } - return false; -} - impHandler0(pickup) { if (localPlayer) @@ -422,47 +324,6 @@ impHandler0(sit) return false; } -impHandler0(changeMapMode) -{ - if (viewport) - viewport->toggleMapDrawType(); - UpdateStatusListener::distributeEvent(); - if (Game::instance()) - { - if (Map *const map = Game::instance()->getCurrentMap()) - map->redrawMap(); - } - return true; -} - -impHandler0(changeTrade) -{ - unsigned int deflt = player_relations.getDefault(); - if (deflt & PlayerRelation::TRADE) - { - if (localChatTab) - { - // TRANSLATORS: disable trades message - localChatTab->chatLog(_("Ignoring incoming trade requests"), - ChatMsgType::BY_SERVER); - } - deflt &= ~PlayerRelation::TRADE; - } - else - { - if (localChatTab) - { - // TRANSLATORS: enable trades message - localChatTab->chatLog(_("Accepting incoming trade requests"), - ChatMsgType::BY_SERVER); - } - deflt |= PlayerRelation::TRADE; - } - - player_relations.setDefault(deflt); - return true; -} - impHandler0(screenshot) { Game::createScreenshot(); diff --git a/src/actions/actions.h b/src/actions/actions.h index da216deb5..36a83d1d3 100644 --- a/src/actions/actions.h +++ b/src/actions/actions.h @@ -35,30 +35,13 @@ namespace Actions decHandler(quit); decHandler(dropItem0); decHandler(dropItem); - decHandler(switchQuickDrop); decHandler(heal); decHandler(itenplz); - decHandler(changeCrazyMove); - decHandler(changePickupType); decHandler(setHome); - decHandler(changeMoveType); - decHandler(changeAttackWeaponType); - decHandler(changeAttackType); - decHandler(changeFollowMode); - decHandler(changeImitationMode); decHandler(magicAttack); - decHandler(changeMagicAttackType); - decHandler(changePvpMode); - decHandler(changeMoveToTarget); decHandler(copyEquippedToOutfit); - decHandler(changeGameModifier); - decHandler(changeAudio); - decHandler(away); - decHandler(camera); decHandler(pickup); decHandler(sit); - decHandler(changeMapMode); - decHandler(changeTrade); decHandler(screenshot); decHandler(ignoreInput); decHandler(talk); diff --git a/src/actions/statusbar.cpp b/src/actions/statusbar.cpp new file mode 100644 index 000000000..d74cc916b --- /dev/null +++ b/src/actions/statusbar.cpp @@ -0,0 +1,237 @@ +/* + * 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/statusbar.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 <SDL_screenkeyboard.h> +#endif +#endif + +#include "debug.h" + +extern ShortcutWindow *spellShortcutWindow; +extern std::string tradePartnerName; +extern QuitDialog *quitDialog; + +namespace Actions +{ + +impHandler0(switchQuickDrop) +{ + callYellowBarCond(changeQuickDropCounter) +} + +impHandler0(changeCrazyMove) +{ + callYellowBar(changeCrazyMoveType); +} + +impHandler0(changePickupType) +{ + callYellowBar(changePickUpType); +} + +impHandler0(changeMoveType) +{ + callYellowBar(changeMoveType); +} + +impHandler0(changeAttackWeaponType) +{ + callYellowBar(changeAttackWeaponType); +} + +impHandler0(changeAttackType) +{ + callYellowBar(changeAttackType); +} + +impHandler0(changeFollowMode) +{ + callYellowBar(changeFollowMode); +} + +impHandler0(changeImitationMode) +{ + callYellowBar(changeImitationMode); +} + +impHandler0(changeMagicAttackType) +{ + callYellowBar(changeMagicAttackType); +} + +impHandler0(changePvpMode) +{ + callYellowBar(changePvpAttackType); +} + +impHandler0(changeMoveToTarget) +{ + callYellowBar(changeMoveToTargetType); +} + +impHandler0(changeGameModifier) +{ + if (localPlayer) + { + GameModifiers::changeGameModifiers(); + return true; + } + return false; +} + +impHandler0(changeAudio) +{ + soundManager.changeAudio(); + if (localPlayer) + localPlayer->updateMusic(); + return true; +} + +impHandler0(away) +{ + GameModifiers::changeAwayMode(); + if (localPlayer) + { + localPlayer->updateStatus(); + if (Game::instance()) + Game::instance()->setValidSpeed(); + return true; + } + return false; +} + +impHandler0(camera) +{ + if (viewport) + { + viewport->toggleCameraMode(); + if (Game::instance()) + Game::instance()->setValidSpeed(); + return true; + } + return false; +} + +impHandler0(changeMapMode) +{ + if (viewport) + viewport->toggleMapDrawType(); + UpdateStatusListener::distributeEvent(); + if (Game::instance()) + { + if (Map *const map = Game::instance()->getCurrentMap()) + map->redrawMap(); + } + return true; +} + +impHandler0(changeTrade) +{ + unsigned int deflt = player_relations.getDefault(); + if (deflt & PlayerRelation::TRADE) + { + if (localChatTab) + { + // TRANSLATORS: disable trades message + localChatTab->chatLog(_("Ignoring incoming trade requests"), + ChatMsgType::BY_SERVER); + } + deflt &= ~PlayerRelation::TRADE; + } + else + { + if (localChatTab) + { + // TRANSLATORS: enable trades message + localChatTab->chatLog(_("Accepting incoming trade requests"), + ChatMsgType::BY_SERVER); + } + deflt |= PlayerRelation::TRADE; + } + + player_relations.setDefault(deflt); + return true; +} + +} // namespace Actions diff --git a/src/actions/statusbar.h b/src/actions/statusbar.h new file mode 100644 index 000000000..68e1d6217 --- /dev/null +++ b/src/actions/statusbar.h @@ -0,0 +1,51 @@ +/* + * 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_STATUSBAR_H +#define ACTIONS_STATUSBAR_H + +#define decHandler(name) bool name(const InputEvent &event) + +struct InputEvent; + +namespace Actions +{ + decHandler(switchQuickDrop); + decHandler(changeCrazyMove); + decHandler(changePickupType); + decHandler(changeMoveType); + decHandler(changeAttackWeaponType); + decHandler(changeAttackType); + decHandler(changeFollowMode); + decHandler(changeImitationMode); + decHandler(changeMagicAttackType); + decHandler(changePvpMode); + decHandler(changeMoveToTarget); + decHandler(changeGameModifier); + decHandler(changeAudio); + decHandler(away); + decHandler(camera); + decHandler(changeMapMode); + decHandler(changeTrade); +} // namespace Actions + +#undef decHandler + +#endif // ACTIONS_STATUSBAR_H diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 843dce5b5..29c4b9448 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/statusbar.h" #include "actions/tabs.h" #include "actions/windows.h" |