summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2008-12-07 15:23:34 +0100
committerIra Rice <irarice@gmail.com>2008-12-07 20:04:18 -0700
commitca96882fe9319f687fce46c18f6edc671e4efc8a (patch)
tree7ae83e3613fdea072feac03296c39123b24826f7
parent65e00cfe8c9ec876e3fadadac99a6cad0697283d (diff)
downloadmana-ca96882fe9319f687fce46c18f6edc671e4efc8a.tar.gz
mana-ca96882fe9319f687fce46c18f6edc671e4efc8a.tar.bz2
mana-ca96882fe9319f687fce46c18f6edc671e4efc8a.tar.xz
mana-ca96882fe9319f687fce46c18f6edc671e4efc8a.zip
Fixed inconsistency in default window sizes
The default window sizes were all too small, since they were specified in content size. On pressing "Reset Windows", the sizes would be interpreted as such and apply alright. The inconsistency is now removed, and the default window sizes are always the size of the whole widget now, not just the contents. Signed-off-by: Bjørn Lindeijer <bjorn@lindeijer.nl>
-rw-r--r--src/gui/chat.cpp7
-rw-r--r--src/gui/equipmentwindow.cpp2
-rw-r--r--src/gui/inventorywindow.cpp2
-rw-r--r--src/gui/itemshortcutwindow.cpp2
-rw-r--r--src/gui/ministatus.cpp3
-rw-r--r--src/gui/setup.cpp2
-rw-r--r--src/gui/skill.cpp2
-rw-r--r--src/gui/trade.cpp2
-rw-r--r--src/gui/window.cpp19
9 files changed, 21 insertions, 20 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 3f12c462..eef1150f 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -50,10 +50,9 @@ Window(""), mNetwork(network), mTmpVisible(false)
setWindowName("Chat");
setResizable(true);
- setDefaultSize(0, (windowContainer->getHeight() - 123), 600, 100);
- loadWindowState();
+ setDefaultSize(0, windowContainer->getHeight() - 123, 600, 123);
- mChatInput = new ChatInput();
+ mChatInput = new ChatInput;
mChatInput->setActionEventId("chatinput");
mChatInput->addActionListener(this);
@@ -71,6 +70,8 @@ Window(""), mNetwork(network), mTmpVisible(false)
add(mScrollArea);
add(mChatInput);
+ loadWindowState();
+
// Add key listener to chat input to be able to respond to up/down
mChatInput->addKeyListener(this);
mCurHist = mHistory.end();
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index 7e1ef315..f1cbb0da 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -40,7 +40,7 @@ EquipmentWindow::EquipmentWindow(Equipment *equipment):
{
setWindowName("Equipment");
setCloseButton(true);
- setDefaultSize(5, 230, 200, 120);
+ setDefaultSize(5, 230, 200, 140);
loadWindowState();
mInventory = player_node->getInventory();
}
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 424fca59..302d2cab 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -47,7 +47,7 @@ InventoryWindow::InventoryWindow():
setCloseButton(true);
setMinWidth(240);
// If you adjust these defaults, don't forget to adjust the trade window's.
- setDefaultSize(115, 25, 322, 172);
+ setDefaultSize(115, 25, 322, 200);
mUseButton = new Button("Use", "use", this);
mDropButton = new Button("Drop", "drop", this);
diff --git a/src/gui/itemshortcutwindow.cpp b/src/gui/itemshortcutwindow.cpp
index 5a4dfacd..08e76241 100644
--- a/src/gui/itemshortcutwindow.cpp
+++ b/src/gui/itemshortcutwindow.cpp
@@ -34,7 +34,7 @@ ItemShortcutWindow::ItemShortcutWindow()
setResizable(true);
setDefaultSize(758, 174, 42, 426);
- mItems = new ItemShortcutContainer();
+ mItems = new ItemShortcutContainer;
const int border = SCROLL_PADDING * 2 + getPadding() * 2;
setMinWidth(mItems->getBoxWidth() + border);
diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp
index 59dca0e1..6884f4d6 100644
--- a/src/gui/ministatus.cpp
+++ b/src/gui/ministatus.cpp
@@ -73,8 +73,9 @@ MiniStatusWindow::MiniStatusWindow():
add(mMpLabel);
add(mXpLabel);
- setDefaultSize(0, 0, mXpBar->getX() + mXpBar->getWidth(),
+ setContentSize(mXpBar->getX() + mXpBar->getWidth(),
mXpBar->getY() + mXpBar->getHeight());
+ setDefaultSize(0, 0, getWidth(), getHeight());
loadWindowState();
}
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index 2c22a426..baa2bf2b 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -41,6 +41,7 @@ extern Window *inventoryWindow;
extern Window *minimap;
extern Window *skillDialog;
extern Window *statusWindow;
+extern Window *itemShortcutWindow;
Setup::Setup():
Window("Setup")
@@ -132,5 +133,6 @@ void Setup::action(const gcn::ActionEvent &event)
equipmentWindow->resetToDefaultSize();
helpWindow->resetToDefaultSize();
skillDialog->resetToDefaultSize();
+ itemShortcutWindow->resetToDefaultSize();
}
}
diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp
index 8e61dea4..321a6c52 100644
--- a/src/gui/skill.cpp
+++ b/src/gui/skill.cpp
@@ -125,7 +125,7 @@ SkillDialog::SkillDialog():
setWindowName("Skills");
setCloseButton(true);
- setDefaultSize(windowContainer->getWidth() - 255, 25, 240, 240);
+ setDefaultSize(windowContainer->getWidth() - 260, 25, 255, 260);
// mSkillListBox = new ListBox(this);
skillScrollArea = new ScrollArea(&mTable);
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp
index 8c02ab01..843c9663 100644
--- a/src/gui/trade.cpp
+++ b/src/gui/trade.cpp
@@ -50,7 +50,7 @@ TradeWindow::TradeWindow(Network *network):
mPartnerInventory(new Inventory(INVENTORY_SIZE))
{
setWindowName("Trade");
- setDefaultSize(115, 197, 332, 209);
+ setDefaultSize(115, 227, 332, 209);
mAddButton = new Button("Add", "add", this);
mOkButton = new Button("Ok", "ok", this);
diff --git a/src/gui/window.cpp b/src/gui/window.cpp
index 30456a81..cdace3ae 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -233,7 +233,7 @@ void Window::setMaxHeight(unsigned int height)
void Window::setResizable(bool r)
{
- if ((bool)mGrip == r) return;
+ if ((bool) mGrip == r) return;
if (r)
{
@@ -251,9 +251,12 @@ void Window::setResizable(bool r)
void Window::widgetResized(const gcn::Event &event)
{
+ const gcn::Rectangle area = getChildrenArea();
+
+ mChrome->setSize(area.width, area.height);
+
if (mGrip)
{
- gcn::Rectangle const &area = getChildrenArea();
mGrip->setPosition(getWidth() - mGrip->getWidth() - area.x,
getHeight() - mGrip->getHeight() - area.y);
}
@@ -458,13 +461,10 @@ void Window::mouseDragged(gcn::MouseEvent &event)
// Set the new window and content dimensions
setDimension(newDim);
- const gcn::Rectangle area = getChildrenArea();
- mChrome->setSize(area.width, area.height);
}
}
-void
-Window::loadWindowState()
+void Window::loadWindowState()
{
const std::string &name = mWindowName;
assert(!name.empty());
@@ -477,13 +477,10 @@ Window::loadWindowState()
{
setSize((int) config.getValue(name + "WinWidth", mDefaultWidth),
(int) config.getValue(name + "WinHeight", mDefaultHeight));
-
- const gcn::Rectangle area = getChildrenArea();
- mChrome->setSize(area.width, area.height);
}
else
{
- setContentSize(mDefaultWidth, mDefaultHeight);
+ setSize(mDefaultWidth, mDefaultHeight);
}
}
@@ -499,7 +496,7 @@ void Window::setDefaultSize(int defaultX, int defaultY,
void Window::resetToDefaultSize()
{
setPosition(mDefaultX, mDefaultY);
- setContentSize(mDefaultWidth, mDefaultHeight);
+ setSize(mDefaultWidth, mDefaultHeight);
}
int Window::getResizeHandles(gcn::MouseEvent &event)