Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
desktop-style.cpp File Reference

Go to the source code of this file.

Functions

static bool isTextualItem (SPObject const *obj)
 
void sp_desktop_set_color (SPDesktop *desktop, Color const &color, bool is_relative, bool fill)
 Set color on selection on desktop.
 
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.
 
void sp_desktop_set_style (Inkscape::ObjectSet *set, SPDesktop *desktop, SPCSSAttr *css, bool change, bool write_current, bool switch_style)
 
SPCSSAttrsp_desktop_get_style (SPDesktop *desktop, bool with_text)
 Return the desktop's current style.
 
std::optional< Colorsp_desktop_get_color (SPDesktop *desktop, bool is_fill)
 Return the desktop's current color.
 
double sp_desktop_get_master_opacity_tool (SPDesktop *desktop, Glib::ustring const &tool, bool *has_opacity)
 
double sp_desktop_get_opacity_tool (SPDesktop *desktop, Glib::ustring const &tool, bool is_fill)
 
std::optional< Colorsp_desktop_get_color_tool (SPDesktop *desktop, Glib::ustring const &tool, bool is_fill)
 
void sp_desktop_apply_style_tool (SPDesktop *desktop, Inkscape::XML::Node *repr, Glib::ustring const &tool_path, bool with_text)
 Apply the desktop's current style or the tool style to repr.
 
double sp_desktop_get_font_size_tool (SPDesktop *desktop)
 Returns the font size (in SVG pixels) of the text tool style (if text tool uses its own style) or desktop style (otherwise).
 
gdouble stroke_average_width (const std::vector< SPItem * > &objects)
 Determine average stroke width, simple method.
 
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.
 
int objects_query_opacity (const std::vector< SPItem * > &objects, SPStyle *style_res)
 Write to style_res the average opacity of a list of objects.
 
int objects_query_strokewidth (const std::vector< SPItem * > &objects, SPStyle *style_res)
 Write to style_res the average stroke width of a list of objects.
 
int objects_query_miterlimit (const std::vector< SPItem * > &objects, SPStyle *style_res)
 Write to style_res the average miter limit of a list of objects.
 
int objects_query_strokecap (const std::vector< SPItem * > &objects, SPStyle *style_res)
 Write to style_res the stroke cap of a list of objects.
 
int objects_query_strokejoin (const std::vector< SPItem * > &objects, SPStyle *style_res)
 Write to style_res the stroke join of a list of objects.
 
int objects_query_paintorder (const std::vector< SPItem * > &objects, SPStyle *style_res)
 Write to style_res the paint order of a list of objects.
 
int objects_query_fontnumbers (const std::vector< SPItem * > &objects, SPStyle *style_res)
 Write to style_res the average font size and spacing of objects.
 
int objects_query_fontstyle (const std::vector< SPItem * > &objects, SPStyle *style_res)
 Write to style_res the average font style of objects.
 
int objects_query_fontvariants (const std::vector< SPItem * > &objects, SPStyle *style_res)
 
int objects_query_writing_modes (const std::vector< SPItem * > &objects, SPStyle *style_res)
 Write to style_res the average writing modes style of objects.
 
int objects_query_fontfeaturesettings (const std::vector< SPItem * > &objects, SPStyle *style_res)
 
static int objects_query_baselines (const std::vector< SPItem * > &objects, SPStyle *style_res)
 Write to style_res the baseline numbers.
 
int objects_query_fontfamily (const std::vector< SPItem * > &objects, SPStyle *style_res)
 Write to style_res the average font family of objects.
 
static int objects_query_fontspecification (const std::vector< SPItem * > &objects, SPStyle *style_res)
 
int objects_query_blend (const std::vector< SPItem * > &objects, SPStyle *style_res)
 
int objects_query_isolation (const std::vector< SPItem * > &objects, SPStyle *style_res)
 
int objects_query_blur (const std::vector< SPItem * > &objects, SPStyle *style_res)
 Write to style_res the average blurring of a list of objects.
 
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, return appropriate flag.
 
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, write the result to style, return appropriate flag.
 

Function Documentation

◆ isTextualItem()

◆ objects_query_baselines()

static int objects_query_baselines ( const std::vector< SPItem * > &  objects,
SPStyle style_res 
)
static

◆ objects_query_blend()

◆ objects_query_blur()

int objects_query_blur ( const std::vector< SPItem * > &  objects,
SPStyle style_res 
)

◆ objects_query_fillstroke()

◆ objects_query_fontfamily()

int objects_query_fontfamily ( const std::vector< SPItem * > &  objects,
SPStyle style_res 
)

Write to style_res the average font family of objects.

Definition at line 1506 of file desktop-style.cpp.

