diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-04-30 14:08:37 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-04-30 14:08:37 +0300 |
commit | 1cffd95a2d98736c2d0dc2f382995889ceaef86a (patch) | |
tree | 9bb16984a2cc28daf7521beb2f9125f0b0ea77da /src/gui/theme.cpp | |
parent | 27a4c8b4acdf5f433f42b5dce97f95f391e36cbf (diff) | |
download | plus-1cffd95a2d98736c2d0dc2f382995889ceaef86a.tar.gz plus-1cffd95a2d98736c2d0dc2f382995889ceaef86a.tar.bz2 plus-1cffd95a2d98736c2d0dc2f382995889ceaef86a.tar.xz plus-1cffd95a2d98736c2d0dc2f382995889ceaef86a.zip |
add support for set fonts and font sizes from themes.
Changed default font size from 11 to 12 px.
Diffstat (limited to 'src/gui/theme.cpp')
-rw-r--r-- | src/gui/theme.cpp | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 27945b808..db3b247cb 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -1147,6 +1147,14 @@ ImageSet *Theme::getImageSetFromThemeXml(const std::string &name, return nullptr; } +#define readValue(name) \ + info->name = reinterpret_cast<const char*>(\ + xmlNodeGetContent(infoNode)) + +#define readIntValue(name) \ + info->name = atoi(reinterpret_cast<const char*>(\ + xmlNodeGetContent(infoNode))) + ThemeInfo *Theme::loadInfo(const std::string &themeName) { std::string path; @@ -1171,15 +1179,25 @@ ThemeInfo *Theme::loadInfo(const std::string &themeName) for_each_xml_child_node(infoNode, rootNode) { if (xmlNameEqual(infoNode, "name")) - { - info->name = reinterpret_cast<const char*>( - xmlNodeGetContent(infoNode)); - } + readValue(name); else if (xmlNameEqual(infoNode, "copyright")) - { - info->copyright = reinterpret_cast<const char*>( - xmlNodeGetContent(infoNode)); - } + readValue(copyright); + else if (xmlNameEqual(infoNode, "font")) + readValue(font); + else if (xmlNameEqual(infoNode, "boldFont")) + readValue(boldFont); + else if (xmlNameEqual(infoNode, "particleFont")) + readValue(particleFont); + else if (xmlNameEqual(infoNode, "helpFont")) + readValue(helpFont); + else if (xmlNameEqual(infoNode, "secureFont")) + readValue(secureFont); + else if (xmlNameEqual(infoNode, "japanFont")) + readValue(japanFont); + else if (xmlNameEqual(infoNode, "fontSize")) + readIntValue(fontSize); + else if (xmlNameEqual(infoNode, "npcfontSize")) + readIntValue(npcfontSize); } return info; } |