summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-30 12:46:49 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-30 12:46:49 +0300
commit9bb11133522836a9c5e251550ac88c9a4e091c0e (patch)
treef65703ac1a51b79a0766c48420769d28d0847f41 /src/gui/widgets
parente55ed9a138e97f6fba5e3b6858a755f8a50197d2 (diff)
downloadplus-9bb11133522836a9c5e251550ac88c9a4e091c0e.tar.gz
plus-9bb11133522836a9c5e251550ac88c9a4e091c0e.tar.bz2
plus-9bb11133522836a9c5e251550ac88c9a4e091c0e.tar.xz
plus-9bb11133522836a9c5e251550ac88c9a4e091c0e.zip
Move main window related code into windowmanager.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/button.cpp3
-rw-r--r--src/gui/widgets/checkbox.cpp3
-rw-r--r--src/gui/widgets/desktop.cpp2
-rw-r--r--src/gui/widgets/desktop.h2
-rw-r--r--src/gui/widgets/dropdown.cpp3
-rw-r--r--src/gui/widgets/dropshortcutcontainer.cpp7
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.cpp7
-rw-r--r--src/gui/widgets/guitable.cpp5
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp7
-rw-r--r--src/gui/widgets/listbox.cpp3
-rw-r--r--src/gui/widgets/playerbox.cpp5
-rw-r--r--src/gui/widgets/progressbar.cpp3
-rw-r--r--src/gui/widgets/radiobutton.cpp3
-rw-r--r--src/gui/widgets/scrollarea.cpp3
-rw-r--r--src/gui/widgets/shoplistbox.cpp5
-rw-r--r--src/gui/widgets/slider.cpp3
-rw-r--r--src/gui/widgets/spellshortcutcontainer.cpp7
-rw-r--r--src/gui/widgets/tabs/chattab.cpp9
-rw-r--r--src/gui/widgets/tabs/setup_video.cpp6
-rw-r--r--src/gui/widgets/tabs/setup_visual.cpp6
-rw-r--r--src/gui/widgets/tabs/tab.cpp3
-rw-r--r--src/gui/widgets/textfield.cpp3
-rw-r--r--src/gui/widgets/textpreview.cpp5
-rw-r--r--src/gui/widgets/window.cpp1
24 files changed, 67 insertions, 37 deletions
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index f9ea17516..e67f77056 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -67,6 +67,7 @@
#include "client.h"
#include "graphicsvertexes.h"
+#include "settings.h"
#include "events/keyevent.h"
@@ -414,7 +415,7 @@ void Button::loadImageSet(const std::string &imageName)
void Button::updateAlpha()
{
- const float alpha = std::max(client->getGuiAlpha(),
+ const float alpha = std::max(settings.guiAlpha,
theme->getMinimumOpacity());
if (mAlpha != alpha)
diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp
index 86ebefd60..508bfead4 100644
--- a/src/gui/widgets/checkbox.cpp
+++ b/src/gui/widgets/checkbox.cpp
@@ -66,6 +66,7 @@
#include "gui/widgets/checkbox.h"
#include "client.h"
+#include "settings.h"
#include "input/inputaction.h"
@@ -165,7 +166,7 @@ void CheckBox::draw(Graphics *const graphics)
void CheckBox::updateAlpha()
{
- const float alpha = std::max(client->getGuiAlpha(),
+ const float alpha = std::max(settings.guiAlpha,
theme->getMinimumOpacity());
if (mAlpha != alpha)
diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp
index bdda1a09f..c383bb8a2 100644
--- a/src/gui/widgets/desktop.cpp
+++ b/src/gui/widgets/desktop.cpp
@@ -39,6 +39,8 @@
#include "debug.h"
+Desktop *desktop = nullptr;
+
Desktop::Desktop(const Widget2 *const widget) :
Container(widget),
LinkHandler(),
diff --git a/src/gui/widgets/desktop.h b/src/gui/widgets/desktop.h
index b7b61d040..20bcb241f 100644
--- a/src/gui/widgets/desktop.h
+++ b/src/gui/widgets/desktop.h
@@ -82,4 +82,6 @@ class Desktop final : public Container,
bool mShowBackground;
};
+extern Desktop *desktop;
+
#endif // GUI_WIDGETS_DESKTOP_H
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index 86e79b504..ab6b0dab0 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -23,6 +23,7 @@
#include "gui/widgets/dropdown.h"
#include "client.h"
+#include "settings.h"
#include "events/keyevent.h"
@@ -191,7 +192,7 @@ DropDown::~DropDown()
void DropDown::updateAlpha()
{
- const float alpha = std::max(client->getGuiAlpha(),
+ const float alpha = std::max(settings.guiAlpha,
theme->getMinimumOpacity());
if (mAlpha != alpha)
diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp
index 6e4e0d90c..150c94f77 100644
--- a/src/gui/widgets/dropshortcutcontainer.cpp
+++ b/src/gui/widgets/dropshortcutcontainer.cpp
@@ -25,6 +25,7 @@
#include "client.h"
#include "dragdrop.h"
#include "dropshortcut.h"
+#include "settings.h"
#include "being/playerinfo.h"
@@ -65,7 +66,7 @@ DropShortcutContainer::DropShortcutContainer(Widget2 *const widget) :
if (mBackgroundImg)
{
- mBackgroundImg->setAlpha(client->getGuiAlpha());
+ mBackgroundImg->setAlpha(settings.guiAlpha);
mBoxHeight = mBackgroundImg->getHeight();
mBoxWidth = mBackgroundImg->getWidth();
}
@@ -101,9 +102,9 @@ void DropShortcutContainer::draw(Graphics *graphics)
return;
BLOCK_START("DropShortcutContainer::draw")
- if (client->getGuiAlpha() != mAlpha)
+ if (settings.guiAlpha != mAlpha)
{
- mAlpha = client->getGuiAlpha();
+ mAlpha = settings.guiAlpha;
if (mBackgroundImg)
mBackgroundImg->setAlpha(mAlpha);
}
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp
index 0f0fa2c1d..6c6c82b43 100644
--- a/src/gui/widgets/emoteshortcutcontainer.cpp
+++ b/src/gui/widgets/emoteshortcutcontainer.cpp
@@ -24,6 +24,7 @@
#include "animatedsprite.h"
#include "client.h"
#include "emoteshortcut.h"
+#include "settings.h"
#include "input/inputmanager.h"
@@ -59,7 +60,7 @@ EmoteShortcutContainer::EmoteShortcutContainer(Widget2 *const widget) :
"item_shortcut_background.xml", "background.xml");
if (mBackgroundImg)
- mBackgroundImg->setAlpha(client->getGuiAlpha());
+ mBackgroundImg->setAlpha(settings.guiAlpha);
// Setup emote sprites
for (int i = 0; i <= EmoteDB::getLast(); i++)
@@ -108,11 +109,11 @@ void EmoteShortcutContainer::draw(Graphics *graphics)
return;
BLOCK_START("EmoteShortcutContainer::draw")
- if (client->getGuiAlpha() != mAlpha)
+ if (settings.guiAlpha != mAlpha)
{
if (mBackgroundImg)
mBackgroundImg->setAlpha(mAlpha);
- mAlpha = client->getGuiAlpha();
+ mAlpha = settings.guiAlpha;
}
Font *const font = getFont();
diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp
index 5374e8a7c..c3725b46f 100644
--- a/src/gui/widgets/guitable.cpp
+++ b/src/gui/widgets/guitable.cpp
@@ -23,6 +23,7 @@
#include "gui/widgets/guitable.h"
#include "client.h"
+#include "settings.h"
#include "gui/gui.h"
@@ -247,8 +248,8 @@ void GuiTable::draw(Graphics* graphics)
return;
BLOCK_START("GuiTable::draw")
- if (client->getGuiAlpha() != mAlpha)
- mAlpha = client->getGuiAlpha();
+ if (settings.guiAlpha != mAlpha)
+ mAlpha = settings.guiAlpha;
const Rect &rect = mDimension;
const int width = rect.width;
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index 4cf0e76f7..e7e2455bb 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -27,6 +27,7 @@
#include "inventory.h"
#include "item.h"
#include "itemshortcut.h"
+#include "settings.h"
#include "spellshortcut.h"
#include "being/playerinfo.h"
@@ -80,7 +81,7 @@ ItemShortcutContainer::ItemShortcutContainer(Widget2 *const widget,
if (mBackgroundImg)
{
- mBackgroundImg->setAlpha(client->getGuiAlpha());
+ mBackgroundImg->setAlpha(settings.guiAlpha);
mBoxHeight = mBackgroundImg->getHeight();
mBoxWidth = mBackgroundImg->getWidth();
}
@@ -124,11 +125,11 @@ void ItemShortcutContainer::draw(Graphics *graphics)
return;
}
- if (client->getGuiAlpha() != mAlpha)
+ if (settings.guiAlpha != mAlpha)
{
if (mBackgroundImg)
mBackgroundImg->setAlpha(mAlpha);
- mAlpha = client->getGuiAlpha();
+ mAlpha = settings.guiAlpha;
}
Font *const font = getFont();
diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp
index 87a9f43cc..8953fc5e2 100644
--- a/src/gui/widgets/listbox.cpp
+++ b/src/gui/widgets/listbox.cpp
@@ -66,6 +66,7 @@
#include "gui/widgets/listbox.h"
#include "client.h"
+#include "settings.h"
#include "input/inputaction.h"
@@ -145,7 +146,7 @@ ListBox::~ListBox()
void ListBox::updateAlpha()
{
- const float alpha = std::max(client->getGuiAlpha(),
+ const float alpha = std::max(settings.guiAlpha,
theme->getMinimumOpacity());
if (mAlpha != alpha)
diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp
index b7b5c8134..b77b1bc42 100644
--- a/src/gui/widgets/playerbox.cpp
+++ b/src/gui/widgets/playerbox.cpp
@@ -23,6 +23,7 @@
#include "gui/widgets/playerbox.h"
#include "client.h"
+#include "settings.h"
#include "being/being.h"
@@ -126,9 +127,9 @@ void PlayerBox::draw(Graphics *graphics)
mBeing->drawSpriteAt(graphics, x, y);
}
- if (client->getGuiAlpha() != mAlpha)
+ if (settings.guiAlpha != mAlpha)
{
- const float alpha = client->getGuiAlpha();
+ const float alpha = settings.guiAlpha;
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 b9675af7f..68db6ee1d 100644
--- a/src/gui/widgets/progressbar.cpp
+++ b/src/gui/widgets/progressbar.cpp
@@ -24,6 +24,7 @@
#include "client.h"
#include "graphicsvertexes.h"
+#include "settings.h"
#include "gui/gui.h"
#include "gui/skin.h"
@@ -141,7 +142,7 @@ void ProgressBar::logic()
void ProgressBar::updateAlpha()
{
- const float alpha = std::max(client->getGuiAlpha(),
+ const float alpha = std::max(settings.guiAlpha,
theme->getMinimumOpacity());
mAlpha = alpha;
}
diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp
index 9074a8a0c..e0d031908 100644
--- a/src/gui/widgets/radiobutton.cpp
+++ b/src/gui/widgets/radiobutton.cpp
@@ -66,6 +66,7 @@
#include "gui/widgets/radiobutton.h"
#include "client.h"
+#include "settings.h"
#include "input/inputaction.h"
@@ -152,7 +153,7 @@ RadioButton::~RadioButton()
void RadioButton::updateAlpha()
{
- const float alpha = std::max(client->getGuiAlpha(),
+ const float alpha = std::max(settings.guiAlpha,
theme->getMinimumOpacity());
if (mAlpha != alpha)
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index ca29c09fa..d439765af 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -67,6 +67,7 @@
#include "client.h"
#include "graphicsvertexes.h"
+#include "settings.h"
#include "gui/gui.h"
#include "gui/skin.h"
@@ -288,7 +289,7 @@ void ScrollArea::logic()
void ScrollArea::updateAlpha()
{
- const float alpha = std::max(client->getGuiAlpha(),
+ const float alpha = std::max(settings.guiAlpha,
theme->getMinimumOpacity());
if (alpha != mAlpha)
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp
index c259d187f..cd250d274 100644
--- a/src/gui/widgets/shoplistbox.cpp
+++ b/src/gui/widgets/shoplistbox.cpp
@@ -23,6 +23,7 @@
#include "gui/widgets/shoplistbox.h"
#include "client.h"
+#include "settings.h"
#include "shopitem.h"
#include "being/playerinfo.h"
@@ -92,8 +93,8 @@ void ShopListBox::draw(Graphics *graphics)
return;
}
- if (client->getGuiAlpha() != mAlpha)
- mAlpha = client->getGuiAlpha();
+ if (settings.guiAlpha != mAlpha)
+ mAlpha = settings.guiAlpha;
const int alpha = static_cast<int>(mAlpha * 255.0F);
Font *const font = getFont();
diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp
index c660648d8..444480ae1 100644
--- a/src/gui/widgets/slider.cpp
+++ b/src/gui/widgets/slider.cpp
@@ -67,6 +67,7 @@
#include "client.h"
#include "graphicsvertexes.h"
+#include "settings.h"
#include "events/keyevent.h"
@@ -172,7 +173,7 @@ void Slider::init()
void Slider::updateAlpha()
{
- const float alpha = std::max(client->getGuiAlpha(),
+ const float alpha = std::max(settings.guiAlpha,
theme->getMinimumOpacity());
if (alpha != mAlpha)
diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp
index 4a4a5beb5..1b3355265 100644
--- a/src/gui/widgets/spellshortcutcontainer.cpp
+++ b/src/gui/widgets/spellshortcutcontainer.cpp
@@ -25,6 +25,7 @@
#include "client.h"
#include "dragdrop.h"
#include "itemshortcut.h"
+#include "settings.h"
#include "spellshortcut.h"
#include "gui/viewport.h"
@@ -64,7 +65,7 @@ SpellShortcutContainer::SpellShortcutContainer(Widget2 *const widget,
if (mBackgroundImg)
{
- mBackgroundImg->setAlpha(client->getGuiAlpha());
+ mBackgroundImg->setAlpha(settings.guiAlpha);
mBoxHeight = mBackgroundImg->getHeight();
mBoxWidth = mBackgroundImg->getWidth();
}
@@ -97,9 +98,9 @@ void SpellShortcutContainer::draw(Graphics *graphics)
return;
BLOCK_START("SpellShortcutContainer::draw")
- if (client->getGuiAlpha() != mAlpha)
+ if (settings.guiAlpha != mAlpha)
{
- mAlpha = client->getGuiAlpha();
+ mAlpha = settings.guiAlpha;
if (mBackgroundImg)
mBackgroundImg->setAlpha(mAlpha);
}
diff --git a/src/gui/widgets/tabs/chattab.cpp b/src/gui/widgets/tabs/chattab.cpp
index 893149a98..36e4b5437 100644
--- a/src/gui/widgets/tabs/chattab.cpp
+++ b/src/gui/widgets/tabs/chattab.cpp
@@ -27,12 +27,14 @@
#include "commands.h"
#include "commandhandler.h"
#include "configuration.h"
+#include "settings.h"
#include "soundconsts.h"
#include "soundmanager.h"
#include "being/localplayer.h"
#include "gui/chatlog.h"
+#include "gui/windowmanager.h"
#include "gui/windows/chatwindow.h"
#include "gui/windows/helpwindow.h"
@@ -320,8 +322,9 @@ void ChatTab::chatLog(std::string line, ChatMsgType::Type own,
if ((getAllowHighlight() || own == ChatMsgType::BY_GM)
&& (this != tabArea->getSelectedTab()
- || (client->getIsMinimized() || (!client->getMouseFocused()
- && !client->getInputFocused()))))
+ || (WindowManager::getIsMinimized()
+ || (!settings.mouseFocused
+ && !settings.inputFocused))))
{
if (own == ChatMsgType::BY_GM)
{
@@ -335,7 +338,7 @@ void ChatTab::chatLog(std::string line, ChatMsgType::Type own,
chatWindow->unHideWindow();
playNewMessageSound();
}
- client->newChatMessage();
+ WindowManager::newChatMessage();
}
}
}
diff --git a/src/gui/widgets/tabs/setup_video.cpp b/src/gui/widgets/tabs/setup_video.cpp
index 439765260..54b17396a 100644
--- a/src/gui/widgets/tabs/setup_video.cpp
+++ b/src/gui/widgets/tabs/setup_video.cpp
@@ -27,6 +27,8 @@
#include "graphicsmanager.h"
+#include "gui/windowmanager.h"
+
#include "gui/windows/okdialog.h"
#include "gui/windows/textdialog.h"
@@ -360,7 +362,7 @@ void Setup_Video::action(const ActionEvent &event)
if (intToRenderType(config.getIntValue("opengl"))
== RENDER_SOFTWARE)
{
- client->resizeVideo(width, height, false);
+ WindowManager::resizeVideo(width, height, false);
}
else
{
@@ -385,7 +387,7 @@ void Setup_Video::action(const ActionEvent &event)
}
#else
mainGraphics->setWindowSize(width, height);
- client->resizeVideo(width, height, false);
+ WindowManager::resizeVideo(width, height, false);
#endif
}
diff --git a/src/gui/widgets/tabs/setup_visual.cpp b/src/gui/widgets/tabs/setup_visual.cpp
index d9f3ec4cf..e90008ac1 100644
--- a/src/gui/widgets/tabs/setup_visual.cpp
+++ b/src/gui/widgets/tabs/setup_visual.cpp
@@ -21,6 +21,8 @@
#include "gui/widgets/tabs/setup_visual.h"
+#include "gui/windowmanager.h"
+
#include "gui/models/namesmodel.h"
#include "gui/widgets/containerplacer.h"
@@ -228,8 +230,8 @@ Setup_Visual::~Setup_Visual()
void Setup_Visual::apply()
{
SetupTabScroll::apply();
- Client::applyGrabMode();
+ WindowManager::applyGrabMode();
#ifndef WIN32
- client->applyScale();
+ WindowManager::applyScale();
#endif
}
diff --git a/src/gui/widgets/tabs/tab.cpp b/src/gui/widgets/tabs/tab.cpp
index 2ad0e8ac8..73c38343b 100644
--- a/src/gui/widgets/tabs/tab.cpp
+++ b/src/gui/widgets/tabs/tab.cpp
@@ -67,6 +67,7 @@
#include "client.h"
#include "graphicsvertexes.h"
+#include "settings.h"
#include "gui/gui.h"
#include "gui/skin.h"
@@ -178,7 +179,7 @@ void Tab::init()
void Tab::updateAlpha()
{
- const float alpha = std::max(client->getGuiAlpha(),
+ const float alpha = std::max(settings.guiAlpha,
theme->getMinimumOpacity());
if (alpha != mAlpha)
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index dc8b107c4..0eb16867a 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -66,6 +66,7 @@
#include "gui/widgets/textfield.h"
#include "client.h"
+#include "settings.h"
#include "input/inputmanager.h"
@@ -173,7 +174,7 @@ TextField::~TextField()
void TextField::updateAlpha()
{
- const float alpha = std::max(client->getGuiAlpha(),
+ const float alpha = std::max(settings.guiAlpha,
theme->getMinimumOpacity());
if (alpha != mAlpha)
diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp
index e215d21b3..febd1b6ba 100644
--- a/src/gui/widgets/textpreview.cpp
+++ b/src/gui/widgets/textpreview.cpp
@@ -23,6 +23,7 @@
#include "gui/widgets/textpreview.h"
#include "client.h"
+#include "settings.h"
#include "gui/gui.h"
#include "gui/skin.h"
@@ -85,8 +86,8 @@ void TextPreview::draw(Graphics* graphics)
return;
BLOCK_START("TextPreview::draw")
- if (client->getGuiAlpha() != mAlpha)
- mAlpha = client->getGuiAlpha();
+ if (settings.guiAlpha != mAlpha)
+ mAlpha = settings.guiAlpha;
const int intAlpha = static_cast<int>(mAlpha * 255.0F);
const int alpha = mTextAlpha ? intAlpha : 255;
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 74c6d1cfc..453bb125c 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -76,6 +76,7 @@
#include "gui/gui.h"
#include "gui/skin.h"
#include "gui/viewport.h"
+#include "gui/windowmanager.h"
#include "gui/fonts/font.h"