summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-03-28 00:02:01 +0100
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-03-28 00:28:45 +0100
commite083abd148c70982a098d3f2fff8e61eee5c4f91 (patch)
treead375c5c635e5b45f5d79558bc716e9a4165c741
parenta96ad66d345807d6021f28c9b05b02328f76cc0f (diff)
downloadmana-client-e083abd148c70982a098d3f2fff8e61eee5c4f91.tar.gz
mana-client-e083abd148c70982a098d3f2fff8e61eee5c4f91.tar.bz2
mana-client-e083abd148c70982a098d3f2fff8e61eee5c4f91.tar.xz
mana-client-e083abd148c70982a098d3f2fff8e61eee5c4f91.zip
Removed a lot of useless isVisible() checks
The draw() method of a widget isn't called when a widget is not visible.
-rw-r--r--src/game.cpp1
-rw-r--r--src/gui/browserbox.cpp3
-rw-r--r--src/gui/emotecontainer.cpp3
-rw-r--r--src/gui/emoteshortcutcontainer.cpp3
-rw-r--r--src/gui/equipmentwindow.cpp3
-rw-r--r--src/gui/itemshortcutcontainer.cpp3
-rw-r--r--src/gui/listbox.cpp2
-rw-r--r--src/gui/minimap.cpp11
-rw-r--r--src/gui/playerbox.cpp3
-rw-r--r--src/gui/popup.cpp3
-rw-r--r--src/gui/radiobutton.cpp3
-rw-r--r--src/gui/scrollarea.cpp3
-rw-r--r--src/gui/shoplistbox.cpp2
-rw-r--r--src/gui/status.cpp3
-rw-r--r--src/gui/table.cpp2
-rw-r--r--src/gui/textfield.cpp3
-rw-r--r--src/gui/widgets/dropdown.cpp3
-rw-r--r--src/gui/window.cpp3
-rw-r--r--src/net/ea/playerhandler.cpp3
19 files changed, 7 insertions, 53 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 109ae071..ba756df3 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -880,7 +880,6 @@ void Game::handleInput()
break;
case KeyboardConfig::KEY_WINDOW_MINIMAP:
minimap->toggle();
- requestedWindow = minimap;
break;
case KeyboardConfig::KEY_WINDOW_CHAT:
requestedWindow = chatWindow;
diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp
index 2f667237..0240b67b 100644
--- a/src/gui/browserbox.cpp
+++ b/src/gui/browserbox.cpp
@@ -244,9 +244,6 @@ void BrowserBox::mouseMoved(gcn::MouseEvent &event)
void BrowserBox::draw(gcn::Graphics *graphics)
{
- if (!isVisible())
- return;
-
if (mOpaque)
{
graphics->setColor(guiPalette->getColor(Palette::BACKGROUND));
diff --git a/src/gui/emotecontainer.cpp b/src/gui/emotecontainer.cpp
index b4caf4f1..3425cde8 100644
--- a/src/gui/emotecontainer.cpp
+++ b/src/gui/emotecontainer.cpp
@@ -79,9 +79,6 @@ EmoteContainer::~EmoteContainer()
void EmoteContainer::draw(gcn::Graphics *graphics)
{
- if (!isVisible())
- return;
-
int columns = getWidth() / gridWidth;
// Have at least 1 column
diff --git a/src/gui/emoteshortcutcontainer.cpp b/src/gui/emoteshortcutcontainer.cpp
index 661f42a7..ae5eb859 100644
--- a/src/gui/emoteshortcutcontainer.cpp
+++ b/src/gui/emoteshortcutcontainer.cpp
@@ -76,9 +76,6 @@ EmoteShortcutContainer::~EmoteShortcutContainer()
void EmoteShortcutContainer::draw(gcn::Graphics *graphics)
{
- if (!isVisible())
- return;
-
if (config.getValue("guialpha", 0.8) != mAlpha)
{
mAlpha = config.getValue("guialpha", 0.8);
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index 96500e88..0be33ca6 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -121,9 +121,6 @@ EquipmentWindow::~EquipmentWindow()
void EquipmentWindow::draw(gcn::Graphics *graphics)
{
- if (!isVisible())
- return;
-
// Draw window graphics
Window::draw(graphics);
diff --git a/src/gui/itemshortcutcontainer.cpp b/src/gui/itemshortcutcontainer.cpp
index d4de3477..a7bb229f 100644
--- a/src/gui/itemshortcutcontainer.cpp
+++ b/src/gui/itemshortcutcontainer.cpp
@@ -70,9 +70,6 @@ ItemShortcutContainer::~ItemShortcutContainer()
void ItemShortcutContainer::draw(gcn::Graphics *graphics)
{
- if (!isVisible())
- return;
-
if (config.getValue("guialpha", 0.8) != mAlpha)
{
mAlpha = config.getValue("guialpha", 0.8);
diff --git a/src/gui/listbox.cpp b/src/gui/listbox.cpp
index dbd8e674..70b4fc55 100644
--- a/src/gui/listbox.cpp
+++ b/src/gui/listbox.cpp
@@ -38,7 +38,7 @@ ListBox::ListBox(gcn::ListModel *listModel):
void ListBox::draw(gcn::Graphics *graphics)
{
- if (!mListModel || !isVisible())
+ if (!mListModel)
return;
if (config.getValue("guialpha", 0.8) != mAlpha)
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
index 6bca796d..75ee7e3d 100644
--- a/src/gui/minimap.cpp
+++ b/src/gui/minimap.cpp
@@ -92,21 +92,14 @@ void Minimap::setMapImage(Image *img)
void Minimap::toggle()
{
- mShow = !mShow;
+ mShow = ! isVisible();
+ setVisible(mShow);
}
void Minimap::draw(gcn::Graphics *graphics)
{
- setVisible(mShow);
-
- if (!isVisible())
- return;
-
Window::draw(graphics);
- if (!mShow)
- return;
-
const gcn::Rectangle a = getChildrenArea();
graphics->pushClipArea(a);
diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp
index 58ef4cd7..d00194bd 100644
--- a/src/gui/playerbox.cpp
+++ b/src/gui/playerbox.cpp
@@ -78,9 +78,6 @@ PlayerBox::~PlayerBox()
void PlayerBox::draw(gcn::Graphics *graphics)
{
- if (!isVisible())
- return;
-
if (mPlayer)
{
// Draw character
diff --git a/src/gui/popup.cpp b/src/gui/popup.cpp
index 648a9d6a..46246639 100644
--- a/src/gui/popup.cpp
+++ b/src/gui/popup.cpp
@@ -108,9 +108,6 @@ void Popup::savePopupConfiguration()
void Popup::draw(gcn::Graphics *graphics)
{
- if (!isVisible())
- return;
-
Graphics *g = static_cast<Graphics*>(graphics);
g->drawImageRect(0, 0, getWidth(), getHeight(), mSkin->getBorder());
diff --git a/src/gui/radiobutton.cpp b/src/gui/radiobutton.cpp
index 4a98e29a..d563a2db 100644
--- a/src/gui/radiobutton.cpp
+++ b/src/gui/radiobutton.cpp
@@ -69,9 +69,6 @@ RadioButton::~RadioButton()
void RadioButton::drawBox(gcn::Graphics* graphics)
{
- if (!isVisible())
- return;
-
if (config.getValue("guialpha", 0.8) != mAlpha)
{
mAlpha = config.getValue("guialpha", 0.8);
diff --git a/src/gui/scrollarea.cpp b/src/gui/scrollarea.cpp
index a867822e..2fa087c1 100644
--- a/src/gui/scrollarea.cpp
+++ b/src/gui/scrollarea.cpp
@@ -170,9 +170,6 @@ void ScrollArea::logic()
void ScrollArea::draw(gcn::Graphics *graphics)
{
- if (!isVisible())
- return;
-
if (mVBarVisible)
{
drawUpButton(graphics);
diff --git a/src/gui/shoplistbox.cpp b/src/gui/shoplistbox.cpp
index 8801c51a..b35c1d80 100644
--- a/src/gui/shoplistbox.cpp
+++ b/src/gui/shoplistbox.cpp
@@ -58,7 +58,7 @@ void ShopListBox::setPlayersMoney(int money)
void ShopListBox::draw(gcn::Graphics *gcnGraphics)
{
- if (!mListModel || !isVisible())
+ if (!mListModel)
return;
if (config.getValue("guialpha", 0.8) != mAlpha)
diff --git a/src/gui/status.cpp b/src/gui/status.cpp
index e298c3e2..e6f57de5 100644
--- a/src/gui/status.cpp
+++ b/src/gui/status.cpp
@@ -253,9 +253,6 @@ void StatusWindow::update()
void StatusWindow::draw(gcn::Graphics *g)
{
- if (!isVisible())
- return;
-
update();
Window::draw(g);
diff --git a/src/gui/table.cpp b/src/gui/table.cpp
index 4dda9246..e98d76e5 100644
--- a/src/gui/table.cpp
+++ b/src/gui/table.cpp
@@ -265,7 +265,7 @@ void GuiTable::installActionListeners()
// -- widget ops
void GuiTable::draw(gcn::Graphics* graphics)
{
- if (!mModel || !isVisible())
+ if (!mModel)
return;
if (config.getValue("guialpha", 0.8) != mAlpha)
diff --git a/src/gui/textfield.cpp b/src/gui/textfield.cpp
index c94710b3..48a00dcc 100644
--- a/src/gui/textfield.cpp
+++ b/src/gui/textfield.cpp
@@ -84,9 +84,6 @@ TextField::~TextField()
void TextField::draw(gcn::Graphics *graphics)
{
- if (!isVisible())
- return;
-
if (isFocused())
{
drawCaret(graphics,
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index d8c66789..68c7e093 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -111,9 +111,6 @@ DropDown::~DropDown()
void DropDown::draw(gcn::Graphics* graphics)
{
- if (!isVisible())
- return;
-
int h;
if (mDroppedDown)
diff --git a/src/gui/window.cpp b/src/gui/window.cpp
index 5dd32e00..a916ba38 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -118,9 +118,6 @@ void Window::setWindowContainer(WindowContainer *wc)
void Window::draw(gcn::Graphics *graphics)
{
- if (!isVisible())
- return;
-
Graphics *g = static_cast<Graphics*>(graphics);
g->drawImageRect(0, 0, getWidth(), getHeight(), mSkin->getBorder());
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index 05f74630..534c1b7b 100644
--- a/src/net/ea/playerhandler.cpp
+++ b/src/net/ea/playerhandler.cpp
@@ -93,7 +93,8 @@ namespace {
sellDialog->setVisible(false);
buySellDialog->setVisible(false);
- if (storageWindow->isVisible()) storageWindow->close();
+ if (storageWindow->isVisible())
+ storageWindow->close();
}
} deathListener;