From 1636c1dd1651780d01759676b194312529f211f7 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Sat, 25 Jun 2016 22:24:26 +0200 Subject: Moved next functions, added namespace, renamed range functions (bzr r14954.1.10) --- src/desktop-style.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/desktop-style.cpp') diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 7f9b46c7d..6fab01f16 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -194,7 +194,7 @@ sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change, bool write sp_repr_css_merge(css_write, css); sp_css_attr_unset_uris(css_write); prefs->mergeStyle("/desktop/style", css_write); - std::vector const itemlist = desktop->selection->itemList(); + std::vector const itemlist = desktop->selection->items(); for (std::vector::const_iterator i = itemlist.begin(); i!= itemlist.end(); ++i) { /* last used styles for 3D box faces are stored separately */ SPObject *obj = *i; @@ -234,7 +234,7 @@ sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change, bool write sp_repr_css_merge(css_no_text, css); css_no_text = sp_css_attr_unset_text(css_no_text); - std::vector const itemlist = desktop->selection->itemList(); + std::vector const itemlist = desktop->selection->items(); for (std::vector::const_iterator i = itemlist.begin(); i!= itemlist.end(); ++i) { SPItem *item = *i; @@ -1917,7 +1917,7 @@ sp_desktop_query_style(SPDesktop *desktop, SPStyle *style, int property) // otherwise, do querying and averaging over selection if (desktop->selection != NULL) { - return sp_desktop_query_style_from_list (desktop->selection->itemList(), style, property); + return sp_desktop_query_style_from_list (desktop->selection->items(), style, property); } return QUERY_STYLE_NOTHING; -- cgit v1.2.3 From d1947e768272c703674129d5c583204ff2b59251 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 13 Jul 2016 13:36:19 +0200 Subject: Second part of new SPObject children list (bzr r14954.1.19) --- src/desktop-style.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'src/desktop-style.cpp') diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 885d17c21..a52ab3d76 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -163,17 +163,17 @@ sp_desktop_apply_css_recursive(SPObject *o, SPCSSAttr *css, bool skip_lines) return; } - for ( SPObject *child = o->firstChild() ; child ; child = child->getNext() ) { + for (auto& child: o->_children) { if (sp_repr_css_property(css, "opacity", NULL) != NULL) { // Unset properties which are accumulating and thus should not be set recursively. // For example, setting opacity 0.5 on a group recursively would result in the visible opacity of 0.25 for an item in the group. SPCSSAttr *css_recurse = sp_repr_css_attr_new(); sp_repr_css_merge(css_recurse, css); sp_repr_css_set_property(css_recurse, "opacity", NULL); - sp_desktop_apply_css_recursive(child, css_recurse, skip_lines); + sp_desktop_apply_css_recursive(&child, css_recurse, skip_lines); sp_repr_css_attr_unref(css_recurse); } else { - sp_desktop_apply_css_recursive(child, css, skip_lines); + sp_desktop_apply_css_recursive(&child, css, skip_lines); } } } @@ -1714,10 +1714,11 @@ objects_query_blend (const std::vector &objects, SPStyle *style_res) int blendcount = 0; // determine whether filter is simple (blend and/or blur) or complex - for(SPObject *primitive_obj = style->getFilter()->children; - primitive_obj && dynamic_cast(primitive_obj); - primitive_obj = primitive_obj->next) { - SPFilterPrimitive *primitive = dynamic_cast(primitive_obj); + for(auto& primitive_obj: style->getFilter()->_children) { + SPFilterPrimitive *primitive = dynamic_cast(&primitive_obj); + if (!primitive) { + break; + } if (dynamic_cast(primitive)) { ++blendcount; } else if (dynamic_cast(primitive)) { @@ -1730,10 +1731,12 @@ objects_query_blend (const std::vector &objects, SPStyle *style_res) // simple filter if(blurcount == 1 || blendcount == 1) { - for(SPObject *primitive_obj = style->getFilter()->children; - primitive_obj && dynamic_cast(primitive_obj); - primitive_obj = primitive_obj->next) { - SPFeBlend *spblend = dynamic_cast(primitive_obj); + for(auto& primitive_obj: style->getFilter()->_children) { + SPFilterPrimitive *primitive = dynamic_cast(&primitive_obj); + if (!primitive) { + break; + } + SPFeBlend *spblend = dynamic_cast(&primitive_obj); if (spblend) { blend = spblend->blend_mode; } -- cgit v1.2.3 From 9e210a6d1333c3366681547e3e81593ef69ff73e Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 14 Jul 2016 12:56:49 +0200 Subject: Last part of new SPObject children list (bzr r14954.1.20) --- src/desktop-style.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/desktop-style.cpp') diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index a52ab3d76..e4b7c6a83 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -1810,9 +1810,8 @@ objects_query_blur (const std::vector &objects, SPStyle *style_res) //if object has a filter if (style->filter.set && style->getFilter()) { //cycle through filter primitives - SPObject *primitive_obj = style->getFilter()->children; - while (primitive_obj) { - SPFilterPrimitive *primitive = dynamic_cast(primitive_obj); + for(auto& primitive_obj: style->getFilter()->_children) { + SPFilterPrimitive *primitive = dynamic_cast(&primitive_obj); if (primitive) { //if primitive is gaussianblur @@ -1830,7 +1829,6 @@ objects_query_blur (const std::vector &objects, SPStyle *style_res) } } } - primitive_obj = primitive_obj->next; } } } -- cgit v1.2.3 From 24d3f50003ca3cec6a03a7f5267cc4fe5588c69f Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 14 Jul 2016 13:17:21 +0200 Subject: Renamed children list in SPObject (bzr r14954.1.21) --- src/desktop-style.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/desktop-style.cpp') diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index e4b7c6a83..01586096c 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -163,7 +163,7 @@ sp_desktop_apply_css_recursive(SPObject *o, SPCSSAttr *css, bool skip_lines) return; } - for (auto& child: o->_children) { + for (auto& child: o->children) { if (sp_repr_css_property(css, "opacity", NULL) != NULL) { // Unset properties which are accumulating and thus should not be set recursively. // For example, setting opacity 0.5 on a group recursively would result in the visible opacity of 0.25 for an item in the group. @@ -1714,7 +1714,7 @@ objects_query_blend (const std::vector &objects, SPStyle *style_res) int blendcount = 0; // determine whether filter is simple (blend and/or blur) or complex - for(auto& primitive_obj: style->getFilter()->_children) { + for(auto& primitive_obj: style->getFilter()->children) { SPFilterPrimitive *primitive = dynamic_cast(&primitive_obj); if (!primitive) { break; @@ -1731,7 +1731,7 @@ objects_query_blend (const std::vector &objects, SPStyle *style_res) // simple filter if(blurcount == 1 || blendcount == 1) { - for(auto& primitive_obj: style->getFilter()->_children) { + for(auto& primitive_obj: style->getFilter()->children) { SPFilterPrimitive *primitive = dynamic_cast(&primitive_obj); if (!primitive) { break; @@ -1810,7 +1810,7 @@ objects_query_blur (const std::vector &objects, SPStyle *style_res) //if object has a filter if (style->filter.set && style->getFilter()) { //cycle through filter primitives - for(auto& primitive_obj: style->getFilter()->_children) { + for(auto& primitive_obj: style->getFilter()->children) { SPFilterPrimitive *primitive = dynamic_cast(&primitive_obj); if (primitive) { -- cgit v1.2.3 From f35bb1f74a0ffeb5c6477a25e3c4cde87a97bcf1 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 28 Jul 2016 12:06:06 +0200 Subject: Removed unused includes, decrease compilation time (bzr r15025) --- src/desktop-style.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src/desktop-style.cpp') diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 7f9b46c7d..393e0caa7 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -24,11 +24,7 @@ #include "selection.h" #include "inkscape.h" #include "style.h" -#include "preferences.h" -#include "sp-use.h" #include "filters/blend.h" -#include "sp-filter.h" -#include "sp-filter-reference.h" #include "filters/gaussian-blur.h" #include "sp-flowtext.h" #include "sp-flowregion.h" @@ -39,15 +35,12 @@ #include "sp-textpath.h" #include "sp-tref.h" #include "sp-tspan.h" -#include "xml/repr.h" #include "xml/sp-css-attr.h" #include "sp-path.h" #include "ui/tools/tool-base.h" #include "desktop-style.h" -#include "svg/svg-icc-color.h" #include "box3d-side.h" -#include <2geom/math-utils.h> namespace { -- cgit v1.2.3 From 43b49e325db73cc19b1731db6c69545664ee8fbe Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 28 Jul 2016 13:26:17 +0200 Subject: Reverted changes to r15024 after many building problems (bzr r15027) --- src/desktop-style.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/desktop-style.cpp') diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 393e0caa7..7f9b46c7d 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -24,7 +24,11 @@ #include "selection.h" #include "inkscape.h" #include "style.h" +#include "preferences.h" +#include "sp-use.h" #include "filters/blend.h" +#include "sp-filter.h" +#include "sp-filter-reference.h" #include "filters/gaussian-blur.h" #include "sp-flowtext.h" #include "sp-flowregion.h" @@ -35,12 +39,15 @@ #include "sp-textpath.h" #include "sp-tref.h" #include "sp-tspan.h" +#include "xml/repr.h" #include "xml/sp-css-attr.h" #include "sp-path.h" #include "ui/tools/tool-base.h" #include "desktop-style.h" +#include "svg/svg-icc-color.h" #include "box3d-side.h" +#include <2geom/math-utils.h> namespace { -- cgit v1.2.3 From 35830f456cadaecf8b8e3944e3031a1a93f6cb41 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 3 Aug 2016 15:29:38 +0200 Subject: Removed unused includes, decreased compilation time. Once again (bzr r15034) --- src/desktop-style.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src/desktop-style.cpp') diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 7f9b46c7d..393e0caa7 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -24,11 +24,7 @@ #include "selection.h" #include "inkscape.h" #include "style.h" -#include "preferences.h" -#include "sp-use.h" #include "filters/blend.h" -#include "sp-filter.h" -#include "sp-filter-reference.h" #include "filters/gaussian-blur.h" #include "sp-flowtext.h" #include "sp-flowregion.h" @@ -39,15 +35,12 @@ #include "sp-textpath.h" #include "sp-tref.h" #include "sp-tspan.h" -#include "xml/repr.h" #include "xml/sp-css-attr.h" #include "sp-path.h" #include "ui/tools/tool-base.h" #include "desktop-style.h" -#include "svg/svg-icc-color.h" #include "box3d-side.h" -#include <2geom/math-utils.h> namespace { -- cgit v1.2.3 From 532f77b14a76fc04e6bdeca3625f9a55b5f11bdf Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Tue, 25 Oct 2016 00:58:43 +0200 Subject: CPPification: almost all sp_object_set_whatever and sp_selection_whatever global functions are now methods of ObjectSet*, with these additional benefits: - They can now act on any SelectionSet, not just the current selection; - Whenever possible, they don't need a desktop anymore and can run if called from GUI. I hope I did not break too many things in the process. *: So instead of callink sp_selection_move(desktop,x,y), you call myobjectset->move(x,y) (bzr r15189) --- src/desktop-style.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/desktop-style.cpp') diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 81aa95b48..65e511245 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -174,8 +174,12 @@ sp_desktop_apply_css_recursive(SPObject *o, SPCSSAttr *css, bool skip_lines) /** * Apply style on selection on desktop. */ + void sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change, bool write_current){ + return sp_desktop_set_style(desktop->getSelection(), desktop, css, change, write_current); +} + void -sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change, bool write_current) +sp_desktop_set_style(Inkscape::ObjectSet *set, SPDesktop *desktop, SPCSSAttr *css, bool change, bool write_current) { if (write_current) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -187,7 +191,7 @@ sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change, bool write sp_repr_css_merge(css_write, css); sp_css_attr_unset_uris(css_write); prefs->mergeStyle("/desktop/style", css_write); - auto itemlist = desktop->selection->items(); + auto itemlist = set->items(); for (auto i = itemlist.begin(); i!= itemlist.end(); ++i) { /* last used styles for 3D box faces are stored separately */ SPObject *obj = *i; @@ -227,7 +231,7 @@ sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change, bool write sp_repr_css_merge(css_no_text, css); css_no_text = sp_css_attr_unset_text(css_no_text); - auto itemlist = desktop->selection->items(); + auto itemlist = set->items(); for (auto i = itemlist.begin(); i!= itemlist.end(); ++i) { SPItem *item = *i; -- cgit v1.2.3 From d1ad68792ac1eeaaa166463c0aa125072a30f4c8 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Fri, 9 Dec 2016 19:13:02 +0100 Subject: Add button to access outer text style ('font-size', 'line-height'). These determine the minimum line spacing. (bzr r15315) --- src/desktop-style.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/desktop-style.cpp') diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 65e511245..dee36d681 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -209,7 +209,7 @@ sp_desktop_set_style(Inkscape::ObjectSet *set, SPDesktop *desktop, SPCSSAttr *cs if (!change) return; -// 2. Emit signal +// 2. Emit signal... See desktop->connectStyleSet in text-tool, tweak-tool, and gradient-drag. bool intercepted = desktop->_set_style_signal.emit(css); /** \todo -- cgit v1.2.3 From 401349277d025fb736184e014b636027b412d29e Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sun, 11 Dec 2016 15:33:49 +0100 Subject: Add option to unset 'line-height' (as well as determine where it is set). (bzr r15321) --- src/desktop-style.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/desktop-style.cpp') diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index dee36d681..4c07c76ea 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -209,7 +209,7 @@ sp_desktop_set_style(Inkscape::ObjectSet *set, SPDesktop *desktop, SPCSSAttr *cs if (!change) return; -// 2. Emit signal... See desktop->connectStyleSet in text-tool, tweak-tool, and gradient-drag. +// 2. Emit signal... See desktop->connectSetStyle in text-tool, tweak-tool, and gradient-drag. bool intercepted = desktop->_set_style_signal.emit(css); /** \todo @@ -1045,6 +1045,7 @@ objects_query_fontnumbers (const std::vector &objects, SPStyle *style_r bool lineheight_normal = false; bool lineheight_unit_proportional = false; bool lineheight_unit_absolute = false; + bool lineheight_set = false; // Set true if any object has lineheight set. double size_prev = 0; double letterspacing_prev = 0; @@ -1130,6 +1131,9 @@ objects_query_fontnumbers (const std::vector &objects, SPStyle *style_r lineheight_normal = false; lineheight += lineheight_current * doc_scale; } + if (style->line_height.set) { + lineheight_set = true; + } if ((size_prev != 0 && style->font_size.computed != size_prev) || (letterspacing_prev != 0 && style->letter_spacing.computed != letterspacing_prev) || @@ -1205,6 +1209,9 @@ objects_query_fontnumbers (const std::vector &objects, SPStyle *style_r } } + // Used by text toolbar unset 'line-height' + style_res->line_height.set = lineheight_set; + if (texts > 1) { if (different || different_lineheight) { return QUERY_STYLE_MULTIPLE_AVERAGED; @@ -1907,7 +1914,7 @@ sp_desktop_query_style_from_list (const std::vector &list, SPStyle *sty int sp_desktop_query_style(SPDesktop *desktop, SPStyle *style, int property) { - // Used by text tool and in gradient dragging + // Used by text tool and in gradient dragging. See connectQueryStyle. int ret = desktop->_query_style_signal.emit(style, property); if (ret != QUERY_STYLE_NOTHING) -- cgit v1.2.3