From 2744e4fa8f39cd06bfe557a5a3881830bd11501c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 20 Jan 2013 20:43:54 +0300 Subject: Last part with FOR_EACH changes. --- src/gui/widgets/browserbox.cpp | 12 ++++-------- src/gui/widgets/extendednamesmodel.cpp | 3 +-- src/gui/widgets/itemcontainer.cpp | 12 +++--------- src/gui/widgets/setuptouchitem.cpp | 3 +-- src/gui/widgets/tabbedarea.cpp | 6 ++---- src/gui/widgets/tabstrip.cpp | 3 +-- src/gui/widgets/vertcontainer.cpp | 6 +----- src/gui/widgets/windowcontainer.cpp | 3 +-- 8 files changed, 14 insertions(+), 34 deletions(-) (limited to 'src/gui/widgets') diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index e931c7626..8236dbdd3 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -253,8 +253,7 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) const int hyphenWidth = font->getWidth(hyphen); unsigned x = 0; - for (TextRowCIter i = mTextRows.begin(), i_end = mTextRows.end(); - i != i_end; ++ i) + FOR_EACH (TextRowCIter, i, mTextRows) { std::string tempRow = *i; for (unsigned int j = 0, sz = static_cast( @@ -413,8 +412,7 @@ void BrowserBox::draw(gcn::Graphics *graphics) gcn::Font *const font = getFont(); - for (LinePartCIter i = mLineParts.begin(), i_end = mLineParts.end(); - i != i_end; ++i) + FOR_EACH (LinePartCIter, i, mLineParts) { const LinePart &part = *i; if (part.mY + 50 < mYStart) @@ -465,8 +463,7 @@ int BrowserBox::calcHeight() mLineParts.clear(); - for (TextRowCIter i = mTextRows.begin(), i_end = mTextRows.end(); - i != i_end; ++ i) + FOR_EACH (TextRowCIter, i, mTextRows) { const std::string row = *(i); bool wrapped = false; @@ -753,8 +750,7 @@ std::string BrowserBox::getTextAtPos(const int x, const int y) const int lastY = 0; - for (LinePartCIter i = mLineParts.begin(), i_end = mLineParts.end(); - i != i_end; ++i) + FOR_EACH (LinePartCIter, i, mLineParts) { const LinePart &part = *i; if (part.mY + 50 < mYStart) diff --git a/src/gui/widgets/extendednamesmodel.cpp b/src/gui/widgets/extendednamesmodel.cpp index 015d4d685..90deb999c 100644 --- a/src/gui/widgets/extendednamesmodel.cpp +++ b/src/gui/widgets/extendednamesmodel.cpp @@ -59,8 +59,7 @@ const Image *ExtendedNamesModel::getImageAt(int i) void ExtendedNamesModel::clear() { mNames.clear(); - for (std::vector::iterator it = mImages.begin(), - it_end = mImages.end(); it != it_end; ++ it) + FOR_EACH (std::vector::iterator, it, mImages) { if (*it) (*it)->decRef(); diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 42c9bafcf..e11e27fd6 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -354,9 +354,7 @@ Item *ItemContainer::getSelectedItem() const void ItemContainer::distributeValueChangedEvent() { - for (SelectionListenerIterator i = mSelectionListeners.begin(), - i_end = mSelectionListeners.end(); - i != i_end; ++i) + FOR_EACH (SelectionListenerIterator, i, mSelectionListeners) { if (*i) { @@ -576,8 +574,7 @@ void ItemContainer::updateMatrix() int jMult = j * mGridColumns; const int maxSize = mGridRows * mGridColumns; - for (std::vector::const_iterator iter = sortedItems.begin(), - iter_end = sortedItems.end(); iter != iter_end; ++ iter) + FOR_EACH (std::vector::const_iterator, iter, sortedItems) { if (jMult >= maxSize) break; @@ -593,11 +590,8 @@ void ItemContainer::updateMatrix() } } - for (int idx = j * mGridColumns + i; - idx < maxSize; idx ++) - { + for (int idx = j * mGridColumns + i; idx < maxSize; idx ++) mShowMatrix[idx] = -1; - } for (size_t idx = 0, sz = sortedItems.size(); idx < sz; idx ++) delete sortedItems[idx]; diff --git a/src/gui/widgets/setuptouchitem.cpp b/src/gui/widgets/setuptouchitem.cpp index 7cb84ae81..8f8ec500c 100644 --- a/src/gui/widgets/setuptouchitem.cpp +++ b/src/gui/widgets/setuptouchitem.cpp @@ -56,8 +56,7 @@ TouchActionsModel::TouchActionsModel() : std::sort(data.begin(), data.end(), touchActionSorter); int cnt = 0; - for (std::vector::iterator it = data.begin(), - it_end = data.end(); it != it_end; ++ it) + FOR_EACH (std::vector::iterator, it, data) { const SetupActionData *data1 = *it; mNames.push_back(data1->name); diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index e930ab60d..b0999fbd4 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -343,8 +343,7 @@ int TabbedArea::getSelectedTabIndex() const void TabbedArea::setSelectedTabByName(const std::string &name) { - for (TabContainer::const_iterator itr = mTabs.begin(), - itr_end = mTabs.end(); itr != itr_end; ++itr) + FOR_EACH (TabContainer::const_iterator, itr, mTabs) { if ((*itr).first && (*itr).first->getCaption() == name) { @@ -430,8 +429,7 @@ void TabbedArea::widgetResized(const gcn::Event &event A_UNUSED) void TabbedArea::updateTabsWidth() { mTabsWidth = 0; - for (TabContainer::const_iterator itr = mTabs.begin(), - itr_end = mTabs.end(); itr != itr_end; ++itr) + FOR_EACH (TabContainer::const_iterator, itr, mTabs) { if ((*itr).first) mTabsWidth += (*itr).first->getWidth(); diff --git a/src/gui/widgets/tabstrip.cpp b/src/gui/widgets/tabstrip.cpp index 2ecbb5eed..e0a4b0461 100644 --- a/src/gui/widgets/tabstrip.cpp +++ b/src/gui/widgets/tabstrip.cpp @@ -57,8 +57,7 @@ void TabStrip::action(const gcn::ActionEvent &event) gcn::Widget *const widget = event.getSource(); if (static_cast(widget)->isPressed2()) { - for (WidgetListConstIterator iter = mWidgets.begin(); - iter != mWidgets.end(); ++ iter) + FOR_EACH (WidgetListConstIterator, iter, mWidgets) { if (*iter != widget) { diff --git a/src/gui/widgets/vertcontainer.cpp b/src/gui/widgets/vertcontainer.cpp index 0bda6c869..c8bc862ee 100644 --- a/src/gui/widgets/vertcontainer.cpp +++ b/src/gui/widgets/vertcontainer.cpp @@ -79,10 +79,6 @@ void VertContainer::clear() void VertContainer::widgetResized(const gcn::Event &event A_UNUSED) { - for (std::vector::const_iterator - it = mResizableWidgets.begin(), it_end = mResizableWidgets.end(); - it != it_end; ++ it) - { + FOR_EACH (std::vector::const_iterator, it, mResizableWidgets) (*it)->setWidth(getWidth()); - } } diff --git a/src/gui/widgets/windowcontainer.cpp b/src/gui/widgets/windowcontainer.cpp index 1c4b926f5..2447e12e4 100644 --- a/src/gui/widgets/windowcontainer.cpp +++ b/src/gui/widgets/windowcontainer.cpp @@ -54,8 +54,7 @@ void WindowContainer::scheduleDelete(gcn::Widget *const widget) void WindowContainer::adjustAfterResize(const int oldScreenWidth, const int oldScreenHeight) { - for (WidgetListIterator i = mWidgets.begin(), i_end = mWidgets.end(); - i != i_end; ++i) + FOR_EACH (WidgetListIterator, i, mWidgets) { if (Window *const window = dynamic_cast(*i)) window->adjustPositionAfterResize(oldScreenWidth, oldScreenHeight); -- cgit v1.2.3-70-g09d2