diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2006-08-24 09:33:33 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2006-08-24 09:33:33 +0000 |
commit | dd79b36895a17b3da131197be66827e6809615f0 (patch) | |
tree | be41cac640f44cf45ce2f58142cf32eff78dc5d8 | |
parent | 9581f6556ac1646b4d30c676403aba544e4edaec (diff) | |
download | mana-client-dd79b36895a17b3da131197be66827e6809615f0.tar.gz mana-client-dd79b36895a17b3da131197be66827e6809615f0.tar.bz2 mana-client-dd79b36895a17b3da131197be66827e6809615f0.tar.xz mana-client-dd79b36895a17b3da131197be66827e6809615f0.zip |
Added support for sticky windows as discussed with doener. Patch by AHarrison
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | README | 1 | ||||
-rw-r--r-- | data/help/commands.txt | 1 | ||||
-rw-r--r-- | src/game.cpp | 29 | ||||
-rw-r--r-- | src/gui/chat.cpp | 2 | ||||
-rw-r--r-- | src/gui/window.cpp | 21 | ||||
-rw-r--r-- | src/gui/window.h | 20 |
7 files changed, 78 insertions, 2 deletions
@@ -1,3 +1,9 @@ +2006-08-24 Eugenio Favalli <elvenprogrammer@gmail.com> + + * data/help/commands.txt, README, src/game.cpp, src/gui/chat.cpp, + src/gui/window.cpp, src/gui/window.h: Added support for sticky windows + as discussed with doener. Patch by AHarrison. + 2006-08-24 Philipp Sehmisch <tmw@crushnet.org> * src/engine.cpp: Scrolling speed no longer affected by framerate. @@ -53,6 +53,7 @@ Use arrow keys to move around. Other keys: - Alt + S sit down / stand up - Alt + F toggle debug pathfinding feature - Alt + P take screenshot +- H hide all non-sticky windows - G or Z pick up item - Enter focus chat window / send message - Shift hold it when attacking to lock target for auto attack diff --git a/data/help/commands.txt b/data/help/commands.txt index dbb37195..37c77df2 100644 --- a/data/help/commands.txt +++ b/data/help/commands.txt @@ -23,6 +23,7 @@ ##2Alt + S##P sit down / stand up ##2Alt + F##P toggle debug pathfinding feature ##2Alt + P##P take screenshot + ##2H##P hide all non-sticky windows ##2G or Z##P pick up item ##2Enter##P focus chat window / send message ##2Shift##P hold it when attacking to lock target for auto diff --git a/src/game.cpp b/src/game.cpp index 819e863e..ed8ad827 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -202,6 +202,10 @@ void createGuiWindows(Network *network) minimap->getHeight() + 30);*/ // Set initial window visibility + chatWindow->setSticky(true); + miniStatusWindow->setSticky(true); + menuWindow->setSticky(true); + chatWindow->setVisible(true); miniStatusWindow->setVisible(true); statusWindow->setVisible(false); @@ -461,7 +465,30 @@ void Game::handleInput() } break; - // Picking up items on the floor + // Attempt to hide all windows + case SDLK_h: + chatWindow->setVisible(false); + miniStatusWindow->setVisible(false); + statusWindow->setVisible(false); + menuWindow->setVisible(false); + buyDialog->setVisible(false); + sellDialog->setVisible(false); + buySellDialog->setVisible(false); + inventoryWindow->setVisible(false); + npcTextDialog->setVisible(false); + npcListDialog->setVisible(false); + skillDialog->setVisible(false); + //newSkillWindow->setVisible(false); + setupWindow->setVisible(false); + equipmentWindow->setVisible(false); + chargeDialog->setVisible(false); + tradeWindow->setVisible(false); + //buddyWindow->setVisible(false); + helpWindow->setVisible(false); + debugWindow->setVisible(false); + break; + + // Picking up items on the floor case SDLK_g: case SDLK_z: if (!chatWindow->isFocused()) diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 77c44332..f188b90e 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -400,7 +400,7 @@ ChatWindow::setInputText(std::string input_str) void ChatWindow::setVisible(bool isVisible) { - Widget::setVisible(isVisible); + Window::setVisible(isVisible); /* * For whatever reason, if setVisible is called, the mTmpVisible effect diff --git a/src/gui/window.cpp b/src/gui/window.cpp index 9edecfca..fe23c775 100644 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -63,6 +63,7 @@ Window::Window(const std::string& caption, bool modal, Window *parent): mModal(modal), mResizable(false), mMouseResize(false), + mSticky(false), mMinWinWidth(100), mMinWinHeight(28), mMaxWinWidth(INT_MAX), @@ -243,6 +244,26 @@ bool Window::isResizable() return mResizable; } +void Window::setSticky(bool sticky) +{ + mSticky = sticky; +} + +bool Window::isSticky() { + return mSticky; +} + +void Window::setVisible(bool visible) { + if(isSticky()) + { + gcn::Window::setVisible(true); + } + else + { + gcn::Window::setVisible(visible); + } +} + void Window::scheduleDelete() { windowContainer->scheduleDelete(this); diff --git a/src/gui/window.h b/src/gui/window.h index 42ce444c..51c876e3 100644 --- a/src/gui/window.h +++ b/src/gui/window.h @@ -134,6 +134,25 @@ class Window : public gcn::Window void setMaxHeight(unsigned int height); /** + * Sets whether the window is sticky. + * A sticky window will not have its visibility set to false + * on a general setVisible(false) call. + */ + void setSticky(bool sticky); + + /** + * Returns whether the window is sticky. + */ + bool isSticky(); + + /** + * Overloads window setVisible by guichan to allow sticky window + * Handling + */ + + void setVisible(bool visible); + + /** * Returns the parent window. * * @return The parent window or <code>NULL</code> if there is none. @@ -204,6 +223,7 @@ class Window : public gcn::Window bool mModal; /**< Window is modal */ bool mResizable; /**< Window can be resized */ bool mMouseResize; /**< Window is being resized */ + bool mSticky; /**< Window resists minimzation */ int mMinWinWidth; /**< Minimum window width */ int mMinWinHeight; /**< Minimum window height */ int mMaxWinWidth; /**< Maximum window width */ |