diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-08-30 16:06:19 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-08-30 16:59:12 +0300 |
commit | 60d90692e487948b77edcac63acbef34254cea5b (patch) | |
tree | c2ca72f720f835099bc65c2832d5c7df3d92abbd /src/gui/widgets | |
parent | 38fe5f43b5ac41e41debed4868e81b4b4bf839ac (diff) | |
download | plus-60d90692e487948b77edcac63acbef34254cea5b.tar.gz plus-60d90692e487948b77edcac63acbef34254cea5b.tar.bz2 plus-60d90692e487948b77edcac63acbef34254cea5b.tar.xz plus-60d90692e487948b77edcac63acbef34254cea5b.zip |
remove duplicate variables.
Diffstat (limited to 'src/gui/widgets')
27 files changed, 35 insertions, 42 deletions
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index fd4af6620..c1910ae88 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -67,7 +67,6 @@ BrowserBox::BrowserBox(const Widget2 *const widget, const unsigned int mode, mUpdateTime(-1), mPadding(0), mNewLinePadding(15), - mBackgroundColor(getThemeColor(Theme::BACKGROUND)), mHighlightColor(getThemeColor(Theme::HIGHLIGHT)), mHyperLinkColor(getThemeColor(Theme::HYPERLINK)), mOpaque(opaque), @@ -82,6 +81,8 @@ BrowserBox::BrowserBox(const Widget2 *const widget, const unsigned int mode, setFocusable(true); addMouseListener(this); + mBackgroundColor = getThemeColor(Theme::BACKGROUND); + if (mInstances == 0) { if (Theme::instance()) @@ -435,7 +436,7 @@ void BrowserBox::mouseMoved(gcn::MouseEvent &event) void BrowserBox::draw(gcn::Graphics *graphics) { BLOCK_START("BrowserBox::draw") - const gcn::ClipRectangle cr = graphics->getCurrentClipArea(); + const gcn::ClipRectangle &cr = graphics->getCurrentClipArea(); Graphics *const graphics2 = static_cast<Graphics *const>(graphics); mYStart = cr.y - cr.yOffset; const int yEnd = mYStart + cr.height; diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h index 3a6c7972b..bcc487177 100644 --- a/src/gui/widgets/browserbox.h +++ b/src/gui/widgets/browserbox.h @@ -265,7 +265,6 @@ class BrowserBox final : public gcn::Widget, int mPadding; int mNewLinePadding; - gcn::Color mBackgroundColor; gcn::Color mHighlightColor; gcn::Color mHyperLinkColor; gcn::Color mColors[2][COLORS_MAX]; diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp index f1ab408fe..d0c10ecb6 100644 --- a/src/gui/widgets/checkbox.cpp +++ b/src/gui/widgets/checkbox.cpp @@ -44,13 +44,13 @@ CheckBox::CheckBox(const Widget2 *const widget, const std::string &eventId) : gcn::CheckBox(caption, selected), Widget2(widget), - mForegroundColor2(getThemeColor(Theme::CHECKBOX_OUTLINE)), mPadding(0), mImagePadding(0), mImageSize(9), mSpacing(2), mHasMouse(false) { + mForegroundColor2 = getThemeColor(Theme::CHECKBOX_OUTLINE); if (instances == 0) { if (Theme::instance()) diff --git a/src/gui/widgets/checkbox.h b/src/gui/widgets/checkbox.h index 53e767787..211230250 100644 --- a/src/gui/widgets/checkbox.h +++ b/src/gui/widgets/checkbox.h @@ -86,7 +86,6 @@ class CheckBox final : public gcn::CheckBox, void adjustSize(); private: - gcn::Color mForegroundColor2; int mPadding; int mImagePadding; int mImageSize; diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 0b67958df..9845c295c 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -76,7 +76,6 @@ DropDown::DropDown(const Widget2 *const widget, mPadding(1), mImagePadding(2), mSpacing(0), - mForegroundColor2(getThemeColor(Theme::DROPDOWN_OUTLINE)), mFoldedUpHeight(0), mSelectionListeners(), mExtended(extended), @@ -85,6 +84,7 @@ DropDown::DropDown(const Widget2 *const widget, mIsDragged(false) { mFrameSize = 2; + mForegroundColor2 = getThemeColor(Theme::DROPDOWN_OUTLINE); mPopup->setHeight(100); @@ -455,6 +455,8 @@ void DropDown::dropDown() { if (!mDroppedDown) { + if (!mParent) + return; mDroppedDown = true; mFoldedUpHeight = getHeight(); adjustHeight(); @@ -462,7 +464,7 @@ void DropDown::dropDown() int x = 0; int y = 0; getAbsolutePosition(x, y); - const int frame = getParent()->getFrameSize(); + const int frame = mParent->getFrameSize(); const int pad = mPopup->getPadding(); const int pad2 = pad * 2; diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index 58b01b288..01e1ec78c 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -152,7 +152,6 @@ class DropDown final : public gcn::ActionListener, int mPadding; int mImagePadding; int mSpacing; - gcn::Color mForegroundColor2; int mFoldedUpHeight; typedef std::list<SelectionListener*> SelectionListenerList; diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index 1353e6317..977b55a4f 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -49,13 +49,13 @@ EmoteShortcutContainer::EmoteShortcutContainer(): ShortcutContainer(), mEmoteImg(), mEmotePopup(new TextPopup), - mForegroundColor2(getThemeColor(Theme::TEXT_OUTLINE)), mEmoteClicked(false), mEmoteMoved(0) { addMouseListener(this); addWidgetListener(this); + mForegroundColor2 = getThemeColor(Theme::TEXT_OUTLINE); mBackgroundImg = Theme::getImageFromThemeXml( "item_shortcut_background.xml", "background.xml"); diff --git a/src/gui/widgets/emoteshortcutcontainer.h b/src/gui/widgets/emoteshortcutcontainer.h index 6929f3318..49ddf90e1 100644 --- a/src/gui/widgets/emoteshortcutcontainer.h +++ b/src/gui/widgets/emoteshortcutcontainer.h @@ -84,7 +84,6 @@ class EmoteShortcutContainer final : public ShortcutContainer std::vector<const EmoteSprite*> mEmoteImg; TextPopup *mEmotePopup; - gcn::Color mForegroundColor2; bool mEmoteClicked; unsigned char mEmoteMoved; }; diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp index 473899b29..638f310bd 100644 --- a/src/gui/widgets/guitable.cpp +++ b/src/gui/widgets/guitable.cpp @@ -100,7 +100,6 @@ GuiTable::GuiTable(const Widget2 *const widget, mModel(nullptr), mTopWidget(nullptr), mActionListeners(), - mBackgroundColor(getThemeColor(Theme::BACKGROUND)), mHighlightColor(getThemeColor(Theme::HIGHLIGHT)), mSelectedRow(0), mSelectedColumn(0), @@ -108,6 +107,8 @@ GuiTable::GuiTable(const Widget2 *const widget, mWrappingEnabled(false), mOpaque(opacity) { + mBackgroundColor = getThemeColor(Theme::BACKGROUND); + setModel(initial_model); setFocusable(true); diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h index 0bd880c45..24360062f 100644 --- a/src/gui/widgets/guitable.h +++ b/src/gui/widgets/guitable.h @@ -183,7 +183,6 @@ private: /** * Holds the background color of the table. */ - gcn::Color mBackgroundColor; gcn::Color mHighlightColor; int mSelectedRow; diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index 3d36caafe..c42074d6b 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -57,12 +57,12 @@ ItemShortcutContainer::ItemShortcutContainer(const unsigned number) : mEquipedColor(getThemeColor(Theme::ITEM_EQUIPPED)), mEquipedColor2(getThemeColor(Theme::ITEM_EQUIPPED_OUTLINE)), mUnEquipedColor(getThemeColor(Theme::ITEM_NOT_EQUIPPED)), - mUnEquipedColor2(getThemeColor(Theme::ITEM_NOT_EQUIPPED_OUTLINE)), - mForegroundColor2(getThemeColor(Theme::TEXT_OUTLINE)) + mUnEquipedColor2(getThemeColor(Theme::ITEM_NOT_EQUIPPED_OUTLINE)) { addMouseListener(this); addWidgetListener(this); + mForegroundColor2 = getThemeColor(Theme::TEXT_OUTLINE); mBackgroundImg = Theme::getImageFromThemeXml( "item_shortcut_background.xml", "background.xml"); if (itemShortcut[mNumber]) diff --git a/src/gui/widgets/itemshortcutcontainer.h b/src/gui/widgets/itemshortcutcontainer.h index 5f08cdd56..e5e9911a4 100644 --- a/src/gui/widgets/itemshortcutcontainer.h +++ b/src/gui/widgets/itemshortcutcontainer.h @@ -90,7 +90,6 @@ class ItemShortcutContainer final : public ShortcutContainer gcn::Color mEquipedColor2; gcn::Color mUnEquipedColor; gcn::Color mUnEquipedColor2; - gcn::Color mForegroundColor2; }; #endif // GUI_WIDGETS_ITEMSHORTCUTCONTAINER_H diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp index e283d5db0..a5ffc2f8b 100644 --- a/src/gui/widgets/listbox.cpp +++ b/src/gui/widgets/listbox.cpp @@ -45,7 +45,6 @@ ListBox::ListBox(const Widget2 *const widget, gcn::ListBox(listModel), Widget2(widget), mHighlightColor(getThemeColor(Theme::HIGHLIGHT)), - mForegroundColor2(getThemeColor(Theme::LISTBOX_OUTLINE)), mForegroundSelectedColor(getThemeColor(Theme::LISTBOX_SELECTED)), mForegroundSelectedColor2(getThemeColor(Theme::LISTBOX_SELECTED_OUTLINE)), mOldSelected(-1), @@ -55,6 +54,7 @@ ListBox::ListBox(const Widget2 *const widget, mCenterText(false) { mForegroundColor = getThemeColor(Theme::LISTBOX); + mForegroundColor2 = getThemeColor(Theme::LISTBOX_OUTLINE); Theme *const theme = Theme::instance(); if (theme) diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h index dd22ca431..ef662e3ac 100644 --- a/src/gui/widgets/listbox.h +++ b/src/gui/widgets/listbox.h @@ -96,7 +96,6 @@ class ListBox : public gcn::ListBox, protected: gcn::Color mHighlightColor; - gcn::Color mForegroundColor2; gcn::Color mForegroundSelectedColor; gcn::Color mForegroundSelectedColor2; int mOldSelected; diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp index c8d833a64..ff4a8f6f4 100644 --- a/src/gui/widgets/radiobutton.cpp +++ b/src/gui/widgets/radiobutton.cpp @@ -46,10 +46,10 @@ RadioButton::RadioButton(const Widget2 *const widget, mImagePadding(0), mImageSize(9), mSpacing(2), - mForegroundColor2(getThemeColor(Theme::RADIOBUTTON_OUTLINE)), mHasMouse(false) { mForegroundColor = getThemeColor(Theme::RADIOBUTTON); + mForegroundColor2 = getThemeColor(Theme::RADIOBUTTON_OUTLINE); if (instances == 0) { Theme *const theme = Theme::instance(); diff --git a/src/gui/widgets/radiobutton.h b/src/gui/widgets/radiobutton.h index fad8309ea..02015bb14 100644 --- a/src/gui/widgets/radiobutton.h +++ b/src/gui/widgets/radiobutton.h @@ -87,7 +87,6 @@ class RadioButton final : public gcn::RadioButton, int mImagePadding; int mImageSize; int mSpacing; - gcn::Color mForegroundColor2; bool mHasMouse; }; diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index c21ddd17c..ec03e5cea 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -62,9 +62,9 @@ ScrollArea::ScrollArea(const bool opaque, const std::string &skin) : mDrawWidth(0), mDrawHeight(0), mHasMouse(false), - mOpaque(opaque), mRedraw(true) { + mOpaque = opaque; addWidgetListener(this); init(skin); } @@ -84,9 +84,9 @@ ScrollArea::ScrollArea(gcn::Widget *const widget, const bool opaque, mDrawWidth(0), mDrawHeight(0), mHasMouse(false), - mOpaque(opaque), mRedraw(true) { + mOpaque = opaque; init(skin); } diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h index d488a7422..75e59e2d2 100644 --- a/src/gui/widgets/scrollarea.h +++ b/src/gui/widgets/scrollarea.h @@ -192,7 +192,6 @@ class ScrollArea final : public gcn::ScrollArea, int mDrawWidth; int mDrawHeight; bool mHasMouse; - bool mOpaque; bool mRedraw; }; diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 6cfff4727..b7e0ad120 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -50,12 +50,12 @@ ShopListBox::ShopListBox(const Widget2 *const widget, mShopItems(nullptr), mItemPopup(new ItemPopup), mRowHeight(getFont()->getHeight()), - mHighlightColor(getThemeColor(Theme::HIGHLIGHT)), mBackgroundColor(getThemeColor(Theme::BACKGROUND)), mWarningColor(getThemeColor(Theme::SHOP_WARNING)), mPriceCheck(true), mProtectItems(false) { + mHighlightColor = getThemeColor(Theme::HIGHLIGHT); mForegroundColor = getThemeColor(Theme::LISTBOX); } @@ -67,12 +67,12 @@ ShopListBox::ShopListBox(const Widget2 *const widget, mShopItems(shopListModel), mItemPopup(new ItemPopup), mRowHeight(std::max(getFont()->getHeight(), ITEM_ICON_SIZE)), - mHighlightColor(getThemeColor(Theme::HIGHLIGHT)), mBackgroundColor(getThemeColor(Theme::BACKGROUND)), mWarningColor(getThemeColor(Theme::SHOP_WARNING)), mPriceCheck(true), mProtectItems(false) { + mHighlightColor = getThemeColor(Theme::HIGHLIGHT); mForegroundColor = getThemeColor(Theme::LISTBOX); } diff --git a/src/gui/widgets/shoplistbox.h b/src/gui/widgets/shoplistbox.h index 8c0b6de45..b5fc7c896 100644 --- a/src/gui/widgets/shoplistbox.h +++ b/src/gui/widgets/shoplistbox.h @@ -100,7 +100,6 @@ class ShopListBox final : public ListBox unsigned int mRowHeight; /**< Row Height */ - gcn::Color mHighlightColor; gcn::Color mBackgroundColor; gcn::Color mWarningColor; diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index 31d0a716b..335be9866 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -49,12 +49,13 @@ SpellShortcutContainer::SpellShortcutContainer(const unsigned number) : ShortcutContainer(), mSpellPopup(new SpellPopup), mNumber(number), - mForegroundColor2(getThemeColor(Theme::TEXT_OUTLINE)), mSpellClicked(false) { addMouseListener(this); addWidgetListener(this); + mForegroundColor2 = getThemeColor(Theme::TEXT_OUTLINE); + mBackgroundImg = Theme::getImageFromThemeXml( "item_shortcut_background.xml", "background.xml"); if (spellShortcut) diff --git a/src/gui/widgets/spellshortcutcontainer.h b/src/gui/widgets/spellshortcutcontainer.h index 57f5b4a13..0a9eacf83 100644 --- a/src/gui/widgets/spellshortcutcontainer.h +++ b/src/gui/widgets/spellshortcutcontainer.h @@ -84,7 +84,6 @@ class SpellShortcutContainer final : public ShortcutContainer private: SpellPopup *mSpellPopup; unsigned int mNumber; - gcn::Color mForegroundColor2; bool mSpellClicked; }; diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index 660655033..d38c3c9c9 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -167,7 +167,7 @@ void TextBox::setTextWrapped(const std::string &text, const int minDimension) void TextBox::keyPressed(gcn::KeyEvent& keyEvent) { - const gcn::Key key = keyEvent.getKey(); + const gcn::Key &key = keyEvent.getKey(); const int action = static_cast<KeyEvent*>(&keyEvent)->getActionId(); switch (action) diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 37629e44e..bff4f67f2 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -57,7 +57,6 @@ TextField::TextField(const Widget2 *const widget, Widget2(widget), mSendAlwaysEvents(sendAlwaysEvents), mCaretColor(&getThemeColor(Theme::CARET)), - mForegroundColor2(getThemeColor(Theme::TEXTFIELD_OUTLINE)), mPopupMenu(nullptr), mMinimum(0), mMaximum(0), @@ -68,6 +67,7 @@ TextField::TextField(const Widget2 *const widget, { setFrameSize(2); mForegroundColor = getThemeColor(Theme::TEXTFIELD); + mForegroundColor2 = getThemeColor(Theme::TEXTFIELD_OUTLINE); addFocusListener(this); @@ -488,7 +488,7 @@ void TextField::handleCopy() const void TextField::drawCaret(gcn::Graphics* graphics, int x) { - const gcn::Rectangle clipArea = graphics->getCurrentClipArea(); + const gcn::Rectangle &clipArea = graphics->getCurrentClipArea(); graphics->setColor(*mCaretColor); graphics->drawLine(x + mPadding, clipArea.height - mPadding, diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h index 8990730ba..f16025c4b 100644 --- a/src/gui/widgets/textfield.h +++ b/src/gui/widgets/textfield.h @@ -141,7 +141,6 @@ class TextField : public gcn::TextField, private: const gcn::Color *mCaretColor; - gcn::Color mForegroundColor2; PopupMenu *mPopupMenu; static int instances; static float mAlpha; diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index fccf8bbcd..a0683fa45 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -44,7 +44,7 @@ const int resizeMask = 8 + 4 + 2 + 1; -int Window::instances = 0; +int Window::windowInstances = 0; int Window::mouseResize = 0; Window::Window(const std::string &caption, const bool modal, @@ -81,7 +81,7 @@ Window::Window(const std::string &caption, const bool modal, mCaptionFont(getFont()), mShowTitle(true), mModal(modal), - mCloseButton(false), + mCloseWindowButton(false), mDefaultVisible(false), mSaveVisible(false), mStickyButton(false), @@ -99,7 +99,7 @@ Window::Window(const std::string &caption, const bool modal, if (!windowContainer) throw GCN_EXCEPTION("Window::Window(): no windowContainer set"); - instances++; + windowInstances++; setFrameSize(0); setPadding(3); @@ -184,7 +184,7 @@ Window::~Window() delete mVertexes; mVertexes = nullptr; - instances--; + windowInstances--; if (mSkin) { @@ -231,7 +231,7 @@ void Window::draw(gcn::Graphics *graphics) mDimension.height, mSkin->getBorder()); // Draw Close Button - if (mCloseButton) + if (mCloseWindowButton) { const Image *const button = mSkin->getCloseImage( mResizeHandles == CLOSE); @@ -264,7 +264,7 @@ void Window::draw(gcn::Graphics *graphics) mDimension.height, mSkin->getBorder()); // Draw Close Button - if (mCloseButton) + if (mCloseWindowButton) { const Image *const button = mSkin->getCloseImage( mResizeHandles == CLOSE); @@ -494,7 +494,7 @@ void Window::widgetResized(const gcn::Event &event A_UNUSED) } if (mSkin) { - const bool showClose = mCloseButton && mSkin->getCloseImage(false); + const bool showClose = mCloseWindowButton && mSkin->getCloseImage(false); const int closePadding = getOption("closePadding"); if (showClose) { @@ -562,7 +562,7 @@ void Window::widgetHidden(const gcn::Event &event A_UNUSED) void Window::setCloseButton(const bool flag) { - mCloseButton = flag; + mCloseWindowButton = flag; } bool Window::isResizable() const @@ -654,7 +654,7 @@ void Window::mousePressed(gcn::MouseEvent &event) const int y = event.getY(); // Handle close button - if (mCloseButton && mSkin && mCloseRect.isPointInRect(x, y)) + if (mCloseWindowButton && mSkin && mCloseRect.isPointInRect(x, y)) { mouseResize = 0; mMoved = 0; diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index 139dbcb1d..f6c5d0765 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -482,7 +482,7 @@ class Window : public gcn::Window, int mMaxWinHeight; /**< Maximum window height */ static int mouseResize; /**< Active resize handles */ - static int instances; /**< Number of Window instances */ + static int windowInstances; /**< Number of Window instances */ /** @@ -502,7 +502,7 @@ class Window : public gcn::Window, gcn::Font *mCaptionFont; bool mShowTitle; /**< Window has a title bar */ bool mModal; /**< Window is modal */ - bool mCloseButton; /**< Window has a close button */ + bool mCloseWindowButton; /**< Window has a close button */ bool mDefaultVisible; /**< Window's default visibility */ bool mSaveVisible; /**< Window will save visibility */ bool mStickyButton; /**< Window has a sticky button */ |