From 209fdbeaf69176fdab23604e820a73103e66776d Mon Sep 17 00:00:00 2001
From: Andrei Karas <akaras@inbox.ru>
Date: Wed, 1 May 2013 23:13:02 +0300
Subject: Fix tilebar padding with different font sizes.

Fix paddings in outfits window.
---
 data/graphics/gui/CMakeLists.txt     |  1 +
 data/graphics/gui/Makefile.am        |  1 +
 data/graphics/gui/outfits.xml        | 25 +++++++++++++++++++++++++
 data/themes/enchilado/CMakeLists.txt |  1 +
 data/themes/enchilado/Makefile.am    |  1 +
 data/themes/enchilado/outfits.xml    | 25 +++++++++++++++++++++++++
 data/themes/jewelry/CMakeLists.txt   |  1 +
 data/themes/jewelry/Makefile.am      |  1 +
 data/themes/jewelry/outfits.xml      | 31 +++++++++++++++++++++++++++++++
 data/themes/pink/CMakeLists.txt      |  1 +
 data/themes/pink/Makefile.am         |  1 +
 data/themes/pink/outfits.xml         | 25 +++++++++++++++++++++++++
 data/themes/unity/CMakeLists.txt     |  1 +
 data/themes/unity/Makefile.am        |  1 +
 data/themes/unity/outfits.xml        | 25 +++++++++++++++++++++++++
 data/themes/wood/CMakeLists.txt      |  1 +
 data/themes/wood/Makefile.am         |  1 +
 data/themes/wood/outfits.xml         | 25 +++++++++++++++++++++++++
 data/themes/wood/window.xml          |  2 ++
 src/gui/outfitwindow.cpp             |  5 +++--
 src/gui/theme.cpp                    |  4 ++--
 src/gui/widgets/window.cpp           |  7 +++++--
 22 files changed, 180 insertions(+), 6 deletions(-)
 create mode 100644 data/graphics/gui/outfits.xml
 create mode 100644 data/themes/enchilado/outfits.xml
 create mode 100644 data/themes/jewelry/outfits.xml
 create mode 100644 data/themes/pink/outfits.xml
 create mode 100644 data/themes/unity/outfits.xml
 create mode 100644 data/themes/wood/outfits.xml

