From 2780743d5b7f864e6a91bffabf757d29c4c93625 Mon Sep 17 00:00:00 2001 From: hybrid Date: Tue, 2 Oct 2007 12:43:25 +0000 Subject: [PATCH] Fixed some typos in irrList and adapted GUIEditor to ConstIterators. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1017 dfc29bdd-3216-0410-991c-e03cc46cb475 --- include/irrList.h | 5 +++-- tools/GUIEditor/CGUIEditWindow.cpp | 1 - tools/GUIEditor/CGUIEditWorkspace.cpp | 10 ++++------ tools/GUIEditor/CGUIPanel.cpp | 13 ++++++------- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/include/irrList.h b/include/irrList.h index a7fbef8b..25839f56 100644 --- a/include/irrList.h +++ b/include/irrList.h @@ -83,8 +83,8 @@ public: ConstIterator& operator ++() { Current = Current->Next; return *this; } ConstIterator& operator --() { Current = Current->Prev; return *this; } - ConstIterator operator ++(s32) { Iterator tmp = *this; Current = Current->Next; return tmp; } - ConstIterator operator --(s32) { Iterator tmp = *this; Current = Current->Prev; return tmp; } + ConstIterator operator ++(s32) { ConstIterator tmp = *this; Current = Current->Next; return tmp; } + ConstIterator operator --(s32) { ConstIterator tmp = *this; Current = Current->Prev; return tmp; } ConstIterator& operator +=(s32 num) { @@ -118,6 +118,7 @@ public: SKListNode* Current; + friend class Iterator; friend class list; }; diff --git a/tools/GUIEditor/CGUIEditWindow.cpp b/tools/GUIEditor/CGUIEditWindow.cpp index b22ba909..8bb6648a 100644 --- a/tools/GUIEditor/CGUIEditWindow.cpp +++ b/tools/GUIEditor/CGUIEditWindow.cpp @@ -127,7 +127,6 @@ CGUIAttributeEditor* CGUIEditWindow::getOptionEditor() const void CGUIEditWindow::setSelectedElement(IGUIElement *sel) { - // save changes AttribEditor->updateAttribs(); diff --git a/tools/GUIEditor/CGUIEditWorkspace.cpp b/tools/GUIEditor/CGUIEditWorkspace.cpp index 1a98f0d6..e2e93b72 100644 --- a/tools/GUIEditor/CGUIEditWorkspace.cpp +++ b/tools/GUIEditor/CGUIEditWorkspace.cpp @@ -117,7 +117,7 @@ IGUIElement* CGUIEditWorkspace::getEditableElementFromPoint(IGUIElement *start, // we have to search from back to front. - core::list::Iterator it = start->getChildren().getLast(); + core::list::ConstIterator it = start->getChildren().getLast(); s32 count=0; while(it != start->getChildren().end()) { @@ -174,14 +174,13 @@ IGUIElement* CGUIEditWorkspace::getSelectedElement() void CGUIEditWorkspace::selectNextSibling() { IGUIElement* p=0; - core::list::Iterator it; if (!SelectedElement) p = Parent; else p = SelectedElement->getParent(); - it = p->getChildren().begin(); + core::list::ConstIterator it = p->getChildren().begin(); // find selected element if (SelectedElement) while (*it != SelectedElement) @@ -198,14 +197,13 @@ void CGUIEditWorkspace::selectNextSibling() void CGUIEditWorkspace::selectPreviousSibling() { IGUIElement* p=0; - core::list::Iterator it; if (!SelectedElement) p = Parent; else p = SelectedElement->getParent(); - it = p->getChildren().getLast(); + core::list::ConstIterator it = p->getChildren().getLast(); // find selected element if (SelectedElement) while (*it != SelectedElement) @@ -595,7 +593,7 @@ bool CGUIEditWorkspace::OnEvent(const SEvent &e) el = Parent; grab(); // remove all children - while(el->getChildren().begin() != Children.end()) + while(Children.end() != el->getChildren().begin()) el->removeChild(*(el->getChildren().begin())); // attach to parent again el->addChild(this); diff --git a/tools/GUIEditor/CGUIPanel.cpp b/tools/GUIEditor/CGUIPanel.cpp index 46a9d76d..8b6bf9a0 100644 --- a/tools/GUIEditor/CGUIPanel.cpp +++ b/tools/GUIEditor/CGUIPanel.cpp @@ -231,14 +231,14 @@ void CGUIPanel::resizeInnerPane() // get desired size (total size of all children) core::rect totalRect(0,0,0,0); - core::list::Iterator it = InnerPane->getChildren().begin(); - - while ( it != InnerPane->getChildren().end() ) + core::list::ConstIterator it; + + for ( it = InnerPane->getChildren().begin(); + it != InnerPane->getChildren().end(); ++it ) { core::rect rct = (*it)->getRelativePosition(); totalRect.addInternalPoint(rct.UpperLeftCorner); totalRect.addInternalPoint(rct.LowerRightCorner); - it++; } // move children if pane needs to grow @@ -253,11 +253,10 @@ void CGUIPanel::resizeInnerPane() { totalRect += adjustedMovement; - it = InnerPane->getChildren().begin(); - while ( it != InnerPane->getChildren().end() ) + for (it = InnerPane->getChildren().begin(); + it != InnerPane->getChildren().end(); ++it ) { (*it)->move(adjustedMovement); - it++; } }