diff options
author | Ira Rice <irarice@gmail.com> | 2009-03-06 08:50:11 -0700 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-03-06 08:50:11 -0700 |
commit | 6ea994477c58912785729e7922eb90862a1ab13c (patch) | |
tree | d3899862249213761358b2ff11560bd03297b272 /src | |
parent | 249b699ee7d6b80700cd648c4a7634c267b0ee68 (diff) | |
download | mana-client-6ea994477c58912785729e7922eb90862a1ab13c.tar.gz mana-client-6ea994477c58912785729e7922eb90862a1ab13c.tar.bz2 mana-client-6ea994477c58912785729e7922eb90862a1ab13c.tar.xz mana-client-6ea994477c58912785729e7922eb90862a1ab13c.zip |
Cut down on redundant constant int declarations in the windows skinning
code. While this shouldn't do too much, if anything, for performance, it
makes maintenence easier in the future if only one set of ints needs to
be modified rather than 9 when they do the same thing.
Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/window.cpp | 74 |
1 files changed, 6 insertions, 68 deletions
diff --git a/src/gui/window.cpp b/src/gui/window.cpp index e285c3c4..0869368d 100644 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -569,7 +569,7 @@ void Window::loadSkin(const std::string &filename) if (!skinSetImage.empty()) { logger->log("Window::loadSkin(): <skinset> defines '%s' as a skin image.", skinSetImage.c_str()); - dBorders = resman->getImage("graphics/gui/" + skinSetImage);//"graphics/gui/speech_bubble.png"); + dBorders = resman->getImage("graphics/gui/" + skinSetImage); } else { @@ -593,104 +593,42 @@ void Window::loadSkin(const std::string &filename) for_each_xml_child_node(partNode, widgetNode) { if (!xmlStrEqual(partNode->name, BAD_CAST "part")) - { continue; - } std::string partType; partType = XML::getProperty(partNode, "type", "unknown"); // TOP ROW - if (partType == "top-left-corner") - { - const int xPos = XML::getProperty(partNode, "xpos", 0); - const int yPos = XML::getProperty(partNode, "ypos", 0); - const int width = XML::getProperty(partNode, "width", 1); - const int height = XML::getProperty(partNode, "height", 1); + const int xPos = XML::getProperty(partNode, "xpos", 0); + const int yPos = XML::getProperty(partNode, "ypos", 0); + const int width = XML::getProperty(partNode, "width", 1); + const int height = XML::getProperty(partNode, "height", 1); + if (partType == "top-left-corner") border.grid[0] = dBorders->getSubImage(xPos, yPos, width, height); - } else if (partType == "top-edge") - { - const int xPos = XML::getProperty(partNode, "xpos", 0); - const int yPos = XML::getProperty(partNode, "ypos", 0); - const int width = XML::getProperty(partNode, "width", 1); - const int height = XML::getProperty(partNode, "height", 1); - border.grid[1] = dBorders->getSubImage(xPos, yPos, width, height); - } else if (partType == "top-right-corner") - { - const int xPos = XML::getProperty(partNode, "xpos", 0); - const int yPos = XML::getProperty(partNode, "ypos", 0); - const int width = XML::getProperty(partNode, "width", 1); - const int height = XML::getProperty(partNode, "height", 1); - border.grid[2] = dBorders->getSubImage(xPos, yPos, width, height); - } // MIDDLE ROW else if (partType == "left-edge") - { - const int xPos = XML::getProperty(partNode, "xpos", 0); - const int yPos = XML::getProperty(partNode, "ypos", 0); - const int width = XML::getProperty(partNode, "width", 1); - const int height = XML::getProperty(partNode, "height", 1); - border.grid[3] = dBorders->getSubImage(xPos, yPos, width, height); - } else if (partType == "bg-quad") - { - const int xPos = XML::getProperty(partNode, "xpos", 0); - const int yPos = XML::getProperty(partNode, "ypos", 0); - const int width = XML::getProperty(partNode, "width", 1); - const int height = XML::getProperty(partNode, "height", 1); - border.grid[4] = dBorders->getSubImage(xPos, yPos, width, height); - } else if (partType == "right-edge") - { - const int xPos = XML::getProperty(partNode, "xpos", 0); - const int yPos = XML::getProperty(partNode, "ypos", 0); - const int width = XML::getProperty(partNode, "width", 1); - const int height = XML::getProperty(partNode, "height", 1); - border.grid[5] = dBorders->getSubImage(xPos, yPos, width, height); - } // BOTTOM ROW else if (partType == "bottom-left-corner") - { - const int xPos = XML::getProperty(partNode, "xpos", 0); - const int yPos = XML::getProperty(partNode, "ypos", 0); - const int width = XML::getProperty(partNode, "width", 1); - const int height = XML::getProperty(partNode, "height", 1); - border.grid[6] = dBorders->getSubImage(xPos, yPos, width, height); - } else if (partType == "bottom-edge") - { - const int xPos = XML::getProperty(partNode, "xpos", 0); - const int yPos = XML::getProperty(partNode, "ypos", 0); - const int width = XML::getProperty(partNode, "width", 1); - const int height = XML::getProperty(partNode, "height", 1); - border.grid[7] = dBorders->getSubImage(xPos, yPos, width, height); - } else if (partType == "bottom-right-corner") - { - const int xPos = XML::getProperty(partNode, "xpos", 0); - const int yPos = XML::getProperty(partNode, "ypos", 0); - const int width = XML::getProperty(partNode, "width", 1); - const int height = XML::getProperty(partNode, "height", 1); - border.grid[8] = dBorders->getSubImage(xPos, yPos, width, height); - } // Part is of an uknown type. else - { logger->log("Window::loadSkin(): Unknown Part Type '%s'", partType.c_str()); - } } } // Widget is of an uknown type. |