diff options
author | Bertram <bertram@cegetel.net> | 2010-03-06 15:53:30 +0100 |
---|---|---|
committer | Bertram <bertram@cegetel.net> | 2010-03-06 15:53:30 +0100 |
commit | da77a5f25dbf9cdfbb33ddae1c01ed961f41374f (patch) | |
tree | 7160c19d185fa8d0bf826c09c9346cdc8354e50d /src | |
parent | f0bf3996fbc2f9dc3edc55b45e4fa3a3a6275db4 (diff) | |
parent | 3a447afa534573ed4a014372c687ef4028d16760 (diff) | |
download | mana-da77a5f25dbf9cdfbb33ddae1c01ed961f41374f.tar.gz mana-da77a5f25dbf9cdfbb33ddae1c01ed961f41374f.tar.bz2 mana-da77a5f25dbf9cdfbb33ddae1c01ed961f41374f.tar.xz mana-da77a5f25dbf9cdfbb33ddae1c01ed961f41374f.zip |
Merge branch 'master' of gitorious.org:mana/mana
Diffstat (limited to 'src')
32 files changed, 139 insertions, 164 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b84e59c6..68147db7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -282,8 +282,6 @@ SET(SRCS gui/shortcutwindow.h gui/skilldialog.cpp gui/skilldialog.h - gui/skin.cpp - gui/skin.h gui/socialwindow.cpp gui/socialwindow.h gui/speechbubble.cpp @@ -296,6 +294,8 @@ SET(SRCS gui/storagewindow.h gui/textdialog.cpp gui/textdialog.h + gui/theme.cpp + gui/theme.h gui/trade.cpp gui/trade.h gui/truetypefont.cpp diff --git a/src/Makefile.am b/src/Makefile.am index f36fcdf2..55937c0c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -181,8 +181,6 @@ mana_SOURCES = gui/widgets/avatarlistbox.cpp \ gui/shortcutwindow.h \ gui/skilldialog.cpp \ gui/skilldialog.h \ - gui/skin.cpp \ - gui/skin.h \ gui/socialwindow.cpp \ gui/socialwindow.h \ gui/speechbubble.cpp \ @@ -195,6 +193,8 @@ mana_SOURCES = gui/widgets/avatarlistbox.cpp \ gui/storagewindow.h \ gui/textdialog.cpp \ gui/textdialog.h \ + gui/theme.cpp \ + gui/theme.h \ gui/trade.cpp \ gui/trade.h \ gui/truetypefont.cpp \ diff --git a/src/client.cpp b/src/client.cpp index dfa42034..1b9dcd4c 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -40,7 +40,6 @@ #include "gui/charselectdialog.h" #include "gui/connectiondialog.h" #include "gui/gui.h" -#include "gui/skin.h" #include "gui/login.h" #include "gui/okdialog.h" #include "gui/palette.h" @@ -49,6 +48,7 @@ #include "gui/sdlinput.h" #include "gui/serverdialog.h" #include "gui/setup.h" +#include "gui/theme.h" #include "gui/unregisterdialog.h" #include "gui/updatewindow.h" #include "gui/worldselectdialog.h" @@ -340,7 +340,7 @@ Client::Client(const Options &options): // Initialize for drawing graphics->_beginDraw(); - SkinLoader::prepareThemePath(); + Theme::prepareThemePath(); // Initialize the item and emote shortcuts. itemShortcut = new ItemShortcut; @@ -601,7 +601,7 @@ int Client::exec() { // Don't allow an alpha opacity // lower than the default value - SkinLoader::instance()->setMinimumOpacity(0.8f); + Theme::instance()->setMinimumOpacity(0.8f); mCurrentDialog = new ServerDialog(&mCurrentServer, mConfigDir); @@ -627,7 +627,7 @@ int Client::exec() logger->log("State: LOGIN"); // Don't allow an alpha opacity // lower than the default value - SkinLoader::instance()->setMinimumOpacity(0.8f); + Theme::instance()->setMinimumOpacity(0.8f); if (mOptions.username.empty() || mOptions.password.empty()) @@ -744,7 +744,7 @@ int Client::exec() logger->log("State: CHAR SELECT"); // Don't allow an alpha opacity // lower than the default value - SkinLoader::instance()->setMinimumOpacity(0.8f); + Theme::instance()->setMinimumOpacity(0.8f); mCurrentDialog = new CharSelectDialog(&loginData); @@ -781,7 +781,7 @@ int Client::exec() sound.fadeOutMusic(1000); // Allow any alpha opacity - SkinLoader::instance()->setMinimumOpacity(-1.0f); + Theme::instance()->setMinimumOpacity(-1.0f); delete mSetupButton; delete mDesktop; diff --git a/src/gui/emotepopup.cpp b/src/gui/emotepopup.cpp index 2161e04c..7c05e263 100644 --- a/src/gui/emotepopup.cpp +++ b/src/gui/emotepopup.cpp @@ -29,7 +29,7 @@ #include "localplayer.h" #include "log.h" -#include "gui/skin.h" +#include "gui/theme.h" #include "resources/emotedb.h" #include "resources/image.h" @@ -57,7 +57,7 @@ EmotePopup::EmotePopup(): mEmotes.push_back(EmoteDB::getAnimation(i)); } - mSelectionImage = SkinLoader::getImageFromTheme("selection.png"); + mSelectionImage = Theme::getImageFromTheme("selection.png"); if (!mSelectionImage) logger->error("Unable to load selection.png"); diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 1e36523c..a59b0157 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -24,7 +24,7 @@ #include "gui/focushandler.h" #include "gui/palette.h" #include "gui/sdlinput.h" -#include "gui/skin.h" +#include "gui/theme.h" #include "gui/truetypefont.h" #include "gui/widgets/window.h" @@ -154,7 +154,7 @@ Gui::~Gui() delete guiInput; - SkinLoader::deleteInstance(); + Theme::deleteInstance(); } void Gui::logic() @@ -209,8 +209,7 @@ void Gui::setUseCustomCursor(bool customCursor) SDL_ShowCursor(SDL_DISABLE); // Load the mouse cursor - mMouseCursors = SkinLoader::getImageSetFromTheme("mouse.png", - 40, 40); + mMouseCursors = Theme::getImageSetFromTheme("mouse.png", 40, 40); if (!mMouseCursors) logger->error("Unable to load mouse cursors."); diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index 09c7ccb2..76ddd7b0 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -25,7 +25,7 @@ #include "log.h" #include "gui/setup.h" -#include "gui/skin.h" +#include "gui/theme.h" #include "gui/widgets/button.h" #include "gui/widgets/container.h" @@ -86,7 +86,7 @@ struct SkillInfo } else { - icon = SkinLoader::getImageFromTheme("unknown-item.png"); + icon = Theme::getImageFromTheme("unknown-item.png"); } } diff --git a/src/gui/specialswindow.cpp b/src/gui/specialswindow.cpp index 3ca0f037..44551825 100644 --- a/src/gui/specialswindow.cpp +++ b/src/gui/specialswindow.cpp @@ -24,7 +24,7 @@ #include "log.h" #include "gui/setup.h" -#include "gui/skin.h" +#include "gui/theme.h" #include "gui/widgets/button.h" #include "gui/widgets/container.h" @@ -220,7 +220,7 @@ SpecialEntry::SpecialEntry(SpecialInfo *info) : if (!info->icon.empty()) mIcon = new Icon(info->icon); else - mIcon = new Icon(SkinLoader::resolveThemePath("unknown-item.png")); + mIcon = new Icon(Theme::resolveThemePath("unknown-item.png")); mIcon->setPosition(1, 0); add(mIcon); diff --git a/src/gui/speechbubble.cpp b/src/gui/speechbubble.cpp index f02965d1..5cc5772d 100644 --- a/src/gui/speechbubble.cpp +++ b/src/gui/speechbubble.cpp @@ -25,7 +25,7 @@ #include "graphics.h" #include "gui/gui.h" -#include "gui/skin.h" +#include "gui/theme.h" #include "gui/widgets/textbox.h" diff --git a/src/gui/skin.cpp b/src/gui/theme.cpp index 22153720..961694e6 100644 --- a/src/gui/skin.cpp +++ b/src/gui/theme.cpp @@ -21,11 +21,10 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "gui/skin.h" +#include "gui/theme.h" #include "client.h" #include "configuration.h" -#include "configlistener.h" #include "log.h" #include "resources/image.h" @@ -40,32 +39,8 @@ #include <algorithm> -std::string SkinLoader::mThemePath; -SkinLoader *SkinLoader::mInstance = 0; - -class SkinConfigListener : public ConfigListener -{ - public: - SkinConfigListener(SkinLoader *skinLoader) - : mSkinLoader(skinLoader) - { - config.addListener("guialpha", this); - } - - ~SkinConfigListener() - { - config.removeListener("guialpha", this); - } - - void optionChanged(const std::string &) - { - mSkinLoader->updateAlpha(); - } - - private: - SkinLoader *mSkinLoader; -}; - +std::string Theme::mThemePath; +Theme *Theme::mInstance = 0; Skin::Skin(ImageRect skin, Image *close, Image *stickyUp, Image *stickyDown, const std::string &filePath, @@ -116,34 +91,33 @@ int Skin::getMinHeight() const mBorder.grid[ImageRect::LOWER_LEFT]->getHeight(); } -SkinLoader::SkinLoader() - : mSkinConfigListener(new SkinConfigListener(this)), +Theme::Theme(): mMinimumOpacity(-1.0f) { + config.addListener("guialpha", this); } -SkinLoader::~SkinLoader() +Theme::~Theme() { delete_all(mSkins); - delete mSkinConfigListener; + config.removeListener("guialpha", this); } -SkinLoader *SkinLoader::instance() +Theme *Theme::instance() { if (!mInstance) - mInstance = new SkinLoader; + mInstance = new Theme; return mInstance; } -void SkinLoader::deleteInstance() +void Theme::deleteInstance() { delete mInstance; mInstance = 0; } -Skin *SkinLoader::load(const std::string &filename, - const std::string &defaultPath) +Skin *Theme::load(const std::string &filename, const std::string &defaultPath) { // Check if this skin was already loaded SkinIterator skinIterator = mSkins.find(filename); @@ -180,7 +154,7 @@ Skin *SkinLoader::load(const std::string &filename, return skin; } -void SkinLoader::setMinimumOpacity(float minimumOpacity) +void Theme::setMinimumOpacity(float minimumOpacity) { if (minimumOpacity > 1.0f) return; @@ -188,13 +162,18 @@ void SkinLoader::setMinimumOpacity(float minimumOpacity) updateAlpha(); } -void SkinLoader::updateAlpha() +void Theme::updateAlpha() { for (SkinIterator iter = mSkins.begin(); iter != mSkins.end(); ++iter) iter->second->updateAlpha(mMinimumOpacity); } -Skin *SkinLoader::readSkin(const std::string &filename) +void Theme::optionChanged(const std::string &) +{ + updateAlpha(); +} + +Skin *Theme::readSkin(const std::string &filename) { if (filename.empty()) return 0; @@ -211,15 +190,14 @@ Skin *SkinLoader::readSkin(const std::string &filename) if (skinSetImage.empty()) { - logger->log("SkinLoader::readSkin(): Skinset does not define an " - "image!"); + logger->log("Theme::readSkin(): Skinset does not define an image!"); return 0; } - logger->log("SkinLoader::load(): <skinset> defines " - "'%s' as a skin image.", skinSetImage.c_str()); + logger->log("Theme::load(): <skinset> defines '%s' as a skin image.", + skinSetImage.c_str()); - Image *dBorders = SkinLoader::getImageFromTheme(skinSetImage); + Image *dBorders = Theme::getImageFromTheme(skinSetImage); ImageRect border; // iterate <widget>'s @@ -273,13 +251,13 @@ Skin *SkinLoader::readSkin(const std::string &filename) border.grid[8] = dBorders->getSubImage(xPos, yPos, width, height); else - logger->log("SkinLoader::readSkin(): Unknown part type '%s'", + logger->log("Theme::readSkin(): Unknown part type '%s'", partType.c_str()); } } else { - logger->log("SkinLoader::readSkin(): Unknown widget type '%s'", + logger->log("Theme::readSkin(): Unknown widget type '%s'", widgetType.c_str()); } } @@ -289,8 +267,8 @@ Skin *SkinLoader::readSkin(const std::string &filename) logger->log("Finished loading skin."); // Hard-coded for now until we update the above code to look for window buttons - Image *closeImage = SkinLoader::getImageFromTheme("close_button.png"); - Image *sticky = SkinLoader::getImageFromTheme("sticky_button.png"); + Image *closeImage = Theme::getImageFromTheme("close_button.png"); + Image *sticky = Theme::getImageFromTheme("sticky_button.png"); Image *stickyImageUp = sticky->getSubImage(0, 0, 15, 15); Image *stickyImageDown = sticky->getSubImage(15, 0, 15, 15); sticky->decRef(); @@ -301,7 +279,7 @@ Skin *SkinLoader::readSkin(const std::string &filename) return skin; } -bool SkinLoader::tryThemePath(std::string themePath) +bool Theme::tryThemePath(std::string themePath) { if (!themePath.empty()) { @@ -316,7 +294,7 @@ bool SkinLoader::tryThemePath(std::string themePath) return false; } -void SkinLoader::prepareThemePath() +void Theme::prepareThemePath() { // Try theme from settings if (tryThemePath(config.getValue("theme", ""))) @@ -330,7 +308,7 @@ void SkinLoader::prepareThemePath() mThemePath = "graphics/gui"; } -std::string SkinLoader::resolveThemePath(const std::string &path) +std::string Theme::resolveThemePath(const std::string &path) { // Need to strip off any dye info for the existence tests int pos = path.find('|'); @@ -353,13 +331,13 @@ std::string SkinLoader::resolveThemePath(const std::string &path) return "graphics/gui/" + path; } -Image *SkinLoader::getImageFromTheme(const std::string &path) +Image *Theme::getImageFromTheme(const std::string &path) { ResourceManager *resman = ResourceManager::getInstance(); return resman->getImage(resolveThemePath(path)); } -ImageSet *SkinLoader::getImageSetFromTheme(const std::string &path, +ImageSet *Theme::getImageSetFromTheme(const std::string &path, int w, int h) { ResourceManager *resman = ResourceManager::getInstance(); diff --git a/src/gui/skin.h b/src/gui/theme.h index 091d3001..abc2612f 100644 --- a/src/gui/skin.h +++ b/src/gui/theme.h @@ -24,12 +24,12 @@ #ifndef SKIN_H #define SKIN_H +#include "configlistener.h" #include "graphics.h" #include <map> #include <string> -class ConfigListener; class Image; class ImageSet; @@ -96,10 +96,10 @@ class Skin Image *mStickyImageDown; /**< Sticky Button Image */ }; -class SkinLoader +class Theme : public ConfigListener { public: - static SkinLoader *instance(); + static Theme *instance(); static void deleteInstance(); static void prepareThemePath(); @@ -138,9 +138,11 @@ class SkinLoader */ void setMinimumOpacity(float minimumOpacity); + void optionChanged(const std::string &); + private: - SkinLoader(); - ~SkinLoader(); + Theme(); + ~Theme(); Skin *readSkin(const std::string &filename); @@ -156,7 +158,7 @@ class SkinLoader ConfigListener *mSkinConfigListener; static std::string mThemePath; - static SkinLoader *mInstance; + static Theme *mInstance; static bool tryThemePath(std::string themePath); diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index 92386739..17651137 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -25,7 +25,7 @@ #include "gui/chat.h" #include "gui/gui.h" #include "gui/palette.h" -#include "gui/skin.h" +#include "gui/theme.h" #include "resources/image.h" #include "resources/resourcemanager.h" @@ -45,8 +45,8 @@ AvatarListBox::AvatarListBox(AvatarListModel *model): if (instances == 1) { - onlineIcon = SkinLoader::getImageFromTheme("circle-green.png"); - offlineIcon = SkinLoader::getImageFromTheme("circle-gray.png"); + onlineIcon = Theme::getImageFromTheme("circle-green.png"); + offlineIcon = Theme::getImageFromTheme("circle-gray.png"); } setWidth(200); diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index 36a47859..aff46b2a 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -25,7 +25,7 @@ #include "graphics.h" #include "gui/palette.h" -#include "gui/skin.h" +#include "gui/theme.h" #include "resources/image.h" @@ -90,7 +90,7 @@ void Button::init() for (mode = 0; mode < BUTTON_COUNT; mode++) { - btn[mode] = SkinLoader::getImageFromTheme(data[mode].file); + btn[mode] = Theme::getImageFromTheme(data[mode].file); a = 0; for (y = 0; y < 3; y++) { @@ -126,7 +126,7 @@ Button::~Button() void Button::updateAlpha() { float alpha = std::max(config.getValue("guialpha", 0.8f), - (double)SkinLoader::instance()->getMinimumOpacity()); + (double) Theme::instance()->getMinimumOpacity()); if (mAlpha != alpha) { diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp index 0fefbfe9..5ca38727 100644 --- a/src/gui/widgets/checkbox.cpp +++ b/src/gui/widgets/checkbox.cpp @@ -25,7 +25,7 @@ #include "graphics.h" #include "gui/palette.h" -#include "gui/skin.h" +#include "gui/theme.h" #include "resources/image.h" @@ -44,7 +44,7 @@ CheckBox::CheckBox(const std::string &caption, bool selected): { if (instances == 0) { - Image *checkBox = SkinLoader::getImageFromTheme("checkbox.png"); + Image *checkBox = Theme::getImageFromTheme("checkbox.png"); checkBoxNormal = checkBox->getSubImage(0, 0, 9, 10); checkBoxChecked = checkBox->getSubImage(9, 0, 9, 10); checkBoxDisabled = checkBox->getSubImage(18, 0, 9, 10); @@ -93,7 +93,7 @@ void CheckBox::draw(gcn::Graphics* graphics) void CheckBox::updateAlpha() { float alpha = std::max(config.getValue("guialpha", 0.8f), - (double)SkinLoader::instance()->getMinimumOpacity()); + (double) Theme::instance()->getMinimumOpacity()); if (mAlpha != alpha) { diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index eb0cdef2..57a09ed2 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -26,7 +26,7 @@ #include "gui/palette.h" #include "gui/sdlinput.h" -#include "gui/skin.h" +#include "gui/theme.h" #include "gui/widgets/listbox.h" #include "gui/widgets/scrollarea.h" @@ -55,14 +55,10 @@ DropDown::DropDown(gcn::ListModel *listModel): // Load the background skin // Get the button skin - buttons[1][0] = - SkinLoader::getImageFromTheme("vscroll_up_default.png"); - buttons[0][0] = - SkinLoader::getImageFromTheme("vscroll_down_default.png"); - buttons[1][1] = - SkinLoader::getImageFromTheme("vscroll_up_pressed.png"); - buttons[0][1] = - SkinLoader::getImageFromTheme("vscroll_down_pressed.png"); + buttons[1][0] = Theme::getImageFromTheme("vscroll_up_default.png"); + buttons[0][0] = Theme::getImageFromTheme("vscroll_down_default.png"); + buttons[1][1] = Theme::getImageFromTheme("vscroll_up_pressed.png"); + buttons[0][1] = Theme::getImageFromTheme("vscroll_down_pressed.png"); buttons[0][0]->setAlpha(mAlpha); buttons[0][1]->setAlpha(mAlpha); @@ -70,7 +66,7 @@ DropDown::DropDown(gcn::ListModel *listModel): buttons[1][1]->setAlpha(mAlpha); // get the border skin - Image *boxBorder = SkinLoader::getImageFromTheme("deepbox.png"); + Image *boxBorder = Theme::getImageFromTheme("deepbox.png"); int gridx[4] = {0, 3, 28, 31}; int gridy[4] = {0, 3, 28, 31}; int a = 0, x, y; @@ -115,7 +111,7 @@ DropDown::~DropDown() void DropDown::updateAlpha() { float alpha = std::max(config.getValue("guialpha", 0.8f), - (double)SkinLoader::instance()->getMinimumOpacity()); + (double) Theme::instance()->getMinimumOpacity()); if (mAlpha != alpha) { diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index dd13c679..aadc6f24 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -32,7 +32,7 @@ #include "log.h" #include "gui/palette.h" -#include "gui/skin.h" +#include "gui/theme.h" #include "resources/emotedb.h" #include "resources/image.h" @@ -49,7 +49,7 @@ EmoteShortcutContainer::EmoteShortcutContainer(): addMouseListener(this); addWidgetListener(this); - mBackgroundImg = SkinLoader::getImageFromTheme("item_shortcut_bgr.png"); + mBackgroundImg = Theme::getImageFromTheme("item_shortcut_bgr.png"); mBackgroundImg->setAlpha(config.getValue("guialpha", 0.8)); diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index b4270912..0a211d29 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -32,7 +32,7 @@ #include "gui/outfitwindow.h" #include "gui/palette.h" #include "gui/sdlinput.h" -#include "gui/skin.h" +#include "gui/theme.h" #include "gui/viewport.h" #include "net/net.h" @@ -67,7 +67,7 @@ ItemContainer::ItemContainer(Inventory *inventory, bool forceQuantity): mItemPopup = new ItemPopup; setFocusable(true); - mSelImg = SkinLoader::getImageFromTheme("selection.png"); + mSelImg = Theme::getImageFromTheme("selection.png"); if (!mSelImg) logger->error("Unable to load selection.png"); diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index 92a3e7d0..da5d11c5 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -32,7 +32,7 @@ #include "gui/inventorywindow.h" #include "gui/itempopup.h" #include "gui/palette.h" -#include "gui/skin.h" +#include "gui/theme.h" #include "gui/viewport.h" #include "resources/image.h" @@ -50,7 +50,7 @@ ItemShortcutContainer::ItemShortcutContainer(): mItemPopup = new ItemPopup; - mBackgroundImg = SkinLoader::getImageFromTheme("item_shortcut_bgr.png"); + mBackgroundImg = Theme::getImageFromTheme("item_shortcut_bgr.png"); mMaxItems = itemShortcut->getItemCount(); mBackgroundImg->setAlpha(config.getValue("guialpha", 0.8)); diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp index bfef9e2f..138cf3a0 100644 --- a/src/gui/widgets/listbox.cpp +++ b/src/gui/widgets/listbox.cpp @@ -25,7 +25,7 @@ #include "gui/palette.h" #include "gui/sdlinput.h" -#include "gui/skin.h" +#include "gui/theme.h" #include <guichan/font.hpp> #include <guichan/graphics.hpp> @@ -46,7 +46,7 @@ ListBox::~ListBox() void ListBox::updateAlpha() { float alpha = std::max(config.getValue("guialpha", 0.8), - (double)SkinLoader::instance()->getMinimumOpacity()); + (double) Theme::instance()->getMinimumOpacity()); if (mAlpha != alpha) mAlpha = alpha; diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp index 24395db7..d2c16dbc 100644 --- a/src/gui/widgets/playerbox.cpp +++ b/src/gui/widgets/playerbox.cpp @@ -26,7 +26,7 @@ #include "graphics.h" #include "player.h" -#include "gui/skin.h" +#include "gui/theme.h" #include "resources/image.h" @@ -44,7 +44,7 @@ PlayerBox::PlayerBox(const Player *player): if (instances == 0) { // Load the background skin - Image *textbox = SkinLoader::getImageFromTheme("deepbox.png"); + Image *textbox = Theme::getImageFromTheme("deepbox.png"); int bggridx[4] = {0, 3, 28, 31}; int bggridy[4] = {0, 3, 28, 31}; int a = 0, x, y; diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp index 970b21ec..5cc8fad6 100644 --- a/src/gui/widgets/popup.cpp +++ b/src/gui/widgets/popup.cpp @@ -26,7 +26,7 @@ #include "graphics.h" #include "log.h" -#include "gui/skin.h" +#include "gui/theme.h" #include "gui/viewport.h" #include "gui/widgets/windowcontainer.h" @@ -51,7 +51,7 @@ Popup::Popup(const std::string &name, const std::string &skin): setPadding(3); // Loads the skin - mSkin = SkinLoader::instance()->load(skin, mDefaultSkinPath); + mSkin = Theme::instance()->load(skin, mDefaultSkinPath); // Add this window to the window container windowContainer->add(this); @@ -86,7 +86,7 @@ void Popup::loadPopupConfiguration() if (skinName.compare(mSkin->getFilePath()) != 0) { mSkin->instances--; - mSkin = SkinLoader::instance()->load(skinName, mDefaultSkinPath); + mSkin = Theme::instance()->load(skinName, mDefaultSkinPath); } } diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index 31c32132..99a8c36a 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -27,7 +27,7 @@ #include "gui/gui.h" #include "gui/palette.h" -#include "gui/skin.h" +#include "gui/theme.h" #include "resources/image.h" @@ -58,7 +58,7 @@ ProgressBar::ProgressBar(float progress, if (mInstances == 0) { - Image *dBorders = SkinLoader::getImageFromTheme("vscroll_grey.png"); + Image *dBorders = Theme::getImageFromTheme("vscroll_grey.png"); mBorder.grid[0] = dBorders->getSubImage(0, 0, 4, 4); mBorder.grid[1] = dBorders->getSubImage(4, 0, 3, 4); mBorder.grid[2] = dBorders->getSubImage(7, 0, 4, 4); @@ -122,7 +122,7 @@ void ProgressBar::logic() void ProgressBar::updateAlpha() { float alpha = std::max(config.getValue("guialpha", 0.8), - (double)SkinLoader::instance()->getMinimumOpacity()); + (double) Theme::instance()->getMinimumOpacity()); if (mAlpha != alpha) { diff --git a/src/gui/widgets/progressindicator.cpp b/src/gui/widgets/progressindicator.cpp index f88f6045..1941da4a 100644 --- a/src/gui/widgets/progressindicator.cpp +++ b/src/gui/widgets/progressindicator.cpp @@ -20,7 +20,7 @@ #include "progressindicator.h" -#include "gui/skin.h" +#include "gui/theme.h" #include "resources/animation.h" #include "resources/imageset.h" @@ -33,8 +33,8 @@ ProgressIndicator::ProgressIndicator() { - ImageSet *images = - SkinLoader::getImageSetFromTheme("progress-indicator.png", 32, 32); + ImageSet *images = Theme::getImageSetFromTheme("progress-indicator.png", + 32, 32); Animation *anim = new Animation; for (ImageSet::size_type i = 0; i < images->size(); ++i) diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp index 41c8faf7..96797225 100644 --- a/src/gui/widgets/radiobutton.cpp +++ b/src/gui/widgets/radiobutton.cpp @@ -24,7 +24,7 @@ #include "configuration.h" #include "graphics.h" -#include "gui/skin.h" +#include "gui/theme.h" #include "resources/image.h" @@ -44,12 +44,12 @@ RadioButton::RadioButton(const std::string &caption, const std::string &group, { if (instances == 0) { - radioNormal = SkinLoader::getImageFromTheme("radioout.png"); - radioChecked = SkinLoader::getImageFromTheme("radioin.png"); - radioDisabled = SkinLoader::getImageFromTheme("radioout.png"); - radioDisabledChecked = SkinLoader::getImageFromTheme("radioin.png"); - radioNormalHi = SkinLoader::getImageFromTheme("radioout_highlight.png"); - radioCheckedHi = SkinLoader::getImageFromTheme("radioin_highlight.png"); + radioNormal = Theme::getImageFromTheme("radioout.png"); + radioChecked = Theme::getImageFromTheme("radioin.png"); + radioDisabled = Theme::getImageFromTheme("radioout.png"); + radioDisabledChecked = Theme::getImageFromTheme("radioin.png"); + radioNormalHi = Theme::getImageFromTheme("radioout_highlight.png"); + radioCheckedHi = Theme::getImageFromTheme("radioin_highlight.png"); radioNormal->setAlpha(mAlpha); radioChecked->setAlpha(mAlpha); radioDisabled->setAlpha(mAlpha); diff --git a/src/gui/widgets/resizegrip.cpp b/src/gui/widgets/resizegrip.cpp index d0b9b845..f0c3691c 100644 --- a/src/gui/widgets/resizegrip.cpp +++ b/src/gui/widgets/resizegrip.cpp @@ -24,7 +24,7 @@ #include "configuration.h" #include "graphics.h" -#include "gui/skin.h" +#include "gui/theme.h" #include "resources/image.h" @@ -39,7 +39,7 @@ ResizeGrip::ResizeGrip(const std::string &image) if (mInstances == 0) { // Load the grip image - gripImage = SkinLoader::getImageFromTheme(image); + gripImage = Theme::getImageFromTheme(image); gripImage->setAlpha(mAlpha); } diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index dea99e8e..0c7f4d7d 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -24,7 +24,7 @@ #include "configuration.h" #include "graphics.h" -#include "gui/skin.h" +#include "gui/theme.h" #include "resources/image.h" @@ -95,7 +95,7 @@ void ScrollArea::init() if (instances == 0) { // Load the background skin - Image *textbox = SkinLoader::getImageFromTheme("deepbox.png"); + Image *textbox = Theme::getImageFromTheme("deepbox.png"); const int bggridx[4] = {0, 3, 28, 31}; const int bggridy[4] = {0, 3, 28, 31}; int a = 0, x, y; @@ -116,8 +116,8 @@ void ScrollArea::init() textbox->decRef(); // Load vertical scrollbar skin - Image *vscroll = SkinLoader::getImageFromTheme("vscroll_grey.png"); - Image *vscrollHi = SkinLoader::getImageFromTheme("vscroll_highlight.png"); + Image *vscroll = Theme::getImageFromTheme("vscroll_grey.png"); + Image *vscrollHi = Theme::getImageFromTheme("vscroll_highlight.png"); int vsgridx[4] = {0, 4, 7, 11}; int vsgridy[4] = {0, 4, 15, 19}; @@ -145,21 +145,21 @@ void ScrollArea::init() vscrollHi->decRef(); buttons[UP][0] = - SkinLoader::getImageFromTheme("vscroll_up_default.png"); + Theme::getImageFromTheme("vscroll_up_default.png"); buttons[DOWN][0] = - SkinLoader::getImageFromTheme("vscroll_down_default.png"); + Theme::getImageFromTheme("vscroll_down_default.png"); buttons[LEFT][0] = - SkinLoader::getImageFromTheme("hscroll_left_default.png"); + Theme::getImageFromTheme("hscroll_left_default.png"); buttons[RIGHT][0] = - SkinLoader::getImageFromTheme("hscroll_right_default.png"); + Theme::getImageFromTheme("hscroll_right_default.png"); buttons[UP][1] = - SkinLoader::getImageFromTheme("vscroll_up_pressed.png"); + Theme::getImageFromTheme("vscroll_up_pressed.png"); buttons[DOWN][1] = - SkinLoader::getImageFromTheme("vscroll_down_pressed.png"); + Theme::getImageFromTheme("vscroll_down_pressed.png"); buttons[LEFT][1] = - SkinLoader::getImageFromTheme("hscroll_left_pressed.png"); + Theme::getImageFromTheme("hscroll_left_pressed.png"); buttons[RIGHT][1] = - SkinLoader::getImageFromTheme("hscroll_right_pressed.png"); + Theme::getImageFromTheme("hscroll_right_pressed.png"); } instances++; @@ -214,7 +214,7 @@ void ScrollArea::logic() void ScrollArea::updateAlpha() { float alpha = std::max(config.getValue("guialpha", 0.8), - (double)SkinLoader::instance()->getMinimumOpacity()); + (double) Theme::instance()->getMinimumOpacity()); if (alpha != mAlpha) { diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index af36518a..6a9a5c7c 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -24,7 +24,7 @@ #include "configuration.h" #include "graphics.h" -#include "gui/skin.h" +#include "gui/theme.h" #include "resources/image.h" @@ -82,8 +82,8 @@ void Slider::init() // Load resources if (mInstances == 0) { - Image *slider = SkinLoader::getImageFromTheme("slider.png"); - Image *sliderHi = SkinLoader::getImageFromTheme("slider_hilight.png"); + Image *slider = Theme::getImageFromTheme("slider.png"); + Image *sliderHi = Theme::getImageFromTheme("slider_hilight.png"); x = 0; y = 0; w = 15; h = 6; @@ -127,7 +127,7 @@ void Slider::init() void Slider::updateAlpha() { float alpha = std::max(config.getValue("guialpha", 0.8), - (double)SkinLoader::instance()->getMinimumOpacity()); + (double) Theme::instance()->getMinimumOpacity()); if (alpha != mAlpha) { diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp index 17145eae..d770dbfe 100644 --- a/src/gui/widgets/tab.cpp +++ b/src/gui/widgets/tab.cpp @@ -25,7 +25,7 @@ #include "graphics.h" #include "gui/palette.h" -#include "gui/skin.h" +#include "gui/theme.h" #include "gui/widgets/tabbedarea.h" @@ -96,7 +96,7 @@ void Tab::init() for (mode = 0; mode < TAB_COUNT; mode++) { - tab[mode] = SkinLoader::getImageFromTheme(data[mode].file); + tab[mode] = Theme::getImageFromTheme(data[mode].file); a = 0; for (y = 0; y < 3; y++) { @@ -119,7 +119,7 @@ void Tab::init() void Tab::updateAlpha() { float alpha = std::max(config.getValue("guialpha", 0.8), - (double)SkinLoader::instance()->getMinimumOpacity()); + (double) Theme::instance()->getMinimumOpacity()); // TODO We don't need to do this for every tab on every draw // Maybe use a config listener to do it as the value changes. diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index e599c37d..1fab4eb7 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -26,7 +26,7 @@ #include "gui/palette.h" #include "gui/sdlinput.h" -#include "gui/skin.h" +#include "gui/theme.h" #include "resources/image.h" @@ -52,7 +52,7 @@ TextField::TextField(const std::string &text, bool loseFocusOnTab): if (instances == 0) { // Load the skin - Image *textbox = SkinLoader::getImageFromTheme("deepbox.png"); + Image *textbox = Theme::getImageFromTheme("deepbox.png"); int gridx[4] = {0, 3, 28, 31}; int gridy[4] = {0, 3, 28, 31}; int a = 0, x, y; @@ -87,7 +87,7 @@ TextField::~TextField() void TextField::updateAlpha() { float alpha = std::max(config.getValue("guialpha", 0.8), - (double)SkinLoader::instance()->getMinimumOpacity()); + (double) Theme::instance()->getMinimumOpacity()); if (alpha != mAlpha) { diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 83c918cf..b3d6bd02 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -26,7 +26,7 @@ #include "gui/gui.h" #include "gui/palette.h" -#include "gui/skin.h" +#include "gui/theme.h" #include "gui/viewport.h" #include "gui/widgets/layout.h" @@ -73,7 +73,7 @@ Window::Window(const std::string &caption, bool modal, Window *parent, setTitleBarHeight(20); // Loads the skin - mSkin = SkinLoader::instance()->load(skin, mDefaultSkinPath); + mSkin = Theme::instance()->load(skin, mDefaultSkinPath); // Add this window to the window container windowContainer->add(this); @@ -531,7 +531,7 @@ void Window::loadWindowState() if (skinName.compare(mSkin->getFilePath()) != 0) { mSkin->instances--; - mSkin = SkinLoader::instance()->load(skinName, mDefaultSkinPath); + mSkin = Theme::instance()->load(skinName, mDefaultSkinPath); } if (mGrip) @@ -709,7 +709,7 @@ int Window::getResizeHandles(gcn::MouseEvent &event) int Window::getGuiAlpha() { float alpha = std::max(config.getValue("guialpha", 0.8), - (double)SkinLoader::instance()->getMinimumOpacity()); + (double) Theme::instance()->getMinimumOpacity()); return (int) (alpha * 255.0f); } diff --git a/src/item.cpp b/src/item.cpp index 378c7efe..79ccd2c3 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -21,7 +21,7 @@ #include "item.h" -#include "gui/skin.h" +#include "gui/theme.h" #include "resources/image.h" #include "resources/iteminfo.h" @@ -62,8 +62,8 @@ void Item::setId(int id) mDrawImage = resman->getImage(imagePath); if (!mImage) - mImage = SkinLoader::getImageFromTheme("unknown-item.png"); + mImage = Theme::getImageFromTheme("unknown-item.png"); if (!mDrawImage) - mDrawImage = SkinLoader::getImageFromTheme("unknown-item.png"); + mDrawImage = Theme::getImageFromTheme("unknown-item.png"); } diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 8c918a97..a48c7f4c 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -43,9 +43,9 @@ #include "gui/ministatus.h" #include "gui/palette.h" #include "gui/skilldialog.h" -#include "gui/skin.h" #include "gui/statuswindow.h" #include "gui/storagewindow.h" +#include "gui/theme.h" #include "gui/widgets/chattab.h" @@ -1061,8 +1061,8 @@ void LocalPlayer::loadTargetCursor(const std::string &filename, assert(size > -1); assert(size < 3); - ImageSet *currentImageSet = SkinLoader::getImageSetFromTheme(filename, - width, height); + ImageSet *currentImageSet = Theme::getImageSetFromTheme(filename, + width, height); Animation *anim = new Animation; for (unsigned int i = 0; i < currentImageSet->size(); ++i) diff --git a/src/text.cpp b/src/text.cpp index ce09146f..f6c71dba 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -28,7 +28,7 @@ #include "gui/gui.h" #include "gui/palette.h" -#include "gui/skin.h" +#include "gui/theme.h" #include "resources/resourcemanager.h" #include "resources/image.h" @@ -50,7 +50,7 @@ Text::Text(const std::string &text, int x, int y, if (textManager == 0) { textManager = new TextManager; - Image *sbImage = SkinLoader::getImageFromTheme("bubble.png|W:#" + Image *sbImage = Theme::getImageFromTheme("bubble.png|W:#" + config.getValue("speechBubblecolor", "000000")); mBubble.grid[0] = sbImage->getSubImage(0, 0, 5, 5); mBubble.grid[1] = sbImage->getSubImage(5, 0, 5, 5); |