From a7f2b2ba3f13ceb60376802f4a31e104153839e8 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Tue, 17 Feb 2015 03:00:37 +0100 Subject: At first, I was thinking "I just have to go to the selection file, and change that GSList* with a std::list, then resolve the few problems" So, i tried that. And I will continue tomorrow, and the days after, on and on. (bzr r13922.1.1) --- src/selcue.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/selcue.cpp') diff --git a/src/selcue.cpp b/src/selcue.cpp index d2fa0970a..0fab6e5a8 100644 --- a/src/selcue.cpp +++ b/src/selcue.cpp @@ -96,15 +96,16 @@ void Inkscape::SelCue::_updateItemBboxes(Inkscape::Preferences *prefs) void Inkscape::SelCue::_updateItemBboxes(gint mode, int prefs_bbox) { - GSList const *items = _selection->itemList(); - if (_item_bboxes.size() != g_slist_length((GSList *) items)) { + const SelContainer items = _selection->itemList(); + if (_item_bboxes.size() != items.size()) { _newItemBboxes(); return; } int bcount = 0; - for (GSList const *l = _selection->itemList(); l != NULL; l = l->next) { - SPItem *item = static_cast(l->data); + SelContainer ll=_selection->itemList(); + for (SelContainer::const_iterator l=ll.begin();l!=ll.end();l++) { + SPItem *item = static_cast(*l); SPCanvasItem* box = _item_bboxes[bcount ++]; if (box) { @@ -145,8 +146,9 @@ void Inkscape::SelCue::_newItemBboxes() int prefs_bbox = prefs->getBool("/tools/bounding_box"); - for (GSList const *l = _selection->itemList(); l != NULL; l = l->next) { - SPItem *item = static_cast(l->data); + SelContainer ll=_selection->itemList(); + for (SelContainer::const_iterator l=ll.begin();l!=ll.end();l++) { + SPItem *item = static_cast(*l); Geom::OptRect const b = (prefs_bbox == 0) ? item->desktopVisualBounds() : item->desktopGeometricBounds(); @@ -199,8 +201,9 @@ void Inkscape::SelCue::_newTextBaselines() } _text_baselines.clear(); - for (GSList const *l = _selection->itemList(); l != NULL; l = l->next) { - SPItem *item = static_cast(l->data); + SelContainer ll=_selection->itemList(); + for (SelContainer::const_iterator l=ll.begin();l!=ll.end();l++) { + SPItem *item = static_cast(*l); SPCanvasItem* baseline_point = NULL; if (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item)) { // visualize baseline -- cgit v1.2.3 From 5fd00cab14d48beaf2279a2b8f3ad5b02b76c87b Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 19 Feb 2015 04:25:21 +0100 Subject: Put a few std::vector (bzr r13922.1.5) --- src/selcue.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/selcue.cpp') diff --git a/src/selcue.cpp b/src/selcue.cpp index 0fab6e5a8..f48378cdc 100644 --- a/src/selcue.cpp +++ b/src/selcue.cpp @@ -96,15 +96,15 @@ void Inkscape::SelCue::_updateItemBboxes(Inkscape::Preferences *prefs) void Inkscape::SelCue::_updateItemBboxes(gint mode, int prefs_bbox) { - const SelContainer items = _selection->itemList(); + const std::vector items = _selection->itemList(); if (_item_bboxes.size() != items.size()) { _newItemBboxes(); return; } int bcount = 0; - SelContainer ll=_selection->itemList(); - for (SelContainer::const_iterator l=ll.begin();l!=ll.end();l++) { + std::vector ll=_selection->itemList(); + for (std::vector::const_iterator l=ll.begin();l!=ll.end();l++) { SPItem *item = static_cast(*l); SPCanvasItem* box = _item_bboxes[bcount ++]; @@ -146,8 +146,8 @@ void Inkscape::SelCue::_newItemBboxes() int prefs_bbox = prefs->getBool("/tools/bounding_box"); - SelContainer ll=_selection->itemList(); - for (SelContainer::const_iterator l=ll.begin();l!=ll.end();l++) { + std::vector ll=_selection->itemList(); + for (std::vector::const_iterator l=ll.begin();l!=ll.end();l++) { SPItem *item = static_cast(*l); Geom::OptRect const b = (prefs_bbox == 0) ? @@ -201,8 +201,8 @@ void Inkscape::SelCue::_newTextBaselines() } _text_baselines.clear(); - SelContainer ll=_selection->itemList(); - for (SelContainer::const_iterator l=ll.begin();l!=ll.end();l++) { + std::vector ll=_selection->itemList(); + for (std::vector::const_iterator l=ll.begin();l!=ll.end();l++) { SPItem *item = static_cast(*l); SPCanvasItem* baseline_point = NULL; -- cgit v1.2.3 From 9a7fa4d1899d30ec745107823f307b2a0bf3172f Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 27 Feb 2015 03:10:36 +0100 Subject: corrected the casts (hopefully) (bzr r13922.1.10) --- src/selcue.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/selcue.cpp') diff --git a/src/selcue.cpp b/src/selcue.cpp index f48378cdc..76eae3fa8 100644 --- a/src/selcue.cpp +++ b/src/selcue.cpp @@ -104,8 +104,8 @@ void Inkscape::SelCue::_updateItemBboxes(gint mode, int prefs_bbox) int bcount = 0; std::vector ll=_selection->itemList(); - for (std::vector::const_iterator l=ll.begin();l!=ll.end();l++) { - SPItem *item = static_cast(*l); + for (std::vector::const_iterator l = ll.begin(); l != ll.end(); l++) { + SPItem *item = *l; SPCanvasItem* box = _item_bboxes[bcount ++]; if (box) { @@ -147,8 +147,8 @@ void Inkscape::SelCue::_newItemBboxes() int prefs_bbox = prefs->getBool("/tools/bounding_box"); std::vector ll=_selection->itemList(); - for (std::vector::const_iterator l=ll.begin();l!=ll.end();l++) { - SPItem *item = static_cast(*l); + for (std::vector::const_iterator l = ll.begin(); l != ll.end(); l++) { + SPItem *item = *l; Geom::OptRect const b = (prefs_bbox == 0) ? item->desktopVisualBounds() : item->desktopGeometricBounds(); @@ -201,7 +201,7 @@ void Inkscape::SelCue::_newTextBaselines() } _text_baselines.clear(); - std::vector ll=_selection->itemList(); + std::vector ll = _selection->itemList(); for (std::vector::const_iterator l=ll.begin();l!=ll.end();l++) { SPItem *item = static_cast(*l); -- cgit v1.2.3 From 9bdc157f705ca61516e599cb416580283d21ec35 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 27 Feb 2015 04:21:48 +0100 Subject: more cast cleanup (bzr r13922.1.11) --- src/selcue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/selcue.cpp') diff --git a/src/selcue.cpp b/src/selcue.cpp index 76eae3fa8..c73219b7d 100644 --- a/src/selcue.cpp +++ b/src/selcue.cpp @@ -203,7 +203,7 @@ void Inkscape::SelCue::_newTextBaselines() std::vector ll = _selection->itemList(); for (std::vector::const_iterator l=ll.begin();l!=ll.end();l++) { - SPItem *item = static_cast(*l); + SPItem *item = *l; SPCanvasItem* baseline_point = NULL; if (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item)) { // visualize baseline -- cgit v1.2.3