diff --git a/data/graphics/gui/CMakeLists.txt b/data/graphics/gui/CMakeLists.txt
index 4a1091b47..444dd3cf5 100644
--- a/data/graphics/gui/CMakeLists.txt
+++ b/data/graphics/gui/CMakeLists.txt
@@ -38,6 +38,7 @@ SET (FILES
     ministatus.xml
     mouse.png
     ok.xml
+    outfits.xml
     playerbox.xml
     playerboxselected.xml
     popup.xml
diff --git a/data/graphics/gui/Makefile.am b/data/graphics/gui/Makefile.am
index ffcfbca53..cf0109322 100644
--- a/data/graphics/gui/Makefile.am
+++ b/data/graphics/gui/Makefile.am
@@ -41,6 +41,7 @@ gui_DATA =				\
 	ministatus.xml			\
 	mouse.png			\
 	ok.xml			\
+	outfits.xml			\
 	playerbox.xml	\
 	playerboxselected.xml	\
 	popup.xml			\
diff --git a/data/graphics/gui/outfits.xml b/data/graphics/gui/outfits.xml
new file mode 100644
index 000000000..34419257c
--- /dev/null
+++ b/data/graphics/gui/outfits.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<skinset name="Default" image="window.png">
+    <widget type="Window">
+        <option name="padding" value="8" />
+
+        <!-- Top Row -->
+        <part type="top-left-corner" xpos="0" ypos="0" width="4" height="4" />
+        <part type="top-edge" xpos="4" ypos="0" width="32" height="4" />
+        <part type="top-right-corner" xpos="36" ypos="0" width="4" height="4" />
+
+        <!-- Middle Row -->
+        <part type="left-edge" xpos="0" ypos="4" width="4" height="216" />
+        <part type="bg-quad" xpos="4" ypos="4" width="32" height="216" />
+        <part type="right-edge" xpos="36" ypos="4" width="4" height="216" />
+
+        <!-- Bottom Row -->
+        <part type="bottom-left-corner" xpos="0" ypos="220" width="4" height="4" />
+        <part type="bottom-edge" xpos="4" ypos="220" width="32" height="4" />
+        <part type="bottom-right-corner" xpos="36" ypos="220" width="4" height="4" />
+
+        <part type="closeImage" xpos="130" ypos="0" width="15" height="15" />
+        <part type="stickyImageUp" xpos="130" ypos="51" width="15" height="15" />
+        <part type="stickyImageDown" xpos="145" ypos="51" width="15" height="15" />
+    </widget>
+</skinset>
\ No newline at end of file
diff --git a/data/themes/enchilado/CMakeLists.txt b/data/themes/enchilado/CMakeLists.txt
index dab8ddb41..f14fdd481 100644
--- a/data/themes/enchilado/CMakeLists.txt
+++ b/data/themes/enchilado/CMakeLists.txt
@@ -5,6 +5,7 @@ SET (FILES
     info.xml
     inventory.xml
     ok.xml
+    outfits.xml
     popup.xml
     progressbar.xml
     quests.xml
diff --git a/data/themes/enchilado/Makefile.am b/data/themes/enchilado/Makefile.am
index da0917225..4823a123b 100644
--- a/data/themes/enchilado/Makefile.am
+++ b/data/themes/enchilado/Makefile.am
@@ -8,6 +8,7 @@ gui_DATA =				\
 	info.xml		\
 	inventory.xml		\
 	ok.xml		\
+	outfits.xml		\
 	popup.xml		\
 	progressbar.xml		\
 	quests.xml		\
diff --git a/data/themes/enchilado/outfits.xml b/data/themes/enchilado/outfits.xml
new file mode 100644
index 000000000..c37161bd0
--- /dev/null
+++ b/data/themes/enchilado/outfits.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<skinset name="Default" image="window.png">
+    <widget type="Window" xpos="190" ypos="30">
+        <option name="padding" value="6" />
+
+        <!-- Top Row -->
+        <part type="top-left-corner" xpos="0" ypos="0" width="10" height="10" />
+        <part type="top-edge" xpos="11" ypos="0" width="127" height="10" />
+        <part type="top-right-corner" xpos="139" ypos="0" width="12" height="10" />
+
+        <!-- Middle Row -->
+        <part type="left-edge" xpos="0" ypos="11" width="10" height="81" />
+        <part type="bg-quad" xpos="11" ypos="11" width="127" height="81" />
+        <part type="right-edge" xpos="139" ypos="11" width="12" height="81" />
+
+        <!-- Bottom Row -->
+        <part type="bottom-left-corner" xpos="0" ypos="93" width="10" height="12" />
+        <part type="bottom-edge" xpos="11" ypos="93" width="127" height="12" />
+        <part type="bottom-right-corner" xpos="139" ypos="93" width="12" height="12" />
+
+        <part type="closeImage" xpos="-60" ypos="-30" width="15" height="15" />
+        <part type="stickyImageUp" xpos="-60" ypos="21" width="15" height="15" />
+        <part type="stickyImageDown" xpos="-45" ypos="21" width="15" height="15" />
+    </widget>
+</skinset>
diff --git a/data/themes/jewelry/CMakeLists.txt b/data/themes/jewelry/CMakeLists.txt
index 29bddf8bf..01265ac58 100644
--- a/data/themes/jewelry/CMakeLists.txt
+++ b/data/themes/jewelry/CMakeLists.txt
@@ -43,6 +43,7 @@ SET (FILES
     mouse.png
     npc.xml
     ok.xml
+    outfits.xml
     playerbox.xml
     playerboxselected.xml
     popup.xml
diff --git a/data/themes/jewelry/Makefile.am b/data/themes/jewelry/Makefile.am
index 107d6b077..2f5b8145c 100644
--- a/data/themes/jewelry/Makefile.am
+++ b/data/themes/jewelry/Makefile.am
@@ -46,6 +46,7 @@ gui_DATA =				\
 	mouse.png		\
 	npc.xml		\
 	ok.xml		\
+	outfits.xml		\
 	playerbox.xml		\
 	playerboxselected.xml		\
 	popup.xml		\
diff --git a/data/themes/jewelry/outfits.xml b/data/themes/jewelry/outfits.xml
new file mode 100644
index 000000000..e4e11476a
--- /dev/null
+++ b/data/themes/jewelry/outfits.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<skinset name="Default" image="window.png">
+    <widget type="Window" xpos="260" ypos="0">
+        <option name="captionoffsetx" value="20" /> 
+        <option name="captionoffsety" value="7" />
+        <option name="titlebarBold" value="1" />
+        <option name="titlebarHeight" value="35" />
+        <option name="padding" value="10" />
+        <option name="stickySpacing" value="6" />
+
+        <!-- Top Row -->
+        <part type="top-left-corner" xpos="0" ypos="0" width="30" height="53" />
+        <part type="top-edge" xpos="31" ypos="0" width="48" height="53" />
+        <part type="top-right-corner" xpos="80" ypos="0" width="30" height="53" />
+
+        <!-- Middle Row -->
+        <part type="left-edge" xpos="0" ypos="54" width="30" height="24" />
+        <part type="bg-quad" xpos="31" ypos="54" width="48" height="24" />
+        <part type="right-edge" xpos="80" ypos="54" width="30" height="24" />
+
+        <!-- Bottom Row -->
+        <part type="bottom-left-corner" xpos="0" ypos="79" width="30" height="28" />
+        <part type="bottom-edge" xpos="31" ypos="79" width="48" height="28" />
+        <part type="bottom-right-corner" xpos="80" ypos="79" width="30" height="28" />
+
+        <part type="closeImage" xpos="-163" ypos="0" width="22" height="22" />
+        <part type="closeImageHighlighted" xpos="-138" ypos="0" width="22" height="22" />
+        <part type="stickyImageUp" xpos="-130" ypos="51" width="19" height="22" />
+        <part type="stickyImageDown" xpos="-99" ypos="51" width="19" height="22" />
+    </widget>
+</skinset>
diff --git a/data/themes/pink/CMakeLists.txt b/data/themes/pink/CMakeLists.txt
index 82598e776..b1d3af540 100644
--- a/data/themes/pink/CMakeLists.txt
+++ b/data/themes/pink/CMakeLists.txt
@@ -6,6 +6,7 @@ SET (FILES
     info.xml
     inventory.xml
     ok.xml
+    outfits.xml
     popup.xml
     progress-indicator.png
     progressbar.xml
diff --git a/data/themes/pink/Makefile.am b/data/themes/pink/Makefile.am
index 6af7350a5..99d670e0f 100644
--- a/data/themes/pink/Makefile.am
+++ b/data/themes/pink/Makefile.am
@@ -9,6 +9,7 @@ gui_DATA =				\
 	info.xml		\
 	inventory.xml		\
 	ok.xml		\
+	outfits.xml		\
 	popup.xml		\
 	progress-indicator.png		\
 	progressbar.xml		\
diff --git a/data/themes/pink/outfits.xml b/data/themes/pink/outfits.xml
new file mode 100644
index 000000000..416fcf9ed
--- /dev/null
+++ b/data/themes/pink/outfits.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<skinset name="Default" image="window.png">
+    <widget type="Window" xpos="250" ypos="0">
+        <option name="padding" value="6" />
+
+        <!-- Top Row -->
+        <part type="top-left-corner" xpos="0" ypos="0" width="10" height="10" />
+        <part type="top-edge" xpos="0" ypos="10" width="10" height="10" />
+        <part type="top-right-corner" xpos="0" ypos="20" width="10" height="10" />
+
+        <!-- Middle Row -->
+        <part type="left-edge" xpos="0" ypos="30" width="10" height="10" />
+        <part type="bg-quad" xpos="0" ypos="40" width="10" height="10" />
+        <part type="right-edge" xpos="0" ypos="50" width="10" height="10" />
+
+        <!-- Bottom Row -->
+        <part type="bottom-left-corner" xpos="0" ypos="60" width="10" height="10" />
+        <part type="bottom-edge" xpos="0" ypos="70" width="10" height="10" />
+        <part type="bottom-right-corner" xpos="10" ypos="0" width="132" height="134" />
+
+        <part type="closeImage" xpos="-120" ypos="0" width="15" height="15" />
+        <part type="stickyImageUp" xpos="-120" ypos="51" width="15" height="15" />
+        <part type="stickyImageDown" xpos="-105" ypos="51" width="15" height="15" />
+    </widget>
+</skinset>
diff --git a/data/themes/unity/CMakeLists.txt b/data/themes/unity/CMakeLists.txt
index 6eda666a7..2c60a6036 100644
--- a/data/themes/unity/CMakeLists.txt
+++ b/data/themes/unity/CMakeLists.txt
@@ -7,6 +7,7 @@ SET (FILES
     inventory.xml
     npc.xml
     ok.xml
+    outfits.xml
     popup.xml
     progressbar.xml
     quests.xml
diff --git a/data/themes/unity/Makefile.am b/data/themes/unity/Makefile.am
index f6c6fc91e..7fd51fb44 100644
--- a/data/themes/unity/Makefile.am
+++ b/data/themes/unity/Makefile.am
@@ -10,6 +10,7 @@ gui_DATA =				\
 	inventory.xml		\
 	npc.xml		\
 	ok.xml		\
+	outfits.xml		\
 	popup.xml		\
 	progressbar.xml		\
 	quests.xml		\
diff --git a/data/themes/unity/outfits.xml b/data/themes/unity/outfits.xml
new file mode 100644
index 000000000..a30baacb3
--- /dev/null
+++ b/data/themes/unity/outfits.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<skinset name="Default" image="window.png">
+    <widget type="Window" xpos="260" ypos="0">
+        <option name="padding" value="10" />
+
+        <!-- Top Row -->
+        <part type="top-left-corner" xpos="0" ypos="0" width="10" height="10" />
+        <part type="top-edge" xpos="11" ypos="0" width="127" height="10" />
+        <part type="top-right-corner" xpos="139" ypos="0" width="12" height="10" />
+
+        <!-- Middle Row -->
+        <part type="left-edge" xpos="0" ypos="11" width="10" height="81" />
+        <part type="bg-quad" xpos="11" ypos="11" width="127" height="81" />
+        <part type="right-edge" xpos="139" ypos="11" width="12" height="81" />
+
+        <!-- Bottom Row -->
+        <part type="bottom-left-corner" xpos="0" ypos="93" width="10" height="12" />
+        <part type="bottom-edge" xpos="11" ypos="93" width="127" height="12" />
+        <part type="bottom-right-corner" xpos="139" ypos="93" width="12" height="12" />
+
+        <part type="closeImage" xpos="-130" ypos="0" width="15" height="15" />
+        <part type="stickyImageUp" xpos="-130" ypos="51" width="15" height="15" />
+        <part type="stickyImageDown" xpos="-115" ypos="51" width="15" height="15" />
+    </widget>
+</skinset>
diff --git a/data/themes/wood/CMakeLists.txt b/data/themes/wood/CMakeLists.txt
index c65e18222..f9fa12651 100644
--- a/data/themes/wood/CMakeLists.txt
+++ b/data/themes/wood/CMakeLists.txt
@@ -7,6 +7,7 @@ SET (FILES
     item_shortcut_bgr.png
     mouse.png
     ok.xml
+    outfits.xml
     popup.xml
     progressbar.xml
     quests.xml
diff --git a/data/themes/wood/Makefile.am b/data/themes/wood/Makefile.am
index d16bfac19..3984e5f7f 100644
--- a/data/themes/wood/Makefile.am
+++ b/data/themes/wood/Makefile.am
@@ -10,6 +10,7 @@ gui_DATA =				\
 	item_shortcut_bgr.png		\
 	mouse.png			\
 	ok.xml			\
+	outfits.xml			\
 	popup.xml			\
 	progressbar.xml			\
 	quests.xml			\
diff --git a/data/themes/wood/outfits.xml b/data/themes/wood/outfits.xml
new file mode 100644
index 000000000..6a113cac4
--- /dev/null
+++ b/data/themes/wood/outfits.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<skinset name="Default" image="window.png">
+    <widget type="Window" xpos="260" ypos="0">
+        <option name="padding" value="8" />
+
+        <!-- Top Row -->
+        <part type="top-left-corner" width="10" height="10" />
+        <part type="top-edge" xpos="11" ypos="0" width="127" height="10" />
+        <part type="top-right-corner" xpos="139" ypos="0" width="12" height="10" />
+
+        <!-- Middle Row -->
+        <part type="left-edge" xpos="0" ypos="11" width="10" height="81" />
+        <part type="bg-quad" xpos="11" ypos="11" width="127" height="81" />
+        <part type="right-edge" xpos="139" ypos="11" width="12" height="81" />
+
+        <!-- Bottom Row -->
+        <part type="bottom-left-corner" xpos="0" ypos="93" width="10" height="12" />
+        <part type="bottom-edge" xpos="11" ypos="93" width="127" height="12" />
+        <part type="bottom-right-corner" xpos="139" ypos="93" width="12" height="12" />
+
+        <part type="closeImage" xpos="-130" ypos="0" width="15" height="15" />
+        <part type="stickyImageUp" xpos="-130" ypos="51" width="15" height="15" />
+        <part type="stickyImageDown" xpos="-115" ypos="51" width="15" height="15" />
+    </widget>
+</skinset>
diff --git a/data/themes/wood/window.xml b/data/themes/wood/window.xml
index 0ed48061a..38b016fca 100644
--- a/data/themes/wood/window.xml
+++ b/data/themes/wood/window.xml
@@ -1,6 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <skinset name="Default" image="window.png">
     <widget type="Window" xpos="260" ypos="0">
+        <option name="padding" value="6" />
+
         <!-- Top Row -->
         <part type="top-left-corner" width="10" height="10" />
         <part type="top-edge" xpos="11" ypos="0" width="127" height="10" />
diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp
index 809b99b37..f43f1ba54 100644
--- a/src/gui/outfitwindow.cpp
+++ b/src/gui/outfitwindow.cpp
@@ -313,8 +313,9 @@ void OutfitWindow::draw(gcn::Graphics *graphics)
 
     for (unsigned int i = 0; i < OUTFIT_ITEM_COUNT; i++)
     {
-        const int itemX = 10 + ((i % mGridWidth) * mBoxWidth);
-        const int itemY = 25 + ((i / mGridWidth) * mBoxHeight);
+        const int itemX = mPadding + ((i % mGridWidth) * mBoxWidth);
+        const int itemY = mPadding + getTitleBarHeight()
+            + ((i / mGridWidth) * mBoxHeight);
 
         graphics->setColor(mBorderColor);
         graphics->drawRectangle(gcn::Rectangle(itemX, itemY, 32, 32));
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index 565391ed9..860174efb 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -505,7 +505,7 @@ Skin *Theme::readSkin(const std::string &filename, const bool full)
     memset(images, 0, sizeof(ImageRect));
     int padding = 3;
     int titlePadding = 4;
-    int titlebarHeight = 20;
+    int titlebarHeight = 0;
     int closePadding = 3;
     int stickySpacing = 3;
     int stickyPadding = 3;
@@ -577,7 +577,7 @@ Skin *Theme::readSkin(const std::string &filename, const bool full)
                     else if (name == "titlebarHeight")
                     {
                         titlebarHeight = XML::getProperty(
-                            partNode, "value", 16);
+                            partNode, "value", 0);
                     }
                     else if (name == "resizePadding")
                     {
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 0619a85a9..ad8014ee8 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -116,8 +116,7 @@ Window::Window(const std::string &caption, const bool modal,
             setPadding(mSkin->getPadding());
             if (getOptionBool("titlebarBold"))
                 mCaptionFont = reinterpret_cast<gcn::Font*>(boldFont);
-            setTitlePadding(mSkin->getTitlePadding());
-            setTitleBarHeight(getOption("titlebarHeight"));
+            mTitlePadding = mSkin->getTitlePadding();
             mGripPadding = getOption("resizePadding");
             mCaptionOffsetX = getOption("captionoffsetx");
             if (!mCaptionOffsetX)
@@ -131,6 +130,10 @@ Window::Window(const std::string &caption, const bool modal,
             {
                 mCaptionAlign = gcn::Graphics::LEFT;
             }
+            setTitleBarHeight(getOption("titlebarHeight"));
+            if (!mTitleBarHeight)
+                mTitleBarHeight = mCaptionFont->getHeight();
+
             setPalette(getOption("palette"));
             childPalette = getOption("childPalette");
         }
-- 
cgit v1.2.3-70-g09d2