References SPStyle::font_family, isTextualItem(), QUERY_STYLE_MULTIPLE_DIFFERENT, QUERY_STYLE_MULTIPLE_SAME, QUERY_STYLE_NOTHING, and QUERY_STYLE_SINGLE.

Referenced by sp_desktop_query_style_from_list().

◆ objects_query_fontfeaturesettings()

int objects_query_fontfeaturesettings ( const std::vector< SPItem * > &  objects,
SPStyle style_res 
)

◆ objects_query_fontnumbers()

int objects_query_fontnumbers ( const std::vector< SPItem * > &  objects,
SPStyle style_res 
)

◆ objects_query_fontspecification()

static int objects_query_fontspecification ( const std::vector< SPItem * > &  objects,
SPStyle style_res 
)
static

◆ objects_query_fontstyle()

int objects_query_fontstyle ( const std::vector< SPItem * > &  objects,
SPStyle style_res 
)

◆ objects_query_fontvariants()

◆ objects_query_isolation()

int objects_query_isolation ( const std::vector< SPItem * > &  objects,
SPStyle style_res 
)

◆ objects_query_miterlimit()

int objects_query_miterlimit ( const std::vector< SPItem * > &  objects,
SPStyle style_res 
)

Write to style_res the average miter limit of a list of objects.

Definition at line 749 of file desktop-style.cpp.

References QUERY_STYLE_MULTIPLE_AVERAGED, QUERY_STYLE_MULTIPLE_SAME, QUERY_STYLE_NOTHING, QUERY_STYLE_SINGLE, SPStyle::stroke, and SPStyle::stroke_miterlimit.

Referenced by sp_desktop_query_style_from_list().

◆ objects_query_opacity()

int objects_query_opacity ( const std::vector< SPItem * > &  objects,
SPStyle style_res 
)

Write to style_res the average opacity of a list of objects.

Definition at line 617 of file desktop-style.cpp.

References SPStyle::opacity, QUERY_STYLE_MULTIPLE_AVERAGED, QUERY_STYLE_MULTIPLE_SAME, QUERY_STYLE_NOTHING, and QUERY_STYLE_SINGLE.

Referenced by sp_desktop_query_style_from_list().

◆ objects_query_paintorder()

int objects_query_paintorder ( const std::vector< SPItem * > &  objects,
SPStyle style_res 
)

Write to style_res the paint order of a list of objects.

Definition at line 909 of file desktop-style.cpp.

References SPStyle::paint_order, QUERY_STYLE_MULTIPLE_DIFFERENT, QUERY_STYLE_MULTIPLE_SAME, QUERY_STYLE_NOTHING, QUERY_STYLE_SINGLE, and SPStyle::stroke.

Referenced by sp_desktop_query_style_from_list().

◆ objects_query_strokecap()

int objects_query_strokecap ( const std::vector< SPItem * > &  objects,
SPStyle style_res 
)

◆ objects_query_strokejoin()

int objects_query_strokejoin ( const std::vector< SPItem * > &  objects,
SPStyle style_res 
)

◆ objects_query_strokewidth()

int objects_query_strokewidth ( const std::vector< SPItem * > &  objects,
SPStyle style_res 
)

◆ objects_query_writing_modes()

int objects_query_writing_modes ( const std::vector< SPItem * > &  objects,
SPStyle style_res 
)

◆ sp_desktop_apply_css_recursive()

◆ sp_desktop_apply_style_tool()

◆ sp_desktop_get_color()

std::optional< Color > sp_desktop_get_color ( SPDesktop desktop,
bool  is_fill 
)

◆ sp_desktop_get_color_tool()

◆ sp_desktop_get_font_size_tool()

double sp_desktop_get_font_size_tool ( SPDesktop desktop)

Returns the font size (in SVG pixels) of the text tool style (if text tool uses its own style) or desktop style (otherwise).

Definition at line 398 of file desktop-style.cpp.

References desktop, SPStyle::font_size, Inkscape::Preferences::get(), Inkscape::Preferences::getBool(), Inkscape::Preferences::getString(), and SPStyle::mergeString().

Referenced by Inkscape::UI::Tools::TextTool::root_handler().

◆ sp_desktop_get_master_opacity_tool()

◆ sp_desktop_get_opacity_tool()

◆ sp_desktop_get_style()

◆ sp_desktop_query_style()

◆ sp_desktop_query_style_from_list()

int sp_desktop_query_style_from_list ( const std::vector< SPItem * > &  list,
SPStyle style,
int  property 
)

◆ sp_desktop_set_color()

void sp_desktop_set_color ( SPDesktop desktop,
Color const &  color,
bool  is_relative,
bool  fill 
)

◆ sp_desktop_set_style() [1/2]

void sp_desktop_set_style ( Inkscape::ObjectSet set,
SPDesktop desktop,
SPCSSAttr css,
bool  change,
bool  write_current,
bool  switch_style 
)
Todo:
FIXME: in set_style, compensate pattern and gradient fills, stroke width, rect corners, font size for the object's own transform so that pasting fills does not depend on preserve/optimize.

