From 555e68e24f2bb7d38f7ce52ce9a43198c0ccedec Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Wed, 4 Feb 2009 11:46:03 -0700 Subject: Went through the gui folder and revised the include statements to not include anything not needed by that specific widget or window. This appears to have cleaned up system performance a bit on my current setup, where it went from idling on 45% in game with opengl down to 30% now. Also moved iptostring to the tostring header, as importing all of network.h is a little overkill to use that function, and it goes along with the basic functions that are in that header file anyways. TODO: find out a way to get rid of warnings when a class doesn't use this function. Signed-off-by: Ira Rice --- src/gui/shortcutwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui/shortcutwindow.cpp') diff --git a/src/gui/shortcutwindow.cpp b/src/gui/shortcutwindow.cpp index 3a7cf0e0..91b33b72 100644 --- a/src/gui/shortcutwindow.cpp +++ b/src/gui/shortcutwindow.cpp @@ -19,9 +19,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "scrollarea.h" #include "shortcutcontainer.h" #include "shortcutwindow.h" -#include "scrollarea.h" #include "../configuration.h" -- cgit v1.2.3-70-g09d2 From c42eba00701f28b3cf720d90c73d1cfc6c3815da Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Sat, 7 Feb 2009 15:09:11 -0700 Subject: Adjusted the shortcut window initialization so that all new shortcut window instances don't overlap by default. After that, it'll defer to the user's saved window positions. Signed-off-by: Ira Rice --- src/gui/shortcutwindow.cpp | 13 +++++++++---- src/gui/shortcutwindow.h | 2 ++ 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src/gui/shortcutwindow.cpp') diff --git a/src/gui/shortcutwindow.cpp b/src/gui/shortcutwindow.cpp index 91b33b72..dd8634f7 100644 --- a/src/gui/shortcutwindow.cpp +++ b/src/gui/shortcutwindow.cpp @@ -27,6 +27,8 @@ static const int SCROLL_PADDING = 0; +int ShortcutWindow::mInstances = 1; + ShortcutWindow::ShortcutWindow(const char *title, ShortcutContainer *content) { setWindowName(title); @@ -46,16 +48,19 @@ ShortcutWindow::ShortcutWindow(const char *title, ShortcutContainer *content) const int width = (int) config.getValue("screenwidth", 800); const int height = (int) config.getValue("screenheight", 600); - setDefaultSize(width - mItems->getBoxWidth() - border, - height - (mItems->getBoxHeight() * mItems->getMaxItems()) - - border, mItems->getBoxWidth() + border, - (mItems->getBoxHeight() * mItems->getMaxItems()) + border); + setDefaultSize(width - (mInstances * mItems->getBoxWidth()) - + (mInstances * border), height - (mItems->getBoxHeight() * + mItems->getMaxItems()) - border, mItems->getBoxWidth() + + border, (mItems->getBoxHeight() * mItems->getMaxItems()) + + border); mScrollArea = new ScrollArea(mItems); mScrollArea->setPosition(SCROLL_PADDING, SCROLL_PADDING); mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); mScrollArea->setOpaque(false); + mInstances++; + add(mScrollArea); loadWindowState(); diff --git a/src/gui/shortcutwindow.h b/src/gui/shortcutwindow.h index 2711ced5..64592328 100644 --- a/src/gui/shortcutwindow.h +++ b/src/gui/shortcutwindow.h @@ -55,6 +55,8 @@ class ShortcutWindow : public Window ShortcutContainer *mItems; ScrollArea *mScrollArea; + + static int mInstances; }; extern ShortcutWindow *itemShortcutWindow; -- cgit v1.2.3-70-g09d2 From 472494898ee15e92f16ea5f5667c11b6f46b0057 Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Sat, 7 Feb 2009 15:21:33 -0700 Subject: While this commit isn't really needed, this cleans up the reported instances number so that it accurately reflects the number of instances, instead of always being +1. I wasn't intending on using that variable that way, but in case anyone does in the future, it'll at least be accurate. Signed-off-by: Ira Rice --- src/gui/shortcutwindow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/gui/shortcutwindow.cpp') diff --git a/src/gui/shortcutwindow.cpp b/src/gui/shortcutwindow.cpp index dd8634f7..5d49a3c6 100644 --- a/src/gui/shortcutwindow.cpp +++ b/src/gui/shortcutwindow.cpp @@ -27,7 +27,7 @@ static const int SCROLL_PADDING = 0; -int ShortcutWindow::mInstances = 1; +int ShortcutWindow::mInstances = 0; ShortcutWindow::ShortcutWindow(const char *title, ShortcutContainer *content) { @@ -39,6 +39,8 @@ ShortcutWindow::ShortcutWindow(const char *title, ShortcutContainer *content) mItems = content; + mInstances++; + const int border = SCROLL_PADDING * 2 + getPadding() * 2; setMinWidth(mItems->getBoxWidth() + border); setMinHeight(mItems->getBoxHeight() + border); @@ -59,8 +61,6 @@ ShortcutWindow::ShortcutWindow(const char *title, ShortcutContainer *content) mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); mScrollArea->setOpaque(false); - mInstances++; - add(mScrollArea); loadWindowState(); -- cgit v1.2.3-70-g09d2