summaryrefslogtreecommitdiff
path: root/src/gui/theme.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-08-03 02:11:25 +0300
committerAndrei Karas <akaras@inbox.ru>2012-08-04 23:57:02 +0300
commit0647852f65598ef9cb9ebff6dfb508e8b1a98c1c (patch)
tree4cc9395e820e60f3d511351b78fe187e897a8c7e /src/gui/theme.cpp
parentc52472123eb7847b5cee6b1898c42ef25a5466dd (diff)
downloadmanaverse-0647852f65598ef9cb9ebff6dfb508e8b1a98c1c.tar.gz
manaverse-0647852f65598ef9cb9ebff6dfb508e8b1a98c1c.tar.bz2
manaverse-0647852f65598ef9cb9ebff6dfb508e8b1a98c1c.tar.xz
manaverse-0647852f65598ef9cb9ebff6dfb508e8b1a98c1c.zip
Add support for default theme file names.
Diffstat (limited to 'src/gui/theme.cpp')
-rw-r--r--src/gui/theme.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index 2ea8ba840..44de72cdc 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -230,8 +230,8 @@ gcn::Color Theme::getProgressColor(int type, float progress)
return gcn::Color(color[0], color[1], color[2]);
}
-Skin *Theme::load(const std::string &filename, bool full,
- const std::string &defaultPath)
+Skin *Theme::load(const std::string &filename, const std::string &filename2,
+ bool full, const std::string &defaultPath)
{
// Check if this skin was already loaded
@@ -245,7 +245,10 @@ Skin *Theme::load(const std::string &filename, bool full,
Skin *skin = readSkin(filename, full);
- if (!skin && filename != "window.xml")
+ if (!skin && !filename2.empty() && filename2 != filename)
+ skin = readSkin(filename2, full);
+
+ if (!skin && filename2 != "window.xml")
skin = readSkin("window.xml", full);
if (!skin)
@@ -873,9 +876,10 @@ void Theme::loadColors(std::string file)
}
}
-void Theme::loadRect(ImageRect &image, std::string name, int start, int end)
+void Theme::loadRect(ImageRect &image, std::string name, std::string name2,
+ int start, int end)
{
- Skin *skin = load(name, false);
+ Skin *skin = load(name, name2, false);
if (skin)
{
const ImageRect &rect = skin->getBorder();
@@ -892,9 +896,9 @@ void Theme::loadRect(ImageRect &image, std::string name, int start, int end)
}
Skin *Theme::loadSkinRect(ImageRect &image, std::string name,
- int start, int end)
+ std::string name2, int start, int end)
{
- Skin *skin = load(name);
+ Skin *skin = load(name, name2);
if (skin)
{
const ImageRect &rect = skin->getBorder();
@@ -919,10 +923,11 @@ void Theme::unloadRect(ImageRect &rect, int start, int end)
}
}
-Image *Theme::getImageFromThemeXml(const std::string &name)
+Image *Theme::getImageFromThemeXml(const std::string &name,
+ const std::string &name2)
{
Theme *theme = Theme::instance();
- Skin *skin = theme->load(name, false);
+ Skin *skin = theme->load(name, name2, false);
if (skin)
{
const ImageRect &rect = skin->getBorder();
@@ -939,10 +944,11 @@ Image *Theme::getImageFromThemeXml(const std::string &name)
}
ImageSet *Theme::getImageSetFromThemeXml(const std::string &name,
+ const std::string &name2,
int w, int h)
{
Theme *theme = Theme::instance();
- Skin *skin = theme->load(name, false);
+ Skin *skin = theme->load(name, name2, false);
if (skin)
{
const ImageRect &rect = skin->getBorder();