From 4d75f1ecca2fcab4cbfec9fb84c5b1f3647dbc17 Mon Sep 17 00:00:00 2001 From: Tomasz Boczkowski Date: Wed, 28 May 2014 23:28:17 +0200 Subject: SPPattern c++-sification: replaced function by methods (bzr r13341.6.21) --- src/widgets/fill-style.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/widgets/fill-style.cpp') diff --git a/src/widgets/fill-style.cpp b/src/widgets/fill-style.cpp index d1d318abe..27ab7156c 100644 --- a/src/widgets/fill-style.cpp +++ b/src/widgets/fill-style.cpp @@ -304,7 +304,7 @@ void FillNStroke::performUpdate() psel->setGradientProperties( rg->getUnits(), rg->getSpread() ); } else if (SP_IS_PATTERN(server)) { - SPPattern *pat = pattern_getroot(SP_PATTERN(server)); + SPPattern *pat = SP_PATTERN(server)->get_root(); psel->updatePatternList( pat ); } } @@ -663,7 +663,7 @@ void FillNStroke::updateFromPaint() SPPaintServer *server = (kind == FILL) ? selobj->style->getFillPaintServer() : selobj->style->getStrokePaintServer(); - if (SP_IS_PATTERN(server) && pattern_getroot(SP_PATTERN(server)) == pattern) + if (SP_IS_PATTERN(server) && SP_PATTERN(server)->get_root() == pattern) // only if this object's pattern is not rooted in our selected pattern, apply continue; } -- cgit v1.2.3 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/widgets/fill-style.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/widgets/fill-style.cpp') 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(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(i->data)->getRepr(), css, "style"); + sp_repr_css_change_recursive(reinterpret_cast(*i)->getRepr(), css, "style"); } if (!vector) { SPGradient *gr = sp_gradient_vector_for_object( document, desktop, - reinterpret_cast(i->data), + reinterpret_cast(*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(i->data)->getRepr(), css, "style"); + sp_repr_css_change_recursive(reinterpret_cast(*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(i->data)->getRepr(); + for(SelContainer::const_iterator i=items.begin();i!=items.end();i++){ + Inkscape::XML::Node *selrepr = reinterpret_cast(*i)->getRepr(); if ( (kind == STROKE) && !selrepr) { continue; } - SPObject *selobj = reinterpret_cast(i->data); + SPObject *selobj = reinterpret_cast(*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"); -- 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/widgets/fill-style.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/widgets/fill-style.cpp') diff --git a/src/widgets/fill-style.cpp b/src/widgets/fill-style.cpp index 2c298b04d..dbb84efba 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(); - SelContainer const items = selection->itemList(); + std::vector const items = selection->itemList(); switch (psel->mode) { case SPPaintSelector::MODE_EMPTY: @@ -576,7 +576,7 @@ void FillNStroke::updateFromPaint() } } - for(SelContainer::const_iterator i=items.begin();i!=items.end();i++){ + for(std::vector::const_iterator i=items.begin();i!=items.end();i++){ //FIXME: see above if (kind == FILL) { sp_repr_css_change_recursive(reinterpret_cast(*i)->getRepr(), css, "style"); @@ -602,7 +602,7 @@ void FillNStroke::updateFromPaint() // We have changed from another gradient type, or modified spread/units within // this gradient type. vector = sp_gradient_ensure_vector_normalized(vector); - for(SelContainer::const_iterator i=items.begin();i!=items.end();i++){ + for(std::vector::const_iterator i=items.begin();i!=items.end();i++){ //FIXME: see above if (kind == FILL) { sp_repr_css_change_recursive(reinterpret_cast(*i)->getRepr(), css, "style"); @@ -648,7 +648,7 @@ 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(SelContainer::const_iterator i=items.begin();i!=items.end();i++){ + for(std::vector::const_iterator i=items.begin();i!=items.end();i++){ Inkscape::XML::Node *selrepr = reinterpret_cast(*i)->getRepr(); if ( (kind == STROKE) && !selrepr) { continue; -- 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/widgets/fill-style.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/widgets/fill-style.cpp') diff --git a/src/widgets/fill-style.cpp b/src/widgets/fill-style.cpp index dbb84efba..7d5a89cf5 100644 --- a/src/widgets/fill-style.cpp +++ b/src/widgets/fill-style.cpp @@ -591,11 +591,11 @@ void FillNStroke::updateFromPaint() if ( gr && createSwatch ) { gr->setSwatch(); } - sp_item_set_gradient(SP_ITEM(*i), + sp_item_set_gradient(*i, gr, gradient_type, (kind == FILL) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE); } else { - sp_item_set_gradient(SP_ITEM(*i), vector, gradient_type, (kind == FILL) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE); + sp_item_set_gradient(*i, vector, gradient_type, (kind == FILL) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE); } } } else { @@ -608,7 +608,7 @@ void FillNStroke::updateFromPaint() sp_repr_css_change_recursive(reinterpret_cast(*i)->getRepr(), css, "style"); } - SPGradient *gr = sp_item_set_gradient(SP_ITEM(*i), vector, gradient_type, (kind == FILL) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE); + SPGradient *gr = sp_item_set_gradient(*i, vector, gradient_type, (kind == FILL) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE); psel->pushAttrsToGradient( gr ); } } -- 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/widgets/fill-style.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/widgets/fill-style.cpp') diff --git a/src/widgets/fill-style.cpp b/src/widgets/fill-style.cpp index 7d5a89cf5..1d258bbb0 100644 --- a/src/widgets/fill-style.cpp +++ b/src/widgets/fill-style.cpp @@ -579,7 +579,7 @@ void FillNStroke::updateFromPaint() for(std::vector::const_iterator i=items.begin();i!=items.end();i++){ //FIXME: see above if (kind == FILL) { - sp_repr_css_change_recursive(reinterpret_cast(*i)->getRepr(), css, "style"); + sp_repr_css_change_recursive((*i)->getRepr(), css, "style"); } if (!vector) { @@ -605,7 +605,7 @@ void FillNStroke::updateFromPaint() for(std::vector::const_iterator i=items.begin();i!=items.end();i++){ //FIXME: see above if (kind == FILL) { - sp_repr_css_change_recursive(reinterpret_cast(*i)->getRepr(), css, "style"); + sp_repr_css_change_recursive((*i)->getRepr(), css, "style"); } SPGradient *gr = sp_item_set_gradient(*i, vector, gradient_type, (kind == FILL) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE); @@ -649,11 +649,11 @@ void FillNStroke::updateFromPaint() // objects who already have the same root pattern but through a different href // chain. FIXME: move this to a sp_item_set_pattern for(std::vector::const_iterator i=items.begin();i!=items.end();i++){ - Inkscape::XML::Node *selrepr = reinterpret_cast(*i)->getRepr(); + Inkscape::XML::Node *selrepr = (*i)->getRepr(); if ( (kind == STROKE) && !selrepr) { continue; } - SPObject *selobj = reinterpret_cast(*i); + SPObject *selobj = *i; SPStyle *style = selobj->style; if (style && ((kind == FILL) ? style->fill : style->stroke).isPaintserver()) { -- cgit v1.2.3 From ba4dbfb351180e0fc4ad57be6e3534fa2ab5cf8c Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Tue, 28 Apr 2015 00:38:31 +0100 Subject: Fix unnecessary inclusion of glibmm/threads.h. This can be resolved by ensuring that glibmm headers always preceed glib.h headers. Same applies with gtkmm/gtk+ etc (bzr r14064) --- src/widgets/fill-style.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/widgets/fill-style.cpp') diff --git a/src/widgets/fill-style.cpp b/src/widgets/fill-style.cpp index d60a92b8b..b92b0a474 100644 --- a/src/widgets/fill-style.cpp +++ b/src/widgets/fill-style.cpp @@ -22,10 +22,6 @@ # include "config.h" #endif -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include -#endif - #include #include -- cgit v1.2.3 From 705243e1266aec7527ae76065213ca7536ed7c41 Mon Sep 17 00:00:00 2001 From: Tomasz Boczkowski Date: Sun, 3 May 2015 12:37:06 +0200 Subject: renamed SPPattern methods to match coding style (bzr r14059.1.20) --- src/widgets/fill-style.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/widgets/fill-style.cpp') diff --git a/src/widgets/fill-style.cpp b/src/widgets/fill-style.cpp index e29420ac6..264ebff5a 100644 --- a/src/widgets/fill-style.cpp +++ b/src/widgets/fill-style.cpp @@ -300,7 +300,7 @@ void FillNStroke::performUpdate() psel->setGradientProperties( rg->getUnits(), rg->getSpread() ); } else if (SP_IS_PATTERN(server)) { - SPPattern *pat = SP_PATTERN(server)->get_root(); + SPPattern *pat = SP_PATTERN(server)->rootPattern(); psel->updatePatternList( pat ); } } @@ -656,7 +656,7 @@ void FillNStroke::updateFromPaint() SPPaintServer *server = (kind == FILL) ? selobj->style->getFillPaintServer() : selobj->style->getStrokePaintServer(); - if (SP_IS_PATTERN(server) && SP_PATTERN(server)->get_root() == pattern) + if (SP_IS_PATTERN(server) && SP_PATTERN(server)->rootPattern() == pattern) // only if this object's pattern is not rooted in our selected pattern, apply continue; } -- cgit v1.2.3 From ae5fc6f7c5d78bca051dcc308d3344c65fb802cb Mon Sep 17 00:00:00 2001 From: Tomasz Boczkowski Date: Sat, 9 May 2015 13:41:17 +0200 Subject: Using MODE_SOLID_COLOR in paint selector instead of duplicated MODE_COLOR_RGB and MODE_COLOR_CMYK (bzr r14059.1.22) --- src/widgets/fill-style.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/widgets/fill-style.cpp') diff --git a/src/widgets/fill-style.cpp b/src/widgets/fill-style.cpp index 264ebff5a..fa5eabab4 100644 --- a/src/widgets/fill-style.cpp +++ b/src/widgets/fill-style.cpp @@ -431,8 +431,7 @@ void FillNStroke::dragFromPaint() update = true; switch (psel->mode) { - case SPPaintSelector::MODE_COLOR_RGB: - case SPPaintSelector::MODE_COLOR_CMYK: + case SPPaintSelector::MODE_SOLID_COLOR: { // local change, do not update from selection dragId = g_timeout_add_full(G_PRIORITY_DEFAULT, 100, dragDelayCB, this, 0); @@ -505,8 +504,7 @@ void FillNStroke::updateFromPaint() break; } - case SPPaintSelector::MODE_COLOR_RGB: - case SPPaintSelector::MODE_COLOR_CMYK: + case SPPaintSelector::MODE_SOLID_COLOR: { if (kind == FILL) { // FIXME: fix for GTK breakage, see comment in SelectedStyle::on_opacity_changed; here it results in losing release events -- cgit v1.2.3