diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/gradient-drag.cpp | 28 | ||||
| -rw-r--r-- | src/helper/geom-pathvectorsatellites.cpp | 18 | ||||
| -rw-r--r-- | src/live_effects/lpe-embrodery-stitch-ordering.cpp | 3 | ||||
| -rw-r--r-- | src/live_effects/lpe-fill-between-many.cpp | 13 | ||||
| -rw-r--r-- | src/live_effects/lpe-perspective-envelope.cpp | 8 | ||||
| -rw-r--r-- | src/live_effects/lpe-pts2ellipse.cpp | 4 | ||||
| -rw-r--r-- | src/live_effects/lpe-rough-hatches.cpp | 8 | ||||
| -rw-r--r-- | src/live_effects/parameter/satellitesarray.cpp | 6 | ||||
| -rw-r--r-- | src/object/sp-mesh-array.cpp | 6 | ||||
| -rw-r--r-- | src/text-editing.cpp | 2 | ||||
| -rw-r--r-- | src/transf_mat_3x4.cpp | 4 | ||||
| -rw-r--r-- | src/ui/dialog/input.cpp | 10 | ||||
| -rw-r--r-- | src/ui/tool/path-manipulator.cpp | 28 |
13 files changed, 67 insertions, 71 deletions
diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index 0a19f8e26..9f9a29765 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -2228,44 +2228,44 @@ void GrDrag::addDraggersMesh(SPMeshGradient *mg, SPItem *item, Inkscape::PaintTa } for(auto & node : nodes) { - for( guint j = 0; j < node.size(); ++j ) { + for(auto & j : node) { // std::cout << " Draggers: " << i << " " << j << " " << nodes[i][j]->node_type << std::endl; - switch ( node[j]->node_type ) { + switch ( j->node_type ) { case MG_NODE_TYPE_CORNER: { - mg->array.corners.push_back( node[j] ); + mg->array.corners.push_back( j ); GrDraggable *corner = new GrDraggable (item, POINT_MG_CORNER, icorner, fill_or_stroke); addDragger ( corner ); - node[j]->draggable = icorner; + j->draggable = icorner; ++icorner; break; } case MG_NODE_TYPE_HANDLE: { - mg->array.handles.push_back( node[j] ); + mg->array.handles.push_back( j ); GrDraggable *handle = new GrDraggable (item, POINT_MG_HANDLE, ihandle, fill_or_stroke); GrDragger* dragger = addDragger ( handle ); - if( !show_handles || !node[j]->set ) { + if( !show_handles || !j->set ) { dragger->knot->hide(); } - node[j]->draggable = ihandle; + j->draggable = ihandle; ++ihandle; break; } case MG_NODE_TYPE_TENSOR: { - mg->array.tensors.push_back( node[j] ); + mg->array.tensors.push_back( j ); GrDraggable *tensor = new GrDraggable (item, POINT_MG_TENSOR, itensor, fill_or_stroke); GrDragger* dragger = addDragger ( tensor ); - if( !show_handles || !node[j]->set ) { + if( !show_handles || !j->set ) { dragger->knot->hide(); } - node[j]->draggable = itensor; + j->draggable = itensor; ++itensor; break; } @@ -2303,11 +2303,11 @@ void GrDrag::refreshDraggersMesh(SPMeshGradient *mg, SPItem *item, Inkscape::Pai guint itensor = 0; for(auto & node : nodes) { - for( guint j = 0; j < node.size(); ++j ) { + for(auto & j : node) { // std::cout << " Draggers: " << i << " " << j << " " << nodes[i][j]->node_type << std::endl; - switch ( node[j]->node_type ) { + switch ( j->node_type ) { case MG_NODE_TYPE_CORNER: // Do nothing, corners are always shown. @@ -2319,7 +2319,7 @@ void GrDrag::refreshDraggersMesh(SPMeshGradient *mg, SPItem *item, Inkscape::Pai if (dragger) { Geom::Point pk = getGradientCoords( item, POINT_MG_HANDLE, ihandle, fill_or_stroke); dragger->knot->moveto(pk); - if( !show_handles || !node[j]->set ) { + if( !show_handles || !j->set ) { dragger->knot->hide(); } else { dragger->knot->show(); @@ -2338,7 +2338,7 @@ void GrDrag::refreshDraggersMesh(SPMeshGradient *mg, SPItem *item, Inkscape::Pai if (dragger) { Geom::Point pk = getGradientCoords( item, POINT_MG_TENSOR, itensor, fill_or_stroke); dragger->knot->moveto(pk); - if( !show_handles || !node[j]->set ) { + if( !show_handles || !j->set ) { dragger->knot->hide(); } else { dragger->knot->show(); diff --git a/src/helper/geom-pathvectorsatellites.cpp b/src/helper/geom-pathvectorsatellites.cpp index 92936813d..fe5f45774 100644 --- a/src/helper/geom-pathvectorsatellites.cpp +++ b/src/helper/geom-pathvectorsatellites.cpp @@ -69,11 +69,11 @@ void PathVectorSatellites::setSelected(std::vector<size_t> selected) { size_t counter = 0; for (auto & _satellite : _satellites) { - for (size_t j = 0; j < _satellite.size(); ++j) { + for (auto & j : _satellite) { if (find (selected.begin(), selected.end(), counter) != selected.end()) { - _satellite[j].setSelected(true); + j.setSelected(true); } else { - _satellite[j].setSelected(false); + j.setSelected(false); } counter++; } @@ -83,18 +83,18 @@ void PathVectorSatellites::setSelected(std::vector<size_t> selected) void PathVectorSatellites::updateSteps(size_t steps, bool apply_no_radius, bool apply_with_radius, bool only_selected) { for (auto & _satellite : _satellites) { - for (size_t j = 0; j < _satellite.size(); ++j) { - if ((!apply_no_radius && _satellite[j].amount == 0) || - (!apply_with_radius && _satellite[j].amount != 0)) + for (auto & j : _satellite) { + if ((!apply_no_radius && j.amount == 0) || + (!apply_with_radius && j.amount != 0)) { continue; } if (only_selected) { - if (_satellite[j].selected) { - _satellite[j].steps = steps; + if (j.selected) { + j.steps = steps; } } else { - _satellite[j].steps = steps; + j.steps = steps; } } } diff --git a/src/live_effects/lpe-embrodery-stitch-ordering.cpp b/src/live_effects/lpe-embrodery-stitch-ordering.cpp index 1c3548420..3858accc6 100644 --- a/src/live_effects/lpe-embrodery-stitch-ordering.cpp +++ b/src/live_effects/lpe-embrodery-stitch-ordering.cpp @@ -784,8 +784,7 @@ bool FindShortestReconnect(std::vector<OrderingSegment> &segments, std::vector<O void AssertIsTour(std::vector<OrderingGroup *> &groups, std::vector<OrderingGroupConnection *> &connections, OrderingGroupConnection *longestConnection) { for (auto & connection : connections) { - for (int i = 0; i < 2; i++) { - OrderingGroupPoint *pnt = connection->points[i]; + for (auto pnt : connection->points) { assert(pnt->connection == connection); assert(pnt->connection->points[pnt->indexInConnection] == pnt); assert(pnt->group->endpoints[pnt->indexInGroup] == pnt); diff --git a/src/live_effects/lpe-fill-between-many.cpp b/src/live_effects/lpe-fill-between-many.cpp index c5121c37a..06c25b69d 100644 --- a/src/live_effects/lpe-fill-between-many.cpp +++ b/src/live_effects/lpe-fill-between-many.cpp @@ -115,13 +115,12 @@ void LPEFillBetweenMany::doEffect (SPCurve * curve) unsigned int counter = 0; Geom::Point current = Geom::Point(); std::vector<unsigned int> done; - for (std::vector<PathAndDirectionAndVisible *>::iterator iter = linked_paths._vector.begin(); - iter != linked_paths._vector.end(); ++iter) { + for (auto & iter : linked_paths._vector) { SPObject *obj; - if ((*iter)->ref.isAttached() && (obj = (*iter)->ref.getObject()) && SP_IS_ITEM(obj) && - !(*iter)->_pathvector.empty() && (*iter)->visibled) { + if (iter->ref.isAttached() && (obj = iter->ref.getObject()) && SP_IS_ITEM(obj) && + !iter->_pathvector.empty() && iter->visibled) { Geom::Path linked_path; - if ((*iter)->_pathvector.front().closed() && linked_paths._vector.size() > 1) { + if (iter->_pathvector.front().closed() && linked_paths._vector.size() > 1) { counter++; continue; } @@ -129,8 +128,8 @@ void LPEFillBetweenMany::doEffect (SPCurve * curve) SP_ITEM(obj)->doWriteTransform(transf); } if (counter == 0) { - current = (*iter)->_pathvector.front().finalPoint(); - Geom::Path initial_path = (*iter)->_pathvector.front(); + current = iter->_pathvector.front().finalPoint(); + Geom::Path initial_path = iter->_pathvector.front(); done.push_back(0); if (close && !join) { initial_path.close(); diff --git a/src/live_effects/lpe-perspective-envelope.cpp b/src/live_effects/lpe-perspective-envelope.cpp index 6d0cd707f..541055bdb 100644 --- a/src/live_effects/lpe-perspective-envelope.cpp +++ b/src/live_effects/lpe-perspective-envelope.cpp @@ -205,8 +205,8 @@ void LPEPerspectiveEnvelope::doEffect(SPCurve *curve) } int h = 0; for(auto & i : solmatrix) { - for( int j = 0; j < 8; j++ ) { - gslSolmatrix[h] = i[j]; + for(double j : i) { + gslSolmatrix[h] = j; h++; } } @@ -221,12 +221,12 @@ void LPEPerspectiveEnvelope::doEffect(SPCurve *curve) gsl_linalg_LU_solve (&m.matrix, p, &b.vector, x); h = 0; for(auto & i : projmatrix) { - for( int j = 0; j < 3; j++ ) { + for(double & j : i) { if(h==8) { projmatrix[2][2] = 1.0; continue; } - i[j] = gsl_vector_get(x, h); + j = gsl_vector_get(x, h); h++; } } diff --git a/src/live_effects/lpe-pts2ellipse.cpp b/src/live_effects/lpe-pts2ellipse.cpp index 0d3f70314..48655b25a 100644 --- a/src/live_effects/lpe-pts2ellipse.cpp +++ b/src/live_effects/lpe-pts2ellipse.cpp @@ -265,8 +265,8 @@ LPEPts2Ellipse::doEffect_path (Geom::PathVector const & path_in) // extract first point of this path pts.push_back(pit.initialPoint()); // iterate over all curves - for (Geom::Path::const_iterator cit = pit.begin(); cit != pit.end(); ++cit) { - pts.push_back(cit->finalPoint()); + for (const auto & cit : pit) { + pts.push_back(cit.finalPoint()); } } diff --git a/src/live_effects/lpe-rough-hatches.cpp b/src/live_effects/lpe-rough-hatches.cpp index b93e0a94e..e121045f7 100644 --- a/src/live_effects/lpe-rough-hatches.cpp +++ b/src/live_effects/lpe-rough-hatches.cpp @@ -90,11 +90,11 @@ public: for (const auto & time : times){ LevelCrossings lcs; - for (unsigned j=0; j<time.size(); j++){ + for (double j : time){ LevelCrossing lc; - lc.pt = f.valueAt(time[j]); - lc.t = time[j]; - lc.sign = ( dx.valueAt(time[j])>0 ); + lc.pt = f.valueAt(j); + lc.t = j; + lc.sign = ( dx.valueAt(j)>0 ); lc.used = false; lcs.push_back(lc); } diff --git a/src/live_effects/parameter/satellitesarray.cpp b/src/live_effects/parameter/satellitesarray.cpp index a82df2d27..e2d5bb2cb 100644 --- a/src/live_effects/parameter/satellitesarray.cpp +++ b/src/live_effects/parameter/satellitesarray.cpp @@ -159,9 +159,9 @@ void SatellitesArrayParam::param_transform_multiply(Geom::Affine const &postmul, if (prefs->getBool("/options/transform/rectcorners", true)) { for (auto & i : _vector) { - for (size_t j = 0; j < i.size(); ++j) { - if (!i[j].is_time && i[j].amount > 0) { - i[j].amount = i[j].amount * ((postmul.expansionX() + postmul.expansionY()) / 2); + for (auto & j : i) { + if (!j.is_time && j.amount > 0) { + j.amount = j.amount * ((postmul.expansionX() + postmul.expansionY()) / 2); } } } diff --git a/src/object/sp-mesh-array.cpp b/src/object/sp-mesh-array.cpp index 6d3826567..848e8de3b 100644 --- a/src/object/sp-mesh-array.cpp +++ b/src/object/sp-mesh-array.cpp @@ -1460,9 +1460,9 @@ void SPMeshNodeArray::create( SPMeshGradient *mg, SPItem *item, Geom::OptRect bb void SPMeshNodeArray::clear() { for(auto & node : nodes) { - for( guint j = 0; j < node.size(); ++j ) { - if( node[j] ) { - delete node[j]; + for(auto & j : node) { + if( j ) { + delete j; } } } diff --git a/src/text-editing.cpp b/src/text-editing.cpp index 98c566e8b..8849faa4f 100644 --- a/src/text-editing.cpp +++ b/src/text-editing.cpp @@ -1241,7 +1241,7 @@ sp_te_adjust_line_height (SPObject *object, double amount, double average, bool // Always set if top level true. // Also set if line_height is set to a non-zero value. if (top_level || - (style->line_height.set && !style->line_height.inherit && ((!((style->line_height.computed)) == 0)))){ + (style->line_height.set && !style->line_height.inherit && (((!(((style->line_height.computed))) == 0))))){ // Scale default values if (!style->line_height.set || style->line_height.inherit || style->line_height.normal) { diff --git a/src/transf_mat_3x4.cpp b/src/transf_mat_3x4.cpp index 7af2d86c5..391783b68 100644 --- a/src/transf_mat_3x4.cpp +++ b/src/transf_mat_3x4.cpp @@ -161,8 +161,8 @@ TransfMat3x4::print () const { g_print ("Transformation matrix:\n"); for (const auto & i : tmat) { g_print (" "); - for (int j = 0; j < 4; ++j) { - g_print ("%8.2f ", i[j]); + for (double j : i) { + g_print ("%8.2f ", j); } g_print ("\n"); } 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(); |
