diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-03-04 19:23:03 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-03-04 19:23:03 +0300 |
commit | 9706e377c799d4b2c0a9f88c8ba6768bf2ea858c (patch) | |
tree | 37bc6dc1cfdac6d392409bc520ac6288a7810989 | |
parent | 367c92d1ac584eb7ad5812f717aea27456f44e5f (diff) | |
download | plus-9706e377c799d4b2c0a9f88c8ba6768bf2ea858c.tar.gz plus-9706e377c799d4b2c0a9f88c8ba6768bf2ea858c.tar.bz2 plus-9706e377c799d4b2c0a9f88c8ba6768bf2ea858c.tar.xz plus-9706e377c799d4b2c0a9f88c8ba6768bf2ea858c.zip |
Remove isVisible getter from widget.
-rw-r--r-- | src/being/being.cpp | 2 | ||||
-rw-r--r-- | src/gui/popups/popupmenu.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/basiccontainer.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/tabbedarea.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/widget.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/widget.h | 13 | ||||
-rw-r--r-- | src/gui/windowmenu.cpp | 6 | ||||
-rw-r--r-- | src/gui/windows/chatwindow.cpp | 31 | ||||
-rw-r--r-- | src/gui/windows/ministatuswindow.cpp | 6 |
9 files changed, 37 insertions, 35 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index bfd9083a0..0d894c6ff 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -2116,7 +2116,7 @@ void Being::drawSpeech(const int offsetX, // Draw speech above this being if (mSpeechTime == 0) { - if (mSpeechBubble && mSpeechBubble->isVisibleLocal()) + if (mSpeechBubble && mSpeechBubble->mVisible == Visible_true) mSpeechBubble->setVisible(Visible_false); mSpeech.clear(); } diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 98c8d26cd..264b2a6cb 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -1953,7 +1953,7 @@ void PopupMenu::showPopup(const int x, const int y, Button *const button) if (!btn || btn->getActionEventId() == "SET") continue; - if (btn->isVisibleLocal()) + if (btn->mVisible == Visible_true) { mBrowserBox->addRow(strprintf("@@hide button_%s|%s %s (%s)@@", // TRANSLATORS: popup menu item @@ -1999,7 +1999,7 @@ void PopupMenu::showPopup(const int x, const int y, const ProgressBar *const b) if (!bar) continue; - if (bar->isVisibleLocal()) + if (bar->mVisible == Visible_true) { cnt ++; onlyBar = bar; @@ -2015,7 +2015,7 @@ void PopupMenu::showPopup(const int x, const int y, const ProgressBar *const b) if (!bar || bar == onlyBar) continue; - if (bar->isVisibleLocal()) + if (bar->mVisible == Visible_true) { mBrowserBox->addRow(strprintf("@@hide bar_%s|%s %s@@", // TRANSLATORS: popup menu item diff --git a/src/gui/widgets/basiccontainer.cpp b/src/gui/widgets/basiccontainer.cpp index 26434d7e9..8a4d3162a 100644 --- a/src/gui/widgets/basiccontainer.cpp +++ b/src/gui/widgets/basiccontainer.cpp @@ -305,7 +305,7 @@ void BasicContainer::drawChildren(Graphics *const restrict graphics) restrict2 FOR_EACH (WidgetListConstIterator, iter, mWidgets) { Widget *restrict const widget = *iter; - if (widget->isVisibleLocal()) + if (widget->mVisible == Visible_true) { // If the widget has a frame, // draw it before drawing the widget @@ -346,7 +346,7 @@ void BasicContainer::safeDrawChildren(Graphics *const restrict graphics) FOR_EACH (WidgetListConstIterator, iter, mWidgets) { Widget *restrict const widget = *iter; - if (widget->isVisibleLocal()) + if (widget->mVisible == Visible_true) { // If the widget has a frame, // draw it before drawing the widget diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index 2d1acc5fc..2a1f59bbf 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -580,7 +580,7 @@ void TabbedArea::adjustTabPositions() maxTabHeight = tab->getHeight(); } - int x = (mEnableScrollButtons && mArrowButton[0]->isVisibleLocal()) + int x = (mEnableScrollButtons && mArrowButton[0]->mVisible == Visible_true) ? mArrowButton[0]->getWidth() : 0; for (size_t i = mTabScrollIndex; i < sz; ++i) { diff --git a/src/gui/widgets/widget.cpp b/src/gui/widgets/widget.cpp index 1ddd2c120..f2f112c61 100644 --- a/src/gui/widgets/widget.cpp +++ b/src/gui/widgets/widget.cpp @@ -81,6 +81,7 @@ std::set<Widget*> Widget::mWidgetsSet; Widget::Widget(const Widget2 *const widget) : Widget2(widget), + mVisible(Visible_true), mMouseListeners(), mKeyListeners(), mActionListeners(), @@ -99,7 +100,6 @@ Widget::Widget(const Widget2 *const widget) : mCurrentFont(nullptr), mFrameSize(0), mFocusable(false), - mVisible(Visible_true), mTabIn(true), mTabOut(true), mEnabled(true), diff --git a/src/gui/widgets/widget.h b/src/gui/widgets/widget.h index b94f81251..ed11955e5 100644 --- a/src/gui/widgets/widget.h +++ b/src/gui/widgets/widget.h @@ -401,9 +401,6 @@ class Widget notfinal : public Widget2 { return mVisible == Visible_true && (!mParent || mParent->isVisible()); } - bool isVisibleLocal() const noexcept A_WARN_UNUSED - { return mVisible == Visible_true; } - /** * Sets the base color of the widget. * @@ -1032,6 +1029,11 @@ class Widget notfinal : public Widget2 virtual void postInit() { } + /** + * True if the widget visible, false otherwise. + */ + Visible mVisible; + protected: /** * Distributes an action event to all action listeners @@ -1221,11 +1223,6 @@ class Widget notfinal : public Widget2 bool mFocusable; /** - * True if the widget visible, false otherwise. - */ - Visible mVisible; - - /** * True if the widget has tab in enabled, false otherwise. */ bool mTabIn; diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index 7360b4a5e..da313a729 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -218,7 +218,7 @@ WindowMenu::~WindowMenu() Button *const btn = *it; if (!btn) continue; - if (!btn->isVisibleLocal()) + if (btn->mVisible == Visible_false) delete btn; } delete_all(mButtonTexts); @@ -361,7 +361,7 @@ void WindowMenu::updateButtons() Button *const btn = *it; if (!btn) continue; - if (btn->isVisibleLocal()) + if (btn->mVisible == Visible_true) { btn->setPosition(x, mPadding); add(btn); @@ -429,7 +429,7 @@ void WindowMenu::saveButtons() const FOR_EACH (std::vector <Button*>::const_iterator, it, mButtons) { const Button *const btn = *it; - if (btn && !btn->isVisibleLocal()) + if (btn && btn->mVisible == Visible_false) { config.setValue("windowmenu" + toString(i), btn->getActionEventId()); diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index b4b73ff23..d7d5f690a 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -253,7 +253,7 @@ void ChatWindow::loadGMCommands() void ChatWindow::updateTabsMargin() { - if (mColorPicker->isVisibleLocal()) + if (mColorPicker->mVisible == Visible_true) mChatTabs->setRightMargin(mColorPicker->getWidth() + 16 + 8); else mChatTabs->setRightMargin(8); @@ -274,10 +274,15 @@ void ChatWindow::adjustTabSize() mChatInput->setPosition(frame, y); mChatTabs->setWidth(awFrame2); const int height = ah - frame2 - (inputHeight + frame2); - if (mChatInput->isVisibleLocal() || !config.getBoolValue("hideChatInput")) + if (mChatInput->mVisible == Visible_true || + !config.getBoolValue("hideChatInput")) + { mChatTabs->setHeight(height); + } else + { mChatTabs->setHeight(height + inputHeight); + } updateTabsMargin(); if (showEmotes) @@ -288,8 +293,7 @@ void ChatWindow::adjustTabSize() w -= mEmoteButtonSpacing; y += mEmoteButtonY; mChatInput->setWidth(w); - mChatButton->setVisible(fromBool(mChatInput->isVisibleLocal(), - Visible)); + mChatButton->setVisible(mChatInput->mVisible); mChatButton->setPosition(x, y); } else @@ -458,7 +462,7 @@ void ChatWindow::action(const ActionEvent &event) { if (emoteWindow) { - if (emoteWindow->isVisibleLocal()) + if (emoteWindow->mVisible == Visible_true) emoteWindow->hide(); else emoteWindow->show(); @@ -497,11 +501,12 @@ void ChatWindow::action(const ActionEvent &event) } } - if (mColorPicker && mColorPicker->isVisibleLocal() - != config.getBoolValue("showChatColorsList")) + if (mColorPicker) { - mColorPicker->setVisible(fromBool(config.getBoolValue( - "showChatColorsList"), Visible)); + const Visible vis = fromBool(config.getBoolValue( + "showChatColorsList"), Visible); + if (mColorPicker->mVisible != vis) + mColorPicker->setVisible(vis); } } @@ -817,12 +822,12 @@ void ChatWindow::keyPressed(KeyEvent &event) return; } else if (actionId == InputAction::GUI_CANCEL && - mChatInput->isVisibleLocal()) + mChatInput->mVisible == Visible_true) { mChatInput->processVisible(Visible_false); } else if (actionId == InputAction::CHAT_PREV_HISTORY && - mChatInput->isVisibleLocal()) + mChatInput->mVisible == Visible_true) { const ChatTab *const tab = getFocused(); if (tab && tab->hasRows()) @@ -854,7 +859,7 @@ void ChatWindow::keyPressed(KeyEvent &event) } } else if (actionId == InputAction::CHAT_NEXT_HISTORY && - mChatInput->isVisibleLocal()) + mChatInput->mVisible == Visible_true) { const ChatTab *const tab = getFocused(); if (tab && tab->hasRows()) @@ -893,7 +898,7 @@ void ChatWindow::keyPressed(KeyEvent &event) { if (emoteWindow) { - if (emoteWindow->isVisibleLocal()) + if (emoteWindow->mVisible == Visible_true) emoteWindow->hide(); else emoteWindow->show(); diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index 267401707..6dd427a98 100644 --- a/src/gui/windows/ministatuswindow.cpp +++ b/src/gui/windows/ministatuswindow.cpp @@ -168,7 +168,7 @@ MiniStatusWindow::~MiniStatusWindow() ProgressBar *bar = *it; if (!bar) continue; - if (!bar->isVisibleLocal()) + if (bar->mVisible == Visible_false) delete bar; } mBars.clear(); @@ -207,7 +207,7 @@ void MiniStatusWindow::updateBars() ProgressBar *const bar = *it; if (!bar) continue; - if (bar->isVisibleLocal()) + if (bar->mVisible == Visible_true) { bar->setPosition(x, 0); add(bar); @@ -525,7 +525,7 @@ void MiniStatusWindow::saveBars() const FOR_EACH (ProgressBarVectorCIter, it, mBars) { const ProgressBar *const bar = *it; - if (!bar->isVisibleLocal()) + if (bar->mVisible == Visible_false) { config.setValue("ministatus" + toString(i), bar->getActionEventId()); |