diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/buy.cpp | 2 | ||||
-rw-r--r-- | src/gui/buysell.cpp | 2 | ||||
-rw-r--r-- | src/gui/chat.cpp | 3 | ||||
-rw-r--r-- | src/gui/debugwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/equipmentwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/guildwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/help.cpp | 2 | ||||
-rw-r--r-- | src/gui/inventorywindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/magic.cpp | 2 | ||||
-rw-r--r-- | src/gui/minimap.cpp | 2 | ||||
-rw-r--r-- | src/gui/ministatus.cpp | 18 | ||||
-rw-r--r-- | src/gui/ministatus.h | 2 | ||||
-rw-r--r-- | src/gui/npcdialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/partywindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/popupmenu.cpp | 2 | ||||
-rw-r--r-- | src/gui/sell.cpp | 2 | ||||
-rw-r--r-- | src/gui/setup.cpp | 55 | ||||
-rw-r--r-- | src/gui/setup.h | 6 | ||||
-rw-r--r-- | src/gui/shortcutwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/skilldialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/statuswindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/storagewindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/trade.cpp | 2 |
23 files changed, 53 insertions, 67 deletions
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp index 5b393a06..22572b63 100644 --- a/src/gui/buy.cpp +++ b/src/gui/buy.cpp @@ -27,6 +27,7 @@ #include "gui/widgets/scrollarea.h" #include "gui/widgets/slider.h" +#include "gui/setup.h" #include "gui/shop.h" #include "gui/shoplistbox.h" @@ -47,6 +48,7 @@ BuyDialog::BuyDialog(): mMoney(0), mAmountItems(0), mMaxItems(0) { setWindowName("Buy"); + setupWindow->registerWindowForReset(this); setResizable(true); setCloseButton(true); setMinWidth(260); diff --git a/src/gui/buysell.cpp b/src/gui/buysell.cpp index 53c2419a..c96c9f24 100644 --- a/src/gui/buysell.cpp +++ b/src/gui/buysell.cpp @@ -24,6 +24,7 @@ #include "npc.h" #include "gui/widgets/button.h" +#include "gui/setup.h" #include "net/net.h" #include "net/npchandler.h" @@ -35,6 +36,7 @@ BuySellDialog::BuySellDialog(): mBuyButton(0) { setWindowName("BuySell"); + setupWindow->registerWindowForReset(this); static const char *buttonNames[] = { N_("Buy"), N_("Sell"), N_("Cancel"), 0 diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 1ce1b77c..c8a51e0e 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -23,6 +23,7 @@ #include "gui/itemlinkhandler.h" #include "gui/recorder.h" +#include "gui/setup.h" #include "gui/sdlinput.h" #include "gui/widgets/chattab.h" @@ -76,6 +77,8 @@ ChatWindow::ChatWindow(): { setWindowName("Chat"); + setupWindow->registerWindowForReset(this); + // no title presented, title bar is padding so window can be moved. gcn::Window::setTitleBarHeight(gcn::Window::getPadding() + 4); setShowTitle(false); diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp index f3dbe5e2..4f18421b 100644 --- a/src/gui/debugwindow.cpp +++ b/src/gui/debugwindow.cpp @@ -21,6 +21,7 @@ #include "gui/debugwindow.h" +#include "gui/setup.h" #include "gui/viewport.h" #include "gui/widgets/label.h" @@ -37,6 +38,7 @@ DebugWindow::DebugWindow(): Window("Debug") { setWindowName("Debug"); + setupWindow->registerWindowForReset(this); setResizable(true); setCloseButton(true); diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index d6493ca2..25de201c 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -25,6 +25,7 @@ #include "gui/itempopup.h" #include "gui/palette.h" #include "gui/playerbox.h" +#include "gui/setup.h" #include "gui/viewport.h" #include "equipment.h" @@ -69,6 +70,7 @@ EquipmentWindow::EquipmentWindow(Equipment *equipment): mSelected(-1) { mItemPopup = new ItemPopup; + setupWindow->registerWindowForReset(this); // Control that shows the Player PlayerBox *playerBox = new PlayerBox; diff --git a/src/gui/guildwindow.cpp b/src/gui/guildwindow.cpp index 1fc1d7fe..5b525b83 100644 --- a/src/gui/guildwindow.cpp +++ b/src/gui/guildwindow.cpp @@ -24,6 +24,7 @@ #include "gui/confirmdialog.h" #include "gui/guildlistbox.h" +#include "gui/setup.h" #include "gui/textdialog.h" #include "gui/widgets/button.h" @@ -59,6 +60,7 @@ GuildWindow::GuildWindow(): setMinWidth(200); setMinHeight(280); setDefaultSize(124, 41, 288, 330); + setupWindow->registerWindowForReset(this); // Set button events Id mGuildButton[0] = new Button(_("Create Guild"), "CREATE_GUILD", this); diff --git a/src/gui/help.cpp b/src/gui/help.cpp index ddcf7b49..e28f64e3 100644 --- a/src/gui/help.cpp +++ b/src/gui/help.cpp @@ -25,6 +25,7 @@ #include "gui/widgets/browserbox.h" #include "gui/widgets/layout.h" #include "gui/widgets/scrollarea.h" +#include "gui/setup.h" #include "resources/resourcemanager.h" @@ -38,6 +39,7 @@ HelpWindow::HelpWindow(): setContentSize(455, 350); setWindowName("Help"); setResizable(true); + setupWindow->registerWindowForReset(this); setDefaultSize(500, 400, ImageRect::CENTER); diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 06e43eac..50465a50 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -23,6 +23,7 @@ #include "gui/itemamount.h" #include "gui/itemcontainer.h" +#include "gui/setup.h" #include "gui/sdlinput.h" #include "gui/viewport.h" @@ -57,6 +58,7 @@ InventoryWindow::InventoryWindow(int invSize): mItemDesc(false) { setWindowName("Inventory"); + setupWindow->registerWindowForReset(this); setResizable(true); setCloseButton(true); setSaveVisible(true); diff --git a/src/gui/magic.cpp b/src/gui/magic.cpp index 0906566b..48cfc5dc 100644 --- a/src/gui/magic.cpp +++ b/src/gui/magic.cpp @@ -22,6 +22,7 @@ #include "gui/magic.h" #include "gui/widgets/button.h" +#include "gui/setup.h" #include "localplayer.h" @@ -35,6 +36,7 @@ MagicDialog::MagicDialog(): setCloseButton(true); setSaveVisible(true); setDefaultSize(255, 30, 175, 225); + setupWindow->registerWindowForReset(this); gcn::Button *spellButton1 = new Button(_("Cast Test Spell 1"), "spell_1", this); gcn::Button *spellButton2 = new Button(_("Cast Test Spell 2"), "spell_2", this); diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index d1c99b84..b617be91 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -31,6 +31,7 @@ #include "player.h" #include "gui/palette.h" +#include "gui/setup.h" #include "resources/image.h" #include "resources/resourcemanager.h" @@ -53,6 +54,7 @@ Minimap::Minimap(): // set this to false as the minimap window size is changed //depending on the map size setResizable(false); + setupWindow->registerWindowForReset(this); setDefaultVisible(true); setSaveVisible(true); diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp index 6d541474..ab5560da 100644 --- a/src/gui/ministatus.cpp +++ b/src/gui/ministatus.cpp @@ -39,34 +39,22 @@ MiniStatusWindow::MiniStatusWindow(): mHpBar = new ProgressBar((float) player_node->getHp() / (float) player_node->getMaxHp(), 100, 20, gcn::Color(0, 171, 34)); -#ifdef EATHENA_SUPPORT mMpBar = new ProgressBar((float) player_node->getMaxMP() / (float) player_node->getMaxMP(), 100, 20, gcn::Color(26, 102, 230)); mXpBar = new ProgressBar((float) player_node->getExp() / player_node->getExpNeeded(), 100, 20, gcn::Color(143, 192, 211)); -#endif - mHpBar->setPosition(0, 3); -#ifdef EATHENA_SUPPORT mMpBar->setPosition(mHpBar->getWidth() + 3, 3); mXpBar->setPosition(mMpBar->getX() + mMpBar->getWidth() + 3, 3); -#endif add(mHpBar); -#ifdef EATHENA_SUPPORT add(mMpBar); add(mXpBar); -#endif -#ifdef EATHENA_SUPPORT setContentSize(mXpBar->getX() + mXpBar->getWidth(), mXpBar->getY() + mXpBar->getHeight()); -#else - setContentSize(mHpBar->getX() + mHpBar->getWidth(), - mHpBar->getY() + mHpBar->getHeight()); -#endif setVisible((bool) config.getValue(getPopupName() + "Visible", true)); } @@ -92,7 +80,6 @@ extern volatile int tick_time; void MiniStatusWindow::update() { StatusWindow::updateHPBar(mHpBar); -#ifdef EATHENA_SUPPORT StatusWindow::updateMPBar(mMpBar); StatusWindow::updateXPBar(mXpBar); @@ -108,7 +95,6 @@ void MiniStatusWindow::update() << config.getValue("xpBarMonsterCounterName", "Monsters") <<" left..."; } */ -#endif for (unsigned int i = 0; i < mIcons.size(); i++) if (mIcons[i]) @@ -124,11 +110,7 @@ void MiniStatusWindow::draw(gcn::Graphics *graphics) void MiniStatusWindow::drawIcons(Graphics *graphics) { // Draw icons -#ifdef TMWSERV_SUPPORT - int icon_x = mHpBar->getX() + mHpBar->getWidth() + 4; -#else int icon_x = mXpBar->getX() + mXpBar->getWidth() + 4; -#endif for (unsigned int i = 0; i < mIcons.size(); i++) { if (mIcons[i]) { mIcons[i]->draw(graphics, icon_x, 3); diff --git a/src/gui/ministatus.h b/src/gui/ministatus.h index 56f53908..f5604486 100644 --- a/src/gui/ministatus.h +++ b/src/gui/ministatus.h @@ -61,10 +61,8 @@ class MiniStatusWindow : public Popup * Mini Status Bars */ ProgressBar *mHpBar; -#ifdef EATHENA_SUPPORT ProgressBar *mMpBar; ProgressBar *mXpBar; -#endif std::vector<AnimatedSprite *> mIcons; }; diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index afcc150d..4e7c6f5a 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -28,6 +28,7 @@ #include "gui/widgets/scrollarea.h" #include "gui/widgets/textbox.h" #include "gui/widgets/textfield.h" +#include "gui/setup.h" #include "npc.h" @@ -54,6 +55,7 @@ NpcDialog::NpcDialog() // Basic Window Setup setWindowName("NpcText"); setResizable(true); + setupWindow->registerWindowForReset(this); setMinWidth(200); setMinHeight(150); diff --git a/src/gui/partywindow.cpp b/src/gui/partywindow.cpp index f66ffaac..d4b084ce 100644 --- a/src/gui/partywindow.cpp +++ b/src/gui/partywindow.cpp @@ -22,6 +22,7 @@ #include "gui/partywindow.h" #include "gui/widgets/chattab.h" +#include "gui/setup.h" #include "beingmanager.h" #include "player.h" @@ -56,6 +57,7 @@ PartyWindow::PartyWindow() : setMinWidth(120); setMinHeight(55); setDefaultSize(590, 200, 150, 60); + setupWindow->registerWindowForReset(this); loadWindowState(); } diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 60ee7353..afaa2512 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -194,13 +194,11 @@ void PopupMenu::handleLink(const std::string &link) Net::getTradeHandler()->request(being); tradePartnerName = being->getName(); } -#ifdef EATHENA_SUPPORT // Attack action else if (link == "attack" && being) { player_node->attack(being, true); } -#endif else if (link == "unignore" && being && being->getType() == Being::PLAYER) diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp index 28288ef4..54cf514f 100644 --- a/src/gui/sell.cpp +++ b/src/gui/sell.cpp @@ -21,6 +21,7 @@ #include "gui/sell.h" +#include "gui/setup.h" #include "gui/shop.h" #include "gui/shoplistbox.h" @@ -47,6 +48,7 @@ SellDialog::SellDialog(): mMaxItems(0), mAmountItems(0) { setWindowName("Sell"); + setupWindow->registerWindowForReset(this); setResizable(true); setCloseButton(true); setMinWidth(260); diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index aebcf61b..2f0d78ca 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -37,29 +37,7 @@ #include "utils/dtor.h" #include "utils/gettext.h" -extern Window *chatWindow; extern Window *statusWindow; -extern Window *buyDialog; -extern Window *sellDialog; -extern Window *buySellDialog; -extern Window *inventoryWindow; -extern Window *npcTextDialog; -extern Window *npcStringDialog; -extern Window *skillDialog; -extern Window *partyWindow; -extern Window *minimap; -extern Window *equipmentWindow; -extern Window *tradeWindow; -extern Window *helpWindow; -extern Window *debugWindow; -extern Window *itemShortcutWindow; -extern Window *emoteShortcutWindow; -#ifdef TMWSERV_SUPPORT -extern Window *magicDialog; -extern Window *guildWindow; -#else -extern Window *storageWindow; -#endif Setup::Setup(): Window(_("Setup")) @@ -137,29 +115,11 @@ void Setup::action(const gcn::ActionEvent &event) if (!statusWindow) return; - chatWindow->resetToDefaultSize(); - statusWindow->resetToDefaultSize(); - buyDialog->resetToDefaultSize(); - sellDialog->resetToDefaultSize(); -#ifdef EATHENA_SUPPORT - buySellDialog->resetToDefaultSize(); -#endif - inventoryWindow->resetToDefaultSize(); - skillDialog->resetToDefaultSize(); - partyWindow->resetToDefaultSize(); - minimap->resetToDefaultSize(); - equipmentWindow->resetToDefaultSize(); - tradeWindow->resetToDefaultSize(); - helpWindow->resetToDefaultSize(); - debugWindow->resetToDefaultSize(); - itemShortcutWindow->resetToDefaultSize(); - emoteShortcutWindow->resetToDefaultSize(); -#ifdef TMWSERV_SUPPORT - magicDialog->resetToDefaultSize(); - guildWindow->resetToDefaultSize(); -#else - storageWindow->resetToDefaultSize(); -#endif + for (std::list<Window*>::iterator it = mWindowsToReset.begin(); + it != mWindowsToReset.end(); it++) + { + (*it)->resetToDefaultSize(); + } } } @@ -168,4 +128,9 @@ void Setup::setInGame(bool inGame) mResetWindows->setEnabled(inGame); } +void Setup::registerWindowForReset(Window *window) +{ + mWindowsToReset.push_back(window); +} + Setup *setupWindow; diff --git a/src/gui/setup.h b/src/gui/setup.h index 630d5eaa..6000adfa 100644 --- a/src/gui/setup.h +++ b/src/gui/setup.h @@ -61,8 +61,14 @@ class Setup : public Window, public gcn::ActionListener */ void setInGame(bool inGame); + void registerWindowForReset(Window *window); + + void clearWindowsForReset() + { mWindowsToReset.clear(); } + private: std::list<SetupTab*> mTabs; + std::list<Window*> mWindowsToReset; gcn::Button *mResetWindows; }; diff --git a/src/gui/shortcutwindow.cpp b/src/gui/shortcutwindow.cpp index b9eda02c..8e7e0bee 100644 --- a/src/gui/shortcutwindow.cpp +++ b/src/gui/shortcutwindow.cpp @@ -25,6 +25,7 @@ #include "gui/widgets/layout.h" #include "gui/widgets/scrollarea.h" +#include "gui/setup.h" #include "configuration.h" @@ -42,6 +43,7 @@ ShortcutWindow::ShortcutWindow(const std::string &title, setResizable(true); setDefaultVisible(false); setSaveVisible(true); + setupWindow->registerWindowForReset(this); mItems = content; diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index d5c5327f..4ada5c59 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -33,6 +33,7 @@ #include "gui/widgets/tabbedarea.h" #include "gui/widgets/vertcontainer.h" #include "gui/widgets/windowcontainer.h" +#include "gui/setup.h" #include "localplayer.h" #include "log.h" @@ -89,6 +90,7 @@ SkillDialog::SkillDialog(): setResizable(true); setSaveVisible(true); setDefaultSize(windowContainer->getWidth() - 280, 30, 275, 425); + setupWindow->registerWindowForReset(this); mTabs = new TabbedArea(); mPointsLabel = new Label("0"); diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index 0c00bd23..1b764615 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -28,6 +28,7 @@ #include "gui/widgets/scrollarea.h" #include "gui/widgets/vertcontainer.h" #include "gui/widgets/windowcontainer.h" +#include "gui/setup.h" #include "localplayer.h" #include "units.h" @@ -86,6 +87,7 @@ StatusWindow::StatusWindow(): Window(player_node->getName()) { setWindowName("Status"); + setupWindow->registerWindowForReset(this); setResizable(true); setCloseButton(true); setSaveVisible(true); diff --git a/src/gui/storagewindow.cpp b/src/gui/storagewindow.cpp index 91224359..f0d00ee7 100644 --- a/src/gui/storagewindow.cpp +++ b/src/gui/storagewindow.cpp @@ -24,6 +24,7 @@ #include "gui/inventorywindow.h" #include "gui/itemamount.h" #include "gui/itemcontainer.h" +#include "gui/setup.h" #include "gui/viewport.h" #include "gui/widgets/button.h" @@ -58,6 +59,7 @@ StorageWindow::StorageWindow(int invSize): setWindowName("Storage"); setResizable(true); setCloseButton(true); + setupWindow->registerWindowForReset(this); // If you adjust these defaults, don't forget to adjust the trade window's. setDefaultSize(375, 300, ImageRect::CENTER); diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp index 3abb985e..e8953c8f 100644 --- a/src/gui/trade.cpp +++ b/src/gui/trade.cpp @@ -29,6 +29,7 @@ #include "gui/inventorywindow.h" #include "gui/itemamount.h" #include "gui/itemcontainer.h" +#include "gui/setup.h" #include "gui/widgets/button.h" #include "gui/widgets/chattab.h" @@ -65,6 +66,7 @@ TradeWindow::TradeWindow(): setDefaultSize(386, 180, ImageRect::CENTER); setMinWidth(386); setMinHeight(180); + setupWindow->registerWindowForReset(this); std::string longestName = getFont()->getWidth(_("OK")) > getFont()->getWidth(_("Trade")) ? |