From: Jon A. Cruz Date: Sun, 4 Jul 2010 03:15:58 +0000 (-0700) Subject: Suppress gradient direction line for 'solid' gradients. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=4f21939492a1b76a83819a5ae3101c044361c7a1;p=inkscape.git Suppress gradient direction line for 'solid' gradients. Removed unneeded and outdated macro use. --- diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp index 4df25aab4..750200841 100644 --- a/src/gradient-chemistry.cpp +++ b/src/gradient-chemistry.cpp @@ -458,24 +458,23 @@ sp_gradient_transform_multiply(SPGradient *gradient, Geom::Matrix postmul, bool g_free(c); } -SPGradient * -sp_item_gradient (SPItem *item, bool fill_or_stroke) +SPGradient *sp_item_gradient(SPItem *item, bool fill_or_stroke) { - SPStyle *style = SP_OBJECT_STYLE (item); - SPGradient *gradient = NULL; + SPStyle *style = item->style; + SPGradient *gradient = 0; if (fill_or_stroke) { if (style && (style->fill.isPaintserver())) { - SPObject *server = SP_OBJECT_STYLE_FILL_SERVER(item); - if (SP_IS_GRADIENT (server)) { - gradient = SP_GRADIENT (server); + SPPaintServer *server = item->style->getFillPaintServer(); + if ( SP_IS_GRADIENT(server) ) { + gradient = SP_GRADIENT(server); } } } else { if (style && (style->stroke.isPaintserver())) { - SPObject *server = SP_OBJECT_STYLE_STROKE_SERVER(item); - if (SP_IS_GRADIENT (server)) { - gradient = SP_GRADIENT (server); + SPPaintServer *server = item->style->getStrokePaintServer(); + if ( SP_IS_GRADIENT(server) ) { + gradient = SP_GRADIENT(server); } } } @@ -1212,8 +1211,8 @@ SPGradient *sp_gradient_vector_for_object( SPDocument *const doc, SPDesktop *con ? style.fill : style.stroke ); if (paint.isPaintserver()) { - SPObject *server = is_fill? SP_OBJECT_STYLE_FILL_SERVER(o) : SP_OBJECT_STYLE_STROKE_SERVER(o); - if (SP_IS_GRADIENT (server)) { + SPObject *server = is_fill? o->style->getFillPaintServer() : o->style->getStrokePaintServer(); + if ( SP_IS_GRADIENT(server) ) { return SP_GRADIENT(server)->getVector(true); } else { color = sp_desktop_get_color(desktop, is_fill); diff --git a/src/gradient-context.cpp b/src/gradient-context.cpp index 6d6ea8761..bf1566b26 100644 --- a/src/gradient-context.cpp +++ b/src/gradient-context.cpp @@ -1,5 +1,3 @@ -#define __SP_GRADIENT_CONTEXT_C__ - /* * Gradient drawing and editing tool * diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index 55348616e..8f0010925 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -1,5 +1,3 @@ -#define __GRADIENT_DRAG_C__ - /* * On-canvas gradient dragging * @@ -503,17 +501,18 @@ GrDraggable::~GrDraggable () } -SPObject * -GrDraggable::getServer () +SPObject *GrDraggable::getServer() { - if (!item) + if (!item) { return NULL; + } SPObject *server = NULL; - if (fill_or_stroke) - server = SP_OBJECT_STYLE_FILL_SERVER (item); - else - server = SP_OBJECT_STYLE_STROKE_SERVER (item); + if (fill_or_stroke) { + server = item->style->getFillPaintServer(); + }else { + server = item->style->getStrokePaintServer(); + } return server; } @@ -1705,10 +1704,12 @@ GrDrag::updateLines () SPStyle *style = SP_OBJECT_STYLE (item); if (style && (style->fill.isPaintserver())) { - SPObject *server = SP_OBJECT_STYLE_FILL_SERVER (item); - if (SP_IS_LINEARGRADIENT (server)) { + SPPaintServer *server = item->style->getFillPaintServer(); + if ( server && server->isSolid() ) { + // Suppress "gradientness" of solid paint + } else if ( SP_IS_LINEARGRADIENT(server) ) { this->addLine (item, sp_item_gradient_get_coords (item, POINT_LG_BEGIN, 0, true), sp_item_gradient_get_coords (item, POINT_LG_END, 0, true), GR_LINE_COLOR_FILL); - } else if (SP_IS_RADIALGRADIENT (server)) { + } else if ( SP_IS_RADIALGRADIENT(server) ) { Geom::Point center = sp_item_gradient_get_coords (item, POINT_RG_CENTER, 0, true); this->addLine (item, center, sp_item_gradient_get_coords (item, POINT_RG_R1, 0, true), GR_LINE_COLOR_FILL); this->addLine (item, center, sp_item_gradient_get_coords (item, POINT_RG_R2, 0, true), GR_LINE_COLOR_FILL); @@ -1716,10 +1717,12 @@ GrDrag::updateLines () } if (style && (style->stroke.isPaintserver())) { - SPObject *server = SP_OBJECT_STYLE_STROKE_SERVER (item); - if (SP_IS_LINEARGRADIENT (server)) { + SPPaintServer *server = item->style->getStrokePaintServer(); + if ( server && server->isSolid() ) { + // Suppress "gradientness" of solid paint + } else if ( SP_IS_LINEARGRADIENT(server) ) { this->addLine (item, sp_item_gradient_get_coords (item, POINT_LG_BEGIN, 0, false), sp_item_gradient_get_coords (item, POINT_LG_END, 0, false), GR_LINE_COLOR_STROKE); - } else if (SP_IS_RADIALGRADIENT (server)) { + } else if ( SP_IS_RADIALGRADIENT(server) ) { Geom::Point center = sp_item_gradient_get_coords (item, POINT_RG_CENTER, 0, false); this->addLine (item, center, sp_item_gradient_get_coords (item, POINT_RG_R1, 0, false), GR_LINE_COLOR_STROKE); this->addLine (item, center, sp_item_gradient_get_coords (item, POINT_RG_R2, 0, false), GR_LINE_COLOR_STROKE); diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index cc153aa71..f1262e9ca 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -285,9 +285,9 @@ void sp_selection_delete_impl(GSList const *items, bool propagate = true, bool p sp_object_ref((SPObject *)i->data, NULL); } for (GSList const *i = items; i != NULL; i = i->next) { - SPItem *item = (SPItem *) i->data; - SP_OBJECT(item)->deleteObject(propagate, propagate_descendants); - sp_object_unref((SPObject *)item, NULL); + SPItem *item = reinterpret_cast(i->data); + item->deleteObject(propagate, propagate_descendants); + sp_object_unref(item, NULL); } } @@ -442,7 +442,7 @@ void sp_edit_clear_all(SPDesktop *dt) GSList *items = sp_item_group_item_list(SP_GROUP(dt->currentLayer())); while (items) { - SP_OBJECT(items->data)->deleteObject(); + reinterpret_cast(items->data)->deleteObject(); items = g_slist_remove(items, items->data); } @@ -453,7 +453,7 @@ void sp_edit_clear_all(SPDesktop *dt) GSList * get_all_items(GSList *list, SPObject *from, SPDesktop *desktop, bool onlyvisible, bool onlysensitive, GSList const *exclude) { - for (SPObject *child = sp_object_first_child(SP_OBJECT(from)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = sp_object_first_child(from) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_ITEM(child) && !desktop->isLayer(SP_ITEM(child)) && (!onlysensitive || !SP_ITEM(child)->isLocked()) && @@ -559,7 +559,7 @@ void sp_edit_invert_in_all_layers(SPDesktop *desktop) } void sp_selection_group_impl(GSList *p, Inkscape::XML::Node *group, Inkscape::XML::Document *xml_doc, SPDocument *doc) { - + p = g_slist_sort(p, (GCompareFunc) sp_repr_compare_position); // Remember the position and parent of the topmost object. @@ -638,9 +638,9 @@ void sp_selection_group(SPDesktop *desktop) } GSList const *l = (GSList *) selection->reprList(); - + GSList *p = g_slist_copy((GSList *) l); - + selection->clear(); Inkscape::XML::Node *group = xml_doc->createElement("svg:g"); @@ -821,7 +821,7 @@ sp_selection_raise(SPDesktop *desktop) // Iterate over all objects in the selection (starting from top). if (selected) { while (rev) { - SPObject *child = SP_OBJECT(rev->data); + SPObject *child = reinterpret_cast(rev->data); // for each selected object, find the next sibling for (SPObject *newref = child->next; newref; newref = newref->next) { // if the sibling is an item AND overlaps our selection, @@ -918,7 +918,7 @@ sp_selection_lower(SPDesktop *desktop) // Iterate over all objects in the selection (starting from top). if (selected) { while (rev) { - SPObject *child = SP_OBJECT(rev->data); + SPObject *child = reinterpret_cast(rev->data); // for each selected object, find the prev sibling for (SPObject *newref = prev_sibling(child); newref; newref = prev_sibling(newref)) { // if the sibling is an item AND overlaps our selection, @@ -1022,16 +1022,16 @@ SPCSSAttr * take_style_from_item(SPItem *item) { // write the complete cascaded style, context-free - SPCSSAttr *css = sp_css_attr_from_object(SP_OBJECT(item), SP_STYLE_FLAG_ALWAYS); + SPCSSAttr *css = sp_css_attr_from_object(item, SP_STYLE_FLAG_ALWAYS); if (css == NULL) return NULL; - if ((SP_IS_GROUP(item) && SP_OBJECT(item)->children) || - (SP_IS_TEXT(item) && SP_OBJECT(item)->children && SP_OBJECT(item)->children->next == NULL)) { + if ((SP_IS_GROUP(item) && item->children) || + (SP_IS_TEXT(item) && item->children && item->children->next == NULL)) { // if this is a text with exactly one tspan child, merge the style of that tspan as well // If this is a group, merge the style of its topmost (last) child with style for (SPObject *last_element = item->lastChild(); last_element != NULL; last_element = SP_OBJECT_PREV(last_element)) { - if (SP_OBJECT_STYLE(last_element) != NULL) { + if ( last_element->style ) { SPCSSAttr *temp = sp_css_attr_from_object(last_element, SP_STYLE_FLAG_IFSET); if (temp) { sp_repr_css_merge(css, temp); @@ -1339,7 +1339,7 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Matrix cons // we're moving both a clone and its original or any ancestor in clone chain? bool transform_clone_with_original = selection_contains_original(item, selection); // ...both a text-on-path and its path? - bool transform_textpath_with_path = (SP_IS_TEXT_TEXTPATH(item) && selection->includes( sp_textpath_get_path_item(SP_TEXTPATH(sp_object_first_child(SP_OBJECT(item)))) )); + bool transform_textpath_with_path = (SP_IS_TEXT_TEXTPATH(item) && selection->includes( sp_textpath_get_path_item(SP_TEXTPATH(sp_object_first_child(item))) )); // ...both a flowtext and its frame? bool transform_flowtext_with_frame = (SP_IS_FLOWTEXT(item) && selection->includes( SP_FLOWTEXT(item)->get_frame(NULL))); // (only the first frame is checked so far) // ...both an offset and its source? @@ -1374,7 +1374,7 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Matrix cons * Same for linked offset if we are also moving its source: do not move it. */ if (transform_textpath_with_path || transform_offset_with_source) { // Restore item->transform field from the repr, in case it was changed by seltrans. - sp_object_read_attr(SP_OBJECT(item), "transform"); + sp_object_read_attr(item, "transform"); } else if (transform_flowtext_with_frame) { // apply the inverse of the region's transform to the so that the flow remains // the same (even though the output itself gets transformed) @@ -1392,7 +1392,7 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Matrix cons // transform and its move compensation are both cancelled out. // restore item->transform field from the repr, in case it was changed by seltrans - sp_object_read_attr(SP_OBJECT(item), "transform"); + sp_object_read_attr(item, "transform"); // calculate the matrix we need to apply to the clone to cancel its induced transform from its original Geom::Matrix parent2dt = sp_item_i2d_affine(SP_ITEM(SP_OBJECT_PARENT(item))); @@ -1434,7 +1434,7 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Matrix cons // center by the same matrix (only necessary for non-translations) if (set_i2d && item->isCenterSet() && !(affine.isTranslation() || affine.isIdentity())) { item->setCenter(old_center * affine); - SP_OBJECT(item)->updateRepr(); + item->updateRepr(); } } } @@ -2096,7 +2096,7 @@ sp_selection_relink(SPDesktop *desktop) continue; SP_OBJECT_REPR(item)->setAttribute("xlink:href", newref); - SP_OBJECT(item)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); relinked = true; } @@ -2134,10 +2134,10 @@ sp_selection_unlink(SPDesktop *desktop) SPItem *item = (SPItem *) items->data; if (SP_IS_TEXT(item)) { - SPObject *tspan = sp_tref_convert_to_tspan(SP_OBJECT(item)); + SPObject *tspan = sp_tref_convert_to_tspan(item); if (tspan) { - SP_OBJECT(item)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } // Set unlink to true, and fall into the next if which @@ -2155,7 +2155,7 @@ sp_selection_unlink(SPDesktop *desktop) if (SP_IS_USE(item)) { unlink = sp_use_unlink(SP_USE(item)); } else /*if (SP_IS_TREF(use))*/ { - unlink = SP_ITEM(sp_tref_convert_to_tspan(SP_OBJECT(item))); + unlink = SP_ITEM(sp_tref_convert_to_tspan(item)); } unlinked = true; @@ -2200,7 +2200,7 @@ sp_select_clone_original(SPDesktop *desktop) } else if (SP_IS_OFFSET(item) && SP_OFFSET(item)->sourceHref) { original = sp_offset_get_source(SP_OFFSET(item)); } else if (SP_IS_TEXT_TEXTPATH(item)) { - original = sp_textpath_get_path_item(SP_TEXTPATH(sp_object_first_child(SP_OBJECT(item)))); + original = sp_textpath_get_path_item(SP_TEXTPATH(sp_object_first_child(item))); } else if (SP_IS_FLOWTEXT(item)) { original = SP_FLOWTEXT(item)->get_frame(NULL); // first frame only } else { // it's an object that we don't know what to do with @@ -2302,7 +2302,7 @@ void sp_selection_to_marker(SPDesktop *desktop, bool apply) if (apply) { // delete objects so that their clones don't get alerted; this object will be restored shortly for (GSList *i = items; i != NULL; i = i->next) { - SPObject *item = SP_OBJECT(i->data); + SPObject *item = reinterpret_cast(i->data); item->deleteObject(false); } } @@ -2341,7 +2341,7 @@ static void sp_selection_to_guides_recursive(SPItem *item, bool deleteitem, bool sp_item_convert_item_to_guides(item); if (deleteitem) { - SP_OBJECT(item)->deleteObject(true); + item->deleteObject(true); } } } @@ -2426,7 +2426,7 @@ sp_selection_tile(SPDesktop *desktop, bool apply) if (apply) { // delete objects so that their clones don't get alerted; this object will be restored shortly for (GSList *i = items; i != NULL; i = i->next) { - SPObject *item = SP_OBJECT(i->data); + SPObject *item = reinterpret_cast(i->data); item->deleteObject(false); } } @@ -2503,12 +2503,12 @@ sp_selection_untile(SPDesktop *desktop) SPItem *item = (SPItem *) items->data; - SPStyle *style = SP_OBJECT_STYLE(item); + SPStyle *style = item->style; if (!style || !style->fill.isPaintserver()) continue; - SPObject *server = SP_OBJECT_STYLE_FILL_SERVER(item); + SPPaintServer *server = item->style->getFillPaintServer(); if (!SP_IS_PATTERN(server)) continue; @@ -2520,7 +2520,7 @@ sp_selection_untile(SPDesktop *desktop) Geom::Matrix pat_transform = to_2geom(pattern_patternTransform(SP_PATTERN(server))); pat_transform *= item->transform; - for (SPObject *child = sp_object_first_child(SP_OBJECT(pattern)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = sp_object_first_child(pattern) ; child != NULL; child = child->next ) { Inkscape::XML::Node *copy = SP_OBJECT_REPR(child)->duplicate(xml_doc); SPItem *i = SP_ITEM(desktop->currentLayer()->appendChildRepr(copy)); @@ -2860,7 +2860,7 @@ sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_to_la GSList *items = g_slist_copy((GSList *) selection->itemList()); items = g_slist_sort(items, (GCompareFunc) sp_object_compare_position); - + // See lp bug #542004 selection->clear(); @@ -2869,7 +2869,7 @@ sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_to_la GSList *apply_to_items = NULL; GSList *items_to_delete = NULL; GSList *items_to_select = NULL; - + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); bool topmost = prefs->getBool("/options/maskobject/topmost", true); bool remove_original = prefs->getBool("/options/maskobject/remove", true); @@ -2878,13 +2878,13 @@ sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_to_la if (apply_to_layer) { // all selected items are used for mask, which is applied to a layer apply_to_items = g_slist_prepend(apply_to_items, desktop->currentLayer()); - + for (GSList *i = items; i != NULL; i = i->next) { Inkscape::XML::Node *dup = (SP_OBJECT_REPR(i->data))->duplicate(xml_doc); mask_items = g_slist_prepend(mask_items, dup); - SPObject *item = SP_OBJECT(i->data); - if (remove_original) { + SPObject *item = reinterpret_cast(i->data); + if (remove_original) { items_to_delete = g_slist_prepend(items_to_delete, item); } else { @@ -2898,7 +2898,7 @@ sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_to_la mask_items = g_slist_prepend(mask_items, dup); if (remove_original) { - SPObject *item = SP_OBJECT(i->data); + SPObject *item = reinterpret_cast(i->data); items_to_delete = g_slist_prepend(items_to_delete, item); } @@ -2917,7 +2917,7 @@ sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_to_la mask_items = g_slist_prepend(mask_items, dup); if (remove_original) { - SPObject *item = SP_OBJECT(i->data); + SPObject *item = reinterpret_cast(i->data); items_to_delete = g_slist_prepend(items_to_delete, item); } } @@ -2942,7 +2942,7 @@ sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_to_la reprs_to_group = g_slist_reverse(reprs_to_group); sp_selection_group_impl(reprs_to_group, group, xml_doc, doc); - + reprs_to_group = NULL; // apply clip/mask only to newly created group @@ -3012,14 +3012,14 @@ sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_to_la g_slist_free(apply_to_items); for (GSList *i = items_to_delete; NULL != i; i = i->next) { - SPObject *item = SP_OBJECT(i->data); + SPObject *item = reinterpret_cast(i->data); item->deleteObject(false); items_to_select = g_slist_remove(items_to_select, item); } g_slist_free(items_to_delete); - + items_to_select = g_slist_reverse(items_to_select); - + selection->addList(items_to_select); g_slist_free(items_to_select); @@ -3053,11 +3053,11 @@ void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) { GSList *items = g_slist_copy((GSList *) selection->itemList()); selection->clear(); - + GSList *items_to_ungroup = NULL; GSList *items_to_select = g_slist_copy(items); - items_to_select = g_slist_reverse(items_to_select); - + items_to_select = g_slist_reverse(items_to_select); + // SPObject* refers to a group containing the clipped path or mask itself, // whereas SPItem* refers to the item being clipped or masked @@ -3143,7 +3143,7 @@ void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) { } g_slist_free(items_to_ungroup); - + // rebuild selection items_to_select = g_slist_reverse(items_to_select); selection->addList(items_to_select); diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 5a2dfb2f0..325009fe5 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -191,16 +191,17 @@ bool SPItem::isVisibleAndUnlocked(unsigned display_key) const { } bool SPItem::isLocked() const { - for (SPObject *o = SP_OBJECT(this); o != NULL; o = SP_OBJECT_PARENT(o)) { - if (SP_IS_ITEM(o) && !(SP_ITEM(o)->sensitive)) + for (SPObject const *o = this; o != NULL; o = o->parent) { + if (SP_IS_ITEM(o) && !(SP_ITEM(o)->sensitive)) { return true; + } } return false; } void SPItem::setLocked(bool locked) { - SP_OBJECT_REPR(this)->setAttribute("sodipodi:insensitive", - ( locked ? "1" : NULL )); + this->repr->setAttribute("sodipodi:insensitive", + ( locked ? "1" : NULL )); updateRepr(); } @@ -250,7 +251,7 @@ void SPItem::resetEvaluated() { requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG); } } if ( StatusSet == _evaluated_status ) { - SPObject const *const parent = SP_OBJECT_PARENT(this); + SPObject const *const parent = this->parent; if (SP_IS_SWITCH(parent)) { SP_SWITCH(parent)->resetChildEvaluated(); } @@ -294,7 +295,7 @@ SPItem::setExplicitlyHidden(bool const val) { void SPItem::setCenter(Geom::Point object_centre) { // for getBounds() to work - sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(this)); + sp_document_ensure_up_to_date( this->document ); Geom::OptRect bbox = getBounds(sp_item_i2d_affine(this)); if (bbox) { @@ -319,7 +320,7 @@ bool SPItem::isCenterSet() { Geom::Point SPItem::getCenter() const { // for getBounds() to work - sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(this)); + sp_document_ensure_up_to_date( this->document ); Geom::OptRect bbox = getBounds(sp_item_i2d_affine(this)); if (bbox) { @@ -342,21 +343,21 @@ void SPItem::raiseToTop() { using Inkscape::Algorithms::find_last_if; SPObject *topmost=find_last_if( - SP_OBJECT_NEXT(this), NULL, &is_item + this->next, NULL, &is_item ); if (topmost) { - Inkscape::XML::Node *repr=SP_OBJECT_REPR(this); - sp_repr_parent(repr)->changeOrder(repr, SP_OBJECT_REPR(topmost)); + Inkscape::XML::Node *repr = this->repr; + sp_repr_parent(repr)->changeOrder( repr, topmost->repr ); } } void SPItem::raiseOne() { SPObject *next_higher=std::find_if( - SP_OBJECT_NEXT(this), NULL, &is_item + this->next, NULL, &is_item ); if (next_higher) { - Inkscape::XML::Node *repr=SP_OBJECT_REPR(this); - Inkscape::XML::Node *ref=SP_OBJECT_REPR(next_higher); + Inkscape::XML::Node *repr = this->repr; + Inkscape::XML::Node *ref = next_higher->repr; sp_repr_parent(repr)->changeOrder(repr, ref); } } @@ -367,15 +368,15 @@ void SPItem::lowerOne() { MutableList next_lower=std::find_if( reverse_list( - SP_OBJECT_PARENT(this)->firstChild(), this + this->parent->firstChild(), this ), MutableList(), &is_item ); if (next_lower) { ++next_lower; - Inkscape::XML::Node *repr=SP_OBJECT_REPR(this); - Inkscape::XML::Node *ref=( next_lower ? SP_OBJECT_REPR(&*next_lower) : NULL ); + Inkscape::XML::Node *repr = this->repr; + Inkscape::XML::Node *ref = ( next_lower ? next_lower->repr : NULL ); sp_repr_parent(repr)->changeOrder(repr, ref); } } @@ -387,15 +388,15 @@ void SPItem::lowerToBottom() { MutableList bottom=find_last_if( reverse_list( - SP_OBJECT_PARENT(this)->firstChild(), this + this->parent->firstChild(), this ), MutableList(), &is_item ); if (bottom) { ++bottom; - Inkscape::XML::Node *repr=SP_OBJECT_REPR(this); - Inkscape::XML::Node *ref=( bottom ? SP_OBJECT_REPR(&*bottom) : NULL ); + Inkscape::XML::Node *repr = this->repr; + Inkscape::XML::Node *ref = ( bottom ? bottom->repr : NULL ); sp_repr_parent(repr)->changeOrder(repr, ref); } } @@ -578,7 +579,7 @@ clip_ref_changed(SPObject *old_clip, SPObject *clip, SPItem *item) nr_arena_item_set_clip(v->arenaitem, ai); nr_arena_item_unref(ai); sp_clippath_set_bbox(SP_CLIPPATH(clip), NR_ARENA_ITEM_GET_KEY(v->arenaitem), &bbox); - SP_OBJECT(clip)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + clip->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } } } @@ -606,7 +607,7 @@ mask_ref_changed(SPObject *old_mask, SPObject *mask, SPItem *item) nr_arena_item_set_mask(v->arenaitem, ai); nr_arena_item_unref(ai); sp_mask_set_bbox(SP_MASK(mask), NR_ARENA_ITEM_GET_KEY(v->arenaitem), &bbox); - SP_OBJECT(mask)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + mask->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } } } @@ -681,7 +682,7 @@ sp_item_write(SPObject *const object, Inkscape::XML::Document *xml_doc, Inkscape Inkscape::XML::Node *crepr; GSList *l; l = NULL; - for (child = sp_object_first_child(object); child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (child = sp_object_first_child(object); child != NULL; child = child->next ) { if (!SP_IS_TITLE(child) && !SP_IS_DESC(child)) continue; crepr = child->updateRepr(xml_doc, NULL, flags); if (crepr) l = g_slist_prepend (l, crepr); @@ -692,7 +693,7 @@ sp_item_write(SPObject *const object, Inkscape::XML::Document *xml_doc, Inkscape l = g_slist_remove (l, l->data); } } else { - for (child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (child = sp_object_first_child(object) ; child != NULL; child = child->next ) { if (!SP_IS_TITLE(child) && !SP_IS_DESC(child)) continue; child->updateRepr(flags); } @@ -788,8 +789,8 @@ sp_item_invoke_bbox_full(SPItem const *item, Geom::OptRect &bbox, Geom::Matrix c // unless this is geometric bbox, extend by filter area and crop the bbox by clip path, if any if ((SPItem::BBoxType) flags != SPItem::GEOMETRIC_BBOX) { - if (SP_OBJECT_STYLE(item) && SP_OBJECT_STYLE(item)->filter.href) { - SPObject *filter = SP_OBJECT_STYLE(item)->getFilter(); + if ( item->style && item->style->filter.href ) { + SPObject *filter = item->style->getFilter(); if (filter && SP_IS_FILTER(filter)) { // default filer area per the SVG spec: double x = -0.1; @@ -912,14 +913,14 @@ unsigned sp_item_pos_in_parent(SPItem *item) g_assert(item != NULL); g_assert(SP_IS_ITEM(item)); - SPObject *parent = SP_OBJECT_PARENT(item); + SPObject *parent = item->parent; g_assert(parent != NULL); g_assert(SP_IS_OBJECT(parent)); - SPObject *object = SP_OBJECT(item); + SPObject *object = item; - unsigned pos=0; - for ( SPObject *iter = sp_object_first_child(parent) ; iter ; iter = SP_OBJECT_NEXT(iter)) { + unsigned pos = 0; + for ( SPObject *iter = sp_object_first_child(parent) ; iter ; iter = iter->next) { if ( iter == object ) { return pos; } @@ -989,8 +990,8 @@ void sp_item_snappoints(SPItem const *item, std::vector clips_and_masks; - clips_and_masks.push_back(SP_OBJECT(item->clip_ref->getObject())); - clips_and_masks.push_back(SP_OBJECT(item->mask_ref->getObject())); + clips_and_masks.push_back(item->clip_ref->getObject()); + clips_and_masks.push_back(item->mask_ref->getObject()); SPDesktop *desktop = inkscape_active_desktop(); for (std::list::const_iterator o = clips_and_masks.begin(); o != clips_and_masks.end(); o++) { @@ -1020,9 +1021,9 @@ sp_item_invoke_print(SPItem *item, SPPrintContext *ctx) if (!item->isHidden()) { if (((SPItemClass *) G_OBJECT_GET_CLASS(item))->print) { if (!item->transform.isIdentity() - || SP_OBJECT_STYLE(item)->opacity.value != SP_SCALE24_MAX) + || item->style->opacity.value != SP_SCALE24_MAX) { - sp_print_bind(ctx, item->transform, SP_SCALE24_TO_FLOAT(SP_OBJECT_STYLE(item)->opacity.value)); + sp_print_bind(ctx, item->transform, SP_SCALE24_TO_FLOAT(item->style->opacity.value)); ((SPItemClass *) G_OBJECT_GET_CLASS(item))->print(item, ctx); sp_print_release(ctx); } else { @@ -1061,8 +1062,8 @@ sp_item_description(SPItem *item) g_free (s); s = snew; } - if (SP_OBJECT_STYLE(item) && SP_OBJECT_STYLE(item)->filter.href && SP_OBJECT_STYLE(item)->filter.href->getObject()) { - const gchar *label = SP_OBJECT_STYLE(item)->filter.href->getObject()->label(); + if ( item->style && item->style->filter.href && item->style->filter.href->getObject() ) { + const gchar *label = item->style->filter.href->getObject()->label(); gchar *snew; if (label) { snew = g_strdup_printf (_("%s; filtered (%s)"), s, _(label)); @@ -1111,7 +1112,7 @@ sp_item_invoke_show(SPItem *item, NRArena *arena, unsigned key, unsigned flags) if (ai != NULL) { item->display = sp_item_view_new_prepend(item->display, item, flags, key, ai); nr_arena_item_set_transform(ai, item->transform); - nr_arena_item_set_opacity(ai, SP_SCALE24_TO_FLOAT(SP_OBJECT_STYLE(item)->opacity.value)); + nr_arena_item_set_opacity(ai, SP_SCALE24_TO_FLOAT(item->style->opacity.value)); nr_arena_item_set_visible(ai, !item->isHidden()); nr_arena_item_set_sensitive(ai, item->sensitive); if (item->clip_ref->getObject()) { @@ -1131,7 +1132,7 @@ sp_item_invoke_show(SPItem *item, NRArena *arena, unsigned key, unsigned flags) NRRect bbox; sp_item_invoke_bbox(item, &bbox, Geom::identity(), TRUE); sp_clippath_set_bbox(SP_CLIPPATH(cp), clip_key, &bbox); - SP_OBJECT(cp)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + cp->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } if (item->mask_ref->getObject()) { SPMask *mask = item->mask_ref->getObject(); @@ -1150,7 +1151,7 @@ sp_item_invoke_show(SPItem *item, NRArena *arena, unsigned key, unsigned flags) NRRect bbox; sp_item_invoke_bbox(item, &bbox, Geom::identity(), TRUE); sp_mask_set_bbox(SP_MASK(mask), mask_key, &bbox); - SP_OBJECT(mask)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + mask->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } NR_ARENA_ITEM_SET_DATA(ai, item); Geom::OptRect item_bbox; @@ -1204,34 +1205,32 @@ sp_item_invoke_hide(SPItem *item, unsigned key) void sp_item_adjust_pattern (SPItem *item, Geom::Matrix const &postmul, bool set) { - SPStyle *style = SP_OBJECT_STYLE (item); + SPStyle *style = item->style; - if (style && (style->fill.isPaintserver())) { - SPObject *server = SP_OBJECT_STYLE_FILL_SERVER (item); - if (SP_IS_PATTERN (server)) { - SPPattern *pattern = sp_pattern_clone_if_necessary (item, SP_PATTERN (server), "fill"); - sp_pattern_transform_multiply (pattern, postmul, set); + if ( style && style->fill.isPaintserver() ) { + SPPaintServer *server = item->style->getFillPaintServer(); + if ( SP_IS_PATTERN(server) ) { + SPPattern *pattern = sp_pattern_clone_if_necessary(item, SP_PATTERN(server), "fill"); + sp_pattern_transform_multiply(pattern, postmul, set); } } - if (style && (style->stroke.isPaintserver())) { - SPObject *server = SP_OBJECT_STYLE_STROKE_SERVER (item); - if (SP_IS_PATTERN (server)) { - SPPattern *pattern = sp_pattern_clone_if_necessary (item, SP_PATTERN (server), "stroke"); - sp_pattern_transform_multiply (pattern, postmul, set); + if ( style && style->stroke.isPaintserver() ) { + SPPaintServer *server = item->style->getStrokePaintServer(); + if ( SP_IS_PATTERN(server) ) { + SPPattern *pattern = sp_pattern_clone_if_necessary(item, SP_PATTERN(server), "stroke"); + sp_pattern_transform_multiply(pattern, postmul, set); } } - } -void -sp_item_adjust_gradient (SPItem *item, Geom::Matrix const &postmul, bool set) +void sp_item_adjust_gradient( SPItem *item, Geom::Matrix const &postmul, bool set ) { - SPStyle *style = SP_OBJECT_STYLE (item); + SPStyle *style = item->style; - if (style && (style->fill.isPaintserver())) { - SPObject *server = SP_OBJECT_STYLE_FILL_SERVER(item); - if (SP_IS_GRADIENT (server)) { + if ( style && style->fill.isPaintserver() ) { + SPPaintServer *server = item->style->getFillPaintServer(); + if ( SP_IS_GRADIENT(server) ) { /** * \note Bbox units for a gradient are generally a bad idea because @@ -1242,40 +1241,37 @@ sp_item_adjust_gradient (SPItem *item, Geom::Matrix const &postmul, bool set) * \todo FIXME: convert back to bbox units after transforming with * the item, so as to preserve the original units. */ - SPGradient *gradient = sp_gradient_convert_to_userspace (SP_GRADIENT (server), item, "fill"); + SPGradient *gradient = sp_gradient_convert_to_userspace( SP_GRADIENT(server), item, "fill" ); - sp_gradient_transform_multiply (gradient, postmul, set); + sp_gradient_transform_multiply( gradient, postmul, set ); } } - if (style && (style->stroke.isPaintserver())) { - SPObject *server = SP_OBJECT_STYLE_STROKE_SERVER(item); - if (SP_IS_GRADIENT (server)) { - SPGradient *gradient = sp_gradient_convert_to_userspace (SP_GRADIENT (server), item, "stroke"); - sp_gradient_transform_multiply (gradient, postmul, set); + if ( style && style->stroke.isPaintserver() ) { + SPPaintServer *server = item->style->getStrokePaintServer(); + if ( SP_IS_GRADIENT(server) ) { + SPGradient *gradient = sp_gradient_convert_to_userspace( SP_GRADIENT(server), item, "stroke" ); + sp_gradient_transform_multiply( gradient, postmul, set ); } } } -void -sp_item_adjust_stroke (SPItem *item, gdouble ex) +void sp_item_adjust_stroke( SPItem *item, gdouble ex ) { - SPStyle *style = SP_OBJECT_STYLE (item); - - if (style && !style->stroke.isNone() && !NR_DF_TEST_CLOSE (ex, 1.0, NR_EPSILON)) { + SPStyle *style = item->style; + if ( style && !style->stroke.isNone() && !NR_DF_TEST_CLOSE(ex, 1.0, NR_EPSILON) ) { style->stroke_width.computed *= ex; style->stroke_width.set = TRUE; - if (style->stroke_dash.n_dash != 0) { - int i; - for (i = 0; i < style->stroke_dash.n_dash; i++) { + if ( style->stroke_dash.n_dash != 0 ) { + for (int i = 0; i < style->stroke_dash.n_dash; i++) { style->stroke_dash.dash[i] *= ex; } style->stroke_dash.offset *= ex; } - SP_OBJECT(item)->updateRepr(); + item->updateRepr(); } } @@ -1286,7 +1282,7 @@ Geom::Matrix sp_item_transform_repr (SPItem *item) { Geom::Matrix t_old(Geom::identity()); - gchar const *t_attr = SP_OBJECT_REPR(item)->attribute("transform"); + gchar const *t_attr = item->repr->attribute("transform"); if (t_attr) { Geom::Matrix t; if (sp_svg_transform_read(t_attr, &t)) { @@ -1310,7 +1306,7 @@ sp_item_adjust_stroke_width_recursive(SPItem *item, double expansion) if (item && SP_IS_USE(item)) return; - for (SPObject *o = SP_OBJECT(item)->children; o != NULL; o = o->next) { + for (SPObject *o = item->children; o != NULL; o = o->next) { if (SP_IS_ITEM(o)) sp_item_adjust_stroke_width_recursive(SP_ITEM(o), expansion); } @@ -1326,7 +1322,7 @@ sp_item_adjust_rects_recursive(SPItem *item, Geom::Matrix advertized_transform) sp_rect_compensate_rxry (SP_RECT(item), advertized_transform); } - for (SPObject *o = SP_OBJECT(item)->children; o != NULL; o = o->next) { + for (SPObject *o = item->children; o != NULL; o = o->next) { if (SP_IS_ITEM(o)) sp_item_adjust_rects_recursive(SP_ITEM(o), advertized_transform); } @@ -1348,7 +1344,7 @@ sp_item_adjust_paint_recursive (SPItem *item, Geom::Matrix advertized_transform, // also we do not recurse into clones, because a clone's child is the ghost of its original - // we must not touch it if (!(item && (SP_IS_TEXT(item) || SP_IS_USE(item)))) { - for (SPObject *o = SP_OBJECT(item)->children; o != NULL; o = o->next) { + for (SPObject *o = item->children; o != NULL; o = o->next) { if (SP_IS_ITEM(o)) { // At the level of the transformed item, t_ancestors is identity; // below it, it is the accmmulated chain of transforms from this level to the top level @@ -1452,7 +1448,7 @@ sp_item_write_transform(SPItem *item, Inkscape::XML::Node *repr, Geom::Matrix co !preserve && // user did not chose to preserve all transforms !item->clip_ref->getObject() && // the object does not have a clippath !item->mask_ref->getObject() && // the object does not have a mask - !(!transform.isTranslation() && SP_OBJECT_STYLE(item) && SP_OBJECT_STYLE(item)->getFilter()) + !(!transform.isTranslation() && item->style && item->style->getFilter()) // the object does not have a filter, or the transform is translation (which is supposed to not affect filters) ) { transform_attr = ((SPItemClass *) G_OBJECT_GET_CLASS(item))->set_transform(item, transform); @@ -1463,7 +1459,7 @@ sp_item_write_transform(SPItem *item, Inkscape::XML::Node *repr, Geom::Matrix co // it causes clone SPUse's copy of the original object to brought up to // date with the original. Otherwise, sp_use_bbox returns incorrect // values if called in code handling the transformed signal. - SP_OBJECT(item)->updateRepr(); + item->updateRepr(); // send the relative transform with a _transformed_signal item->_transformed_signal.emit(&advertized_transform, item); @@ -1534,7 +1530,7 @@ i2anc_affine(SPObject const *object, SPObject const *const ancestor) { } else { ret *= SP_ITEM(object)->transform; } - object = SP_OBJECT_PARENT(object); + object = object->parent; } return ret; } @@ -1569,7 +1565,7 @@ Geom::Matrix sp_item_i2d_affine(SPItem const *item) Geom::Matrix const ret( sp_item_i2doc_affine(item) * Geom::Scale(1, -1) - * Geom::Translate(0, sp_document_height(SP_OBJECT_DOCUMENT(item))) ); + * Geom::Translate(0, sp_document_height(item->document)) ); return ret; } @@ -1579,10 +1575,10 @@ void sp_item_set_i2d_affine(SPItem *item, Geom::Matrix const &i2dt) g_return_if_fail( SP_IS_ITEM(item) ); Geom::Matrix dt2p; /* desktop to item parent transform */ - if (SP_OBJECT_PARENT(item)) { - dt2p = sp_item_i2d_affine((SPItem *) SP_OBJECT_PARENT(item)).inverse(); + if (item->parent) { + dt2p = sp_item_i2d_affine(static_cast(item->parent)).inverse(); } else { - dt2p = ( Geom::Translate(0, -sp_document_height(SP_OBJECT_DOCUMENT(item))) + dt2p = ( Geom::Translate(0, -sp_document_height(item->document)) * Geom::Scale(1, -1) ); } @@ -1660,16 +1656,17 @@ sp_item_get_arenaitem(SPItem *item, unsigned key) int sp_item_repr_compare_position(SPItem *first, SPItem *second) { - return sp_repr_compare_position(SP_OBJECT_REPR(first), - SP_OBJECT_REPR(second)); + return sp_repr_compare_position(first->repr, + second->repr); } SPItem * sp_item_first_item_child (SPObject *obj) { - for ( SPObject *iter = sp_object_first_child(obj) ; iter ; iter = SP_OBJECT_NEXT(iter)) { - if (SP_IS_ITEM (iter)) + for ( SPObject *iter = sp_object_first_child(obj) ; iter ; iter = iter->next) { + if ( SP_IS_ITEM(iter) ) { return SP_ITEM (iter); + } } return NULL; } diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 9ce2ac5ba..0a64e7fa7 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -653,23 +653,23 @@ void ClipboardManagerImpl::_copySelection(Inkscape::Selection *selection) void ClipboardManagerImpl::_copyUsedDefs(SPItem *item) { // copy fill and stroke styles (patterns and gradients) - SPStyle *style = SP_OBJECT_STYLE(item); + SPStyle *style = item->style; if (style && (style->fill.isPaintserver())) { - SPObject *server = SP_OBJECT_STYLE_FILL_SERVER(item); - if (SP_IS_LINEARGRADIENT(server) || SP_IS_RADIALGRADIENT(server)) { + SPPaintServer *server = item->style->getFillPaintServer(); + if ( SP_IS_LINEARGRADIENT(server) || SP_IS_RADIALGRADIENT(server) ) { _copyGradient(SP_GRADIENT(server)); } - if (SP_IS_PATTERN(server)) { + if ( SP_IS_PATTERN(server) ) { _copyPattern(SP_PATTERN(server)); } } if (style && (style->stroke.isPaintserver())) { - SPObject *server = SP_OBJECT_STYLE_STROKE_SERVER(item); - if (SP_IS_LINEARGRADIENT(server) || SP_IS_RADIALGRADIENT(server)) { + SPPaintServer *server = item->style->getStrokePaintServer(); + if ( SP_IS_LINEARGRADIENT(server) || SP_IS_RADIALGRADIENT(server) ) { _copyGradient(SP_GRADIENT(server)); } - if (SP_IS_PATTERN(server)) { + if ( SP_IS_PATTERN(server) ) { _copyPattern(SP_PATTERN(server)); } } diff --git a/src/widgets/fill-style.cpp b/src/widgets/fill-style.cpp index 19b8448c6..a0e343b58 100644 --- a/src/widgets/fill-style.cpp +++ b/src/widgets/fill-style.cpp @@ -556,11 +556,11 @@ void FillNStroke::updateFromPaint() for (GSList const *i = items; i != NULL; i = i->next) { //FIXME: see above if (kind == FILL) { - sp_repr_css_change_recursive(SP_OBJECT_REPR(i->data), css, "style"); + sp_repr_css_change_recursive(reinterpret_cast(i->data)->repr, css, "style"); } if (!vector) { - SPGradient *gr = sp_gradient_vector_for_object( document, desktop, SP_OBJECT(i->data), kind == FILL, createSwatch ); + SPGradient *gr = sp_gradient_vector_for_object( document, desktop, reinterpret_cast(i->data), kind == FILL, createSwatch ); if ( gr && createSwatch ) { gr->setSwatch(); } @@ -578,7 +578,7 @@ void FillNStroke::updateFromPaint() for (GSList const *i = items; i != NULL; i = i->next) { //FIXME: see above if (kind == FILL) { - sp_repr_css_change_recursive(SP_OBJECT_REPR(i->data), css, "style"); + sp_repr_css_change_recursive(reinterpret_cast(i->data)->repr, css, "style"); } SPGradient *gr = sp_item_set_gradient(SP_ITEM(i->data), vector, gradient_type, kind == FILL); @@ -608,7 +608,7 @@ void FillNStroke::updateFromPaint() */ } else { - Inkscape::XML::Node *patrepr = SP_OBJECT_REPR(pattern); + Inkscape::XML::Node *patrepr = pattern->repr; SPCSSAttr *css = sp_repr_css_attr_new(); gchar *urltext = g_strdup_printf("url(#%s)", patrepr->attribute("id")); sp_repr_css_set_property(css, (kind == FILL) ? "fill" : "stroke", urltext); @@ -622,17 +622,17 @@ 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 (GSList const *i = items; i != NULL; i = i->next) { - Inkscape::XML::Node *selrepr = SP_OBJECT_REPR(i->data); + Inkscape::XML::Node *selrepr = reinterpret_cast(i->data)->repr; if ( (kind == STROKE) && !selrepr) { continue; } - SPObject *selobj = SP_OBJECT(i->data); + SPObject *selobj = reinterpret_cast(i->data); - SPStyle *style = SP_OBJECT_STYLE(selobj); + SPStyle *style = selobj->style; if (style && ((kind == FILL) ? style->fill : style->stroke).isPaintserver()) { - SPObject *server = (kind == FILL) ? - SP_OBJECT_STYLE_FILL_SERVER(selobj) : - SP_OBJECT_STYLE_STROKE_SERVER(selobj); + SPPaintServer *server = (kind == FILL) ? + selobj->style->getFillPaintServer() : + selobj->style->getStrokePaintServer(); if (SP_IS_PATTERN(server) && pattern_getroot(SP_PATTERN(server)) == pattern) // only if this object's pattern is not rooted in our selected pattern, apply continue; diff --git a/src/widgets/gradient-toolbar.cpp b/src/widgets/gradient-toolbar.cpp index 1d3187985..ce5f5fb8f 100644 --- a/src/widgets/gradient-toolbar.cpp +++ b/src/widgets/gradient-toolbar.cpp @@ -73,18 +73,17 @@ static void gr_toggle_fillstroke (GtkWidget *button, gpointer data) { } } -void -gr_apply_gradient_to_item (SPItem *item, SPGradient *gr, SPGradientType new_type, guint new_fill, bool do_fill, bool do_stroke) +void gr_apply_gradient_to_item( SPItem *item, SPGradient *gr, SPGradientType new_type, guint new_fill, bool do_fill, bool do_stroke ) { - SPStyle *style = SP_OBJECT_STYLE (item); + SPStyle *style = item->style; if (do_fill) { if (style && (style->fill.isPaintserver()) && - SP_IS_GRADIENT (SP_OBJECT_STYLE_FILL_SERVER (item))) { - SPObject *server = SP_OBJECT_STYLE_FILL_SERVER (item); - if (SP_IS_LINEARGRADIENT (server)) { + SP_IS_GRADIENT( item->style->getFillPaintServer() )) { + SPPaintServer *server = item->style->getFillPaintServer(); + if ( SP_IS_LINEARGRADIENT(server) ) { sp_item_set_gradient(item, gr, SP_GRADIENT_TYPE_LINEAR, true); - } else if (SP_IS_RADIALGRADIENT (server)) { + } else if ( SP_IS_RADIALGRADIENT(server) ) { sp_item_set_gradient(item, gr, SP_GRADIENT_TYPE_RADIAL, true); } } else if (new_fill) { @@ -94,11 +93,11 @@ gr_apply_gradient_to_item (SPItem *item, SPGradient *gr, SPGradientType new_type if (do_stroke) { if (style && (style->stroke.isPaintserver()) && - SP_IS_GRADIENT (SP_OBJECT_STYLE_STROKE_SERVER (item))) { - SPObject *server = SP_OBJECT_STYLE_STROKE_SERVER (item); - if (SP_IS_LINEARGRADIENT (server)) { + SP_IS_GRADIENT( item->style->getStrokePaintServer() )) { + SPPaintServer *server = item->style->getStrokePaintServer(); + if ( SP_IS_LINEARGRADIENT(server) ) { sp_item_set_gradient(item, gr, SP_GRADIENT_TYPE_LINEAR, false); - } else if (SP_IS_RADIALGRADIENT (server)) { + } else if ( SP_IS_RADIALGRADIENT(server) ) { sp_item_set_gradient(item, gr, SP_GRADIENT_TYPE_RADIAL, false); } } else if (!new_fill) { @@ -238,7 +237,7 @@ GtkWidget *gr_vector_list(SPDesktop *desktop, bool selection_empty, SPGradient * GtkWidget *hb = gtk_hbox_new (FALSE, 4); GtkWidget *l = gtk_label_new (""); - gchar *label = gr_prepare_label (SP_OBJECT(gradient)); + gchar *label = gr_prepare_label(gradient); gtk_label_set_markup (GTK_LABEL(l), label); g_free (label); gtk_misc_set_alignment (GTK_MISC (l), 1.0, 0.5); @@ -310,11 +309,11 @@ 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); - SPStyle *style = SP_OBJECT_STYLE (item); + SPStyle *style = item->style; if (style && (style->fill.isPaintserver())) { - SPObject *server = SP_OBJECT_STYLE_FILL_SERVER (item); - if (SP_IS_GRADIENT(server)) { + SPPaintServer *server = item->style->getFillPaintServer(); + if ( SP_IS_GRADIENT(server) ) { SPGradient *gradient = SP_GRADIENT(server)->getVector(); SPGradientSpread spread = SP_GRADIENT(server)->fetchSpread(); @@ -339,14 +338,13 @@ void gr_read_selection( Inkscape::Selection *selection, } } if (style && (style->stroke.isPaintserver())) { - SPObject *server = SP_OBJECT_STYLE_STROKE_SERVER (item); - if (SP_IS_GRADIENT(server)) { + SPPaintServer *server = item->style->getStrokePaintServer(); + if ( SP_IS_GRADIENT(server) ) { SPGradient *gradient = SP_GRADIENT(server)->getVector(); SPGradientSpread spread = SP_GRADIENT(server)->fetchSpread(); if (gradient && gradient->isSolid()) { gradient = 0; - } if (gradient && (gradient != gr_selected)) {