20#define noSP_FS_VERBOSE
24#include <glibmm/i18n.h>
50#define ART_WIND_RULE_NONZERO 0
61 , _solid_colors(
std::make_shared<Colors::
ColorSet>())
70 _psel->set_visible(
true);
109 if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) {
111 g_message(
"selectionModifiedCB(%d) on %p", flags,
this);
169 auto *widg = get_parent()->get_parent()->get_parent()->get_parent();
171 if (dialogbase && !dialogbase->getShowing()) {
191 auto stop = cast<SPStop>(paint.
getTag());
195 std::vector<SPItem*> vec(selection->items().begin(), selection->items().end());
225 color.addOpacity(targOpacity);
231 if (is<SPGradient>(server) && cast<SPGradient>(server)->getVector()->isSwatch()) {
232 auto vector = cast<SPGradient>(server)->getVector();
234 }
else if (is<SPLinearGradient>(server)) {
235 auto vector = cast<SPGradient>(server)->getVector();
236 auto lg = cast<SPLinearGradient>(server);
240 }
else if (is<SPRadialGradient>(server)) {
241 auto vector = cast<SPGradient>(server)->getVector();
242 auto rg = cast<SPRadialGradient>(server);
247 }
else if (is<SPMeshGradient>(server)) {
248 auto array = cast<SPGradient>(server)->getArray();
252 }
else if (is<SPPattern>(server)) {
275 g_message(
"paintModeChangeCB()");
309 gboolean keepGoing = TRUE;
340 guint32 when = g_get_monotonic_time() / 1000;
367 (
kind ==
FILL) ? _(
"Set fill color") : _(
"Set stroke color"),
368 INKSCAPE_ICON(
"dialog-fill-and-stroke"));
373 g_warning(
"file %s: line %d: Paint %d should not emit 'dragged'", __FILE__, __LINE__,
_psel->
get_mode());
381 object->removeAttribute(attribute);
383 for (
auto&
child:
object->children)
385 if (is<SPUse> (
object))
return;
399 g_message(
"paintChangedCB()");
416 std::vector<SPItem *>
const items(selection->items().begin(), selection->items().end());
421 g_warning(
"file %s: line %d: Paint %d should not emit 'changed'", __FILE__, __LINE__,
_psel->
get_mode());
437 DocumentUndo::done(document, (
kind ==
FILL) ? _(
"Remove fill") : _(
"Remove stroke"), INKSCAPE_ICON(
"dialog-fill-and-stroke"));
446 (
kind ==
FILL) ? _(
"Set fill color") : _(
"Set stroke color"),
447 INKSCAPE_ICON(
"dialog-fill-and-stroke"));
464 if (!
items.empty()) {
487 vector->setSwatch(createSwatch);
520 DocumentUndo::done(document, (
kind ==
FILL) ? _(
"Set gradient on fill") : _(
"Set gradient on stroke"), INKSCAPE_ICON(
"dialog-fill-and-stroke"));
527 if (!
items.empty()) {
537 SPDefs *defs = document->getDefs();
549 bool has_mesh =
false;
554 if (server && is<SPMeshGradient>(server))
558 if (!mesh || !has_mesh) {
576 bool isText = is<SPText>(
item);
603 bool isText = is<SPText>(
item);
613 DocumentUndo::done(document, (
kind ==
FILL) ? _(
"Set mesh on fill") : _(
"Set mesh on stroke"), INKSCAPE_ICON(
"dialog-fill-and-stroke"));
620 if (!
items.empty()) {
628 auto link_pattern = pattern;
636 if (link_pattern != root_pattern) {
651 gchar *urltext = g_strdup_printf(
"url(#%s)", patrepr->
attribute(
"id"));
671 if (style && ((
kind ==
FILL) ? style->
fill.isPaintserver() : style->
stroke.isPaintserver())) {
674 if (is<SPPattern>(server) && cast<SPPattern>(server)->rootPattern() == root_pattern)
695 DocumentUndo::done(document, (
kind ==
FILL) ? _(
"Set pattern on fill") : _(
"Set pattern on stroke"), INKSCAPE_ICON(
"dialog-fill-and-stroke"));
701 if (!
items.empty()) {
730 g_warning(
"file %s: line %d: Paint selector should not be in "
3x3 matrix representing an affine transformation.
Axis-aligned rectangle that can be empty.
static void done(SPDocument *document, Glib::ustring const &event_description, Glib::ustring const &undo_icon, unsigned int object_modified_tag=0)
static void maybeDone(SPDocument *document, const gchar *keyconst, Glib::ustring const &event_description, Glib::ustring const &undo_icon, unsigned int object_modified_tag=0)
DialogBase is the base class for the dialog system.
Interface for refcounted XML nodes.
virtual void appendChild(Node *child)=0
Append a node as the last child of this node.
void setAttribute(Util::const_char_ptr key, Util::const_char_ptr value)
Change an attribute of this node.
virtual Node * duplicate(Document *doc) const =0
Create a duplicate of this node.
virtual char const * attribute(char const *key) const =0
Get the string representation of a node's attribute.
To do: update description of desktop.
SPDocument * getDocument() const
sigc::connection connect_gradient_stop_selected(sigc::slot< void(SPStop *)> const &slot)
Inkscape::Selection * getSelection() const
sigc::connection connect_text_cursor_moved(sigc::slot< void(Inkscape::UI::Tools::TextTool *)> const &slot)
void emit_gradient_stop_selected(SPStop *stop)
sigc::connection connectEventContextChanged(F &&slot)
SPMeshNodeArray array
Mesh Gradients.
void setSwatch(bool swatch=true)
Paint type internal to SPStyle.
bool isPaintserver() const
Colors::Color const & getColor() const
void adjust_pattern(Geom::Affine const &postmul, bool set=false, PaintServerTransform=TRANSFORM_BOTH)
Geom::OptRect geometricBounds(Geom::Affine const &transform=Geom::identity()) const
Get item's geometric bounding box in this item's coordinate system.
Geom::OptRect visualBounds(Geom::Affine const &transform=Geom::identity(), bool wfilter=true, bool wclip=true, bool wmask=true) const
Get item's visual bounding box in this item's coordinate system.
bool fill_box(Geom::OptRect &box)
bool read(SPMeshGradient *mg)
void create(SPMeshGradient *mg, SPItem *item, Geom::OptRect bbox)
Create a default mesh.
SPObject is an abstract base class of all of the document nodes at the SVG document level.
SPStyle * style
Represents the style properties, whether from presentation attributes, the style attribute,...
Inkscape::XML::Node * getRepr()
Returns the XML representation of tree.
SPPattern const * rootPattern() const
SPPaintServer * getFillPaintServer()
T< SPAttr::FILL, SPIPaint > fill
fill
T< SPAttr::STROKE, SPIPaint > stroke
stroke
SPPaintServer * getStrokePaintServer()
T< SPAttr::FILL_RULE, SPIEnum< SPWindRule > > fill_rule
fill-rule: 0 nonzero, 1 evenodd
T< SPAttr::FILL_OPACITY, SPIScale24 > fill_opacity
fill-opacity
SPIPaint * getFillOrStroke(bool fill_)
Get either the fill or the stroke property.
T< SPAttr::STROKE_OPACITY, SPIScale24 > stroke_opacity
stroke-opacity
std::shared_ptr< Css const > css
int sp_desktop_query_style_from_list(const std::vector< SPItem * > &list, SPStyle *style, int property)
Query the given list of objects for the given property, write the result to style,...
std::optional< Color > sp_desktop_get_color(SPDesktop *desktop, bool is_fill)
Return the desktop's current color.
void sp_desktop_apply_css_recursive(SPObject *o, SPCSSAttr *css, bool skip_lines)
Apply style on object and children, recursively.
void sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change, bool write_current, bool switch_style)
Apply style on selection on desktop.
int sp_desktop_query_style(SPDesktop *desktop, SPStyle *style, int property)
Query the subselection (if any) or selection on the given desktop for the given property,...
int objects_query_fillstroke(const std::vector< SPItem * > &objects, SPStyle *style_res, bool const isfill)
Write to style_res the average fill or stroke of list of objects, if applicable.
void sp_desktop_set_color(SPDesktop *desktop, Color const &color, bool is_relative, bool fill)
Set color on selection on desktop.
@ QUERY_STYLE_PROPERTY_STROKE
@ QUERY_STYLE_PROPERTY_FILL
@ QUERY_STYLE_MULTIPLE_DIFFERENT
@ QUERY_STYLE_MULTIPLE_AVERAGED
@ QUERY_STYLE_MULTIPLE_SAME
Editable view implementation.
A base class for all dialogs.
TODO: insert short description here.
Fill style configuration.
SPGradient * sp_gradient_ensure_vector_normalized(SPGradient *gr)
Either normalizes given gradient to vector, or returns fresh normalized vector - in latter case,...
SPGradient * sp_document_default_gradient_vector(SPDocument *document, Color const &color, double opacity, bool singleStop)
SPGradient * sp_gradient_vector_for_object(SPDocument *const doc, SPDesktop *const desktop, SPObject *const o, Inkscape::PaintTarget const fill_or_stroke, bool singleStop)
Return the preferred vector for o, made from (in order of preference) its current vector,...
SPGradient * sp_item_set_gradient(SPItem *item, SPGradient *gr, SPGradientType type, Inkscape::PaintTarget fill_or_stroke)
Sets item fill or stroke to the gradient of the specified type with given vector, creating new privat...
Macro for icon names used in Inkscape.
static R & release(R &r)
Decrements the reference count of a anchored object.
Helper class to stream background task notifications as a series of messages.
static void append(std::vector< T > &target, std::vector< T > &&source)
void sp_pattern_set_uniform_scale(SPPattern *pattern, bool uniform)
void sp_pattern_set_gap(SPPattern *link_pattern, Geom::Scale gap_percent)
void sp_pattern_set_offset(SPPattern *pattern, const Geom::Point &offset)
void sp_pattern_set_color(SPPattern *pattern, Inkscape::Colors::Color const &c)
void sp_pattern_set_transform(SPPattern *pattern, const Geom::Affine &transform)
SPCSSAttr * sp_repr_css_attr_new()
Creates an empty SPCSSAttr (a class for manipulating CSS style properties).
void sp_repr_css_attr_unref(SPCSSAttr *css)
Unreferences an SPCSSAttr (will be garbage collected if no references remain).
void sp_repr_css_change_recursive(Node *repr, SPCSSAttr *css, gchar const *attr)
void sp_repr_css_unset_property(SPCSSAttr *css, gchar const *name)
Set a style property to "inkscape:unset".
void sp_repr_css_set_property(SPCSSAttr *css, gchar const *name, gchar const *value)
Set a style property to a new value (e.g.
@ SP_GRADIENT_TYPE_LINEAR
@ SP_GRADIENT_TYPE_RADIAL
TODO: insert short description here.
TODO: insert short description here.
SVG <pattern> implementation.
TODO: insert short description here.
TODO: insert short description here.
Interface for XML documents.
virtual Node * createElement(char const *name)=0
void sp_style_set_property_url(SPObject *item, gchar const *property, SPObject *linked, bool recursive)
SPStyle - a style object for SPItem objects.