summaryrefslogtreecommitdiff
path: root/src/gui/minimap.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-01-29 16:25:16 -0700
committerIra Rice <irarice@gmail.com>2009-01-29 16:25:16 -0700
commitd3ac12d94f6ddb25866e10856ec47919a4b6d7a6 (patch)
tree4bbe5b82b7b76fe54efd185d31f533017aad07d2 /src/gui/minimap.cpp
parent50a9e6619f6ffd9215f81d28d6bdd617c52947c1 (diff)
downloadMana-d3ac12d94f6ddb25866e10856ec47919a4b6d7a6.tar.gz
Mana-d3ac12d94f6ddb25866e10856ec47919a4b6d7a6.tar.bz2
Mana-d3ac12d94f6ddb25866e10856ec47919a4b6d7a6.tar.xz
Mana-d3ac12d94f6ddb25866e10856ec47919a4b6d7a6.zip
Fixed up minimap resizing code so that the minimum width is always long
enough to contain the map's name. Also fixed an unnoticed logic flip that was done unintentionally. This class now manages to work perfectly when the config file has no previous dimensional influences, but still won't resize properly without removing the ability to resize or getting rid of those stored configs. TODO: Find out why loading window configuration for the default minimum width or height overrides the Minimap's supplied dimensions it wants. Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui/minimap.cpp')
-rw-r--r--src/gui/minimap.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
index 7802b583..d68faa56 100644
--- a/src/gui/minimap.cpp
+++ b/src/gui/minimap.cpp
@@ -71,19 +71,25 @@ 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();