summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game.cpp29
-rw-r--r--src/gui/buddywindow.cpp2
-rw-r--r--src/gui/chat.cpp2
-rw-r--r--src/gui/debugwindow.cpp1
-rw-r--r--src/gui/emotewindow.cpp1
-rw-r--r--src/gui/equipmentwindow.cpp1
-rw-r--r--src/gui/guildwindow.cpp1
-rw-r--r--src/gui/inventorywindow.cpp1
-rw-r--r--src/gui/magic.cpp1
-rw-r--r--src/gui/menuwindow.cpp2
-rw-r--r--src/gui/minimap.cpp2
-rw-r--r--src/gui/ministatus.cpp2
-rw-r--r--src/gui/partywindow.cpp2
-rw-r--r--src/gui/shortcutwindow.cpp4
-rw-r--r--src/gui/shortcutwindow.h3
-rw-r--r--src/gui/skilldialog.cpp1
-rw-r--r--src/gui/status.cpp1
-rw-r--r--src/gui/statuswindow.cpp1
-rw-r--r--src/gui/widgets/popup.h1
-rw-r--r--src/gui/widgets/window.cpp8
-rw-r--r--src/gui/widgets/window.h22
21 files changed, 52 insertions, 36 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 6d724c9e..47d3b99c 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -247,35 +247,6 @@ static void createGuiWindows()
localChatTab = new ChatTab(_("General"));
- // Set initial window visibility
- chatWindow->setVisible((bool) config.getValue(
- chatWindow->getWindowName() + "Visible", true));
- miniStatusWindow->setVisible((bool) config.getValue(
- miniStatusWindow->getPopupName() + "Visible", true));
- buyDialog->setVisible(false);
- sellDialog->setVisible(false);
- minimap->setVisible((bool) config.getValue(
- minimap->getWindowName() + "Visible", true));
- tradeWindow->setVisible(false);
- menuWindow->setVisible((bool) config.getValue(
- menuWindow->getPopupName() + "Visible", true));
- itemShortcutWindow->setVisible((bool) config.getValue(
- itemShortcutWindow->getWindowName() + "Visible", true));
- emoteShortcutWindow->setVisible((bool) config.getValue(
- emoteShortcutWindow->getWindowName() + "Visible", true));
- minimap->setVisible((bool) config.getValue(
- minimap->getWindowName() + "Visible", true));
-#ifdef EATHENA_SUPPORT
- buySellDialog->setVisible(false);
-#endif
- npcTextDialog->setVisible(false);
- npcIntegerDialog->setVisible(false);
- npcListDialog->setVisible(false);
- npcStringDialog->setVisible(false);
-#ifdef EATHENA_SUPPORT
- storageWindow->setVisible(false);
-#endif
-
if (config.getValue("logToChat", 0))
{
logger->setChatWindow(chatWindow);
diff --git a/src/gui/buddywindow.cpp b/src/gui/buddywindow.cpp
index 8af4dd6e..06273b99 100644
--- a/src/gui/buddywindow.cpp
+++ b/src/gui/buddywindow.cpp
@@ -34,11 +34,11 @@ extern ChatWindow *chatWindow;
BuddyWindow::BuddyWindow():
Window(_("Buddy"))
{
- setVisible(false);
setWindowName("BuddyWindow");
setCaption(_("Buddy List"));
setResizable(true);
setCloseButton(true);
+ setSaveVisible(true);
setMinWidth(110);
setMinHeight(200);
setDefaultSize(124, 41, 288, 330);
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 54b388db..9930fe06 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -76,6 +76,8 @@ ChatWindow::ChatWindow():
setWindowName("Chat");
setResizable(true);
+ setDefaultVisible(true);
+ setSaveVisible(true);
setDefaultSize(600, 123, ImageRect::LOWER_LEFT);
setMinWidth(150);
setMinHeight(90);
diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp
index db062059..f3dbe5e2 100644
--- a/src/gui/debugwindow.cpp
+++ b/src/gui/debugwindow.cpp
@@ -40,6 +40,7 @@ DebugWindow::DebugWindow():
setResizable(true);
setCloseButton(true);
+ setSaveVisible(true);
setDefaultSize(400, 100, ImageRect::CENTER);
mFPSLabel = new Label("0 FPS");
diff --git a/src/gui/emotewindow.cpp b/src/gui/emotewindow.cpp
index 1d7c0102..69282f8f 100644
--- a/src/gui/emotewindow.cpp
+++ b/src/gui/emotewindow.cpp
@@ -39,6 +39,7 @@ EmoteWindow::EmoteWindow():
setWindowName("Emote");
setResizable(true);
setCloseButton(true);
+ setSaveVisible(true);
setMinWidth(80);
setMinHeight(130);
setDefaultSize(322, 200, ImageRect::CENTER);
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index 2ba55792..42a00926 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -80,6 +80,7 @@ EquipmentWindow::EquipmentWindow():
setWindowName("Equipment");
setCloseButton(true);
+ setSaveVisible(true);
setDefaultSize(180, 300, ImageRect::CENTER);
loadWindowState();
diff --git a/src/gui/guildwindow.cpp b/src/gui/guildwindow.cpp
index 020edf44..a6bcb690 100644
--- a/src/gui/guildwindow.cpp
+++ b/src/gui/guildwindow.cpp
@@ -54,6 +54,7 @@ GuildWindow::GuildWindow():
setCaption(_("Guild"));
setResizable(false);
setCloseButton(true);
+ setSaveVisible(true);
setMinWidth(200);
setMinHeight(280);
setDefaultSize(124, 41, 288, 330);
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 50b0bd78..ae62aa80 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -56,6 +56,7 @@ InventoryWindow::InventoryWindow(int invSize):
setWindowName("Inventory");
setResizable(true);
setCloseButton(true);
+ setSaveVisible(true);
setDefaultSize(387, 307, ImageRect::CENTER);
setMinWidth(316);
diff --git a/src/gui/magic.cpp b/src/gui/magic.cpp
index c0b0519f..0906566b 100644
--- a/src/gui/magic.cpp
+++ b/src/gui/magic.cpp
@@ -33,6 +33,7 @@ MagicDialog::MagicDialog():
{
setWindowName("Magic");
setCloseButton(true);
+ setSaveVisible(true);
setDefaultSize(255, 30, 175, 225);
gcn::Button *spellButton1 = new Button(_("Cast Test Spell 1"), "spell_1", this);
diff --git a/src/gui/menuwindow.cpp b/src/gui/menuwindow.cpp
index 6ad57d61..c21dbc90 100644
--- a/src/gui/menuwindow.cpp
+++ b/src/gui/menuwindow.cpp
@@ -90,6 +90,8 @@ MenuWindow::MenuWindow():
setPosition(graphics->getWidth() - x - 3, 3);
setContentSize(x - 3, h);
+
+ setVisible((bool) config.getValue(getPopupName() + "Visible", true));
}
void MenuWindow::draw(gcn::Graphics *graphics)
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
index 3762043c..5781b3fe 100644
--- a/src/gui/minimap.cpp
+++ b/src/gui/minimap.cpp
@@ -44,6 +44,8 @@ Minimap::Minimap():
mShow = config.getValue(getWindowName() + "Show", true);
setDefaultSize(5, 25, 100, 100);
setResizable(true);
+ setDefaultVisible(true);
+ setSaveVisible(true);
setStickyButton(true);
setSticky(false);
diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp
index 9f74ad6e..b49ca051 100644
--- a/src/gui/ministatus.cpp
+++ b/src/gui/ministatus.cpp
@@ -61,6 +61,8 @@ MiniStatusWindow::MiniStatusWindow():
setContentSize(mHpBar->getX() + mHpBar->getWidth(),
mHpBar->getY() + mHpBar->getHeight());
#endif
+
+ setVisible((bool) config.getValue(getPopupName() + "Visible", true));
}
void MiniStatusWindow::setIcon(int index, AnimatedSprite *sprite)
diff --git a/src/gui/partywindow.cpp b/src/gui/partywindow.cpp
index d9ba5a63..07f66a2f 100644
--- a/src/gui/partywindow.cpp
+++ b/src/gui/partywindow.cpp
@@ -35,7 +35,7 @@ PartyWindow::PartyWindow() : Window(_("Party"))
setWindowName("Party");
setVisible(false);
setResizable(false);
- setCaption(_("Party"));
+ setSaveVisible(true);
setCloseButton(true);
setMinWidth(110);
setMinHeight(200);
diff --git a/src/gui/shortcutwindow.cpp b/src/gui/shortcutwindow.cpp
index 783661f6..18a6829d 100644
--- a/src/gui/shortcutwindow.cpp
+++ b/src/gui/shortcutwindow.cpp
@@ -33,13 +33,15 @@ static const int SCROLL_PADDING = 0;
int ShortcutWindow::mInstances = 0;
ShortcutWindow::ShortcutWindow(const std::string &title,
- ShortcutContainer *content)
+ ShortcutContainer *content, bool defaultVisible)
{
setWindowName(title);
// no title presented, title bar is padding so window can be moved.
gcn::Window::setTitleBarHeight(gcn::Window::getPadding());
setShowTitle(false);
setResizable(true);
+ setDefaultVisible(defaultVisible);
+ setSaveVisible(true);
mItems = content;
diff --git a/src/gui/shortcutwindow.h b/src/gui/shortcutwindow.h
index c069811d..826243a5 100644
--- a/src/gui/shortcutwindow.h
+++ b/src/gui/shortcutwindow.h
@@ -38,7 +38,8 @@ class ShortcutWindow : public Window
/**
* Constructor.
*/
- ShortcutWindow(const std::string &title, ShortcutContainer *content);
+ ShortcutWindow(const std::string &title, ShortcutContainer *content,
+ bool defaultVisible = true);
/**
* Destructor.
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp
index c3ff1ded..48931bf7 100644
--- a/src/gui/skilldialog.cpp
+++ b/src/gui/skilldialog.cpp
@@ -100,6 +100,7 @@ SkillDialog::SkillDialog():
{
setWindowName("Skills");
setCloseButton(true);
+ setSaveVisible(true);
setDefaultSize(windowContainer->getWidth() - 280, 30, 275, 425);
TabbedArea *panel = new TabbedArea;
diff --git a/src/gui/status.cpp b/src/gui/status.cpp
index df6bc017..e91e6bd5 100644
--- a/src/gui/status.cpp
+++ b/src/gui/status.cpp
@@ -46,6 +46,7 @@ StatusWindow::StatusWindow(LocalPlayer *player):
{
setWindowName("Status");
setCloseButton(true);
+ setSaveVisible(true);
setDefaultSize(400, 345, ImageRect::CENTER);
// ----------------------
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index c25420e9..2399efb4 100644
--- a/src/gui/statuswindow.cpp
+++ b/src/gui/statuswindow.cpp
@@ -38,6 +38,7 @@ StatusWindow::StatusWindow(LocalPlayer *player):
setWindowName("Status");
setResizable(true);
setCloseButton(true);
+ setSaveVisible(true);
setDefaultSize((windowContainer->getWidth() - 365) / 2,
(windowContainer->getHeight() - 255) / 2, 365, 275);
loadWindowState();
diff --git a/src/gui/widgets/popup.h b/src/gui/widgets/popup.h
index 1e7f103e..895484b0 100644
--- a/src/gui/widgets/popup.h
+++ b/src/gui/widgets/popup.h
@@ -25,6 +25,7 @@
#include "gui/widgets/container.h"
+#include "configuration.h"
#include "guichanfwd.h"
class Skin;
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index fbd328d0..7de09994 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -50,6 +50,8 @@ Window::Window(const std::string &caption, bool modal, Window *parent,
mShowTitle(true),
mModal(modal),
mCloseButton(false),
+ mDefaultVisible(false),
+ mSaveVisible(false),
mStickyButton(false),
mSticky(false),
mMinWinWidth(100),
@@ -492,8 +494,8 @@ void Window::loadWindowState()
setPosition((int) config.getValue(name + "WinX", mDefaultX),
(int) config.getValue(name + "WinY", mDefaultY));
- if (mCloseButton)
- setVisible((bool) config.getValue(name + "Visible", false));
+ if (mSaveVisible)
+ setVisible((bool) config.getValue(name + "Visible", mDefaultVisible));
if (mStickyButton)
setSticky((bool) config.getValue(name + "Sticky", isSticky()));
@@ -534,7 +536,7 @@ void Window::saveWindowState()
config.setValue(mWindowName + "WinX", getX());
config.setValue(mWindowName + "WinY", getY());
- if (mCloseButton)
+ if (mSaveVisible)
config.setValue(mWindowName + "Visible", isVisible());
if (mStickyButton)
diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h
index 510b0f04..aa9872d3 100644
--- a/src/gui/widgets/window.h
+++ b/src/gui/widgets/window.h
@@ -173,6 +173,26 @@ class Window : public gcn::Window, gcn::WidgetListener
void setVisible(bool visible, bool forceSticky);
/**
+ * Returns whether the window will save it's visibility.
+ */
+ bool isDefaultVisible() const { return mDefaultVisible; }
+
+ /**
+ * Returns whether the window will save it's visibility.
+ */
+ void setDefaultVisible(bool save) { mDefaultVisible = save; }
+
+ /**
+ * Returns whether the window will save it's visibility.
+ */
+ bool willSaveVisible() const { return mSaveVisible; }
+
+ /**
+ * Returns whether the window will save it's visibility.
+ */
+ void setSaveVisible(bool save) { mSaveVisible = save; }
+
+ /**
* Returns the parent window.
*
* @return The parent window or <code>NULL</code> if there is none.
@@ -335,6 +355,8 @@ class Window : public gcn::Window, gcn::WidgetListener
bool mShowTitle; /**< Window has a title bar */
bool mModal; /**< Window is modal */
bool mCloseButton; /**< Window has a close button */
+ bool mDefaultVisible; /**< Window's default visibility */
+ bool mSaveVisible; /**< Window will save visibility */
bool mStickyButton; /**< Window has a sticky button */
bool mSticky; /**< Window resists hiding*/
int mMinWinWidth; /**< Minimum window width */