Definition at line 179 of file desktop-style.cpp.

References SPDesktop::_set_style_signal, css, SPDesktop::current, desktop, Inkscape::Preferences::get(), SPDesktop::getTool(), isTextualItem(), item, Inkscape::Preferences::mergeStyle(), set, sp_css_attr_unset_text(), sp_css_attr_unset_uris(), sp_desktop_apply_css_recursive(), sp_repr_css_attr_new(), sp_repr_css_attr_unref(), sp_repr_css_merge(), sp_repr_css_property_is_unset(), and sp_repr_css_unset_property().

◆ sp_desktop_set_style() [2/2]

void sp_desktop_set_style ( SPDesktop desktop,
SPCSSAttr css,
bool  change,
bool  write_current,
bool  switch_style 
)

Apply style on selection on desktop.

Definition at line 173 of file desktop-style.cpp.

References css, desktop, SPDesktop::getSelection(), and sp_desktop_set_style().

Referenced by Inkscape::UI::Tools::EraserTool::_handleStrokeStyle(), Inkscape::UI::Widget::SelectedStyle::_on_paste_callback(), Inkscape::UI::Dialog::TextEdit::apply_changes(), Inkscape::UI::Widget::StrokeStyle::buttonToggledCB(), Inkscape::UI::Widget::RotateableSwatch::color_adjust(), Inkscape::UI::Toolbar::TextToolbar::fontstyle_value_changed(), Inkscape::UI::Toolbar::TextToolbar::lineheight_unit_changed(), Inkscape::UI::Toolbar::TextToolbar::lineheight_value_changed(), Inkscape::UI::Toolbar::TextToolbar::mergeDefaultStyle(), Inkscape::UI::Dialog::ColorItem::on_click(), Inkscape::UI::Widget::SelectedStyle::on_fill_black(), Inkscape::UI::Widget::SelectedStyle::on_fill_invert(), Inkscape::UI::Widget::SelectedStyle::on_fill_lastselected(), Inkscape::UI::Widget::SelectedStyle::on_fill_lastused(), Inkscape::UI::Widget::SelectedStyle::on_fill_opaque(), Inkscape::UI::Widget::SelectedStyle::on_fill_remove(), Inkscape::UI::Widget::SelectedStyle::on_fill_unset(), Inkscape::UI::Widget::SelectedStyle::on_fill_white(), Inkscape::UI::Widget::SelectedStyle::on_opacity_changed(), Inkscape::UI::Widget::SelectedStyle::on_opacity_click(), Inkscape::UI::Widget::SelectedStyle::on_popup_preset(), Inkscape::UI::Widget::SelectedStyle::on_stroke_black(), Inkscape::UI::Widget::SelectedStyle::on_stroke_invert(), Inkscape::UI::Widget::SelectedStyle::on_stroke_lastselected(), Inkscape::UI::Widget::SelectedStyle::on_stroke_lastused(), Inkscape::UI::Widget::SelectedStyle::on_stroke_opaque(), Inkscape::UI::Widget::SelectedStyle::on_stroke_remove(), Inkscape::UI::Widget::SelectedStyle::on_stroke_unset(), Inkscape::UI::Widget::SelectedStyle::on_stroke_white(), Inkscape::ObjectSet::removeFilter(), Inkscape::UI::Toolbar::TextToolbar::script_changed(), Inkscape::UI::Widget::SelectedStyle::SelectedStyle(), Inkscape::UI::Widget::StyleSubject::Selection::setCSS(), Inkscape::UI::Widget::FillNStroke::setFillrule(), Inkscape::UI::Widget::StrokeStyle::setStrokeDash(), Inkscape::UI::Widget::StrokeStyle::setStrokeMiter(), Inkscape::UI::Widget::StrokeStyle::setStrokeWidth(), sp_desktop_set_color(), sp_desktop_set_style(), Inkscape::ObjectSet::swapFillStroke(), Inkscape::UI::Toolbar::TextToolbar::text_outer_set_style(), Inkscape::UI::Widget::StrokeStyle::unitChangedCB(), Inkscape::UI::Widget::FillNStroke::updateFromPaint(), and Inkscape::UI::Widget::RotateableStrokeWidth::value_adjust().

◆ stroke_average_width()

gdouble stroke_average_width ( const std::vector< SPItem * > &  objects)

Determine average stroke width, simple method.

Definition at line 421 of file desktop-style.cpp.

References Geom::Affine::descrim(), SPItem::i2dt_affine(), Geom::infinity(), item, SPStyle::stroke, SPStyle::stroke_width, SPObject::style, and width.

Referenced by Inkscape::SelTrans::_updateVolatileState().