From d3ac12d94f6ddb25866e10856ec47919a4b6d7a6 Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Thu, 29 Jan 2009 16:25:16 -0700 Subject: Fixed up minimap resizing code so that the minimum width is always long enough to contain the map's name. Also fixed an unnoticed logic flip that was done unintentionally. This class now manages to work perfectly when the config file has no previous dimensional influences, but still won't resize properly without removing the ability to resize or getting rid of those stored configs. TODO: Find out why loading window configuration for the default minimum width or height overrides the Minimap's supplied dimensions it wants. Signed-off-by: Ira Rice --- src/gui/minimap.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/gui/minimap.cpp') diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 7802b583..d68faa56 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -71,19 +71,25 @@ void Minimap::setMapImage(Image *img) setMinWidth(mapWidth > titleWidth ? mapWidth : titleWidth); setMinHeight(mapHeight); - setMaxWidth(mMapImage->getWidth() + offsetX); + setMaxWidth(mMapImage->getWidth() > titleWidth ? + mMapImage->getWidth() + offsetX : titleWidth); setMaxHeight(mMapImage->getHeight() + offsetY); mMapImage->setAlpha(config.getValue("guialpha", 0.8)); - // Set content size to be within the minimum and maximum boundaries - setWidth(getMinWidth() < getWidth() ? getWidth() : getMinWidth()); - if (getMaxWidth() > getWidth()) + // Make sure the window is within the minimum and maximum boundaries + // TODO: Shouldn't this be happening automatically within the Window + // class? + if (getMinWidth() > getWidth()) + setWidth(getMinWidth()); + else if (getMaxWidth() < getWidth()) setWidth(getMaxWidth()); - setHeight(getMinHeight() < getHeight() ? getHeight() : getMinHeight()); - if (getMaxHeight() > getHeight()) + if (getMinHeight() > getHeight()) + setHeight(getMinHeight()); + else if (getMaxHeight() < getHeight()) setHeight(getMaxHeight()); + setContentSize(getWidth() - offsetX, getHeight() - offsetY); setDefaultSize(getX(), getY(), getWidth(), getHeight()); resetToDefaultSize(); -- cgit v1.2.3-60-g2f50 From a49b60fc0f9edfba8ec457ce06cf75cc13d4c71b Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Fri, 30 Jan 2009 07:51:11 -0700 Subject: Fixed the last freestanding minimap bug. Now minimaps behave perfectly even when there's already a saved window configuration. Signed-off-by: Ira Rice --- src/gui/minimap.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/gui/minimap.cpp') diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index d68faa56..d1d3af46 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -44,6 +44,8 @@ Minimap::Minimap(): mShow = config.getValue(getWindowName() + "Visible", true); setDefaultSize(5, 25, 100, 100); setResizable(true); + + loadWindowState(); } Minimap::~Minimap() @@ -93,7 +95,6 @@ void Minimap::setMapImage(Image *img) setDefaultSize(getX(), getY(), getWidth(), getHeight()); resetToDefaultSize(); - loadWindowState(); setVisible(mShow); } else -- cgit v1.2.3-60-g2f50 From cc37b4a9153379d5c5529ba85305d36efba2cd85 Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Fri, 30 Jan 2009 09:17:03 -0700 Subject: Changed the minimap to remember whether the minimap was toggled or not when the client was last exited. Signed-off-by: Ira Rice --- src/gui/minimap.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/gui/minimap.cpp') diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index d1d3af46..0b156fc4 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -41,7 +41,7 @@ Minimap::Minimap(): mProportion(0.5) { setWindowName(_("MiniMap")); - mShow = config.getValue(getWindowName() + "Visible", true); + mShow = config.getValue(getWindowName() + "Show", true); setDefaultSize(5, 25, 100, 100); setResizable(true); @@ -52,6 +52,8 @@ Minimap::~Minimap() { if (mMapImage) mMapImage->decRef(); + + config.setValue(getWindowName() + "Show", mShow); } void Minimap::setMapImage(Image *img) @@ -106,7 +108,6 @@ void Minimap::setMapImage(Image *img) void Minimap::toggle() { mShow = !mShow; - config.setValue(getWindowName() + "Visible", mShow); } void Minimap::draw(gcn::Graphics *graphics) -- cgit v1.2.3-60-g2f50 From d57be9d49c55bc0b85eb8f539ff2029518cfafc0 Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Fri, 30 Jan 2009 10:56:54 -0700 Subject: Exposed most gui elements to take alpha values. There are still a few spots that could also be fixed up as well, but require other methods to fix them (the filled color rectangles on the progress bars, as well as the text on them as well, as an example). Signed-off-by: Ira Rice --- src/gui/button.cpp | 34 ++++++++++++++++++++++------------ src/gui/button.h | 1 + src/gui/checkbox.cpp | 27 +++++++++++++++++++++------ src/gui/checkbox.h | 1 + src/gui/emoteshortcutcontainer.cpp | 13 +++++++++++-- src/gui/itemshortcutcontainer.cpp | 8 ++++++-- src/gui/minimap.cpp | 2 -- src/gui/playerbox.cpp | 9 +++++++++ src/gui/playerbox.h | 1 + src/gui/progressbar.cpp | 17 +++++++++++++++++ src/gui/progressbar.h | 1 + src/gui/scrollarea.cpp | 11 +++++++++++ src/gui/scrollarea.h | 1 + src/gui/shortcutcontainer.cpp | 4 +++- src/gui/shortcutcontainer.h | 2 ++ src/gui/slider.cpp | 16 ++++++++++++++++ src/gui/slider.h | 1 + src/gui/textfield.cpp | 13 ++++++++++--- src/gui/textfield.h | 1 + src/gui/widgets/resizegrip.cpp | 9 +++++++++ src/gui/widgets/resizegrip.h | 1 + src/gui/widgets/tab.cpp | 13 +++++++++++++ src/gui/widgets/tab.h | 1 + src/gui/window.cpp | 1 + 24 files changed, 160 insertions(+), 28 deletions(-) (limited to 'src/gui/minimap.cpp') 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 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)-> @@ -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)->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)-> 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)->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)->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)-> 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); } -- cgit v1.2.3-60-g2f50