index e4db09c90c244e775d8ec0f4a23c0ef34092753a..b4272a3a47227afdff671ac880d22641c0d759fb 100644 (file)
* Frank Felfe <innerspace@iname.com>
* bulia byak <buliabyak@users.sf.net>
* Jon A. Cruz <jon@joncruz.org>
+ * Abhishek Sharma
*
* Copyright (C) 1999-2005 authors
* Copyright (C) 2001-2002 Ximian, Inc.
sp_repr_css_attr_unref(css);
css = 0;
- SPDocumentUndo::done(desktop->doc(), SP_VERB_DIALOG_FILL_STROKE,
- _("Change fill rule"));
+ DocumentUndo::done(desktop->doc(), SP_VERB_DIALOG_FILL_STROKE,
+ _("Change fill rule"));
}
}
// local change, do not update from selection
dragId = g_timeout_add_full(G_PRIORITY_DEFAULT, 100, dragDelayCB, this, 0);
psel->setFlatColor( desktop, (kind == FILL) ? "fill" : "stroke", (kind == FILL) ? "fill-opacity" : "stroke-opacity" );
- SPDocumentUndo::maybe_done(desktop->doc(), (kind == FILL) ? undo_F_label : undo_S_label, SP_VERB_DIALOG_FILL_STROKE,
- (kind == FILL) ? _("Set fill color") : _("Set stroke color"));
+ DocumentUndo::maybeDone(desktop->doc(), (kind == FILL) ? undo_F_label : undo_S_label, SP_VERB_DIALOG_FILL_STROKE,
+ (kind == FILL) ? _("Set fill color") : _("Set stroke color"));
break;
}
sp_repr_css_attr_unref(css);
css = 0;
- SPDocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE,
- (kind == FILL) ? _("Remove fill") : _("Remove stroke"));
+ DocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE,
+ (kind == FILL) ? _("Remove fill") : _("Remove stroke"));
break;
}
psel->setFlatColor( desktop,
(kind == FILL) ? "fill" : "stroke",
(kind == FILL) ? "fill-opacity" : "stroke-opacity" );
- SPDocumentUndo::maybe_done(sp_desktop_document(desktop), (kind == FILL) ? undo_F_label : undo_S_label, SP_VERB_DIALOG_FILL_STROKE,
- (kind == FILL) ? _("Set fill color") : _("Set stroke color"));
+ DocumentUndo::maybeDone(sp_desktop_document(desktop), (kind == FILL) ? undo_F_label : undo_S_label, SP_VERB_DIALOG_FILL_STROKE,
+ (kind == FILL) ? _("Set fill color") : _("Set stroke color"));
if (kind == FILL) {
// resume interruptibility
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)->getRepr(), 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)->getRepr(), css, "style");
}
SPGradient *gr = sp_item_set_gradient(SP_ITEM(i->data), vector, gradient_type, kind == FILL);
css = 0;
}
- SPDocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE,
- (kind == FILL) ? _("Set gradient on fill") : _("Set gradient on stroke"));
+ DocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE,
+ (kind == FILL) ? _("Set gradient on fill") : _("Set gradient on stroke"));
}
break;
*/
} else {
- Inkscape::XML::Node *patrepr = SP_OBJECT_REPR(pattern);
+ Inkscape::XML::Node *patrepr = pattern->getRepr();
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)->getRepr();
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;
} // end if
- SPDocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE,
- (kind == FILL) ? _("Set pattern on fill") :
- _("Set pattern on stroke"));
+ DocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE,
+ (kind == FILL) ? _("Set pattern on fill") :
+ _("Set pattern on stroke"));
} // end if
break;
sp_repr_css_attr_unref(css);
css = 0;
- SPDocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE,
- (kind == FILL) ? _("Unset fill") : _("Unset stroke"));
+ DocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE,
+ (kind == FILL) ? _("Unset fill") : _("Unset stroke"));
}
break;
fill-column:99
End:
*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :