diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-02-24 20:15:19 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-02-24 20:15:19 +0000 |
commit | 1c4742e530271e10ae949cf7e85402bee867e298 (patch) | |
tree | f95927614c4f9a84a507c9425b882f945be6d09f /src/gui | |
parent | 05a12d5568111fa13759026442ed358605bf9a28 (diff) | |
download | mana-client-1c4742e530271e10ae949cf7e85402bee867e298.tar.gz mana-client-1c4742e530271e10ae949cf7e85402bee867e298.tar.bz2 mana-client-1c4742e530271e10ae949cf7e85402bee867e298.tar.xz mana-client-1c4742e530271e10ae949cf7e85402bee867e298.zip |
Another bunch of cosmetic cleanups, ie mostly typedefs...
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/browserbox.cpp | 5 | ||||
-rw-r--r-- | src/gui/browserbox.h | 10 | ||||
-rw-r--r-- | src/gui/chat.cpp | 26 | ||||
-rw-r--r-- | src/gui/chat.h | 6 | ||||
-rw-r--r-- | src/gui/gccontainer.cpp | 2 | ||||
-rw-r--r-- | src/gui/gccontainer.h | 4 | ||||
-rw-r--r-- | src/gui/minimap.cpp | 2 | ||||
-rw-r--r-- | src/gui/tabbedcontainer.cpp | 3 | ||||
-rw-r--r-- | src/gui/tabbedcontainer.h | 6 |
9 files changed, 37 insertions, 27 deletions
diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp index cbf7c1cc..8a636679 100644 --- a/src/gui/browserbox.cpp +++ b/src/gui/browserbox.cpp @@ -241,11 +241,10 @@ struct MouseOverLinkFunctor void BrowserBox::mousePress(int mx, int my, int button) { - std::vector<BROWSER_LINK>::iterator i; - mouseOverLink.mX = mx; mouseOverLink.mY = my; - i = find_if(mLinks.begin(), mLinks.end(), mouseOverLink); + + LinkIterator i = find_if(mLinks.begin(), mLinks.end(), mouseOverLink); if (i != mLinks.end()) { mLinkHandler->handleLink(i->link); diff --git a/src/gui/browserbox.h b/src/gui/browserbox.h index 2897ee96..c6d8f117 100644 --- a/src/gui/browserbox.h +++ b/src/gui/browserbox.h @@ -143,8 +143,14 @@ class BrowserBox : public gcn::Widget, public gcn::MouseListener }; private: - std::vector<std::string> mTextRows; - std::vector<BROWSER_LINK> mLinks; + typedef std::vector<std::string> TextRows; + typedef TextRows::iterator TextRowIterator; + TextRows mTextRows; + + typedef std::vector<BROWSER_LINK> Links; + typedef Links::iterator LinkIterator; + Links mLinks; + LinkHandler *mLinkHandler; unsigned int mMode; unsigned int mHighMode; diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 29fbebfe..28259c77 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -75,7 +75,7 @@ ChatWindow::ChatWindow(const std::string &logfile, Network *network): // Add key listener to chat input to be able to respond to up/down chatInput->addKeyListener(this); - curHist = history.end(); + mCurHist = mHistory.end(); } ChatWindow::~ChatWindow() @@ -199,12 +199,12 @@ ChatWindow::action(const std::string& eventId) if (message.length() > 0) { // If message different from previous, put it in the history - if (history.size() == 0 || message != history.back()) { - history.push_back(message); + if (mHistory.size() == 0 || message != mHistory.back()) { + mHistory.push_back(message); } // Reset history iterator - curHist = history.end(); + mCurHist = mHistory.end(); // Send the message to the server chatSend(player_node->getName().c_str(), message.c_str()); @@ -384,24 +384,24 @@ ChatWindow::const_msg(CHATSKILL act) void ChatWindow::keyPress(const gcn::Key &key) { - if (key.getValue() == key.DOWN && curHist != history.end()) + if (key.getValue() == key.DOWN && mCurHist != mHistory.end()) { // Move forward through the history - std::list<std::string>::iterator prevHist = curHist++; - if (curHist != history.end()) { - chatInput->setText(*curHist); + HistoryIterator prevHist = mCurHist++; + if (mCurHist != mHistory.end()) { + chatInput->setText(*mCurHist); chatInput->setCaretPosition(chatInput->getText().length()); } else { - curHist = prevHist; + mCurHist = prevHist; } } - else if (key.getValue() == key.UP && curHist != history.begin() && - history.size() > 0) + else if (key.getValue() == key.UP && mCurHist != mHistory.begin() && + mHistory.size() > 0) { // Move backward through the history - curHist--; - chatInput->setText(*curHist); + mCurHist--; + chatInput->setText(*mCurHist); chatInput->setCaretPosition(chatInput->getText().length()); } } diff --git a/src/gui/chat.h b/src/gui/chat.h index 63b30db3..b460e4c0 100644 --- a/src/gui/chat.h +++ b/src/gui/chat.h @@ -218,8 +218,10 @@ class ChatWindow : public Window, public gcn::ActionListener, BrowserBox *textOutput; /**< Text box for displaying chat history */ ScrollArea *scrollArea; /**< Scroll area around text output */ - std::list<std::string> history; /**< Command history */ - std::list<std::string>::iterator curHist; /**< History iterator */ + typedef std::list<std::string> History; + typedef History::iterator HistoryIterator; + History mHistory; /**< Command history */ + HistoryIterator mCurHist; /**< History iterator */ }; extern ChatWindow *chatWindow; diff --git a/src/gui/gccontainer.cpp b/src/gui/gccontainer.cpp index 32e78e48..3b574622 100644 --- a/src/gui/gccontainer.cpp +++ b/src/gui/gccontainer.cpp @@ -25,7 +25,7 @@ GCContainer::~GCContainer() { - std::list<gcn::Widget*>::iterator i = mDeathList.begin(); + WidgetIterator i = mDeathList.begin(); while (i != mDeathList.end()) { /* Take care _not_ to modify the list in our _announceDeath method */ diff --git a/src/gui/gccontainer.h b/src/gui/gccontainer.h index 696aef0c..46ebfefa 100644 --- a/src/gui/gccontainer.h +++ b/src/gui/gccontainer.h @@ -37,7 +37,9 @@ class GCContainer : public gcn::Container virtual void _announceDeath(gcn::Widget *w); protected: - std::list<gcn::Widget*> mDeathList; + typedef std::list<gcn::Widget*> Widgets; + typedef Widgets::iterator WidgetIterator; + Widgets mDeathList; }; #endif diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index e19a8c62..d0c52b11 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -77,7 +77,7 @@ void Minimap::draw(gcn::Graphics *graphics) } Beings *beings = beingManager->getAll(); - Beings::iterator bi; + BeingIterator bi; for (bi = beings->begin(); bi != beings->end(); bi++) { diff --git a/src/gui/tabbedcontainer.cpp b/src/gui/tabbedcontainer.cpp index 75977571..3d08b390 100644 --- a/src/gui/tabbedcontainer.cpp +++ b/src/gui/tabbedcontainer.cpp @@ -37,8 +37,7 @@ TabbedContainer::TabbedContainer(): TabbedContainer::~TabbedContainer() { - std::vector<gcn::Widget*>::iterator i = mTabs.begin(); - for (i = mTabs.begin(); i != mTabs.end(); i++) { + for (WidgetIterator i = mTabs.begin(); i != mTabs.end(); i++) { remove(*i); delete (*i); } diff --git a/src/gui/tabbedcontainer.h b/src/gui/tabbedcontainer.h index 89c10c1c..24c8c425 100644 --- a/src/gui/tabbedcontainer.h +++ b/src/gui/tabbedcontainer.h @@ -48,8 +48,10 @@ class TabbedContainer : public gcn::Container, public gcn::ActionListener void setOpaque(bool opaque); private: - std::vector<gcn::Widget*> mTabs; // The actual tabs at the top - std::vector<gcn::Widget*> mContents; // The contents of the tabs + typedef std::vector<gcn::Widget*> Widgets; + typedef Widgets::iterator WidgetIterator; + Widgets mTabs; // The actual tabs at the top + Widgets mContents; // The contents of the tabs Widget *mActiveContent; }; |