From 7ca50519fac1ac5f2df5111df13c445b75dfd669 Mon Sep 17 00:00:00 2001 From: vanntile Date: Sat, 10 Aug 2019 16:50:42 +0300 Subject: Some useful hatch changes --- src/desktop-style.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'src/desktop-style.cpp') diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 6c8095d53..072a38eec 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -29,6 +29,7 @@ #include "object/sp-flowdiv.h" #include "object/sp-flowregion.h" #include "object/sp-flowtext.h" +#include "object/sp-hatch.h" #include "object/sp-linear-gradient.h" #include "object/sp-path.h" #include "object/sp-pattern.h" @@ -184,7 +185,7 @@ sp_desktop_apply_css_recursive(SPObject *o, SPCSSAttr *css, bool skip_lines) 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(Inkscape::ObjectSet *set, SPDesktop *desktop, SPCSSAttr *css, bool change, bool write_current) { @@ -533,7 +534,7 @@ objects_query_fillstroke (const std::vector &objects, SPStyle *style_re || dynamic_cast(parent) || dynamic_cast(parent)); // 1. Bail out with QUERY_STYLE_MULTIPLE_DIFFERENT if necessary - + // cppcheck-suppress comparisonOfBoolWithInt if ((!paintImpossible) && (!paint->isSameType(*paint_res) || (paint_res->set != paint_effectively_set))) { return QUERY_STYLE_MULTIPLE_DIFFERENT; // different types of paint @@ -548,6 +549,8 @@ objects_query_fillstroke (const std::vector &objects, SPStyle *style_re SPLinearGradient *linear_res = dynamic_cast(server_res); SPRadialGradient *radial_res = linear_res ? nullptr : dynamic_cast(server_res); SPPattern *pattern_res = (linear_res || radial_res) ? nullptr : dynamic_cast(server_res); + SPHatch *hatch_res = (linear_res || radial_res || pattern_res) ? nullptr : dynamic_cast(server_res); + if (linear_res) { SPLinearGradient *linear = dynamic_cast(server); if (!linear) { @@ -581,6 +584,17 @@ objects_query_fillstroke (const std::vector &objects, SPStyle *style_re if (pat_res != pat) { return QUERY_STYLE_MULTIPLE_DIFFERENT; // different pattern roots } + } else if (hatch_res) { + SPHatch *hatch = dynamic_cast(server); + if (!hatch) { + return QUERY_STYLE_MULTIPLE_DIFFERENT; // different kind of server + } + + SPHatch *hat = SP_HATCH (server)->rootHatch(); + SPHatch *hat_res = SP_HATCH (server_res)->rootHatch(); + if (hat_res != hat) { + return QUERY_STYLE_MULTIPLE_DIFFERENT; // different pattern roots + } } } @@ -1002,7 +1016,7 @@ objects_query_paintorder (const std::vector &objects, SPStyle *style_re } } - + g_free( style_res->paint_order.value ); style_res->paint_order.value= g_strdup( prev_order.c_str() ); style_res->paint_order.set = true; @@ -1066,8 +1080,8 @@ objects_query_fontnumbers (const std::vector &objects, SPStyle *style_r // Quick way of getting document scale. Should be same as: // item->document->getDocumentScale().Affine().descrim() double doc_scale = Geom::Affine(item->i2dt_affine()).descrim(); - - double dummy = style->font_size.computed * doc_scale; + + double dummy = style->font_size.computed * doc_scale; if (!std::isnan(dummy)) { size += dummy; /// \todo FIXME: we assume non-% units here } else { @@ -1199,7 +1213,7 @@ objects_query_fontnumbers (const std::vector &objects, SPStyle *style_r } } - // Used by text toolbar unset 'line-height' + // Used by text toolbar unset 'line-height' style_res->line_height.set = lineheight_set; if (texts > 1) { -- cgit v1.2.3