summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorMarc Jeanmougin <mc@localhost.localdomain>2015-02-17 02:00:37 +0000
committerMarc Jeanmougin <mc@localhost.localdomain>2015-02-17 02:00:37 +0000
commita7f2b2ba3f13ceb60376802f4a31e104153839e8 (patch)
tree6db393e9e5a0a9ab7916a0e7ed29d875efa39ea1 /src/widgets
parentdevice-manager: Get rid of GLists (diff)
downloadinkscape-a7f2b2ba3f13ceb60376802f4a31e104153839e8.tar.gz
inkscape-a7f2b2ba3f13ceb60376802f4a31e104153839e8.zip
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)
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/arc-toolbar.cpp33
-rw-r--r--src/widgets/connector-toolbar.cpp16
-rw-r--r--src/widgets/fill-style.cpp32
-rw-r--r--src/widgets/gradient-toolbar.cpp15
-rw-r--r--src/widgets/mesh-toolbar.cpp10
-rw-r--r--src/widgets/rect-toolbar.cpp18
-rw-r--r--src/widgets/spiral-toolbar.cpp16
-rw-r--r--src/widgets/star-toolbar.cpp38
-rw-r--r--src/widgets/stroke-style.cpp29
-rw-r--r--src/widgets/stroke-style.h2
-rw-r--r--src/widgets/text-toolbar.cpp34
11 files changed, 114 insertions, 129 deletions
diff --git a/src/widgets/arc-toolbar.cpp b/src/widgets/arc-toolbar.cpp
index 8a64854be..23c248129 100644
--- a/src/widgets/arc-toolbar.cpp
+++ b/src/widgets/arc-toolbar.cpp
@@ -97,12 +97,9 @@ sp_arctb_startend_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const *v
gchar* namespaced_name = g_strconcat("sodipodi:", value_name, NULL);
bool modmade = false;
- for (GSList const *items = desktop->getSelection()->itemList();
- items != NULL;
- items = items->next)
- {
- SPItem *item = SP_ITEM(items->data);
-
+ SelContainer itemlist=desktop->getSelection()->itemList();
+ for(SelContainer::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
+ SPItem *item = SP_ITEM(*i);
if (SP_IS_GENERICELLIPSE(item)) {
SPGenericEllipse *ge = SP_GENERICELLIPSE(item);
@@ -166,11 +163,9 @@ static void sp_arctb_open_state_changed( EgeSelectOneAction *act, GObject *tbl )
bool modmade = false;
if ( ege_select_one_action_get_active(act) != 0 ) {
- for (GSList const *items = desktop->getSelection()->itemList();
- items != NULL;
- items = items->next)
- {
- SPItem *item = reinterpret_cast<SPItem*>(items->data);
+ SelContainer itemlist=desktop->getSelection()->itemList();
+ for(SelContainer::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
+ SPItem *item = SP_ITEM(*i);
if (SP_IS_GENERICELLIPSE(item)) {
Inkscape::XML::Node *repr = item->getRepr();
repr->setAttribute("sodipodi:open", "true");
@@ -179,11 +174,9 @@ static void sp_arctb_open_state_changed( EgeSelectOneAction *act, GObject *tbl )
}
}
} else {
- for (GSList const *items = desktop->getSelection()->itemList();
- items != NULL;
- items = items->next)
- {
- SPItem *item = reinterpret_cast<SPItem *>(items->data);
+ SelContainer itemlist=desktop->getSelection()->itemList();
+ for(SelContainer::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
+ SPItem *item = SP_ITEM(*i);
if (SP_IS_GENERICELLIPSE(item)) {
Inkscape::XML::Node *repr = item->getRepr();
repr->setAttribute("sodipodi:open", NULL);
@@ -271,11 +264,9 @@ static void sp_arc_toolbox_selection_changed(Inkscape::Selection *selection, GOb
purge_repr_listener( tbl, tbl );
- for (GSList const *items = selection->itemList();
- items != NULL;
- items = items->next)
- {
- SPItem *item = reinterpret_cast<SPItem *>(items->data);
+ SelContainer itemlist=selection->itemList();
+ for(SelContainer::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
+ SPItem *item = SP_ITEM(*i);
if (SP_IS_GENERICELLIPSE(item)) {
n_selected++;
repr = item->getRepr();
diff --git a/src/widgets/connector-toolbar.cpp b/src/widgets/connector-toolbar.cpp
index c906f7de4..401ce932a 100644
--- a/src/widgets/connector-toolbar.cpp
+++ b/src/widgets/connector-toolbar.cpp
@@ -76,7 +76,6 @@ static void sp_connector_path_set_ignore(void)
static void sp_connector_orthogonal_toggled( GtkToggleAction* act, GObject *tbl )
{
SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data( tbl, "desktop" ));
- Inkscape::Selection * selection = desktop->getSelection();
SPDocument *doc = desktop->getDocument();
if (!DocumentUndo::getUndoSensitive(doc)) {
@@ -98,9 +97,9 @@ static void sp_connector_orthogonal_toggled( GtkToggleAction* act, GObject *tbl
gchar *value = is_orthog ? orthog_str : polyline_str ;
bool modmade = false;
- GSList *l = (GSList *) selection->itemList();
- while (l) {
- SPItem *item = SP_ITEM(l->data);
+ SelContainer itemlist=desktop->getSelection()->itemList();
+ for(SelContainer::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
+ SPItem *item = SP_ITEM(*i);
if (Inkscape::UI::Tools::cc_item_is_connector(item)) {
item->setAttribute( "inkscape:connector-type",
@@ -108,7 +107,6 @@ static void sp_connector_orthogonal_toggled( GtkToggleAction* act, GObject *tbl
item->avoidRef->handleSettingChange();
modmade = true;
}
- l = l->next;
}
if (!modmade) {
@@ -126,7 +124,6 @@ static void sp_connector_orthogonal_toggled( GtkToggleAction* act, GObject *tbl
static void connector_curvature_changed(GtkAdjustment *adj, GObject* tbl)
{
SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data( tbl, "desktop" ));
- Inkscape::Selection * selection = desktop->getSelection();
SPDocument *doc = desktop->getDocument();
if (!DocumentUndo::getUndoSensitive(doc)) {
@@ -147,9 +144,9 @@ static void connector_curvature_changed(GtkAdjustment *adj, GObject* tbl)
g_ascii_dtostr(value, G_ASCII_DTOSTR_BUF_SIZE, newValue);
bool modmade = false;
- GSList *l = (GSList *) selection->itemList();
- while (l) {
- SPItem *item = SP_ITEM(l->data);
+ SelContainer itemlist=desktop->getSelection()->itemList();
+ for(SelContainer::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
+ SPItem *item = SP_ITEM(*i);
if (Inkscape::UI::Tools::cc_item_is_connector(item)) {
item->setAttribute( "inkscape:connector-curvature",
@@ -157,7 +154,6 @@ static void connector_curvature_changed(GtkAdjustment *adj, GObject* tbl)
item->avoidRef->handleSettingChange();
modmade = true;
}
- l = l->next;
}
if (!modmade) {
diff --git a/src/widgets/fill-style.cpp b/src/widgets/fill-style.cpp
index d60a92b8b..2c298b04d 100644
--- a/src/widgets/fill-style.cpp
+++ b/src/widgets/fill-style.cpp
@@ -481,7 +481,7 @@ void FillNStroke::updateFromPaint()
SPDocument *document = desktop->getDocument();
Inkscape::Selection *selection = desktop->getSelection();
- GSList const *items = selection->itemList();
+ SelContainer const items = selection->itemList();
switch (psel->mode) {
case SPPaintSelector::MODE_EMPTY:
@@ -543,7 +543,7 @@ void FillNStroke::updateFromPaint()
case SPPaintSelector::MODE_GRADIENT_LINEAR:
case SPPaintSelector::MODE_GRADIENT_RADIAL:
case SPPaintSelector::MODE_SWATCH:
- if (items) {
+ if (!items.empty()) {
SPGradientType const gradient_type = ( psel->mode != SPPaintSelector::MODE_GRADIENT_RADIAL
? SP_GRADIENT_TYPE_LINEAR
: SP_GRADIENT_TYPE_RADIAL );
@@ -561,7 +561,7 @@ void FillNStroke::updateFromPaint()
/* No vector in paint selector should mean that we just changed mode */
SPStyle query(desktop->doc());
- int result = objects_query_fillstroke(const_cast<GSList *>(items), &query, kind == FILL);
+ int result = objects_query_fillstroke(items, &query, kind == FILL);
if (result == QUERY_STYLE_MULTIPLE_SAME) {
SPIPaint &targPaint = (kind == FILL) ? query.fill : query.stroke;
SPColor common;
@@ -576,39 +576,39 @@ void FillNStroke::updateFromPaint()
}
}
- for (GSList const *i = items; i != NULL; i = i->next) {
+ for(SelContainer::const_iterator i=items.begin();i!=items.end();i++){
//FIXME: see above
if (kind == FILL) {
- sp_repr_css_change_recursive(reinterpret_cast<SPObject*>(i->data)->getRepr(), css, "style");
+ sp_repr_css_change_recursive(reinterpret_cast<SPObject*>(*i)->getRepr(), css, "style");
}
if (!vector) {
SPGradient *gr = sp_gradient_vector_for_object( document,
desktop,
- reinterpret_cast<SPObject*>(i->data),
+ reinterpret_cast<SPObject*>(*i),
(kind == FILL) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE,
createSwatch );
if ( gr && createSwatch ) {
gr->setSwatch();
}
- sp_item_set_gradient(SP_ITEM(i->data),
+ sp_item_set_gradient(SP_ITEM(*i),
gr,
gradient_type, (kind == FILL) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE);
} else {
- sp_item_set_gradient(SP_ITEM(i->data), vector, gradient_type, (kind == FILL) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE);
+ sp_item_set_gradient(SP_ITEM(*i), vector, gradient_type, (kind == FILL) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE);
}
}
} else {
// We have changed from another gradient type, or modified spread/units within
// this gradient type.
vector = sp_gradient_ensure_vector_normalized(vector);
- for (GSList const *i = items; i != NULL; i = i->next) {
+ for(SelContainer::const_iterator i=items.begin();i!=items.end();i++){
//FIXME: see above
if (kind == FILL) {
- sp_repr_css_change_recursive(reinterpret_cast<SPObject*>(i->data)->getRepr(), css, "style");
+ sp_repr_css_change_recursive(reinterpret_cast<SPObject*>(*i)->getRepr(), css, "style");
}
- SPGradient *gr = sp_item_set_gradient(SP_ITEM(i->data), vector, gradient_type, (kind == FILL) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE);
+ SPGradient *gr = sp_item_set_gradient(SP_ITEM(*i), vector, gradient_type, (kind == FILL) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE);
psel->pushAttrsToGradient( gr );
}
}
@@ -625,7 +625,7 @@ void FillNStroke::updateFromPaint()
case SPPaintSelector::MODE_PATTERN:
- if (items) {
+ if (!items.empty()) {
SPPattern *pattern = psel->getPattern();
if (!pattern) {
@@ -648,12 +648,12 @@ void FillNStroke::updateFromPaint()
// cannot just call sp_desktop_set_style, because we don't want to touch those
// objects who already have the same root pattern but through a different href
// chain. FIXME: move this to a sp_item_set_pattern
- for (GSList const *i = items; i != NULL; i = i->next) {
- Inkscape::XML::Node *selrepr = reinterpret_cast<SPObject*>(i->data)->getRepr();
+ for(SelContainer::const_iterator i=items.begin();i!=items.end();i++){
+ Inkscape::XML::Node *selrepr = reinterpret_cast<SPObject*>(*i)->getRepr();
if ( (kind == STROKE) && !selrepr) {
continue;
}
- SPObject *selobj = reinterpret_cast<SPObject*>(i->data);
+ SPObject *selobj = reinterpret_cast<SPObject*>(*i);
SPStyle *style = selobj->style;
if (style && ((kind == FILL) ? style->fill : style->stroke).isPaintserver()) {
@@ -686,7 +686,7 @@ void FillNStroke::updateFromPaint()
break;
case SPPaintSelector::MODE_UNSET:
- if (items) {
+ if (!items.empty()) {
SPCSSAttr *css = sp_repr_css_attr_new();
if (kind == FILL) {
sp_repr_css_unset_property(css, "fill");
diff --git a/src/widgets/gradient-toolbar.cpp b/src/widgets/gradient-toolbar.cpp
index 7ce04403b..b9608130b 100644
--- a/src/widgets/gradient-toolbar.cpp
+++ b/src/widgets/gradient-toolbar.cpp
@@ -116,8 +116,9 @@ void gr_apply_gradient(Inkscape::Selection *selection, GrDrag *drag, SPGradient
}
// If no drag or no dragger selected, act on selection
- for (GSList const* i = selection->itemList(); i != NULL; i = i->next) {
- gr_apply_gradient_to_item(SP_ITEM(i->data), gr, initialType, initialMode, initialMode);
+ SelContainer itemlist=selection->itemList();
+ for(SelContainer::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
+ gr_apply_gradient_to_item(SP_ITEM(*i), gr, initialType, initialMode, initialMode);
}
}
@@ -217,8 +218,9 @@ void gr_get_dt_selected_gradient(Inkscape::Selection *selection, SPGradient *&gr
{
SPGradient *gradient = 0;
- for (GSList const* i = selection->itemList(); i; i = i->next) {
- SPItem *item = SP_ITEM(i->data); // get the items gradient, not the getVector() version
+ SelContainer itemlist=selection->itemList();
+ for(SelContainer::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
+ SPItem *item = SP_ITEM(*i);// get the items gradient, not the getVector() version
SPStyle *style = item->style;
SPPaintServer *server = 0;
@@ -284,8 +286,9 @@ void gr_read_selection( Inkscape::Selection *selection,
}
// If no selected dragger, read desktop selection
- for (GSList const* i = selection->itemList(); i; i = i->next) {
- SPItem *item = SP_ITEM(i->data);
+ SelContainer itemlist=selection->itemList();
+ for(SelContainer::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
+ SPItem *item = SP_ITEM(*i);
SPStyle *style = item->style;
if (style && (style->fill.isPaintserver())) {
diff --git a/src/widgets/mesh-toolbar.cpp b/src/widgets/mesh-toolbar.cpp
index 3d549047a..b4176db6f 100644
--- a/src/widgets/mesh-toolbar.cpp
+++ b/src/widgets/mesh-toolbar.cpp
@@ -87,8 +87,9 @@ void ms_read_selection( Inkscape::Selection *selection,
bool first = true;
ms_smooth = SP_MESH_SMOOTH_NONE;
- for (GSList const* i = selection->itemList(); i; i = i->next) {
- SPItem *item = SP_ITEM(i->data);
+ SelContainer itemlist=selection->itemList();
+ for(SelContainer::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
+ SPItem *item = SP_ITEM(*i);
SPStyle *style = item->style;
if (style && (style->fill.isPaintserver())) {
@@ -213,8 +214,9 @@ void ms_get_dt_selected_gradient(Inkscape::Selection *selection, SPMeshGradient
{
SPMeshGradient *gradient = 0;
- for (GSList const* i = selection->itemList(); i; i = i->next) {
- SPItem *item = SP_ITEM(i->data); // get the items gradient, not the getVector() version
+ SelContainer itemlist=selection->itemList();
+ for(SelContainer::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
+ SPItem *item = SP_ITEM(*i);// get the items gradient, not the getVector() version
SPStyle *style = item->style;
SPPaintServer *server = 0;
diff --git a/src/widgets/rect-toolbar.cpp b/src/widgets/rect-toolbar.cpp
index 016aa4987..1f19867ee 100644
--- a/src/widgets/rect-toolbar.cpp
+++ b/src/widgets/rect-toolbar.cpp
@@ -106,12 +106,13 @@ static void sp_rtb_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const *
bool modmade = false;
Inkscape::Selection *selection = desktop->getSelection();
- for (GSList const *items = selection->itemList(); items != NULL; items = items->next) {
- if (SP_IS_RECT(items->data)) {
+ SelContainer itemlist=selection->itemList();
+ for(SelContainer::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
+ if (SP_IS_RECT(*i)) {
if (gtk_adjustment_get_value(adj) != 0) {
- (SP_RECT(items->data)->*setter)(Quantity::convert(gtk_adjustment_get_value(adj), unit, desktop->getNamedView()->svg_units));
+ (SP_RECT(*i)->*setter)(Quantity::convert(gtk_adjustment_get_value(adj), unit, desktop->getNamedView()->svg_units));
} else {
- SP_OBJECT(items->data)->getRepr()->setAttribute(value_name, NULL);
+ SP_OBJECT(*i)->getRepr()->setAttribute(value_name, NULL);
}
modmade = true;
}
@@ -243,12 +244,11 @@ static void sp_rect_toolbox_selection_changed(Inkscape::Selection *selection, GO
}
purge_repr_listener( tbl, tbl );
- for (GSList const *items = selection->itemList();
- items != NULL;
- items = items->next) {
- if (SP_IS_RECT(reinterpret_cast<SPItem *>(items->data))) {
+ SelContainer itemlist=selection->itemList();
+ for(SelContainer::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
+ if (SP_IS_RECT(reinterpret_cast<SPItem *>(*i))) {
n_selected++;
- item = reinterpret_cast<SPItem *>(items->data);
+ item = reinterpret_cast<SPItem *>(*i);
repr = item->getRepr();
}
}
diff --git a/src/widgets/spiral-toolbar.cpp b/src/widgets/spiral-toolbar.cpp
index 3fb0015c1..2f4ad481d 100644
--- a/src/widgets/spiral-toolbar.cpp
+++ b/src/widgets/spiral-toolbar.cpp
@@ -79,11 +79,9 @@ static void sp_spl_tb_value_changed(GtkAdjustment *adj, GObject *tbl, Glib::ustr
gchar* namespaced_name = g_strconcat("sodipodi:", value_name.data(), NULL);
bool modmade = false;
- for (GSList const *items = desktop->getSelection()->itemList();
- items != NULL;
- items = items->next)
- {
- SPItem *item = reinterpret_cast<SPItem*>(items->data);
+ SelContainer itemlist=desktop->getSelection()->itemList();
+ for(SelContainer::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
+ SPItem *item = SP_ITEM(*i);
if (SP_IS_SPIRAL(item)) {
Inkscape::XML::Node *repr = item->getRepr();
sp_repr_set_svg_double( repr, namespaced_name,
@@ -197,11 +195,9 @@ static void sp_spiral_toolbox_selection_changed(Inkscape::Selection *selection,
purge_repr_listener( tbl, tbl );
- for (GSList const *items = selection->itemList();
- items != NULL;
- items = items->next)
- {
- SPItem *item = reinterpret_cast<SPItem*>(items->data);
+ SelContainer itemlist=selection->itemList();
+ for(SelContainer::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
+ SPItem *item = SP_ITEM(*i);
if (SP_IS_SPIRAL(item)) {
n_selected++;
repr = item->getRepr();
diff --git a/src/widgets/star-toolbar.cpp b/src/widgets/star-toolbar.cpp
index cf12391c1..37daf69d0 100644
--- a/src/widgets/star-toolbar.cpp
+++ b/src/widgets/star-toolbar.cpp
@@ -83,9 +83,9 @@ static void sp_stb_magnitude_value_changed( GtkAdjustment *adj, GObject *dataKlu
bool modmade = false;
Inkscape::Selection *selection = desktop->getSelection();
- GSList const *items = selection->itemList();
- for (; items != NULL; items = items->next) {
- SPItem *item = reinterpret_cast<SPItem*>(items->data);
+ SelContainer itemlist=selection->itemList();
+ for(SelContainer::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
+ SPItem *item = SP_ITEM(*i);
if (SP_IS_STAR(item)) {
Inkscape::XML::Node *repr = item->getRepr();
sp_repr_set_int(repr,"sodipodi:sides",
@@ -128,9 +128,9 @@ static void sp_stb_proportion_value_changed( GtkAdjustment *adj, GObject *dataKl
bool modmade = false;
Inkscape::Selection *selection = desktop->getSelection();
- GSList const *items = selection->itemList();
- for (; items != NULL; items = items->next) {
- SPItem *item = reinterpret_cast<SPItem *>(items->data);
+ SelContainer itemlist=selection->itemList();
+ for(SelContainer::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
+ SPItem *item = SP_ITEM(*i);
if (SP_IS_STAR(item)) {
Inkscape::XML::Node *repr = item->getRepr();
@@ -178,7 +178,6 @@ static void sp_stb_sides_flat_state_changed( EgeSelectOneAction *act, GObject *d
g_object_set_data( dataKludge, "freeze", GINT_TO_POINTER(TRUE) );
Inkscape::Selection *selection = desktop->getSelection();
- GSList const *items = selection->itemList();
GtkAction* prop_action = GTK_ACTION( g_object_get_data( dataKludge, "prop_action" ) );
bool modmade = false;
@@ -186,8 +185,9 @@ static void sp_stb_sides_flat_state_changed( EgeSelectOneAction *act, GObject *d
gtk_action_set_sensitive( prop_action, !flat );
}
- for (; items != NULL; items = items->next) {
- SPItem *item = reinterpret_cast<SPItem *>(items->data);
+ SelContainer itemlist=selection->itemList();
+ for(SelContainer::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
+ SPItem *item = SP_ITEM(*i);
if (SP_IS_STAR(item)) {
Inkscape::XML::Node *repr = item->getRepr();
repr->setAttribute("inkscape:flatsided", flat ? "true" : "false" );
@@ -224,9 +224,9 @@ static void sp_stb_rounded_value_changed( GtkAdjustment *adj, GObject *dataKludg
bool modmade = false;
Inkscape::Selection *selection = desktop->getSelection();
- GSList const *items = selection->itemList();
- for (; items != NULL; items = items->next) {
- SPItem *item = reinterpret_cast<SPItem*>(items->data);
+ SelContainer itemlist=selection->itemList();
+ for(SelContainer::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
+ SPItem *item = SP_ITEM(*i);
if (SP_IS_STAR(item)) {
Inkscape::XML::Node *repr = item->getRepr();
sp_repr_set_svg_double(repr, "inkscape:rounded",
@@ -264,9 +264,9 @@ static void sp_stb_randomized_value_changed( GtkAdjustment *adj, GObject *dataKl
bool modmade = false;
Inkscape::Selection *selection = desktop->getSelection();
- GSList const *items = selection->itemList();
- for (; items != NULL; items = items->next) {
- SPItem *item = reinterpret_cast<SPItem *>(items->data);
+ SelContainer itemlist=selection->itemList();
+ for(SelContainer::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
+ SPItem *item = SP_ITEM(*i);
if (SP_IS_STAR(item)) {
Inkscape::XML::Node *repr = item->getRepr();
sp_repr_set_svg_double(repr, "inkscape:randomized",
@@ -367,11 +367,9 @@ sp_star_toolbox_selection_changed(Inkscape::Selection *selection, GObject *tbl)
purge_repr_listener( tbl, tbl );
- for (GSList const *items = selection->itemList();
- items != NULL;
- items = items->next)
- {
- SPItem* item = reinterpret_cast<SPItem *>(items->data);
+ SelContainer itemlist=selection->itemList();
+ for(SelContainer::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
+ SPItem *item = SP_ITEM(*i);
if (SP_IS_STAR(item)) {
n_selected++;
repr = item->getRepr();
diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp
index 5ca06a795..2599fe537 100644
--- a/src/widgets/stroke-style.cpp
+++ b/src/widgets/stroke-style.cpp
@@ -475,9 +475,9 @@ void StrokeStyle::markerSelectCB(MarkerComboBox *marker_combo, StrokeStyle *spw,
//spw->updateMarkerHist(which);
Inkscape::Selection *selection = spw->desktop->getSelection();
- GSList const *items = selection->itemList();
- for (; items != NULL; items = items->next) {
- SPItem *item = reinterpret_cast<SPItem *>(items->data);
+ SelContainer itemlist=selection->itemList();
+ for(SelContainer::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
+ SPItem *item = SP_ITEM(*i);
if (!SP_IS_SHAPE(item) || SP_IS_RECT(item)) { // can't set marker to rect, until it's converted to using <path>
continue;
}
@@ -901,8 +901,8 @@ StrokeStyle::updateLine()
if (!sel || sel->isEmpty())
return;
- GSList const *objects = sel->itemList();
- SPObject * const object = SP_OBJECT(objects->data);
+ SelContainer const objects = sel->itemList();
+ SPObject * const object = SP_OBJECT(objects.front());
SPStyle * const style = object->style;
/* Markers */
@@ -957,13 +957,12 @@ StrokeStyle::scaleLine()
SPDocument *document = desktop->getDocument();
Inkscape::Selection *selection = desktop->getSelection();
-
- GSList const *items = selection->itemList();
+ SelContainer items=selection->itemList();
/* TODO: Create some standardized method */
SPCSSAttr *css = sp_repr_css_attr_new();
- if (items) {
+ if (!items.empty()) {
#if WITH_GTKMM_3_0
double width_typed = (*widthAdj)->get_value();
double const miterlimit = (*miterLimitAdj)->get_value();
@@ -978,13 +977,13 @@ StrokeStyle::scaleLine()
int ndash;
dashSelector->get_dash(&ndash, &dash, &offset);
- for (GSList const *i = items; i != NULL; i = i->next) {
+ for(SelContainer::const_iterator i=items.begin();i!=items.end();i++){
/* Set stroke width */
double width;
if (unit->type == Inkscape::Util::UNIT_TYPE_LINEAR) {
width = Inkscape::Util::Quantity::convert(width_typed, unit, "px");
} else { // percentage
- gdouble old_w = SP_OBJECT(i->data)->style->stroke_width.computed;
+ gdouble old_w = SP_OBJECT(*i)->style->stroke_width.computed;
width = old_w * width_typed / 100;
}
@@ -1003,7 +1002,7 @@ StrokeStyle::scaleLine()
/* Set dash */
setScaledDash(css, ndash, dash, offset, width);
- sp_desktop_apply_css_recursive (SP_OBJECT(i->data), css, true);
+ sp_desktop_apply_css_recursive (SP_OBJECT(*i), css, true);
}
g_free(dash);
@@ -1144,7 +1143,7 @@ StrokeStyle::setCapButtons(Gtk::ToggleButton *active)
* that marker.
*/
void
-StrokeStyle::updateAllMarkers(GSList const *objects)
+StrokeStyle::updateAllMarkers(SelContainer const &objects)
{
struct { MarkerComboBox *key; int loc; } const keyloc[] = {
{ startMarkerCombo, SP_MARKER_LOC_START },
@@ -1153,8 +1152,8 @@ StrokeStyle::updateAllMarkers(GSList const *objects)
};
bool all_texts = true;
- for (GSList *i = (GSList *) objects; i != NULL; i = i->next) {
- if (!SP_IS_TEXT (i->data)) {
+ for(SelContainer::const_iterator i=objects.begin();i!=objects.end();i++){
+ if (!SP_IS_TEXT (*i)) {
all_texts = false;
}
}
@@ -1167,7 +1166,7 @@ StrokeStyle::updateAllMarkers(GSList const *objects)
// We show markers of the first object in the list only
// FIXME: use the first in the list that has the marker of each type, if any
- SPObject *object = SP_OBJECT(objects->data);
+ SPObject *object = SP_OBJECT(objects.front());
for (unsigned i = 0; i < G_N_ELEMENTS(keyloc); ++i) {
// For all three marker types,
diff --git a/src/widgets/stroke-style.h b/src/widgets/stroke-style.h
index 83048cb76..286305ec3 100644
--- a/src/widgets/stroke-style.h
+++ b/src/widgets/stroke-style.h
@@ -153,7 +153,7 @@ private:
};
void updateLine();
- void updateAllMarkers(GSList const *objects);
+ void updateAllMarkers(SelContainer const &objects);
void updateMarkerHist(SPMarkerLoc const which);
void setDashSelectorFromStyle(SPDashSelector *dsel, SPStyle *style);
void setJoinType (unsigned const jointype);
diff --git a/src/widgets/text-toolbar.cpp b/src/widgets/text-toolbar.cpp
index 3d2e6eef8..ba7dfc1fd 100644
--- a/src/widgets/text-toolbar.cpp
+++ b/src/widgets/text-toolbar.cpp
@@ -366,9 +366,10 @@ static void sp_text_align_mode_changed( EgeSelectOneAction *act, GObject *tbl )
// move the x of all texts to preserve the same bbox
Inkscape::Selection *selection = desktop->getSelection();
- for (GSList const *items = selection->itemList(); items != NULL; items = items->next) {
- if (SP_IS_TEXT(SP_ITEM(items->data))) {
- SPItem *item = SP_ITEM(items->data);
+ SelContainer itemlist=selection->itemList();
+ for(SelContainer::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
+ if (SP_IS_TEXT(SP_ITEM(*i))) {
+ SPItem *item = SP_ITEM(*i);
unsigned writing_mode = item->style->writing_mode.value;
// below, variable names suggest horizontal move, but we check the writing direction
@@ -517,11 +518,11 @@ static void sp_text_lineheight_value_changed( GtkAdjustment *adj, GObject *tbl )
// Until deprecated sodipodi:linespacing purged:
Inkscape::Selection *selection = desktop->getSelection();
- GSList const *items = selection->itemList();
bool modmade = false;
- for (; items != NULL; items = items->next) {
- if (SP_IS_TEXT (items->data)) {
- SP_OBJECT(items->data)->getRepr()->setAttribute("sodipodi:linespacing", sp_repr_css_property (css, "line-height", NULL));
+ SelContainer itemlist=selection->itemList();
+ for(SelContainer::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
+ if (SP_IS_TEXT (*i)) {
+ SP_OBJECT(*i)->getRepr()->setAttribute("sodipodi:linespacing", sp_repr_css_property (css, "line-height", NULL));
modmade = true;
}
}
@@ -863,12 +864,11 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/
// Only flowed text can be justified, only normal text can be kerned...
// Find out if we have flowed text now so we can use it several places
gboolean isFlow = false;
- for (GSList const *items = SP_ACTIVE_DESKTOP->getSelection()->itemList();
- items != NULL;
- items = items->next) {
+ SelContainer itemlist=SP_ACTIVE_DESKTOP->getSelection()->itemList();
+ for(SelContainer::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
// const gchar* id = reinterpret_cast<SPItem *>(items->data)->getId();
// std::cout << " " << id << std::endl;
- if( SP_IS_FLOWTEXT(SP_ITEM(items->data))) {
+ if( SP_IS_FLOWTEXT(SP_ITEM(*i))) {
isFlow = true;
// std::cout << " Found flowed text" << std::endl;
break;
@@ -1153,14 +1153,14 @@ static void sp_text_toolbox_select_cb( GtkEntry* entry, GtkEntryIconPosition /*p
//std::cout << "text_toolbox_missing_font_cb: selecting: " << family << std::endl;
// Get all items with matching font-family set (not inherited!).
- GSList *selectList = NULL;
+ SelContainer selectList;
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
SPDocument *document = desktop->getDocument();
- GSList *allList = get_all_items(NULL, document->getRoot(), desktop, false, false, true, NULL);
- for (GSList *i = allList; i != NULL; i = i->next) {
-
- SPItem *item = SP_ITEM(i->data);
+ SelContainer x,y;
+ SelContainer allList = get_all_items(x, document->getRoot(), desktop, false, false, true, y);
+ for(SelContainer::const_iterator i=allList.begin();i!=allList.end();i++){
+ SPItem *item = SP_ITEM(*i);
SPStyle *style = item->style;
if (style) {
@@ -1177,7 +1177,7 @@ static void sp_text_toolbox_select_cb( GtkEntry* entry, GtkEntryIconPosition /*p
if (family_style.compare( family ) == 0 ) {
//std::cout << " found: " << item->getId() << std::endl;
- selectList = g_slist_prepend (selectList, item);
+ selectList.push_front(static_cast<SPObject*>(item));
}
}
}