summaryrefslogtreecommitdiffstats
path: root/src/widgets/fill-style.cpp
diff options
context:
space:
mode:
authorTomasz Boczkowski <penginsbacon@gmail.com>2015-05-02 09:43:24 +0000
committerTomasz Boczkowski <penginsbacon@gmail.com>2015-05-02 09:43:24 +0000
commit4ae263b8d394775ff631efaacc835346af1ffdae (patch)
tree8c54527cb2698ade852a3286e84692fc29b74ad8 /src/widgets/fill-style.cpp
parentmerged gtk3 compile fix (diff)
parentsp-text: Whitespace cleanup (diff)
downloadinkscape-4ae263b8d394775ff631efaacc835346af1ffdae.tar.gz
inkscape-4ae263b8d394775ff631efaacc835346af1ffdae.zip
merge with trunk
(bzr r14059.1.12)
Diffstat (limited to 'src/widgets/fill-style.cpp')
-rw-r--r--src/widgets/fill-style.cpp36
1 files changed, 16 insertions, 20 deletions
diff --git a/src/widgets/fill-style.cpp b/src/widgets/fill-style.cpp
index 28e1683bd..e29420ac6 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 <glibmm/threads.h>
-#endif
-
#include <gtkmm/box.h>
#include <glibmm/i18n.h>
@@ -481,7 +477,7 @@ void FillNStroke::updateFromPaint()
SPDocument *document = desktop->getDocument();
Inkscape::Selection *selection = desktop->getSelection();
- GSList const *items = selection->itemList();
+ std::vector<SPItem*> const items = selection->itemList();
switch (psel->mode) {
case SPPaintSelector::MODE_EMPTY:
@@ -543,7 +539,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 +557,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 +572,39 @@ void FillNStroke::updateFromPaint()
}
}
- for (GSList const *i = items; i != NULL; i = i->next) {
+ for(std::vector<SPItem*>::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((*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(*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(*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(std::vector<SPItem*>::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((*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(*i, vector, gradient_type, (kind == FILL) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE);
psel->pushAttrsToGradient( gr );
}
}
@@ -625,7 +621,7 @@ void FillNStroke::updateFromPaint()
case SPPaintSelector::MODE_PATTERN:
- if (items) {
+ if (!items.empty()) {
SPPattern *pattern = psel->getPattern();
if (!pattern) {
@@ -648,12 +644,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(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();i++){
+ Inkscape::XML::Node *selrepr = (*i)->getRepr();
if ( (kind == STROKE) && !selrepr) {
continue;
}
- SPObject *selobj = reinterpret_cast<SPObject*>(i->data);
+ SPObject *selobj = *i;
SPStyle *style = selobj->style;
if (style && ((kind == FILL) ? style->fill : style->stroke).isPaintserver()) {
@@ -686,7 +682,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");