diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/button.cpp | 34 | ||||
-rw-r--r-- | src/gui/button.h | 1 | ||||
-rw-r--r-- | src/gui/checkbox.cpp | 27 | ||||
-rw-r--r-- | src/gui/checkbox.h | 1 | ||||
-rw-r--r-- | src/gui/emoteshortcutcontainer.cpp | 13 | ||||
-rw-r--r-- | src/gui/itemshortcutcontainer.cpp | 8 | ||||
-rw-r--r-- | src/gui/minimap.cpp | 2 | ||||
-rw-r--r-- | src/gui/playerbox.cpp | 9 | ||||
-rw-r--r-- | src/gui/playerbox.h | 1 | ||||
-rw-r--r-- | src/gui/progressbar.cpp | 17 | ||||
-rw-r--r-- | src/gui/progressbar.h | 1 | ||||
-rw-r--r-- | src/gui/scrollarea.cpp | 11 | ||||
-rw-r--r-- | src/gui/scrollarea.h | 1 | ||||
-rw-r--r-- | src/gui/shortcutcontainer.cpp | 4 | ||||
-rw-r--r-- | src/gui/shortcutcontainer.h | 2 | ||||
-rw-r--r-- | src/gui/slider.cpp | 16 | ||||
-rw-r--r-- | src/gui/slider.h | 1 | ||||
-rw-r--r-- | src/gui/textfield.cpp | 13 | ||||
-rw-r--r-- | src/gui/textfield.h | 1 | ||||
-rw-r--r-- | src/gui/widgets/resizegrip.cpp | 9 | ||||
-rw-r--r-- | src/gui/widgets/resizegrip.h | 1 | ||||
-rw-r--r-- | src/gui/widgets/tab.cpp | 13 | ||||
-rw-r--r-- | src/gui/widgets/tab.h | 1 | ||||
-rw-r--r-- | src/gui/window.cpp | 1 |
24 files changed, 160 insertions, 28 deletions
diff --git a/src/gui/button.cpp b/src/gui/button.cpp index 9b624015..d578202e 100644 --- a/src/gui/button.cpp +++ b/src/gui/button.cpp @@ -21,6 +21,7 @@ #include "button.h" +#include "../configuration.h" #include "../graphics.h" #include "../resources/image.h" @@ -35,6 +36,7 @@ #include <algorithm> int Button::mInstances = 0; +float Button::mAlpha = config.getValue("guialpha", 0.8); enum{ BUTTON_STANDARD, // 0 @@ -100,6 +102,7 @@ void Button::init() data[x].gridX, data[y].gridY, data[x + 1].gridX - data[x].gridX + 1, data[y + 1].gridY - data[y].gridY + 1); + button[mode].grid[a]->setAlpha(mAlpha); a++; } } @@ -126,17 +129,25 @@ void Button::draw(gcn::Graphics *graphics) { int mode; - if (!isEnabled()) { + if (!isEnabled()) mode = BUTTON_DISABLED; - } - else if (isPressed() || mIsLogged) { + else if (isPressed() || mIsLogged) mode = BUTTON_PRESSED; - } - else if (mHasMouse || isFocused()) { + else if (mHasMouse || isFocused()) mode = BUTTON_HIGHLIGHTED; - } - else { + else mode = BUTTON_STANDARD; + + if (config.getValue("guialpha", 0.8) != mAlpha) + { + mAlpha = config.getValue("guialpha", 0.8); + for (int a = 0; a < 9; a++) + { + button[BUTTON_DISABLED].grid[a]->setAlpha(mAlpha); + button[BUTTON_PRESSED].grid[a]->setAlpha(mAlpha); + button[BUTTON_HIGHLIGHTED].grid[a]->setAlpha(mAlpha); + button[BUTTON_STANDARD].grid[a]->setAlpha(mAlpha); + } } static_cast<Graphics*>(graphics)-> @@ -147,7 +158,8 @@ void Button::draw(gcn::Graphics *graphics) int textX; int textY = getHeight() / 2 - getFont()->getHeight() / 2; - switch (getAlignment()) { + switch (getAlignment()) + { case gcn::Graphics::LEFT: textX = 4; break; @@ -163,10 +175,8 @@ void Button::draw(gcn::Graphics *graphics) graphics->setFont(getFont()); - if (isPressed()) { + if (isPressed()) graphics->drawText(getCaption(), textX + 1, textY + 1, getAlignment()); - } - else { + else graphics->drawText(getCaption(), textX, textY, getAlignment()); - } } diff --git a/src/gui/button.h b/src/gui/button.h index d8ed9fa7..1faf2455 100644 --- a/src/gui/button.h +++ b/src/gui/button.h @@ -71,6 +71,7 @@ class Button : public gcn::Button static ImageRect button[4]; /**< Button state graphics */ static int mInstances; /**< Number of button instances */ + static float mAlpha; bool mIsLogged; /**< Makes the button appear pressed all the time */ }; diff --git a/src/gui/checkbox.cpp b/src/gui/checkbox.cpp index b8fca2b8..7fa4fa81 100644 --- a/src/gui/checkbox.cpp +++ b/src/gui/checkbox.cpp @@ -21,12 +21,14 @@ #include "checkbox.h" +#include "../configuration.h" #include "../graphics.h" #include "../resources/image.h" #include "../resources/resourcemanager.h" int CheckBox::instances = 0; +float CheckBox::mAlpha = config.getValue("guialpha", 0.8); Image *CheckBox::checkBoxNormal; Image *CheckBox::checkBoxChecked; Image *CheckBox::checkBoxDisabled; @@ -43,6 +45,10 @@ CheckBox::CheckBox(const std::string& caption, bool selected): checkBoxChecked = checkBox->getSubImage(9, 0, 9, 10); checkBoxDisabled = checkBox->getSubImage(18, 0, 9, 10); checkBoxDisabledChecked = checkBox->getSubImage(27, 0, 9, 10); + checkBoxNormal->setAlpha(mAlpha); + checkBoxChecked->setAlpha(mAlpha); + checkBoxDisabled->setAlpha(mAlpha); + checkBoxDisabledChecked->setAlpha(mAlpha); checkBox->decRef(); } @@ -66,16 +72,25 @@ void CheckBox::drawBox(gcn::Graphics* graphics) { Image *box; - if (isSelected()) { - if (isEnabled()) { + if (isSelected()) + { + if (isEnabled()) box = checkBoxChecked; - } else { + else box = checkBoxDisabledChecked; - } - } else if (isEnabled()) { + } + else if (isEnabled()) box = checkBoxNormal; - } else { + else box = checkBoxDisabled; + + if (config.getValue("guialpha", 0.8) != mAlpha) + { + mAlpha = config.getValue("guialpha", 0.8); + checkBoxNormal->setAlpha(mAlpha); + checkBoxChecked->setAlpha(mAlpha); + checkBoxDisabled->setAlpha(mAlpha); + checkBoxDisabledChecked->setAlpha(mAlpha); } static_cast<Graphics*>(graphics)->drawImage(box, 2, 2); diff --git a/src/gui/checkbox.h b/src/gui/checkbox.h index d92fc822..2e52fd0a 100644 --- a/src/gui/checkbox.h +++ b/src/gui/checkbox.h @@ -54,6 +54,7 @@ class CheckBox : public gcn::CheckBox { private: static int instances; + static float mAlpha; static Image *checkBoxNormal; static Image *checkBoxChecked; static Image *checkBoxDisabled; diff --git a/src/gui/emoteshortcutcontainer.cpp b/src/gui/emoteshortcutcontainer.cpp index f5ee9843..e35d037f 100644 --- a/src/gui/emoteshortcutcontainer.cpp +++ b/src/gui/emoteshortcutcontainer.cpp @@ -22,6 +22,7 @@ #include "emoteshortcutcontainer.h" #include "../animatedsprite.h" +#include "../configuration.h" #include "../emoteshortcut.h" #include "../graphics.h" #include "../inventory.h" @@ -42,11 +43,10 @@ static const int MAX_ITEMS = 12; EmoteShortcutContainer::EmoteShortcutContainer(): + ShortcutContainer(), mEmoteClicked(false), mEmoteMoved(0) { - mGridWidth = 1, - mGridHeight = 1, addMouseListener(this); addWidgetListener(this); @@ -54,6 +54,8 @@ EmoteShortcutContainer::EmoteShortcutContainer(): mBackgroundImg = resman->getImage("graphics/gui/item_shortcut_bgr.png"); + mBackgroundImg->setAlpha(config.getValue("guialpha", 0.8)); + // Setup emote sprites for (int i = 0; i <= EmoteDB::getLast(); i++) { @@ -96,6 +98,7 @@ void EmoteShortcutContainer::draw(gcn::Graphics *graphics) } } + if (mEmoteMoved) { // Draw the emote image being dragged by the cursor. @@ -108,6 +111,12 @@ void EmoteShortcutContainer::draw(gcn::Graphics *graphics) sprite->draw(g, tPosX, tPosY); } } + + if (config.getValue("guialpha", 0.8) != mAlpha) + { + mAlpha = config.getValue("guialpha", 0.8); + mBackgroundImg->setAlpha(mAlpha); + } } void EmoteShortcutContainer::mouseDragged(gcn::MouseEvent &event) diff --git a/src/gui/itemshortcutcontainer.cpp b/src/gui/itemshortcutcontainer.cpp index 83d8c9fb..ecadd0e4 100644 --- a/src/gui/itemshortcutcontainer.cpp +++ b/src/gui/itemshortcutcontainer.cpp @@ -39,11 +39,10 @@ #include "../utils/tostring.h" ItemShortcutContainer::ItemShortcutContainer(): + ShortcutContainer(), mItemClicked(false), mItemMoved(NULL) { - mGridWidth=1; - mGridHeight=1; addMouseListener(this); addWidgetListener(this); @@ -136,6 +135,11 @@ void ItemShortcutContainer::draw(gcn::Graphics *graphics) gcn::Graphics::CENTER); } } + + if (config.getValue("guialpha", 0.8) != mAlpha) + { + mBackgroundImg->setAlpha(config.getValue("guialpha", 0.8)); + } } void ItemShortcutContainer::mouseDragged(gcn::MouseEvent &event) diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 0b156fc4..37505305 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -79,8 +79,6 @@ void Minimap::setMapImage(Image *img) mMapImage->getWidth() + offsetX : titleWidth); setMaxHeight(mMapImage->getHeight() + offsetY); - mMapImage->setAlpha(config.getValue("guialpha", 0.8)); - // Make sure the window is within the minimum and maximum boundaries // TODO: Shouldn't this be happening automatically within the Window // class? diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp index c22d407c..20ed17f8 100644 --- a/src/gui/playerbox.cpp +++ b/src/gui/playerbox.cpp @@ -34,6 +34,7 @@ #include "../utils/dtor.h" int PlayerBox::instances = 0; +float PlayerBox::mAlpha = config.getValue("guialpha", 0.8); ImageRect PlayerBox::background; PlayerBox::PlayerBox(const Player *player): @@ -94,6 +95,14 @@ void PlayerBox::draw(gcn::Graphics *graphics) } } } + + if (config.getValue("guialpha", 0.8) != mAlpha) + { + for (int a = 0; a < 9; a++) + { + background.grid[a]->setAlpha(config.getValue("guialpha", 0.8)); + } + } } void PlayerBox::drawFrame(gcn::Graphics *graphics) diff --git a/src/gui/playerbox.h b/src/gui/playerbox.h index 5aacd26f..70c41644 100644 --- a/src/gui/playerbox.h +++ b/src/gui/playerbox.h @@ -68,6 +68,7 @@ class PlayerBox : public gcn::ScrollArea private: const Player *mPlayer; /**< The character used for display */ + static float mAlpha; static int instances; static ImageRect background; }; diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp index ecc0017d..d9db0c3c 100644 --- a/src/gui/progressbar.cpp +++ b/src/gui/progressbar.cpp @@ -22,6 +22,7 @@ #include "gui.h" #include "progressbar.h" +#include "../configuration.h" #include "../graphics.h" #include "../resources/image.h" @@ -31,6 +32,7 @@ ImageRect ProgressBar::mBorder; int ProgressBar::mInstances = 0; +float ProgressBar::mAlpha = config.getValue("guialpha", 0.8); ProgressBar::ProgressBar(float progress, unsigned int width, unsigned int height, @@ -56,6 +58,12 @@ ProgressBar::ProgressBar(float progress, mBorder.grid[6] = dBorders->getSubImage(0, 15, 4, 4); mBorder.grid[7] = dBorders->getSubImage(4, 15, 3, 4); mBorder.grid[8] = dBorders->getSubImage(7, 15, 4, 4); + + for (int i = 0; i < 9; i++) + { + mBorder.grid[i]->setAlpha(mAlpha); + } + dBorders->decRef(); } @@ -93,6 +101,15 @@ void ProgressBar::logic() void ProgressBar::draw(gcn::Graphics *graphics) { + if (config.getValue("guialpha", 0.8) != mAlpha) + { + mAlpha = config.getValue("guialpha", 0.8); + for (int i = 0; i < 9; i++) + { + mBorder.grid[i]->setAlpha(mAlpha); + } + } + static_cast<Graphics*>(graphics)-> drawImageRect(0, 0, getWidth(), getHeight(), mBorder); diff --git a/src/gui/progressbar.h b/src/gui/progressbar.h index ee0a5f81..dd9cc896 100644 --- a/src/gui/progressbar.h +++ b/src/gui/progressbar.h @@ -111,6 +111,7 @@ class ProgressBar : public gcn::Widget static ImageRect mBorder; static int mInstances; + static float mAlpha; }; #endif diff --git a/src/gui/scrollarea.cpp b/src/gui/scrollarea.cpp index 1d7f8472..a892f2d0 100644 --- a/src/gui/scrollarea.cpp +++ b/src/gui/scrollarea.cpp @@ -32,6 +32,7 @@ #include "../utils/dtor.h" int ScrollArea::instances = 0; +float ScrollArea::mAlpha = config.getValue("guialpha", 0.8); ImageRect ScrollArea::background; ImageRect ScrollArea::vMarker; Image *ScrollArea::buttons[4][2]; @@ -193,6 +194,16 @@ void ScrollArea::draw(gcn::Graphics *graphics) mScrollbarWidth)); } + if (config.getValue("guialpha", 0.8) != mAlpha) + { + mAlpha = config.getValue("guialpha", 0.8); + for (int a = 0; a < 9; a++) + { + background.grid[a]->setAlpha(mAlpha); + vMarker.grid[a]->setAlpha(mAlpha); + } + } + drawChildren(graphics); } diff --git a/src/gui/scrollarea.h b/src/gui/scrollarea.h index 4fababfa..4324deff 100644 --- a/src/gui/scrollarea.h +++ b/src/gui/scrollarea.h @@ -102,6 +102,7 @@ class ScrollArea : public gcn::ScrollArea void drawHMarker(gcn::Graphics *graphics); static int instances; + static float mAlpha; static ImageRect background; static ImageRect vMarker; static Image *buttons[4][2]; diff --git a/src/gui/shortcutcontainer.cpp b/src/gui/shortcutcontainer.cpp index d03bc809..62b2d382 100644 --- a/src/gui/shortcutcontainer.cpp +++ b/src/gui/shortcutcontainer.cpp @@ -21,6 +21,7 @@ #include "shortcutcontainer.h" +#include "../configuration.h" #include "../graphics.h" #include "../inventory.h" #include "../item.h" @@ -33,13 +34,14 @@ #include "../utils/tostring.h" +float ShortcutContainer::mAlpha = config.getValue("guialpha", 0.8); + ShortcutContainer::ShortcutContainer(): mGridWidth(1), mGridHeight(1) { } - void ShortcutContainer::widgetResized(const gcn::Event &event) { mGridWidth = getWidth() / mBoxWidth; diff --git a/src/gui/shortcutcontainer.h b/src/gui/shortcutcontainer.h index 66aca6c3..b2d0cc78 100644 --- a/src/gui/shortcutcontainer.h +++ b/src/gui/shortcutcontainer.h @@ -97,6 +97,8 @@ class ShortcutContainer : public gcn::Widget, Image *mBackgroundImg; + static float mAlpha; + int mMaxItems; int mBoxWidth; int mBoxHeight; diff --git a/src/gui/slider.cpp b/src/gui/slider.cpp index 37136012..9bfa840f 100644 --- a/src/gui/slider.cpp +++ b/src/gui/slider.cpp @@ -21,6 +21,7 @@ #include "slider.h" +#include "../configuration.h" #include "../graphics.h" #include "../resources/image.h" @@ -28,6 +29,7 @@ Image *Slider::hStart, *Slider::hMid, *Slider::hEnd, *Slider::hGrip; Image *Slider::vStart, *Slider::vMid, *Slider::vEnd, *Slider::vGrip; +float Slider::mAlpha = config.getValue("guialpha", 0.8); int Slider::mInstances = 0; Slider::Slider(double scaleEnd): @@ -107,6 +109,20 @@ void Slider::draw(gcn::Graphics *graphics) int x = 0; int y = (h - hStart->getHeight()) / 2; + if (config.getValue("guialpha", 0.8) != mAlpha) + { + mAlpha = config.getValue("guialpha", 0.8); + hStart->setAlpha(mAlpha); + hMid->setAlpha(mAlpha); + hEnd->setAlpha(mAlpha); + hGrip->setAlpha(mAlpha); + + vStart->setAlpha(mAlpha); + vMid->setAlpha(mAlpha); + vEnd->setAlpha(mAlpha); + vGrip->setAlpha(mAlpha); + } + static_cast<Graphics*>(graphics)->drawImage(hStart, x, y); w -= hStart->getWidth() + hEnd->getWidth(); diff --git a/src/gui/slider.h b/src/gui/slider.h index c14c5be9..12004f55 100644 --- a/src/gui/slider.h +++ b/src/gui/slider.h @@ -68,6 +68,7 @@ class Slider : public gcn::Slider { static Image *hStart, *hMid, *hEnd, *hGrip; static Image *vStart, *vMid, *vEnd, *vGrip; + static float mAlpha; static int mInstances; }; diff --git a/src/gui/textfield.cpp b/src/gui/textfield.cpp index 3ecf5c82..7e5004cc 100644 --- a/src/gui/textfield.cpp +++ b/src/gui/textfield.cpp @@ -39,6 +39,7 @@ #undef DELETE //Win32 compatibility hack int TextField::instances = 0; +float TextField::mAlpha = config.getValue("guialpha", 0.8); ImageRect TextField::skin; TextField::TextField(const std::string& text): @@ -55,9 +56,6 @@ TextField::TextField(const std::string& text): Image *textbox = resman->getImage("graphics/gui/deepbox.png"); int gridx[4] = {0, 3, 28, 31}; int gridy[4] = {0, 3, 28, 31}; - //Image *textbox = resman->getImage("graphics/gui/textbox.png"); - //int gridx[4] = {0, 5, 26, 31}; - //int gridy[4] = {0, 5, 26, 31}; int a = 0, x, y; for (y = 0; y < 3; y++) { @@ -98,6 +96,15 @@ void TextField::draw(gcn::Graphics *graphics) graphics->setColor(getForegroundColor()); graphics->setFont(getFont()); graphics->drawText(mText, 1 - mXScroll, 1); + + if (config.getValue("guialpha", 0.8) != mAlpha) + { + mAlpha = config.getValue("guialpha", 0.8); + for (int a = 0; a < 9; a++) + { + skin.grid[a]->setAlpha(mAlpha); + } + } } void TextField::drawFrame(gcn::Graphics *graphics) diff --git a/src/gui/textfield.h b/src/gui/textfield.h index a2432175..11a58824 100644 --- a/src/gui/textfield.h +++ b/src/gui/textfield.h @@ -99,6 +99,7 @@ class TextField : public gcn::TextField { private: static int instances; + static float mAlpha; static ImageRect skin; bool mNumeric; int mMinimum; diff --git a/src/gui/widgets/resizegrip.cpp b/src/gui/widgets/resizegrip.cpp index 4b8bb4da..fa264e37 100644 --- a/src/gui/widgets/resizegrip.cpp +++ b/src/gui/widgets/resizegrip.cpp @@ -23,6 +23,7 @@ #include "resizegrip.h" +#include "../../configuration.h" #include "../../graphics.h" #include "../../resources/image.h" @@ -30,6 +31,7 @@ Image *ResizeGrip::gripImage = 0; int ResizeGrip::mInstances = 0; +float ResizeGrip::mAlpha = config.getValue("guialpha", 0.8); ResizeGrip::ResizeGrip(std::string image) { @@ -38,6 +40,7 @@ ResizeGrip::ResizeGrip(std::string image) // Load the grip image ResourceManager *resman = ResourceManager::getInstance(); gripImage = resman->getImage(image); + gripImage->setAlpha(mAlpha); } mInstances++; @@ -58,5 +61,11 @@ ResizeGrip::~ResizeGrip() void ResizeGrip::draw(gcn::Graphics *graphics) { + if (config.getValue("guialpha", 0.8) != mAlpha) + { + mAlpha = config.getValue("guialpha", 0.8); + gripImage->setAlpha(mAlpha); + } + static_cast<Graphics*>(graphics)->drawImage(gripImage, 0, 0); } diff --git a/src/gui/widgets/resizegrip.h b/src/gui/widgets/resizegrip.h index 7f1329a2..198954f6 100644 --- a/src/gui/widgets/resizegrip.h +++ b/src/gui/widgets/resizegrip.h @@ -56,6 +56,7 @@ class ResizeGrip : public gcn::Widget private: static Image *gripImage; /**< Resize grip image */ static int mInstances; /**< Number of resize grip instances */ + static float mAlpha; }; #endif diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp index c54b2390..6f7f497a 100644 --- a/src/gui/widgets/tab.cpp +++ b/src/gui/widgets/tab.cpp @@ -25,6 +25,7 @@ #include "tabbedarea.h" +#include "../../configuration.h" #include "../../graphics.h" #include "../../resources/image.h" @@ -33,6 +34,7 @@ #include "../../utils/dtor.h" int Tab::mInstances = 0; +float Tab::mAlpha = config.getValue("guialpha", 0.8); enum{ TAB_STANDARD, // 0 @@ -98,6 +100,7 @@ void Tab::init() data[x].gridX, data[y].gridY, data[x + 1].gridX - data[x].gridX + 1, data[y + 1].gridY - data[y].gridY + 1); + tabImg[mode].grid[a]->setAlpha(mAlpha); a++; } } @@ -121,6 +124,16 @@ void Tab::draw(gcn::Graphics *graphics) mode = TAB_STANDARD; } + if (config.getValue("guialpha", 0.8) != mAlpha) + { + mAlpha = config.getValue("guialpha", 0.8); + for (int a = 0; a < 9; a++) + { + tabImg[TAB_SELECTED].grid[a]->setAlpha(mAlpha); + tabImg[TAB_STANDARD].grid[a]->setAlpha(mAlpha); + } + } + // draw tab static_cast<Graphics*>(graphics)-> drawImageRect(0, 0, getWidth(), getHeight(), tabImg[mode]); diff --git a/src/gui/widgets/tab.h b/src/gui/widgets/tab.h index 8382df83..23987cac 100644 --- a/src/gui/widgets/tab.h +++ b/src/gui/widgets/tab.h @@ -53,6 +53,7 @@ class Tab : public gcn::Tab static ImageRect tabImg[4]; /**< Tab state graphics */ static int mInstances; /**< Number of tab instances */ + static float mAlpha; }; #endif diff --git a/src/gui/window.cpp b/src/gui/window.cpp index 66f38aa8..35d47082 100644 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -199,6 +199,7 @@ void Window::draw(gcn::Graphics *graphics) for_each(border.grid, border.grid + 9, std::bind2nd(std::mem_fun(&Image::setAlpha), config.getValue("guialpha", 0.8))); + closeImage->setAlpha(config.getValue("guialpha", 0.8)); } drawChildren(graphics); } |