diff options
Diffstat (limited to 'src/gui/minimap.cpp')
-rw-r--r-- | src/gui/minimap.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index cc9173ef..55cd8b5d 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -41,15 +41,19 @@ Minimap::Minimap(): mProportion(0.5) { setWindowName(_("MiniMap")); - mShow = config.getValue(getWindowName() + "Visible", true); + mShow = config.getValue(getWindowName() + "Show", true); setDefaultSize(5, 25, 100, 100); setResizable(true); + + loadWindowState(); } Minimap::~Minimap() { if (mMapImage) mMapImage->decRef(); + + config.setValue(getWindowName() + "Show", mShow); } void Minimap::setMapImage(Image *img) @@ -71,23 +75,26 @@ void Minimap::setMapImage(Image *img) setMinWidth(mapWidth > titleWidth ? mapWidth : titleWidth); setMinHeight(mapHeight); - setMaxWidth(mMapImage->getWidth() + offsetX); + setMaxWidth(mMapImage->getWidth() > titleWidth ? + mMapImage->getWidth() + offsetX : titleWidth); setMaxHeight(mMapImage->getHeight() + offsetY); - mMapImage->setAlpha(config.getValue("guialpha", 0.8)); - - // Set content size to be within the minimum and maximum boundaries - setWidth(getMinWidth() < getWidth() ? getWidth() : getMinWidth()); - if (getMaxWidth() > getWidth()) + // Make sure the window is within the minimum and maximum boundaries + // TODO: Shouldn't this be happening automatically within the Window + // class? + if (getMinWidth() > getWidth()) + setWidth(getMinWidth()); + else if (getMaxWidth() < getWidth()) setWidth(getMaxWidth()); - setHeight(getMinHeight() < getHeight() ? getHeight() : getMinHeight()); - if (getMaxHeight() > getHeight()) + if (getMinHeight() > getHeight()) + setHeight(getMinHeight()); + else if (getMaxHeight() < getHeight()) setHeight(getMaxHeight()); + setContentSize(getWidth() - offsetX, getHeight() - offsetY); setDefaultSize(getX(), getY(), getWidth(), getHeight()); resetToDefaultSize(); - loadWindowState(); setVisible(mShow); } else @@ -99,7 +106,6 @@ void Minimap::setMapImage(Image *img) void Minimap::toggle() { mShow = !mShow; - config.setValue(getWindowName() + "Visible", mShow); } void Minimap::draw(gcn::Graphics *graphics) |