From d3994b21fda3e7d8ba417a382fc8f065a7bf1c52 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 23 Aug 2013 22:48:57 +0300 Subject: improve some mode methods in Client. --- src/gui/minimap.cpp | 2 +- src/gui/setup_video.cpp | 4 ++-- src/gui/theme.cpp | 2 +- src/gui/whoisonline.cpp | 2 +- src/gui/widgets/button.cpp | 2 +- src/gui/widgets/chattab.cpp | 6 +++--- src/gui/widgets/checkbox.cpp | 2 +- src/gui/widgets/dropdown.cpp | 2 +- src/gui/widgets/dropshortcutcontainer.cpp | 6 +++--- src/gui/widgets/emoteshortcutcontainer.cpp | 6 +++--- src/gui/widgets/guitable.cpp | 4 ++-- src/gui/widgets/itemshortcutcontainer.cpp | 6 +++--- src/gui/widgets/listbox.cpp | 2 +- src/gui/widgets/playerbox.cpp | 4 ++-- src/gui/widgets/progressbar.cpp | 2 +- src/gui/widgets/radiobutton.cpp | 2 +- src/gui/widgets/scrollarea.cpp | 2 +- src/gui/widgets/shoplistbox.cpp | 4 ++-- src/gui/widgets/slider.cpp | 2 +- src/gui/widgets/spellshortcutcontainer.cpp | 6 +++--- src/gui/widgets/tab.cpp | 2 +- src/gui/widgets/textfield.cpp | 6 +++--- src/gui/widgets/textpreview.cpp | 4 ++-- src/gui/widgets/window.cpp | 2 +- 24 files changed, 41 insertions(+), 41 deletions(-) (limited to 'src/gui') diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 4acf7944d..8b2ddef5e 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -153,7 +153,7 @@ void Minimap::setMap(const Map *const map) SDL_UnlockSurface(surface); mMapImage = imageHelper->load(surface); - mMapImage->setAlpha(Client::getGuiAlpha()); + mMapImage->setAlpha(client->getGuiAlpha()); mCustomMapImage = true; SDL_FreeSurface(surface); } diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 4d030238e..12ae9fe83 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -512,7 +512,7 @@ void Setup_Video::action(const gcn::ActionEvent &event) #if defined(WIN32) || defined(__APPLE__) || defined(ANDROID) if (!config.getIntValue("opengl")) { - Client::resize(width, height); + client->resizeVideo(width, height); } else { @@ -536,7 +536,7 @@ void Setup_Video::action(const gcn::ActionEvent &event) } } #else - Client::resize(width, height); + client->resizeVideo(width, height); #endif } diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index affec0b8c..97afec6d3 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -130,7 +130,7 @@ void Skin::updateAlpha(const float minimumOpacityAllowed) { const float alpha = static_cast( std::max(static_cast(minimumOpacityAllowed), - static_cast(Client::getGuiAlpha()))); + static_cast(client->getGuiAlpha()))); for (int i = 0; i < 9; i++) { diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp index 7036ac7d0..d454eb2f3 100644 --- a/src/gui/whoisonline.cpp +++ b/src/gui/whoisonline.cpp @@ -494,7 +494,7 @@ int WhoIsOnline::downloadThread(void *ptr) int attempts = 0; WhoIsOnline *const wio = reinterpret_cast(ptr); CURLcode res; - const std::string url(Client::getOnlineUrl() + "/online.txt"); + const std::string url(client->getOnlineUrl() + "/online.txt"); while (attempts < 1 && !wio->mDownloadComplete) { diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index ae6886e72..ed9ac0580 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -283,7 +283,7 @@ void Button::loadImage(const std::string &imageName) void Button::updateAlpha() { - const float alpha = std::max(Client::getGuiAlpha(), + const float alpha = std::max(client->getGuiAlpha(), Theme::instance()->getMinimumOpacity()); if (mAlpha != alpha) diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index 37e94ef1b..1cb2e9d82 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -308,8 +308,8 @@ void ChatTab::chatLog(std::string line, Own own, if ((getAllowHighlight() || own == BY_GM) && (this != tabArea->getSelectedTab() - || (Client::getIsMinimized() || (!Client::getMouseFocused() - && !Client::getInputFocused())))) + || (client->getIsMinimized() || (!client->getMouseFocused() + && !client->getInputFocused())))) { if (own == BY_GM) { @@ -323,7 +323,7 @@ void ChatTab::chatLog(std::string line, Own own, chatWindow->unHideWindow(); playNewMessageSound(); } - Client::newChatMessage(); + client->newChatMessage(); } } } diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp index b9abe45fa..f1ab408fe 100644 --- a/src/gui/widgets/checkbox.cpp +++ b/src/gui/widgets/checkbox.cpp @@ -109,7 +109,7 @@ void CheckBox::draw(gcn::Graphics* graphics) void CheckBox::updateAlpha() { - const float alpha = std::max(Client::getGuiAlpha(), + const float alpha = std::max(client->getGuiAlpha(), Theme::instance()->getMinimumOpacity()); if (mAlpha != alpha) diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index e8d4006a2..0b67958df 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -196,7 +196,7 @@ DropDown::~DropDown() void DropDown::updateAlpha() { - const float alpha = std::max(Client::getGuiAlpha(), + const float alpha = std::max(client->getGuiAlpha(), Theme::instance()->getMinimumOpacity()); if (mAlpha != alpha) diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp index e26183116..d0bf896eb 100644 --- a/src/gui/widgets/dropshortcutcontainer.cpp +++ b/src/gui/widgets/dropshortcutcontainer.cpp @@ -61,7 +61,7 @@ DropShortcutContainer::DropShortcutContainer(): if (mBackgroundImg) { - mBackgroundImg->setAlpha(Client::getGuiAlpha()); + mBackgroundImg->setAlpha(client->getGuiAlpha()); mBoxHeight = mBackgroundImg->getHeight(); mBoxWidth = mBackgroundImg->getWidth(); } @@ -98,9 +98,9 @@ void DropShortcutContainer::draw(gcn::Graphics *graphics) return; BLOCK_START("DropShortcutContainer::draw") - if (Client::getGuiAlpha() != mAlpha) + if (client->getGuiAlpha() != mAlpha) { - mAlpha = Client::getGuiAlpha(); + mAlpha = client->getGuiAlpha(); if (mBackgroundImg) mBackgroundImg->setAlpha(mAlpha); } diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index 10ef44f6a..1353e6317 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -60,7 +60,7 @@ EmoteShortcutContainer::EmoteShortcutContainer(): "item_shortcut_background.xml", "background.xml"); if (mBackgroundImg) - mBackgroundImg->setAlpha(Client::getGuiAlpha()); + mBackgroundImg->setAlpha(client->getGuiAlpha()); // Setup emote sprites for (int i = 0; i <= EmoteDB::getLast(); i++) @@ -109,8 +109,8 @@ void EmoteShortcutContainer::draw(gcn::Graphics *graphics) return; BLOCK_START("EmoteShortcutContainer::draw") - mAlpha = Client::getGuiAlpha(); - if (Client::getGuiAlpha() != mAlpha && mBackgroundImg) + mAlpha = client->getGuiAlpha(); + if (client->getGuiAlpha() != mAlpha && mBackgroundImg) mBackgroundImg->setAlpha(mAlpha); Graphics *const g = static_cast(graphics); diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp index e3dda4162..473899b29 100644 --- a/src/gui/widgets/guitable.cpp +++ b/src/gui/widgets/guitable.cpp @@ -299,8 +299,8 @@ void GuiTable::draw(gcn::Graphics* graphics) return; BLOCK_START("GuiTable::draw") - if (Client::getGuiAlpha() != mAlpha) - mAlpha = Client::getGuiAlpha(); + if (client->getGuiAlpha() != mAlpha) + mAlpha = client->getGuiAlpha(); const gcn::Rectangle &rect = mDimension; const int width = rect.width; diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index 517c783a0..3d36caafe 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -72,7 +72,7 @@ ItemShortcutContainer::ItemShortcutContainer(const unsigned number) : if (mBackgroundImg) { - mBackgroundImg->setAlpha(Client::getGuiAlpha()); + mBackgroundImg->setAlpha(client->getGuiAlpha()); mBoxHeight = mBackgroundImg->getHeight(); mBoxWidth = mBackgroundImg->getWidth(); } @@ -118,8 +118,8 @@ void ItemShortcutContainer::draw(gcn::Graphics *graphics) return; } - mAlpha = Client::getGuiAlpha(); - if (Client::getGuiAlpha() != mAlpha) + mAlpha = client->getGuiAlpha(); + if (client->getGuiAlpha() != mAlpha) { if (mBackgroundImg) mBackgroundImg->setAlpha(mAlpha); diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp index 51751c463..e283d5db0 100644 --- a/src/gui/widgets/listbox.cpp +++ b/src/gui/widgets/listbox.cpp @@ -77,7 +77,7 @@ ListBox::~ListBox() void ListBox::updateAlpha() { - const float alpha = std::max(Client::getGuiAlpha(), + const float alpha = std::max(client->getGuiAlpha(), Theme::instance()->getMinimumOpacity()); if (mAlpha != alpha) diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp index 20260b9ac..6a5c815d4 100644 --- a/src/gui/widgets/playerbox.cpp +++ b/src/gui/widgets/playerbox.cpp @@ -126,9 +126,9 @@ void PlayerBox::draw(gcn::Graphics *graphics) mBeing->drawSpriteAt(static_cast(graphics), x, y); } - if (Client::getGuiAlpha() != mAlpha) + if (client->getGuiAlpha() != mAlpha) { - const float alpha = Client::getGuiAlpha(); + const float alpha = client->getGuiAlpha(); for (int a = 0; a < 9; a++) { if (mBackground.grid[a]) diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index f76c9610e..33e27a0d9 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -129,7 +129,7 @@ void ProgressBar::logic() void ProgressBar::updateAlpha() { - const float alpha = std::max(Client::getGuiAlpha(), + const float alpha = std::max(client->getGuiAlpha(), Theme::instance()->getMinimumOpacity()); mAlpha = alpha; } diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp index 08561d56c..c8d833a64 100644 --- a/src/gui/widgets/radiobutton.cpp +++ b/src/gui/widgets/radiobutton.cpp @@ -90,7 +90,7 @@ RadioButton::~RadioButton() void RadioButton::updateAlpha() { - const float alpha = std::max(Client::getGuiAlpha(), + const float alpha = std::max(client->getGuiAlpha(), Theme::instance()->getMinimumOpacity()); if (mAlpha != alpha) diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 76d883216..98b58f51c 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -234,7 +234,7 @@ void ScrollArea::logic() void ScrollArea::updateAlpha() { - const float alpha = std::max(Client::getGuiAlpha(), + const float alpha = std::max(client->getGuiAlpha(), Theme::instance()->getMinimumOpacity()); if (alpha != mAlpha) diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index b0f58bd5f..6cfff4727 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -90,8 +90,8 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics) return; } - if (Client::getGuiAlpha() != mAlpha) - mAlpha = Client::getGuiAlpha(); + if (client->getGuiAlpha() != mAlpha) + mAlpha = client->getGuiAlpha(); const int alpha = static_cast(mAlpha * 255.0f); Graphics *graphics = static_cast(gcnGraphics); diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index e8ea8ea25..00b55f936 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -94,7 +94,7 @@ void Slider::init() void Slider::updateAlpha() { - const float alpha = std::max(Client::getGuiAlpha(), + const float alpha = std::max(client->getGuiAlpha(), Theme::instance()->getMinimumOpacity()); if (alpha != mAlpha) diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index afd4e14f4..31d0a716b 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -64,7 +64,7 @@ SpellShortcutContainer::SpellShortcutContainer(const unsigned number) : if (mBackgroundImg) { - mBackgroundImg->setAlpha(Client::getGuiAlpha()); + mBackgroundImg->setAlpha(client->getGuiAlpha()); mBoxHeight = mBackgroundImg->getHeight(); mBoxWidth = mBackgroundImg->getWidth(); } @@ -98,9 +98,9 @@ void SpellShortcutContainer::draw(gcn::Graphics *graphics) return; BLOCK_START("SpellShortcutContainer::draw") - if (Client::getGuiAlpha() != mAlpha) + if (client->getGuiAlpha() != mAlpha) { - mAlpha = Client::getGuiAlpha(); + mAlpha = client->getGuiAlpha(); if (mBackgroundImg) mBackgroundImg->setAlpha(mAlpha); } diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp index bce4ae11f..99a69897d 100644 --- a/src/gui/widgets/tab.cpp +++ b/src/gui/widgets/tab.cpp @@ -142,7 +142,7 @@ void Tab::init() void Tab::updateAlpha() { - const float alpha = std::max(Client::getGuiAlpha(), + const float alpha = std::max(client->getGuiAlpha(), Theme::instance()->getMinimumOpacity()); if (alpha != mAlpha) diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 0fec552e3..37629e44e 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -119,7 +119,7 @@ TextField::~TextField() void TextField::updateAlpha() { - const float alpha = std::max(Client::getGuiAlpha(), + const float alpha = std::max(client->getGuiAlpha(), Theme::instance()->getMinimumOpacity()); if (alpha != mAlpha) @@ -550,7 +550,7 @@ void TextField::fontChanged() void TextField::mousePressed(gcn::MouseEvent &mouseEvent) { #ifdef ANDROID - if (!Client::isKeyboardVisible()) + if (!client->isKeyboardVisible()) inputManager.executeAction(Input::KEY_SHOW_KEYBOARD); #endif if (mouseEvent.getButton() == gcn::MouseEvent::RIGHT) @@ -578,7 +578,7 @@ void TextField::mousePressed(gcn::MouseEvent &mouseEvent) void TextField::focusGained(const gcn::Event &event A_UNUSED) { #ifdef ANDROID - if (!Client::isKeyboardVisible()) + if (!client->isKeyboardVisible()) inputManager.executeAction(Input::KEY_SHOW_KEYBOARD); #endif } diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp index 11de5b553..e788f1f4c 100644 --- a/src/gui/widgets/textpreview.cpp +++ b/src/gui/widgets/textpreview.cpp @@ -83,8 +83,8 @@ TextPreview::~TextPreview() void TextPreview::draw(gcn::Graphics* graphics) { BLOCK_START("TextPreview::draw") - if (Client::getGuiAlpha() != mAlpha) - mAlpha = Client::getGuiAlpha(); + if (client->getGuiAlpha() != mAlpha) + mAlpha = client->getGuiAlpha(); Graphics *const g = static_cast(graphics); const int intAlpha = static_cast(mAlpha * 255.0f); diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index ad510d363..485f875fc 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -1086,7 +1086,7 @@ bool Window::isResizeAllowed(const gcn::MouseEvent &event) const int Window::getGuiAlpha() const { - const float alpha = std::max(Client::getGuiAlpha(), + const float alpha = std::max(client->getGuiAlpha(), Theme::instance()->getMinimumOpacity()); return static_cast(alpha * 255.0f); } -- cgit v1.2.3-70-g09d2