index 15d8b6cc27289bffc45b6b5e0acd2fbee46b7424..a0e343b5876a5b019bf3ce7be45fe10d939619d0 100644 (file)
psel->setGradientLinear( vector );
SPLinearGradient *lg = SP_LINEARGRADIENT(server);
- psel->setGradientProperties( SP_GRADIENT_UNITS(lg),
- SP_GRADIENT_SPREAD(lg) );
+ psel->setGradientProperties( lg->getUnits(),
+ lg->getSpread() );
} else if (SP_IS_RADIALGRADIENT(server)) {
SPGradient *vector = SP_GRADIENT(server)->getVector();
psel->setGradientRadial( vector );
SPRadialGradient *rg = SP_RADIALGRADIENT(server);
- psel->setGradientProperties( SP_GRADIENT_UNITS(rg),
- SP_GRADIENT_SPREAD(rg) );
+ psel->setGradientProperties( rg->getUnits(),
+ rg->getSpread() );
} else if (SP_IS_PATTERN(server)) {
SPPattern *pat = pattern_getroot(SP_PATTERN(server));
psel->updatePatternList( pat );
SPGradientType const gradient_type = ( psel->mode != SPPaintSelector::MODE_GRADIENT_RADIAL
? SP_GRADIENT_TYPE_LINEAR
: SP_GRADIENT_TYPE_RADIAL );
+ bool createSwatch = (psel->mode == SPPaintSelector::MODE_SWATCH);
SPCSSAttr *css = 0;
if (kind == FILL) {
SPStyle *query = sp_style_new(desktop->doc());
int result = objects_query_fillstroke(const_cast<GSList *>(items), query, kind == FILL);
- SPIPaint &targPaint = (kind == FILL) ? query->fill : query->stroke;
- guint32 common_rgb = 0;
if (result == QUERY_STYLE_MULTIPLE_SAME) {
+ SPIPaint &targPaint = (kind == FILL) ? query->fill : query->stroke;
+ SPColor common;
if (!targPaint.isColor()) {
- common_rgb = sp_desktop_get_color(desktop, kind == FILL);
+ common = sp_desktop_get_color(desktop, kind == FILL);
} else {
- common_rgb = targPaint.value.color.toRGBA32( 0xff );
+ common = targPaint.value.color;
+ }
+ vector = sp_document_default_gradient_vector( document, common, createSwatch );
+ if ( vector && createSwatch ) {
+ vector->setSwatch();
}
- vector = sp_document_default_gradient_vector(document, common_rgb);
}
sp_style_unref(query);
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<SPObject*>(i->data)->repr, css, "style");
}
if (!vector) {
+ SPGradient *gr = sp_gradient_vector_for_object( document, desktop, reinterpret_cast<SPObject*>(i->data), kind == FILL, createSwatch );
+ if ( gr && createSwatch ) {
+ gr->setSwatch();
+ }
sp_item_set_gradient(SP_ITEM(i->data),
- sp_gradient_vector_for_object(document, desktop, SP_OBJECT(i->data), kind == FILL),
+ gr,
gradient_type, kind == FILL);
} else {
sp_item_set_gradient(SP_ITEM(i->data), vector, gradient_type, kind == FILL);
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<SPObject*>(i->data)->repr, css, "style");
}
SPGradient *gr = sp_item_set_gradient(SP_ITEM(i->data), vector, gradient_type, kind == FILL);
*/
} 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);
// 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<SPObject*>(i->data)->repr;
if ( (kind == STROKE) && !selrepr) {
continue;
}
- SPObject *selobj = SP_OBJECT(i->data);
+ SPObject *selobj = reinterpret_cast<SPObject*>(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;