summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2008-12-07 15:23:34 +0100
committerBjørn Lindeijer <bjorn@lindeijer.nl>2008-12-07 15:25:28 +0100
commit72f5288682f46af1f7c04c002172178c880e060b (patch)
tree444ef1af05fc74dd072ad2be51c6ff7ab7ce976e
parentbe25d46954a98b2590b522de5f8aa470ba4f9e81 (diff)
downloadmana-client-72f5288682f46af1f7c04c002172178c880e060b.tar.gz
mana-client-72f5288682f46af1f7c04c002172178c880e060b.tar.bz2
mana-client-72f5288682f46af1f7c04c002172178c880e060b.tar.xz
mana-client-72f5288682f46af1f7c04c002172178c880e060b.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.cpp4
-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, 22 insertions, 21 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 5477ad4a..0c7cc1db 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -49,10 +49,9 @@ ChatWindow::ChatWindow(Network *network):
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);
@@ -70,6 +69,8 @@ ChatWindow::ChatWindow(Network *network):
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 e0246787..762ca8e8 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -38,9 +38,9 @@ EquipmentWindow::EquipmentWindow(Equipment *equipment):
{
setWindowName("Equipment");
setCloseButton(true);
- setDefaultSize(5, 230, 200, 120);
+ setDefaultSize(5, 230, 200, 140);
loadWindowState();
- mInventory = player_node->getInventory();
+ mInventory = player_node->getInventory();
}
EquipmentWindow::~EquipmentWindow()
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index f38c118e..0e1c5291 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -50,7 +50,7 @@ InventoryWindow::InventoryWindow():
setMinWidth(240);
setMinHeight(172);
// 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 e7364411..e21f421b 100644
--- a/src/gui/itemshortcutwindow.cpp
+++ b/src/gui/itemshortcutwindow.cpp
@@ -35,7 +35,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 436c90cd..0a52f516 100644
--- a/src/gui/ministatus.cpp
+++ b/src/gui/ministatus.cpp
@@ -74,8 +74,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 4fae514f..e8e0905e 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -41,6 +41,7 @@ extern Window *inventoryWindow;
extern Window *equipmentWindow;
extern Window *helpWindow;
extern Window *skillDialog;
+extern Window *itemShortcutWindow;
Setup::Setup():
Window("Setup")
@@ -127,5 +128,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 a7b598eb..cadde0b9 100644
--- a/src/gui/skill.cpp
+++ b/src/gui/skill.cpp
@@ -127,7 +127,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);
ScrollArea *skillScrollArea = new ScrollArea(&mTable);
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp
index 9cb0d34f..aac6d587 100644
--- a/src/gui/trade.cpp
+++ b/src/gui/trade.cpp
@@ -50,7 +50,7 @@ TradeWindow::TradeWindow(Network *network):
mPartnerInventory(new Inventory())
{
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 58544f7e..602441fb 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -240,7 +240,7 @@ void Window::setMaxHeight(unsigned int height)
void Window::setResizable(bool r)
{
- if ((bool)mGrip == r) return;
+ if ((bool) mGrip == r) return;
if (r)
{
@@ -258,9 +258,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);
}
@@ -465,13 +468,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());
@@ -484,13 +484,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);
}
}
@@ -506,7 +503,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)