summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-21 18:29:14 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-21 18:29:14 +0300
commitd8bd7fec4c21e4e4b19053153d5e3a271f3e0a42 (patch)
tree296020411f2ff09e0a10d963f675723927b7118f
parent818116248c82fb48f8b99d37e896e18609cdd713 (diff)
downloadmv-d8bd7fec4c21e4e4b19053153d5e3a271f3e0a42.tar.gz
mv-d8bd7fec4c21e4e4b19053153d5e3a271f3e0a42.tar.bz2
mv-d8bd7fec4c21e4e4b19053153d5e3a271f3e0a42.tar.xz
mv-d8bd7fec4c21e4e4b19053153d5e3a271f3e0a42.zip
Move windows related actions into separate file.
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/Makefile.am2
-rw-r--r--src/actions/actiondef.h1
-rw-r--r--src/actions/actions.cpp190
-rw-r--r--src/actions/actions.h25
-rw-r--r--src/actions/windows.cpp280
-rw-r--r--src/actions/windows.h58
-rw-r--r--src/input/inputactionmap.h1
8 files changed, 344 insertions, 215 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0e8e01f3b..6bd09bf17 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/windows.cpp
+ actions/windows.h
being/actor.cpp
being/actor.h
being/actorsprite.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index 79018bc6c..6e0255617 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/windows.cpp \
+ actions/windows.h \
being/actor.cpp \
being/actor.h \
being/actorsprite.cpp \
diff --git a/src/actions/actiondef.h b/src/actions/actiondef.h
index 9877f2d0e..70e44f794 100644
--- a/src/actions/actiondef.h
+++ b/src/actions/actiondef.h
@@ -26,6 +26,7 @@
#include "input/inputmanager.h"
+#define decHandler(name) bool name(const InputEvent &event)
#define impHandler(name) bool name(const InputEvent &event)
#define impHandler0(name) bool name(const InputEvent &event A_UNUSED)
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp
index d85bbeb78..8e1293856 100644
--- a/src/actions/actions.cpp
+++ b/src/actions/actions.cpp
@@ -582,24 +582,6 @@ impHandler0(camera)
return false;
}
-impHandler0(setupWindowShow)
-{
- if (setupWindow)
- {
- if (setupWindow->isWindowVisible())
- {
- setupWindow->doCancel();
- }
- else
- {
- setupWindow->setVisible(true);
- setupWindow->requestMoveToTop();
- }
- return true;
- }
- return false;
-}
-
impHandler0(pickup)
{
if (localPlayer)
@@ -628,178 +610,6 @@ impHandler0(sit)
return false;
}
-impHandler0(hideWindows)
-{
- if (setupWindow)
- setupWindow->hideWindows();
- return true;
-}
-
-static bool showHelpPage(const std::string &page, const bool showHide)
-{
- if (helpWindow)
- {
- if (showHide && helpWindow->isWindowVisible())
- {
- helpWindow->setVisible(false);
- }
- else
- {
- helpWindow->loadHelp(page);
- helpWindow->requestMoveToTop();
- }
- return true;
- }
- return false;
-}
-
-impHandler0(helpWindowShow)
-{
- return showHelpPage("index", true);
-}
-
-impHandler0(aboutWindowShow)
-{
- return showHelpPage("about", false);
-}
-
-static void showHideWindow(Window *const window)
-{
- if (window)
- {
- window->setVisible(!window->isWindowVisible());
- if (window->isWindowVisible())
- window->requestMoveToTop();
- }
-}
-
-impHandler0(statusWindowShow)
-{
- showHideWindow(statusWindow);
- return true;
-}
-
-impHandler0(inventoryWindowShow)
-{
- showHideWindow(inventoryWindow);
- return true;
-}
-
-impHandler0(equipmentWindowShow)
-{
- showHideWindow(equipmentWindow);
- return true;
-}
-
-impHandler0(skillDialogShow)
-{
- showHideWindow(skillDialog);
- return true;
-}
-
-impHandler0(minimapWindowShow)
-{
- if (minimap)
- {
- minimap->toggle();
- return true;
- }
- return false;
-}
-
-impHandler0(chatWindowShow)
-{
- showHideWindow(chatWindow);
- return true;
-}
-
-impHandler0(shortcutWindowShow)
-{
- showHideWindow(itemShortcutWindow);
- return true;
-}
-
-impHandler0(debugWindowShow)
-{
- showHideWindow(debugWindow);
- return true;
-}
-
-impHandler0(socialWindowShow)
-{
- showHideWindow(socialWindow);
- return true;
-}
-
-impHandler0(emoteShortcutWindowShow)
-{
- showHideWindow(emoteShortcutWindow);
- return true;
-}
-
-impHandler0(outfitWindowShow)
-{
- showHideWindow(outfitWindow);
- return true;
-}
-
-impHandler0(shopWindowShow)
-{
- showHideWindow(shopWindow);
- return true;
-}
-
-impHandler0(dropShortcutWindowShow)
-{
- showHideWindow(dropShortcutWindow);
- return true;
-}
-
-impHandler0(killStatsWindowShow)
-{
- showHideWindow(killStats);
- return true;
-}
-
-impHandler0(spellShortcutWindowShow)
-{
- showHideWindow(spellShortcutWindow);
- return true;
-}
-
-impHandler0(botcheckerWindowShow)
-{
- showHideWindow(botCheckerWindow);
- return true;
-}
-
-impHandler0(whoIsOnlineWindowShow)
-{
- showHideWindow(whoIsOnline);
- return true;
-}
-
-impHandler0(didYouKnowWindowShow)
-{
- showHideWindow(didYouKnowWindow);
- return true;
-}
-
-impHandler0(questsWindowShow)
-{
- showHideWindow(questsWindow);
- return true;
-}
-
-impHandler0(updaterWindowShow)
-{
- if (updaterWindow)
- updaterWindow->deleteSelf();
- else
- DialogsManager::createUpdaterWindow();
- return true;
-}
-
impHandler0(changeMapMode)
{
if (viewport)
diff --git a/src/actions/actions.h b/src/actions/actions.h
index 8aee7caf4..a71eb22fb 100644
--- a/src/actions/actions.h
+++ b/src/actions/actions.h
@@ -100,31 +100,6 @@ namespace Actions
decHandler(nextCommandsTab);
decHandler(prevCommandsTab);
decHandler(openTrade);
-
- decHandler(hideWindows);
- decHandler(helpWindowShow);
- decHandler(aboutWindowShow);
- decHandler(setupWindowShow);
- decHandler(statusWindowShow);
- decHandler(inventoryWindowShow);
- decHandler(equipmentWindowShow);
- decHandler(skillDialogShow);
- decHandler(minimapWindowShow);
- decHandler(chatWindowShow);
- decHandler(shortcutWindowShow);
- decHandler(debugWindowShow);
- decHandler(socialWindowShow);
- decHandler(emoteShortcutWindowShow);
- decHandler(outfitWindowShow);
- decHandler(shopWindowShow);
- decHandler(dropShortcutWindowShow);
- decHandler(killStatsWindowShow);
- decHandler(spellShortcutWindowShow);
- decHandler(botcheckerWindowShow);
- decHandler(whoIsOnlineWindowShow);
- decHandler(didYouKnowWindowShow);
- decHandler(questsWindowShow);
- decHandler(updaterWindowShow);
} // namespace Actions
#undef decHandler
diff --git a/src/actions/windows.cpp b/src/actions/windows.cpp
new file mode 100644
index 000000000..7e5b31858
--- /dev/null
+++ b/src/actions/windows.cpp
@@ -0,0 +1,280 @@
+/*
+ * 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/windows.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 "debug.h"
+
+extern ShortcutWindow *spellShortcutWindow;
+extern std::string tradePartnerName;
+extern QuitDialog *quitDialog;
+
+namespace Actions
+{
+
+impHandler0(setupWindowShow)
+{
+ if (setupWindow)
+ {
+ if (setupWindow->isWindowVisible())
+ {
+ setupWindow->doCancel();
+ }
+ else
+ {
+ setupWindow->setVisible(true);
+ setupWindow->requestMoveToTop();
+ }
+ return true;
+ }
+ return false;
+}
+
+impHandler0(hideWindows)
+{
+ if (setupWindow)
+ setupWindow->hideWindows();
+ return true;
+}
+
+static bool showHelpPage(const std::string &page, const bool showHide)
+{
+ if (helpWindow)
+ {
+ if (showHide && helpWindow->isWindowVisible())
+ {
+ helpWindow->setVisible(false);
+ }
+ else
+ {
+ helpWindow->loadHelp(page);
+ helpWindow->requestMoveToTop();
+ }
+ return true;
+ }
+ return false;
+}
+
+impHandler0(helpWindowShow)
+{
+ return showHelpPage("index", true);
+}
+
+impHandler0(aboutWindowShow)
+{
+ return showHelpPage("about", false);
+}
+
+static void showHideWindow(Window *const window)
+{
+ if (window)
+ {
+ window->setVisible(!window->isWindowVisible());
+ if (window->isWindowVisible())
+ window->requestMoveToTop();
+ }
+}
+
+impHandler0(statusWindowShow)
+{
+ showHideWindow(statusWindow);
+ return true;
+}
+
+impHandler0(inventoryWindowShow)
+{
+ showHideWindow(inventoryWindow);
+ return true;
+}
+
+impHandler0(equipmentWindowShow)
+{
+ showHideWindow(equipmentWindow);
+ return true;
+}
+
+impHandler0(skillDialogShow)
+{
+ showHideWindow(skillDialog);
+ return true;
+}
+
+impHandler0(minimapWindowShow)
+{
+ if (minimap)
+ {
+ minimap->toggle();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(chatWindowShow)
+{
+ showHideWindow(chatWindow);
+ return true;
+}
+
+impHandler0(shortcutWindowShow)
+{
+ showHideWindow(itemShortcutWindow);
+ return true;
+}
+
+impHandler0(debugWindowShow)
+{
+ showHideWindow(debugWindow);
+ return true;
+}
+
+impHandler0(socialWindowShow)
+{
+ showHideWindow(socialWindow);
+ return true;
+}
+
+impHandler0(emoteShortcutWindowShow)
+{
+ showHideWindow(emoteShortcutWindow);
+ return true;
+}
+
+impHandler0(outfitWindowShow)
+{
+ showHideWindow(outfitWindow);
+ return true;
+}
+
+impHandler0(shopWindowShow)
+{
+ showHideWindow(shopWindow);
+ return true;
+}
+
+impHandler0(dropShortcutWindowShow)
+{
+ showHideWindow(dropShortcutWindow);
+ return true;
+}
+
+impHandler0(killStatsWindowShow)
+{
+ showHideWindow(killStats);
+ return true;
+}
+
+impHandler0(spellShortcutWindowShow)
+{
+ showHideWindow(spellShortcutWindow);
+ return true;
+}
+
+impHandler0(botcheckerWindowShow)
+{
+ showHideWindow(botCheckerWindow);
+ return true;
+}
+
+impHandler0(whoIsOnlineWindowShow)
+{
+ showHideWindow(whoIsOnline);
+ return true;
+}
+
+impHandler0(didYouKnowWindowShow)
+{
+ showHideWindow(didYouKnowWindow);
+ return true;
+}
+
+impHandler0(questsWindowShow)
+{
+ showHideWindow(questsWindow);
+ return true;
+}
+
+impHandler0(updaterWindowShow)
+{
+ if (updaterWindow)
+ updaterWindow->deleteSelf();
+ else
+ DialogsManager::createUpdaterWindow();
+ return true;
+}
+
+} // namespace Actions
diff --git a/src/actions/windows.h b/src/actions/windows.h
new file mode 100644
index 000000000..97f1b85e7
--- /dev/null
+++ b/src/actions/windows.h
@@ -0,0 +1,58 @@
+/*
+ * 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_WINDOWS_H
+#define ACTIONS_WINDOWS_H
+
+#define decHandler(name) bool name(const InputEvent &event)
+
+struct InputEvent;
+
+namespace Actions
+{
+ decHandler(hideWindows);
+ decHandler(helpWindowShow);
+ decHandler(aboutWindowShow);
+ decHandler(setupWindowShow);
+ decHandler(statusWindowShow);
+ decHandler(inventoryWindowShow);
+ decHandler(equipmentWindowShow);
+ decHandler(skillDialogShow);
+ decHandler(minimapWindowShow);
+ decHandler(chatWindowShow);
+ decHandler(shortcutWindowShow);
+ decHandler(debugWindowShow);
+ decHandler(socialWindowShow);
+ decHandler(emoteShortcutWindowShow);
+ decHandler(outfitWindowShow);
+ decHandler(shopWindowShow);
+ decHandler(dropShortcutWindowShow);
+ decHandler(killStatsWindowShow);
+ decHandler(spellShortcutWindowShow);
+ decHandler(botcheckerWindowShow);
+ decHandler(whoIsOnlineWindowShow);
+ decHandler(didYouKnowWindowShow);
+ decHandler(questsWindowShow);
+ decHandler(updaterWindowShow);
+} // namespace Actions
+
+#undef decHandler
+
+#endif // ACTIONS_ACTIONS_H
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index 538a80882..3c3ba0ab9 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -26,6 +26,7 @@
#include "sdlshared.h"
#include "actions/actions.h"
+#include "actions/windows.h"
#include "input/inputaction.h"
#include "input/inputactiondata.h"