diff options
| author | Marc Jeanmougin <marc@jeanmougin.fr> | 2019-01-02 09:52:13 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marc@jeanmougin.fr> | 2019-01-02 09:52:13 +0000 |
| commit | 3d15e9e5d472920043498e741c52333db2d60415 (patch) | |
| tree | 91783db00e3c6339f10465569efa2228314f0056 /src/ui | |
| parent | modernize loops (diff) | |
| download | inkscape-3d15e9e5d472920043498e741c52333db2d60415.tar.gz inkscape-3d15e9e5d472920043498e741c52333db2d60415.zip | |
modernize loops (2)
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/dialog/input.cpp | 10 | ||||
| -rw-r--r-- | src/ui/tool/path-manipulator.cpp | 28 |
2 files changed, 18 insertions, 20 deletions
diff --git a/src/ui/dialog/input.cpp b/src/ui/dialog/input.cpp index 080a4de12..e1bf1bd1c 100644 --- a/src/ui/dialog/input.cpp +++ b/src/ui/dialog/input.cpp @@ -832,8 +832,8 @@ void InputDialogImpl::setupTree( Glib::RefPtr<Gtk::TreeStore> store, Gtk::TreeIt if ( it.name.empty() ) { // Check to see if we can derive one std::list<Glib::ustring> names; - for ( std::list<Glib::RefPtr<InputDevice const> >::iterator it2 = it.devices.begin(); it2 != it.devices.end(); ++it2 ) { - names.push_back( (*it2)->getName() ); + for (auto & device : it.devices) { + names.push_back( device->getName() ); } Glib::ustring common = getCommon(names); if ( !common.empty() ) { @@ -847,8 +847,7 @@ void InputDialogImpl::setupTree( Glib::RefPtr<Gtk::TreeStore> store, Gtk::TreeIt for ( std::list<Glib::RefPtr<InputDevice const> >::iterator it2 = it.devices.begin(); it2 != it.devices.end(); ++it2 ) { Glib::RefPtr<InputDevice const> dev = *it2; if ( dev->getSource() == Gdk::SOURCE_PEN ) { - for ( std::list<Glib::RefPtr<InputDevice const> >::iterator it3 = it.devices.begin(); it3 != it.devices.end(); ++it3 ) { - Glib::RefPtr<InputDevice const> dev2 = *it3; + for (auto dev2 : it.devices) { if ( dev2->getSource() == Gdk::SOURCE_ERASER ) { DeviceManager::getManager().setLinkedTo(dev->getId(), dev2->getId()); break; // only check the first eraser... for now @@ -858,8 +857,7 @@ void InputDialogImpl::setupTree( Glib::RefPtr<Gtk::TreeStore> store, Gtk::TreeIt } } - for ( std::list<Glib::RefPtr<InputDevice const> >::iterator it2 = it.devices.begin(); it2 != it.devices.end(); ++it2 ) { - Glib::RefPtr<InputDevice const> dev = *it2; + for (auto dev : it.devices) { Gtk::TreeModel::Row deviceRow = *(store->append(childrow.children())); deviceRow[getCols().description] = dev->getName(); deviceRow[getCols().device] = dev; diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 83c177297..d5e111c7b 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -916,8 +916,8 @@ void PathManipulator::showHandles(bool show) } } else { for (auto & _subpath : _subpaths) { - for (NodeList::iterator j = _subpath->begin(); j != _subpath->end(); ++j) { - j->showHandles(false); + for (auto & j : *_subpath) { + j.showHandles(false); } } } @@ -952,8 +952,8 @@ void PathManipulator::setLiveObjects(bool set) void PathManipulator::updateHandles() { for (auto & _subpath : _subpaths) { - for (NodeList::iterator j = _subpath->begin(); j != _subpath->end(); ++j) { - j->updateHandles(); + for (auto & j : *_subpath) { + j.updateHandles(); } } } @@ -963,8 +963,8 @@ void PathManipulator::setControlsTransform(Geom::Affine const &tnew) Geom::Affine delta = _i2d_transform.inverse() * _edit_transform.inverse() * tnew * _i2d_transform; _edit_transform = tnew; for (auto & _subpath : _subpaths) { - for (NodeList::iterator j = _subpath->begin(); j != _subpath->end(); ++j) { - j->transform(delta); + for (auto & j : *_subpath) { + j.transform(delta); } } _createGeometryFromControlPoints(); @@ -1097,8 +1097,8 @@ void PathManipulator::_externalChange(unsigned type) // vector<bool> should be specialized so that it takes only 1 bit per value std::vector<bool> selpos; for (auto & _subpath : _subpaths) { - for (NodeList::iterator j = _subpath->begin(); j != _subpath->end(); ++j) { - selpos.push_back(j->selected()); + for (auto & j : *_subpath) { + selpos.push_back(j.selected()); } } unsigned size = selpos.size(), curpos = 0; @@ -1122,8 +1122,8 @@ void PathManipulator::_externalChange(unsigned type) _d2i_transform = _i2d_transform.inverse(); i2d_change *= _i2d_transform; for (auto & _subpath : _subpaths) { - for (NodeList::iterator j = _subpath->begin(); j != _subpath->end(); ++j) { - j->transform(i2d_change); + for (auto & j : *_subpath) { + j.transform(i2d_change); } } _updateOutline(); @@ -1223,8 +1223,8 @@ void PathManipulator::_createControlPointsFromGeometry() } std::string::iterator tsi = nodetype_string.begin(); for (auto & _subpath : _subpaths) { - for (NodeList::iterator j = _subpath->begin(); j != _subpath->end(); ++j) { - j->setType(Node::parse_nodetype(*tsi++), false); + for (auto & j : *_subpath) { + j.setType(Node::parse_nodetype(*tsi++), false); } if (_subpath->closed()) { // STUPIDITY ALERT: it seems we need to use the duplicate type symbol instead of @@ -1418,8 +1418,8 @@ std::string PathManipulator::_createTypeString() // precondition: no single-node subpaths std::stringstream tstr; for (auto & _subpath : _subpaths) { - for (NodeList::iterator j = _subpath->begin(); j != _subpath->end(); ++j) { - tstr << j->type(); + for (auto & j : *_subpath) { + tstr << j.type(); } // nodestring format peculiarity: first node is counted twice for closed paths if (_subpath->closed()) tstr << _subpath->begin()->type(); |
