summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--src/gui/window.cpp15
-rw-r--r--src/gui/window.h7
3 files changed, 13 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 5802edbe..0bd9bdd3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,8 @@
* data/maps/new_1-1.tmx: Added back a Lua script for testing.
* src/gui/trade.cpp: Added persistent positioning.
* src/gui/menuwindow.cpp: Fixed missing pixels at bottom and right.
+ * src/gui/window.cpp, src/gui/window.h: Changed to use default values
+ when restoring missing settings.
2007-10-20 Guillaume Melquiond <guillaume.melquiond@gmail.com>
diff --git a/src/gui/window.cpp b/src/gui/window.cpp
index f8d4a503..1509ac92 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -525,13 +525,17 @@ void Window::loadWindowState(std::string const &name)
{
mConfigName = name;
- setPosition((int) config.getValue(name + "WinX", getX()),
- (int) config.getValue(name + "WinY", getY()));
+ setPosition((int) config.getValue(name + "WinX", mDefaultX),
+ (int) config.getValue(name + "WinY", mDefaultY));
if (mGrip)
{
- setSize((int) config.getValue(name + "WinWidth", getWidth()),
- (int) config.getValue(name + "WinHeight", getHeight()));
+ setSize((int) config.getValue(name + "WinWidth", mDefaultWidth),
+ (int) config.getValue(name + "WinHeight", mDefaultHeight));
+ }
+ else
+ {
+ setSize(mDefaultWidth, mDefaultHeight);
}
}
@@ -542,9 +546,6 @@ void Window::setDefaultSize(int defaultX, int defaultY,
mDefaultY = defaultY;
mDefaultWidth = defaultWidth;
mDefaultHeight = defaultHeight;
-
- setPosition(mDefaultX, mDefaultY);
- setContentSize(mDefaultWidth, mDefaultHeight);
}
void Window::resetToDefaultSize()
diff --git a/src/gui/window.h b/src/gui/window.h
index 651a8a4e..a09a9bbc 100644
--- a/src/gui/window.h
+++ b/src/gui/window.h
@@ -240,10 +240,9 @@ class Window : public gcn::Window
void mouseExited(gcn::MouseEvent &event);
/**
- * Read the x, y, and width and height for resizables in the config
- * based on the given string.
- * That function let the values set with set{X, Y, Height, width}()
- * if no config value is found.
+ * Reads the position (and the size for resizable windows) in the
+ * configuration based on the given string.
+ * Uses the default values when config values are missing.
* Don't forget to set these default values and resizable before
* calling this function.
*/