Inkscape
Vector Graphics Editor
|
SVG stylesheets implementation. More...
Go to the source code of this file.
Functions | |
void | sp_style_filter_ref_changed (SPObject *old_ref, SPObject *ref, SPStyle *style) |
Gets called when the filter is (re)attached to the style. | |
void | sp_style_fill_paint_server_ref_changed (SPObject *old_ref, SPObject *ref, SPStyle *style) |
Gets called when the paintserver is (re)attached to the style. | |
void | sp_style_stroke_paint_server_ref_changed (SPObject *old_ref, SPObject *ref, SPStyle *style) |
Gets called when the paintserver is (re)attached to the style. | |
static void | sp_style_object_release (SPObject *object, SPStyle *style) |
Release callback. | |
static CRSelEng * | sp_repr_sel_eng () |
static void | sp_style_filter_ref_modified (SPObject *obj, unsigned flags, SPStyle *style) |
Emit style modified signal on style's object if the filter changed. | |
static void | sp_style_paint_server_ref_modified (SPObject *obj, unsigned, SPStyle *style) |
Emit style modified signal on style's object if server is style's fill or stroke paint server. | |
void | sp_style_set_ipaint_to_uri (SPStyle *style, SPIPaint *paint, const Inkscape::URI *uri, SPDocument *document) |
void | sp_style_set_ipaint_to_uri_string (SPStyle *style, SPIPaint *paint, const gchar *uri) |
void | sp_style_set_to_uri (SPStyle *style, bool isfill, Inkscape::URI const *uri) |
gchar const * | sp_style_get_css_unit_string (int unit) |
double | sp_style_css_size_px_to_units (double size, int unit, double font_size) |
double | sp_style_css_size_units_to_px (double size, int unit, double font_size) |
void | sp_style_set_property_url (SPObject *item, gchar const *property, SPObject *linked, bool recursive) |
SPCSSAttr * | sp_css_attr_from_style (SPStyle const *const style, guint const flags) |
SPCSSAttr * | sp_css_attr_from_object (SPObject *object, guint const flags) |
SPCSSAttr * | sp_css_attr_unset_text (SPCSSAttr *css) |
Unset any text-related properties. | |
SPCSSAttr * | sp_css_attr_unset_blacklist (SPCSSAttr *css) |
Unset properties that should not be set for default tool style. | |
static bool | is_url (char const *p) |
SPCSSAttr * | sp_css_attr_unset_uris (SPCSSAttr *css) |
Unset any properties that contain URI values. | |
static void | sp_css_attr_scale_property_single (SPCSSAttr *css, gchar const *property, double ex, bool only_with_units=false) |
Scale a single-value property. | |
static void | sp_css_attr_scale_property_list (SPCSSAttr *css, gchar const *property, double ex) |
Scale a list-of-values property. | |
SPCSSAttr * | sp_css_attr_scale (SPCSSAttr *css, double ex) |
Scale any properties that may hold <length> by ex. | |
void | css_quote (Glib::ustring &val) |
Quote and/or escape string for writing to CSS, changing strings in place. | |
void | css_font_family_quote (Glib::ustring &val) |
Quote font names in font-family lists, changing string in place. | |
void | css_unquote (Glib::ustring &val) |
Remove paired single and double quotes from a string, changing string in place. | |
void | css_font_family_unquote (Glib::ustring &val) |
Remove paired single and double quotes from font names in font-family lists, changing string in place. | |
Variables | |
static constexpr int | BMAX = 8192 |
auto & | _prop_helper = SPStylePropHelper::instance() |
SVG stylesheets implementation.
Definition in file style.cpp.
void css_font_family_quote | ( | Glib::ustring & | val | ) |
Quote font names in font-family lists, changing string in place.
We use unquoted names internally but some need to be quoted in CSS.
Definition at line 1687 of file style.cpp.
References css_quote().
Referenced by Inkscape::FontLister::fill_css(), and SPIString::get_value().
void css_font_family_unquote | ( | Glib::ustring & | val | ) |
Remove paired single and double quotes from font names in font-family lists, changing string in place.
We use unquoted family names internally but CSS sometimes uses quoted names.
Definition at line 1724 of file style.cpp.
References css_unquote().
Referenced by Inkscape::UI::Toolbar::TextToolbar::fontfamily_value_changed(), and SPIString::read().
void css_quote | ( | Glib::ustring & | val | ) |
Quote and/or escape string for writing to CSS, changing strings in place.
See: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
Definition at line 1648 of file style.cpp.
Referenced by css_font_family_quote(), Inkscape::FontLister::fill_css(), and SPIString::get_value().
void css_unquote | ( | Glib::ustring & | val | ) |
Remove paired single and double quotes from a string, changing string in place.
Definition at line 1706 of file style.cpp.
Referenced by css_font_family_unquote(), and SPIString::read().
|
static |
Definition at line 1524 of file style.cpp.
Referenced by sp_css_attr_unset_uris().
Definition at line 1427 of file style.cpp.
References result, sp_css_attr_from_style(), SP_STYLE_FLAG_ALWAYS(), SP_STYLE_FLAG_IFSET(), and SPObject::style.
Referenced by copy_style_links(), file_import(), Inkscape::UI::Tools::spdc_check_for_and_apply_waiting_LPE(), and take_style_from_item().
Definition at line 1409 of file style.cpp.
References css, sp_repr_css_attr_add_from_string(), sp_repr_css_attr_new(), SP_STYLE_FLAG_ALWAYS(), SP_STYLE_FLAG_IFSET(), and SPStyle::write().
Referenced by Inkscape::UI::Dialog::TextEdit::apply_changes(), SPText::hide_shape_inside(), item_to_paths(), Inkscape::UI::Toolbar::TextToolbar::lineheight_unit_changed(), Inkscape::UI::Toolbar::TextToolbar::lineheight_value_changed(), and sp_css_attr_from_object().
Scale any properties that may hold <length> by ex.
Definition at line 1627 of file style.cpp.
References css, sp_css_attr_scale_property_list(), and sp_css_attr_scale_property_single().
Referenced by Inkscape::UI::Toolbar::TextToolbar::lineheight_unit_changed(), Inkscape::LivePathEffect::lpe_shape_revert_stroke_and_fill(), sp_desktop_apply_css_recursive(), sp_te_apply_style(), take_style_from_item(), and Inkscape::UI::Toolbar::TextToolbar::text_outer_set_style().
|
static |
Scale a list-of-values property.
Definition at line 1594 of file style.cpp.
References css, sp_repr_css_property(), sp_repr_css_set_property(), Inkscape::CSSOStringStream::str(), and w.
Referenced by sp_css_attr_scale().
|
static |
Scale a single-value property.
Definition at line 1568 of file style.cpp.
References css, sp_repr_css_property(), sp_repr_css_set_property(), Inkscape::CSSOStringStream::str(), and w.
Referenced by sp_css_attr_scale().
Unset properties that should not be set for default tool style.
This list needs to be reviewed.
Definition at line 1498 of file style.cpp.
References css, and sp_repr_css_set_property().
Referenced by Inkscape::UI::Dialog::StyleFromSelectionToTool(), and take_style_from_item().
Unset any text-related properties.
Definition at line 1444 of file style.cpp.
References css, and sp_repr_css_set_property().
Referenced by sp_desktop_get_style(), sp_desktop_set_style(), Inkscape::UI::Dialog::StyleFromSelectionToTool(), and take_style_from_item().
Unset any properties that contain URI values.
Used for storing style that will be reused across documents when carrying the referenced defs is impractical.
Definition at line 1543 of file style.cpp.
References css, is_url(), sp_repr_css_property(), and sp_repr_css_set_property().
Referenced by Inkscape::UI::Tools::TweakTool::set_style(), sp_desktop_set_style(), and Inkscape::UI::Dialog::StyleFromSelectionToTool().
|
static |
We probably want handlers for link and arguably visited (though inkscape can't visit links at the time of writing). hover etc. more useful in inkview than the editor inkscape.
http://www.w3.org/TR/SVG11/styling.html#StylingWithCSS says that the following should be honoured, at least by inkview: :hover, :active, :focus, :visited, :link.
Definition at line 1225 of file style.cpp.
References cr_sel_eng_new(), and Inkscape::XML::croco_node_iface.
Referenced by SPStyle::_mergeObjectStylesheet().
double sp_style_css_size_px_to_units | ( | double | size, |
int | unit, | ||
double | font_size | ||
) |
Definition at line 1332 of file style.cpp.
References Inkscape::Util::Quantity::convert(), size, SP_CSS_UNIT_CM, SP_CSS_UNIT_EM, SP_CSS_UNIT_EX, SP_CSS_UNIT_IN, SP_CSS_UNIT_MM, SP_CSS_UNIT_NONE, SP_CSS_UNIT_PC, SP_CSS_UNIT_PERCENT, SP_CSS_UNIT_PT, and SP_CSS_UNIT_PX.
Referenced by Inkscape::UI::Toolbar::TextToolbar::_selectionChanged(), SPIFontSize::get_value(), Inkscape::UI::Dialog::TextEdit::onReadSelection(), and sp_style_css_size_units_to_px().
double sp_style_css_size_units_to_px | ( | double | size, |
int | unit, | ||
double | font_size | ||
) |
Definition at line 1367 of file style.cpp.
References size, SP_CSS_UNIT_PX, and sp_style_css_size_px_to_units().
Referenced by Inkscape::UI::Dialog::TextEdit::fillTextStyle(), Inkscape::UI::Toolbar::TextToolbar::fontsize_value_changed(), and Inkscape::UI::Dialog::TextEdit::setPreviewText().
Gets called when the paintserver is (re)attached to the style.
Definition at line 1193 of file style.cpp.
References SPStyle::fill_ps_modified_connection, ref, SPStyle::signal_fill_ps_changed, and sp_style_paint_server_ref_modified().
Referenced by SPStyle::clear(), SPIPaint::read(), and sp_style_set_ipaint_to_uri().
Gets called when the filter is (re)attached to the style.
Definition at line 1147 of file style.cpp.
References SPStyle::filter_modified_connection, ref, SPStyle::signal_filter_changed, and sp_style_filter_ref_modified().
Referenced by SPStyle::clear(), and SPIFilter::read().
Emit style modified signal on style's object if the filter changed.
Definition at line 1126 of file style.cpp.
References SPStyle::block_filter_bbox_updates, SPStyle::getFilter(), SPStyle::object, SPObject::requestDisplayUpdate(), and SPObject::requestModified().
Referenced by sp_style_filter_ref_changed().
gchar const * sp_style_get_css_unit_string | ( | int | unit | ) |
Definition at line 1305 of file style.cpp.
References SP_CSS_UNIT_CM, SP_CSS_UNIT_EM, SP_CSS_UNIT_EX, SP_CSS_UNIT_IN, SP_CSS_UNIT_MM, SP_CSS_UNIT_NONE, SP_CSS_UNIT_PC, SP_CSS_UNIT_PERCENT, SP_CSS_UNIT_PT, and SP_CSS_UNIT_PX.
Referenced by Inkscape::UI::Toolbar::TextToolbar::_selectionChanged(), SPText::description(), Inkscape::UI::Dialog::TextEdit::fillTextStyle(), Inkscape::UI::Toolbar::TextToolbar::fontsize_value_changed(), SPILength::get_value(), SPIFontSize::get_value(), Inkscape::UI::Toolbar::TextToolbar::lineheight_unit_changed(), Inkscape::UI::Widget::FontSelector::set_fontsize_tooltip(), and Inkscape::UI::Toolbar::TextToolbar::TextToolbar().
Release callback.
Definition at line 1116 of file style.cpp.
References SPStyle::object.
Referenced by SPStyle::SPStyle().
|
static |
Emit style modified signal on style's object if server is style's fill or stroke paint server.
Definition at line 1167 of file style.cpp.
References SPStyle::fill, SPStyle::getFillPaintServer(), SPStyle::getStrokePaintServer(), SPStyle::object, SPObject::requestModified(), and SPStyle::stroke.
Referenced by sp_style_fill_paint_server_ref_changed(), and sp_style_stroke_paint_server_ref_changed().
void sp_style_set_ipaint_to_uri | ( | SPStyle * | style, |
SPIPaint * | paint, | ||
const Inkscape::URI * | uri, | ||
SPDocument * | document | ||
) |
Definition at line 1249 of file style.cpp.
References SPStyle::document, SPStyle::fill, SPStyle::fill_ps_changed_connection, SPIPaint::href, SPStyle::object, sp_style_fill_paint_server_ref_changed(), sp_style_stroke_paint_server_ref_changed(), and SPStyle::stroke_ps_changed_connection.
Referenced by SPIPaint::cascade(), sp_style_set_ipaint_to_uri_string(), and sp_style_set_to_uri().
Definition at line 1287 of file style.cpp.
References SPStyle::document, and sp_style_set_ipaint_to_uri().
Referenced by SPIPaint::read().
void sp_style_set_property_url | ( | SPObject * | item, |
gchar const * | property, | ||
SPObject * | linked, | ||
bool | recursive | ||
) |
Definition at line 1380 of file style.cpp.
References css, SPObject::getId(), SPObject::getRepr(), item, sp_repr_css_attr_new(), sp_repr_css_attr_unref(), sp_repr_css_change(), sp_repr_css_change_recursive(), sp_repr_css_set_property(), and sp_repr_css_unset_property().
Referenced by Inkscape::UI::Widget::ObjectCompositeSettings::_blendBlurValueChanged(), Inkscape::UI::Dialog::CloneTiler::apply(), fix_ref(), Inkscape::UI::Tools::MeshTool::new_default(), Inkscape::UI::Dialog::FilterEffectsDialog::FilterModifier::selection_toggled(), sp_gradient_convert_to_userspace(), sp_item_set_gradient(), Inkscape::UI::Tools::sp_tweak_color_recursive(), and Inkscape::UI::Widget::FillNStroke::updateFromPaint().
void sp_style_set_to_uri | ( | SPStyle * | style, |
bool | isfill, | ||
Inkscape::URI const * | uri | ||
) |
Definition at line 1298 of file style.cpp.
References SPStyle::document, SPStyle::getFillOrStroke(), and sp_style_set_ipaint_to_uri().
Referenced by objects_query_fillstroke().
void sp_style_stroke_paint_server_ref_changed | ( | SPObject * | old_ref, |
SPObject * | ref, | ||
SPStyle * | style | ||
) |
Gets called when the paintserver is (re)attached to the style.
Definition at line 1210 of file style.cpp.
References ref, SPStyle::signal_stroke_ps_changed, sp_style_paint_server_ref_modified(), and SPStyle::stroke_ps_modified_connection.
Referenced by SPStyle::clear(), SPIPaint::read(), and sp_style_set_ipaint_to_uri().
auto& _prop_helper = SPStylePropHelper::instance() |
Definition at line 246 of file style.cpp.
Referenced by SPStyle::clear(), SPStyle::isSet(), SPStyle::readIfUnset(), and SPStyle::SPStyle().