From a0ed5b5138836e368e409b9ced656f970b225b38 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sun, 3 May 2015 18:58:35 +0200 Subject: First batch (bzr r14095) --- src/conditions.cpp | 4 +- src/display/canvas-grid.cpp | 3 + src/libcroco/cr-statement.c | 1 + src/live_effects/lpe-taperstroke.cpp | 4 +- src/style-enums.h | 137 +++++++++++++++++++++++++++++++++++ src/style.cpp | 8 ++ src/style.h | 18 +++++ 7 files changed, 171 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/conditions.cpp b/src/conditions.cpp index 9b233a74f..39ab16ba8 100644 --- a/src/conditions.cpp +++ b/src/conditions.cpp @@ -77,7 +77,7 @@ static gchar *preprocessLanguageCode(gchar *lngcode) { static bool evaluateSystemLanguage(SPItem const *item, gchar const *value) { if ( NULL == value ) return true; - + std::cout << "evaluateSystemLanguage: " << value << std::endl; std::set language_codes; gchar *str = NULL; gchar **strlist = g_strsplit( value, ",", 0); @@ -105,7 +105,7 @@ static bool evaluateSystemLanguage(SPItem const *item, gchar const *value) { SPDocument *document = item->document; Glib::ustring document_language = document->getLanguage(); - + std::cout << "language: |" << document_language << "|" << std::endl; if (document_language.size() == 0) return false; diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp index 4eda9b194..8285f7e64 100644 --- a/src/display/canvas-grid.cpp +++ b/src/display/canvas-grid.cpp @@ -916,12 +916,14 @@ CanvasXYGrid::Render (SPCanvasBuf *buf) _empcolor = empcolor; } + std::cout << "CanvasXYGrid::Render: " << no_emp_when_zoomed_out << " " << empspacing << " " << _empcolor << " " << scaled << std::endl; cairo_save(buf->ct); cairo_translate(buf->ct, -buf->rect.left(), -buf->rect.top()); cairo_set_line_width(buf->ct, 1.0); cairo_set_line_cap(buf->ct, CAIRO_LINE_CAP_SQUARE); if (!render_dotted) { + // Render lines gint ylinenum; gdouble y; for (y = syg, ylinenum = ylinestart; y < buf->rect.bottom(); y += sw[Geom::Y], ylinenum++) { @@ -944,6 +946,7 @@ CanvasXYGrid::Render (SPCanvasBuf *buf) } } } else { + // Render dots gint ylinenum; gdouble y; for (y = syg, ylinenum = ylinestart; y < buf->rect.bottom(); y += sw[Geom::Y], ylinenum++) { diff --git a/src/libcroco/cr-statement.c b/src/libcroco/cr-statement.c index 4666f26ec..5fb2dd2fd 100644 --- a/src/libcroco/cr-statement.c +++ b/src/libcroco/cr-statement.c @@ -1678,6 +1678,7 @@ CRStatement * cr_statement_new_at_font_face_rule (CRStyleSheet * a_sheet, CRDeclaration * a_font_decls) { + printf("cr_statement_new_at_font_face_rule\n"); CRStatement *result = (CRStatement *)g_try_malloc (sizeof (CRStatement)); if (!result) { diff --git a/src/live_effects/lpe-taperstroke.cpp b/src/live_effects/lpe-taperstroke.cpp index 2c74af6d6..1888bc3f0 100644 --- a/src/live_effects/lpe-taperstroke.cpp +++ b/src/live_effects/lpe-taperstroke.cpp @@ -275,7 +275,7 @@ Geom::PathVector LPETaperStroke::doEffect_path(Geom::PathVector const& path_in) pat_str << "M 1,0 C " << 1 - (double)smoothing << ",0 0,0.5 0,0.5 0,0.5 " << 1 - (double)smoothing << ",1 1,1"; pat_vec = sp_svg_read_pathv(pat_str.str().c_str()); - pwd2.concat(stretch_along(pathv_out[0].toPwSb(), pat_vec[0], -fabs(line_width))); + pwd2.concat(stretch_along(pathv_out[0].toPwSb(), pat_vec[0], fabs(line_width))); throwaway_path = Geom::path_from_piecewise(pwd2, LPE_CONVERSION_TOLERANCE)[0]; real_path.append(throwaway_path); @@ -304,7 +304,7 @@ Geom::PathVector LPETaperStroke::doEffect_path(Geom::PathVector const& path_in) pat_vec = sp_svg_read_pathv(pat_str_1.str().c_str()); pwd2 = Piecewise >(); - pwd2.concat(stretch_along(pathv_out[2].toPwSb(), pat_vec[0], -fabs(line_width))); + pwd2.concat(stretch_along(pathv_out[2].toPwSb(), pat_vec[0], fabs(line_width))); throwaway_path = Geom::path_from_piecewise(pwd2, LPE_CONVERSION_TOLERANCE)[0]; if (!Geom::are_near(real_path.finalPoint(), throwaway_path.initialPoint()) && real_path.size() >= 1) { diff --git a/src/style-enums.h b/src/style-enums.h index f52752018..f235b6699 100644 --- a/src/style-enums.h +++ b/src/style-enums.h @@ -72,6 +72,72 @@ enum SPCSSFontStretch { SP_CSS_FONT_STRETCH_WIDER }; +// Can select more than one +enum SPCSSFontVariantLigatures { + SP_CSS_FONT_VARIANT_LIGATURES_NORMAL, + SP_CSS_FONT_VARIANT_LIGATURES_NONE, + SP_CSS_FONT_VARIANT_LIGATURES_COMMON, + SP_CSS_FONT_VARIANT_LIGATURES_NO_COMMON, + SP_CSS_FONT_VARIANT_LIGATURES_DISCRETIONARY, + SP_CSS_FONT_VARIANT_LIGATURES_NO_DISCRETIONARY, + SP_CSS_FONT_VARIANT_LIGATURES_HISTORICAL, + SP_CSS_FONT_VARIANT_LIGATURES_NO_HISTORICAL, + SP_CSS_FONT_VARIANT_LIGATURES_CONTEXTUAL, + SP_CSS_FONT_VARIANT_LIGATURES_NO_CONTEXTUAL +}; + +enum SPCSSFontVariantPosition { + SP_CSS_FONT_VARIANT_POSITION_NORMAL, + SP_CSS_FONT_VARIANT_POSITION_SUB, + SP_CSS_FONT_VARIANT_POSITION_SUPER +}; + +enum SPCSSFontVariantCaps { + SP_CSS_FONT_VARIANT_CAPS_NORMAL, + SP_CSS_FONT_VARIANT_CAPS_SMALL, + SP_CSS_FONT_VARIANT_CAPS_ALL_SMALL, + SP_CSS_FONT_VARIANT_CAPS_PETITE, + SP_CSS_FONT_VARIANT_CAPS_ALL_PETITE, + SP_CSS_FONT_VARIANT_CAPS_UNICASE, + SP_CSS_FONT_VARIANT_CAPS_TITLING, +}; + +enum SPCSSFontVariantNumeric { + SP_CSS_FONT_VARIANT_NUMERIC_NORMAL, + SP_CSS_FONT_VARIANT_NUMERIC_LINING_NUMS, + SP_CSS_FONT_VARIANT_NUMERIC_OLDSTYLE_NUMS, + SP_CSS_FONT_VARIANT_NUMERIC_PROPORTIONAL_NUMS, + SP_CSS_FONT_VARIANT_NUMERIC_TABULAR_NUMS, + SP_CSS_FONT_VARIANT_NUMERIC_DIAGONAL_FRACTIONS, + SP_CSS_FONT_VARIANT_NUMERIC_STACKED_FRACTIONS, + SP_CSS_FONT_VARIANT_NUMERIC_ORDINAL, + SP_CSS_FONT_VARIANT_NUMERIC_SLASHED_ZERO +}; + +enum SPCSSFontVariantAlternates { + SP_CSS_FONT_VARIANT_ALTERNATES_NORMAL, + SP_CSS_FONT_VARIANT_ALTERNATES_HISTORICAL_FORMS, + SP_CSS_FONT_VARIANT_ALTERNATES_STYLISTIC, + SP_CSS_FONT_VARIANT_ALTERNATES_STYLESET, + SP_CSS_FONT_VARIANT_ALTERNATES_CHARACTER_VARIANT, + SP_CSS_FONT_VARIANT_ALTERNATES_SWASH, + SP_CSS_FONT_VARIANT_ALTERNATES_ORNAMENTS, + SP_CSS_FONT_VARIANT_ALTERNATES_ANNOTATION +}; + +enum SPCSSFontVariantEastAsian { + SP_CSS_FONT_VARIANT_EAST_ASIAN_NORMAL, + SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS78, + SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS83, + SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS90, + SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS04, + SP_CSS_FONT_VARIANT_EAST_ASIAN_SIMPLIFIED, + SP_CSS_FONT_VARIANT_EAST_ASIAN_TRADITIONAL, + SP_CSS_FONT_VARIANT_EAST_ASIAN_FULL_WIDTH, + SP_CSS_FONT_VARIANT_EAST_ASIAN_PROPORTIONAL_WIDTH, + SP_CSS_FONT_VARIANT_EAST_ASIAN_RUBY +}; + enum SPCSSTextAlign { SP_CSS_TEXT_ALIGN_START, SP_CSS_TEXT_ALIGN_END, @@ -309,6 +375,77 @@ static SPStyleEnum const enum_font_stretch[] = { {NULL, -1} }; +static SPStyleEnum const enum_font_variant_ligatures[] = { + {"normal", SP_CSS_FONT_VARIANT_LIGATURES_NORMAL}, + {"none", SP_CSS_FONT_VARIANT_LIGATURES_NONE}, + {"common-ligatures", SP_CSS_FONT_VARIANT_LIGATURES_COMMON}, + {"no-common-ligatures", SP_CSS_FONT_VARIANT_LIGATURES_NO_COMMON}, + {"discretionary-ligatures", SP_CSS_FONT_VARIANT_LIGATURES_DISCRETIONARY}, + {"no-discretionary-ligatures", SP_CSS_FONT_VARIANT_LIGATURES_NO_DISCRETIONARY}, + {"historical-ligatures", SP_CSS_FONT_VARIANT_LIGATURES_HISTORICAL}, + {"nohistorical-ligatures", SP_CSS_FONT_VARIANT_LIGATURES_NO_HISTORICAL}, + {"contextual", SP_CSS_FONT_VARIANT_LIGATURES_CONTEXTUAL}, + {"no-contextual", SP_CSS_FONT_VARIANT_LIGATURES_NO_CONTEXTUAL}, + {NULL, -1} +}; + +static SPStyleEnum const enum_font_variant_position[] = { + {"normal", SP_CSS_FONT_VARIANT_POSITION_NORMAL}, + {"sub", SP_CSS_FONT_VARIANT_POSITION_SUB}, + {"super", SP_CSS_FONT_VARIANT_POSITION_SUPER}, + {NULL, -1} +}; + +static SPStyleEnum const enum_font_variant_caps[] = { + {"normal", SP_CSS_FONT_VARIANT_CAPS_NORMAL}, + {"small-caps", SP_CSS_FONT_VARIANT_CAPS_SMALL}, + {"all-small-caps", SP_CSS_FONT_VARIANT_CAPS_ALL_SMALL}, + {"petite-caps", SP_CSS_FONT_VARIANT_CAPS_PETITE}, + {"all_petite-caps", SP_CSS_FONT_VARIANT_CAPS_ALL_PETITE}, + {"unicase", SP_CSS_FONT_VARIANT_CAPS_UNICASE}, + {"titling", SP_CSS_FONT_VARIANT_CAPS_TITLING}, + {NULL, -1} +}; + +static SPStyleEnum const enum_font_variant_numeric[] = { + {"normal", SP_CSS_FONT_VARIANT_NUMERIC_NORMAL}, + {"lining-nums", SP_CSS_FONT_VARIANT_NUMERIC_LINING_NUMS}, + {"oldstyle-nums", SP_CSS_FONT_VARIANT_NUMERIC_OLDSTYLE_NUMS}, + {"proportional-nums", SP_CSS_FONT_VARIANT_NUMERIC_PROPORTIONAL_NUMS}, + {"tabular-nums", SP_CSS_FONT_VARIANT_NUMERIC_TABULAR_NUMS}, + {"diagonal-fractions", SP_CSS_FONT_VARIANT_NUMERIC_DIAGONAL_FRACTIONS}, + {"stacked-fractions", SP_CSS_FONT_VARIANT_NUMERIC_STACKED_FRACTIONS}, + {"ordinal", SP_CSS_FONT_VARIANT_NUMERIC_ORDINAL}, + {"slashed-zero", SP_CSS_FONT_VARIANT_NUMERIC_SLASHED_ZERO}, + {NULL, -1} +}; + +static SPStyleEnum const enum_font_variant_alternates[] = { + {"normal", SP_CSS_FONT_VARIANT_ALTERNATES_NORMAL}, + {"historical-forms", SP_CSS_FONT_VARIANT_ALTERNATES_HISTORICAL_FORMS}, + {"stylistic", SP_CSS_FONT_VARIANT_ALTERNATES_STYLISTIC}, + {"styleset", SP_CSS_FONT_VARIANT_ALTERNATES_STYLESET}, + {"character_variant", SP_CSS_FONT_VARIANT_ALTERNATES_CHARACTER_VARIANT}, + {"swash", SP_CSS_FONT_VARIANT_ALTERNATES_SWASH}, + {"ornaments", SP_CSS_FONT_VARIANT_ALTERNATES_ORNAMENTS}, + {"annotation", SP_CSS_FONT_VARIANT_ALTERNATES_ANNOTATION}, + {NULL, -1} +}; + +static SPStyleEnum const enum_font_variant_east_asian[] = { + {"normal", SP_CSS_FONT_VARIANT_EAST_ASIAN_NORMAL}, + {"jis78", SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS78}, + {"jis83", SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS83}, + {"jis90", SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS90}, + {"jis04", SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS04}, + {"simplified", SP_CSS_FONT_VARIANT_EAST_ASIAN_SIMPLIFIED}, + {"traditional", SP_CSS_FONT_VARIANT_EAST_ASIAN_TRADITIONAL}, + {"full-width", SP_CSS_FONT_VARIANT_EAST_ASIAN_FULL_WIDTH}, + {"proportional-width", SP_CSS_FONT_VARIANT_EAST_ASIAN_PROPORTIONAL_WIDTH}, + {"ruby", SP_CSS_FONT_VARIANT_EAST_ASIAN_RUBY}, + {NULL, -1} +}; + static SPStyleEnum const enum_text_align[] = { {"start", SP_CSS_TEXT_ALIGN_START}, {"end", SP_CSS_TEXT_ALIGN_END}, diff --git a/src/style.cpp b/src/style.cpp index b65bff53f..943a12f3b 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -118,6 +118,14 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) : font(), // SPIFont font_specification( "-inkscape-font-specification" ), // SPIString + // Font variants + font_variant_ligatures( "font-variant-ligatures", enum_font_variant_ligatures, SP_CSS_FONT_VARIANT_LIGATURES_NORMAL ), + font_variant_position( "font-variant-position", enum_font_variant_position, SP_CSS_FONT_VARIANT_POSITION_NORMAL ), + font_variant_caps( "font-variant-caps", enum_font_variant_caps, SP_CSS_FONT_VARIANT_CAPS_NORMAL ), + font_variant_numeric( "font-variant-numeric", enum_font_variant_numeric, SP_CSS_FONT_VARIANT_NUMERIC_NORMAL ), + font_variant_alternates("font-variant-alternates", enum_font_variant_alternates, SP_CSS_FONT_VARIANT_ALTERNATES_NORMAL ), + font_variant_east_asian("font-variant-east_asian", enum_font_variant_east_asian, SP_CSS_FONT_VARIANT_EAST_ASIAN_NORMAL ), + // Text related properties text_indent( "text-indent", 0.0 ), // SPILength text_align( "text-align", enum_text_align, SP_CSS_TEXT_ALIGN_START ), diff --git a/src/style.h b/src/style.h index ab34476b3..f52c14d89 100644 --- a/src/style.h +++ b/src/style.h @@ -111,6 +111,24 @@ public: /** Full font name, as font_factory::ConstructFontSpecification would give, for internal use. */ SPIString font_specification; + /* Font variants -------------------- */ + /** Font variant ligatures */ + SPIEnum font_variant_ligatures; + /** Font variant position (subscript/superscript) */ + SPIEnum font_variant_position; + /** Font variant caps (small caps) */ + SPIEnum font_variant_caps; + /** Font variant numeric (numerical formatting) */ + SPIEnum font_variant_numeric; + /** Font variant alternates (alternates/swatches) */ + SPIEnum font_variant_alternates; + /** Font variant East Asian */ + SPIEnum font_variant_east_asian; + /** Font variant shorthand (Redefines CSS 2.1 value) */ + // ? font_variant; + /** Font feature settings */ + // ? font_feature_settings; + /* Text ----------------------------- */ /** First line indent of paragraphs (css2 16.1) */ -- cgit v1.2.3 From c7ce360901e191572b207df27dd3e972bff3929f Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sun, 3 May 2015 19:01:45 +0200 Subject: Revert bad commit (commited to wrong branch). (bzr r14096) --- src/conditions.cpp | 4 +- src/display/canvas-grid.cpp | 3 - src/libcroco/cr-statement.c | 1 - src/live_effects/lpe-taperstroke.cpp | 4 +- src/style-enums.h | 137 ----------------------------------- src/style.cpp | 8 -- src/style.h | 18 ----- 7 files changed, 4 insertions(+), 171 deletions(-) (limited to 'src') diff --git a/src/conditions.cpp b/src/conditions.cpp index 39ab16ba8..9b233a74f 100644 --- a/src/conditions.cpp +++ b/src/conditions.cpp @@ -77,7 +77,7 @@ static gchar *preprocessLanguageCode(gchar *lngcode) { static bool evaluateSystemLanguage(SPItem const *item, gchar const *value) { if ( NULL == value ) return true; - std::cout << "evaluateSystemLanguage: " << value << std::endl; + std::set language_codes; gchar *str = NULL; gchar **strlist = g_strsplit( value, ",", 0); @@ -105,7 +105,7 @@ static bool evaluateSystemLanguage(SPItem const *item, gchar const *value) { SPDocument *document = item->document; Glib::ustring document_language = document->getLanguage(); - std::cout << "language: |" << document_language << "|" << std::endl; + if (document_language.size() == 0) return false; diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp index 8285f7e64..4eda9b194 100644 --- a/src/display/canvas-grid.cpp +++ b/src/display/canvas-grid.cpp @@ -916,14 +916,12 @@ CanvasXYGrid::Render (SPCanvasBuf *buf) _empcolor = empcolor; } - std::cout << "CanvasXYGrid::Render: " << no_emp_when_zoomed_out << " " << empspacing << " " << _empcolor << " " << scaled << std::endl; cairo_save(buf->ct); cairo_translate(buf->ct, -buf->rect.left(), -buf->rect.top()); cairo_set_line_width(buf->ct, 1.0); cairo_set_line_cap(buf->ct, CAIRO_LINE_CAP_SQUARE); if (!render_dotted) { - // Render lines gint ylinenum; gdouble y; for (y = syg, ylinenum = ylinestart; y < buf->rect.bottom(); y += sw[Geom::Y], ylinenum++) { @@ -946,7 +944,6 @@ CanvasXYGrid::Render (SPCanvasBuf *buf) } } } else { - // Render dots gint ylinenum; gdouble y; for (y = syg, ylinenum = ylinestart; y < buf->rect.bottom(); y += sw[Geom::Y], ylinenum++) { diff --git a/src/libcroco/cr-statement.c b/src/libcroco/cr-statement.c index 5fb2dd2fd..4666f26ec 100644 --- a/src/libcroco/cr-statement.c +++ b/src/libcroco/cr-statement.c @@ -1678,7 +1678,6 @@ CRStatement * cr_statement_new_at_font_face_rule (CRStyleSheet * a_sheet, CRDeclaration * a_font_decls) { - printf("cr_statement_new_at_font_face_rule\n"); CRStatement *result = (CRStatement *)g_try_malloc (sizeof (CRStatement)); if (!result) { diff --git a/src/live_effects/lpe-taperstroke.cpp b/src/live_effects/lpe-taperstroke.cpp index 1888bc3f0..2c74af6d6 100644 --- a/src/live_effects/lpe-taperstroke.cpp +++ b/src/live_effects/lpe-taperstroke.cpp @@ -275,7 +275,7 @@ Geom::PathVector LPETaperStroke::doEffect_path(Geom::PathVector const& path_in) pat_str << "M 1,0 C " << 1 - (double)smoothing << ",0 0,0.5 0,0.5 0,0.5 " << 1 - (double)smoothing << ",1 1,1"; pat_vec = sp_svg_read_pathv(pat_str.str().c_str()); - pwd2.concat(stretch_along(pathv_out[0].toPwSb(), pat_vec[0], fabs(line_width))); + pwd2.concat(stretch_along(pathv_out[0].toPwSb(), pat_vec[0], -fabs(line_width))); throwaway_path = Geom::path_from_piecewise(pwd2, LPE_CONVERSION_TOLERANCE)[0]; real_path.append(throwaway_path); @@ -304,7 +304,7 @@ Geom::PathVector LPETaperStroke::doEffect_path(Geom::PathVector const& path_in) pat_vec = sp_svg_read_pathv(pat_str_1.str().c_str()); pwd2 = Piecewise >(); - pwd2.concat(stretch_along(pathv_out[2].toPwSb(), pat_vec[0], fabs(line_width))); + pwd2.concat(stretch_along(pathv_out[2].toPwSb(), pat_vec[0], -fabs(line_width))); throwaway_path = Geom::path_from_piecewise(pwd2, LPE_CONVERSION_TOLERANCE)[0]; if (!Geom::are_near(real_path.finalPoint(), throwaway_path.initialPoint()) && real_path.size() >= 1) { diff --git a/src/style-enums.h b/src/style-enums.h index f235b6699..f52752018 100644 --- a/src/style-enums.h +++ b/src/style-enums.h @@ -72,72 +72,6 @@ enum SPCSSFontStretch { SP_CSS_FONT_STRETCH_WIDER }; -// Can select more than one -enum SPCSSFontVariantLigatures { - SP_CSS_FONT_VARIANT_LIGATURES_NORMAL, - SP_CSS_FONT_VARIANT_LIGATURES_NONE, - SP_CSS_FONT_VARIANT_LIGATURES_COMMON, - SP_CSS_FONT_VARIANT_LIGATURES_NO_COMMON, - SP_CSS_FONT_VARIANT_LIGATURES_DISCRETIONARY, - SP_CSS_FONT_VARIANT_LIGATURES_NO_DISCRETIONARY, - SP_CSS_FONT_VARIANT_LIGATURES_HISTORICAL, - SP_CSS_FONT_VARIANT_LIGATURES_NO_HISTORICAL, - SP_CSS_FONT_VARIANT_LIGATURES_CONTEXTUAL, - SP_CSS_FONT_VARIANT_LIGATURES_NO_CONTEXTUAL -}; - -enum SPCSSFontVariantPosition { - SP_CSS_FONT_VARIANT_POSITION_NORMAL, - SP_CSS_FONT_VARIANT_POSITION_SUB, - SP_CSS_FONT_VARIANT_POSITION_SUPER -}; - -enum SPCSSFontVariantCaps { - SP_CSS_FONT_VARIANT_CAPS_NORMAL, - SP_CSS_FONT_VARIANT_CAPS_SMALL, - SP_CSS_FONT_VARIANT_CAPS_ALL_SMALL, - SP_CSS_FONT_VARIANT_CAPS_PETITE, - SP_CSS_FONT_VARIANT_CAPS_ALL_PETITE, - SP_CSS_FONT_VARIANT_CAPS_UNICASE, - SP_CSS_FONT_VARIANT_CAPS_TITLING, -}; - -enum SPCSSFontVariantNumeric { - SP_CSS_FONT_VARIANT_NUMERIC_NORMAL, - SP_CSS_FONT_VARIANT_NUMERIC_LINING_NUMS, - SP_CSS_FONT_VARIANT_NUMERIC_OLDSTYLE_NUMS, - SP_CSS_FONT_VARIANT_NUMERIC_PROPORTIONAL_NUMS, - SP_CSS_FONT_VARIANT_NUMERIC_TABULAR_NUMS, - SP_CSS_FONT_VARIANT_NUMERIC_DIAGONAL_FRACTIONS, - SP_CSS_FONT_VARIANT_NUMERIC_STACKED_FRACTIONS, - SP_CSS_FONT_VARIANT_NUMERIC_ORDINAL, - SP_CSS_FONT_VARIANT_NUMERIC_SLASHED_ZERO -}; - -enum SPCSSFontVariantAlternates { - SP_CSS_FONT_VARIANT_ALTERNATES_NORMAL, - SP_CSS_FONT_VARIANT_ALTERNATES_HISTORICAL_FORMS, - SP_CSS_FONT_VARIANT_ALTERNATES_STYLISTIC, - SP_CSS_FONT_VARIANT_ALTERNATES_STYLESET, - SP_CSS_FONT_VARIANT_ALTERNATES_CHARACTER_VARIANT, - SP_CSS_FONT_VARIANT_ALTERNATES_SWASH, - SP_CSS_FONT_VARIANT_ALTERNATES_ORNAMENTS, - SP_CSS_FONT_VARIANT_ALTERNATES_ANNOTATION -}; - -enum SPCSSFontVariantEastAsian { - SP_CSS_FONT_VARIANT_EAST_ASIAN_NORMAL, - SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS78, - SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS83, - SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS90, - SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS04, - SP_CSS_FONT_VARIANT_EAST_ASIAN_SIMPLIFIED, - SP_CSS_FONT_VARIANT_EAST_ASIAN_TRADITIONAL, - SP_CSS_FONT_VARIANT_EAST_ASIAN_FULL_WIDTH, - SP_CSS_FONT_VARIANT_EAST_ASIAN_PROPORTIONAL_WIDTH, - SP_CSS_FONT_VARIANT_EAST_ASIAN_RUBY -}; - enum SPCSSTextAlign { SP_CSS_TEXT_ALIGN_START, SP_CSS_TEXT_ALIGN_END, @@ -375,77 +309,6 @@ static SPStyleEnum const enum_font_stretch[] = { {NULL, -1} }; -static SPStyleEnum const enum_font_variant_ligatures[] = { - {"normal", SP_CSS_FONT_VARIANT_LIGATURES_NORMAL}, - {"none", SP_CSS_FONT_VARIANT_LIGATURES_NONE}, - {"common-ligatures", SP_CSS_FONT_VARIANT_LIGATURES_COMMON}, - {"no-common-ligatures", SP_CSS_FONT_VARIANT_LIGATURES_NO_COMMON}, - {"discretionary-ligatures", SP_CSS_FONT_VARIANT_LIGATURES_DISCRETIONARY}, - {"no-discretionary-ligatures", SP_CSS_FONT_VARIANT_LIGATURES_NO_DISCRETIONARY}, - {"historical-ligatures", SP_CSS_FONT_VARIANT_LIGATURES_HISTORICAL}, - {"nohistorical-ligatures", SP_CSS_FONT_VARIANT_LIGATURES_NO_HISTORICAL}, - {"contextual", SP_CSS_FONT_VARIANT_LIGATURES_CONTEXTUAL}, - {"no-contextual", SP_CSS_FONT_VARIANT_LIGATURES_NO_CONTEXTUAL}, - {NULL, -1} -}; - -static SPStyleEnum const enum_font_variant_position[] = { - {"normal", SP_CSS_FONT_VARIANT_POSITION_NORMAL}, - {"sub", SP_CSS_FONT_VARIANT_POSITION_SUB}, - {"super", SP_CSS_FONT_VARIANT_POSITION_SUPER}, - {NULL, -1} -}; - -static SPStyleEnum const enum_font_variant_caps[] = { - {"normal", SP_CSS_FONT_VARIANT_CAPS_NORMAL}, - {"small-caps", SP_CSS_FONT_VARIANT_CAPS_SMALL}, - {"all-small-caps", SP_CSS_FONT_VARIANT_CAPS_ALL_SMALL}, - {"petite-caps", SP_CSS_FONT_VARIANT_CAPS_PETITE}, - {"all_petite-caps", SP_CSS_FONT_VARIANT_CAPS_ALL_PETITE}, - {"unicase", SP_CSS_FONT_VARIANT_CAPS_UNICASE}, - {"titling", SP_CSS_FONT_VARIANT_CAPS_TITLING}, - {NULL, -1} -}; - -static SPStyleEnum const enum_font_variant_numeric[] = { - {"normal", SP_CSS_FONT_VARIANT_NUMERIC_NORMAL}, - {"lining-nums", SP_CSS_FONT_VARIANT_NUMERIC_LINING_NUMS}, - {"oldstyle-nums", SP_CSS_FONT_VARIANT_NUMERIC_OLDSTYLE_NUMS}, - {"proportional-nums", SP_CSS_FONT_VARIANT_NUMERIC_PROPORTIONAL_NUMS}, - {"tabular-nums", SP_CSS_FONT_VARIANT_NUMERIC_TABULAR_NUMS}, - {"diagonal-fractions", SP_CSS_FONT_VARIANT_NUMERIC_DIAGONAL_FRACTIONS}, - {"stacked-fractions", SP_CSS_FONT_VARIANT_NUMERIC_STACKED_FRACTIONS}, - {"ordinal", SP_CSS_FONT_VARIANT_NUMERIC_ORDINAL}, - {"slashed-zero", SP_CSS_FONT_VARIANT_NUMERIC_SLASHED_ZERO}, - {NULL, -1} -}; - -static SPStyleEnum const enum_font_variant_alternates[] = { - {"normal", SP_CSS_FONT_VARIANT_ALTERNATES_NORMAL}, - {"historical-forms", SP_CSS_FONT_VARIANT_ALTERNATES_HISTORICAL_FORMS}, - {"stylistic", SP_CSS_FONT_VARIANT_ALTERNATES_STYLISTIC}, - {"styleset", SP_CSS_FONT_VARIANT_ALTERNATES_STYLESET}, - {"character_variant", SP_CSS_FONT_VARIANT_ALTERNATES_CHARACTER_VARIANT}, - {"swash", SP_CSS_FONT_VARIANT_ALTERNATES_SWASH}, - {"ornaments", SP_CSS_FONT_VARIANT_ALTERNATES_ORNAMENTS}, - {"annotation", SP_CSS_FONT_VARIANT_ALTERNATES_ANNOTATION}, - {NULL, -1} -}; - -static SPStyleEnum const enum_font_variant_east_asian[] = { - {"normal", SP_CSS_FONT_VARIANT_EAST_ASIAN_NORMAL}, - {"jis78", SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS78}, - {"jis83", SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS83}, - {"jis90", SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS90}, - {"jis04", SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS04}, - {"simplified", SP_CSS_FONT_VARIANT_EAST_ASIAN_SIMPLIFIED}, - {"traditional", SP_CSS_FONT_VARIANT_EAST_ASIAN_TRADITIONAL}, - {"full-width", SP_CSS_FONT_VARIANT_EAST_ASIAN_FULL_WIDTH}, - {"proportional-width", SP_CSS_FONT_VARIANT_EAST_ASIAN_PROPORTIONAL_WIDTH}, - {"ruby", SP_CSS_FONT_VARIANT_EAST_ASIAN_RUBY}, - {NULL, -1} -}; - static SPStyleEnum const enum_text_align[] = { {"start", SP_CSS_TEXT_ALIGN_START}, {"end", SP_CSS_TEXT_ALIGN_END}, diff --git a/src/style.cpp b/src/style.cpp index 943a12f3b..b65bff53f 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -118,14 +118,6 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) : font(), // SPIFont font_specification( "-inkscape-font-specification" ), // SPIString - // Font variants - font_variant_ligatures( "font-variant-ligatures", enum_font_variant_ligatures, SP_CSS_FONT_VARIANT_LIGATURES_NORMAL ), - font_variant_position( "font-variant-position", enum_font_variant_position, SP_CSS_FONT_VARIANT_POSITION_NORMAL ), - font_variant_caps( "font-variant-caps", enum_font_variant_caps, SP_CSS_FONT_VARIANT_CAPS_NORMAL ), - font_variant_numeric( "font-variant-numeric", enum_font_variant_numeric, SP_CSS_FONT_VARIANT_NUMERIC_NORMAL ), - font_variant_alternates("font-variant-alternates", enum_font_variant_alternates, SP_CSS_FONT_VARIANT_ALTERNATES_NORMAL ), - font_variant_east_asian("font-variant-east_asian", enum_font_variant_east_asian, SP_CSS_FONT_VARIANT_EAST_ASIAN_NORMAL ), - // Text related properties text_indent( "text-indent", 0.0 ), // SPILength text_align( "text-align", enum_text_align, SP_CSS_TEXT_ALIGN_START ), diff --git a/src/style.h b/src/style.h index f52c14d89..ab34476b3 100644 --- a/src/style.h +++ b/src/style.h @@ -111,24 +111,6 @@ public: /** Full font name, as font_factory::ConstructFontSpecification would give, for internal use. */ SPIString font_specification; - /* Font variants -------------------- */ - /** Font variant ligatures */ - SPIEnum font_variant_ligatures; - /** Font variant position (subscript/superscript) */ - SPIEnum font_variant_position; - /** Font variant caps (small caps) */ - SPIEnum font_variant_caps; - /** Font variant numeric (numerical formatting) */ - SPIEnum font_variant_numeric; - /** Font variant alternates (alternates/swatches) */ - SPIEnum font_variant_alternates; - /** Font variant East Asian */ - SPIEnum font_variant_east_asian; - /** Font variant shorthand (Redefines CSS 2.1 value) */ - // ? font_variant; - /** Font feature settings */ - // ? font_feature_settings; - /* Text ----------------------------- */ /** First line indent of paragraphs (css2 16.1) */ -- cgit v1.2.3 From 2eab6fad30c9c838902d9113c7e0d41b34ce79ea Mon Sep 17 00:00:00 2001 From: houz Date: Mon, 4 May 2015 12:39:09 +0200 Subject: cmake: shorter linker list (remove duplicates) (bzr r14106) --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 27c5e49db..efb604aca 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -519,7 +519,7 @@ add_dependencies(inkscape inkscape_version) target_link_libraries(inkscape # order from automake #sp_LIB - nrtype_LIB + #nrtype_LIB #inkscape_LIB #sp_LIB # annoying, we need both! -- cgit v1.2.3 From 7e3aabae24c09340fd06cb69b0678158abb4a375 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 4 May 2015 12:57:06 +0200 Subject: Shorthands are not allowed as presentation attributes. (bzr r14107) --- src/style.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/style.cpp b/src/style.cpp index b65bff53f..8b41bbbd7 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -573,7 +573,15 @@ SPStyle::read( SPObject *object, Inkscape::XML::Node *repr ) { /* 3 Presentation attributes */ // std::cout << " MERGING PRESENTATION ATTRIBUTES" << std::endl; for(std::vector::size_type i = 0; i != _properties.size(); ++i) { - _properties[i]->readAttribute( repr ); + + // Shorthands are not allowed as presentation properites. + // Note: text-decoration is converted to a shorthand in CSS 3 but can still be + // read as a non-shorthand so it should not be in this list. + // We could add a flag to SPIBase to avoid string comparison. + if( _properties[i]->name.compare( "font" ) != 0 && + _properties[i]->name.compare( "marker" ) != 0 ) { + _properties[i]->readAttribute( repr ); + } } // for(SPPropMap::iterator i = _propmap.begin(); i != _propmap.end(); ++i ) { // (this->*(i->second)).readAttribute( repr ); -- cgit v1.2.3 From f9afd4f6cdee501fcfd5ae6185643796e9ec646d Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Mon, 4 May 2015 13:09:20 +0200 Subject: Fix crash in PDF export introduced in r14074 (bzr r14108) --- src/extension/internal/cairo-renderer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index 49e145de0..5a5553e97 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -296,7 +296,7 @@ static void sp_group_render(SPGroup *group, CairoRenderContext *ctx) std::vector l(group->childList(false)); for(std::vector::const_iterator x = l.begin(); x!= l.end(); x++){ - SPItem *item = static_cast(*x); + SPItem *item = dynamic_cast(*x); if (item) { renderer->renderItem(ctx, item); } -- cgit v1.2.3 From abe296168df89e7f62e9d670602ffea62ad78a22 Mon Sep 17 00:00:00 2001 From: Raphael Rosch Date: Mon, 4 May 2015 12:17:58 -0400 Subject: going from swatch to flat color should start with previous swatch color Fixed bugs: - https://launchpad.net/bugs/1450112 (bzr r14109) --- src/widgets/paint-selector.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/widgets/paint-selector.cpp b/src/widgets/paint-selector.cpp index 740ce2b0e..221344296 100644 --- a/src/widgets/paint-selector.cpp +++ b/src/widgets/paint-selector.cpp @@ -35,6 +35,7 @@ #include "sp-linear-gradient.h" #include "sp-radial-gradient.h" #include "sp-mesh.h" +#include "sp-stop.h" /* fixme: Move it from dialogs to here */ #include "gradient-selector.h" #include @@ -658,6 +659,20 @@ sp_paint_selector_color_changed(SPColorSelector *csel, SPPaintSelector *psel) static void sp_paint_selector_set_mode_color(SPPaintSelector *psel, SPPaintSelector::Mode /*mode*/) { GtkWidget *csel; + + SPColor newcolor = psel->color; + float newalpha = psel->alpha; + + if ((psel->mode == SPPaintSelector::MODE_SWATCH) + || (psel->mode == SPPaintSelector::MODE_GRADIENT_LINEAR) + || (psel->mode == SPPaintSelector::MODE_GRADIENT_RADIAL) ) { + SPGradientSelector *gsel = getGradientFromData(psel); + if (gsel) { + SPGradient *gradient = gsel->getVector(); + newcolor = gradient->getFirstStop()->specified_color; + newalpha = gradient->getFirstStop()->opacity; + } + } sp_paint_selector_set_style_buttons(psel, psel->solid); gtk_widget_set_sensitive(psel->style, TRUE); @@ -693,8 +708,7 @@ static void sp_paint_selector_set_mode_color(SPPaintSelector *psel, SPPaintSelec psel->selector = vb; /* Set color */ - SP_COLOR_SELECTOR( csel )->base->setColorAlpha( psel->color, psel->alpha ); - + SP_COLOR_SELECTOR( csel )->base->setColorAlpha( newcolor, newalpha ); } gtk_label_set_markup(GTK_LABEL(psel->label), _("Flat color")); -- cgit v1.2.3 From 5af8924e1de466080dc116b47edd7c8d8591652b Mon Sep 17 00:00:00 2001 From: Raphael Rosch Date: Tue, 5 May 2015 13:26:20 -0400 Subject: show filter usage count Fixed bugs: - https://launchpad.net/bugs/1169123 (bzr r14111) --- src/sp-filter.cpp | 10 ++++++++++ src/sp-filter.h | 3 +++ src/style.cpp | 2 ++ src/ui/dialog/filter-effects-dialog.cpp | 31 +++++++++++++++++++++++++------ src/ui/dialog/filter-effects-dialog.h | 4 ++++ 5 files changed, 44 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/sp-filter.cpp b/src/sp-filter.cpp index 2bf1b11a6..1bde69dd1 100644 --- a/src/sp-filter.cpp +++ b/src/sp-filter.cpp @@ -79,6 +79,7 @@ void SPFilter::build(SPDocument *document, Inkscape::XML::Node *repr) { this->readAttr( "height" ); this->readAttr( "filterRes" ); this->readAttr( "xlink:href" ); + this->_refcount = 0; SPObject::build(document, repr); @@ -190,6 +191,15 @@ void SPFilter::set(unsigned int key, gchar const *value) { } } + +/** + * Returns the number of references to the filter. + */ +guint SPFilter::getRefCount() { + // NOTE: this is currently updated by sp_style_filter_ref_changed() in style.cpp + return _refcount; +} + /** * Receives update notifications. */ diff --git a/src/sp-filter.h b/src/sp-filter.h index e6318c569..1c214c6b7 100644 --- a/src/sp-filter.h +++ b/src/sp-filter.h @@ -54,6 +54,9 @@ public: NumberOptNumber filterRes; SPFilterReference *href; sigc::connection modified_connection; + + guint getRefCount(); + guint _refcount; Inkscape::Filters::Filter *_renderer; diff --git a/src/style.cpp b/src/style.cpp index 8b41bbbd7..fa8aed68e 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -1177,10 +1177,12 @@ void sp_style_filter_ref_changed(SPObject *old_ref, SPObject *ref, SPStyle *style) { if (old_ref) { + (dynamic_cast( old_ref ))->_refcount--; style->filter_modified_connection.disconnect(); } if ( SP_IS_FILTER(ref)) { + (dynamic_cast( ref ))->_refcount++; style->filter_modified_connection = ref->connectModified(sigc::bind(sigc::ptr_fun(&sp_style_filter_ref_modified), style)); } diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index f81519ed1..1ff9e4a1b 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -8,6 +8,7 @@ * Felipe C. da S. Sanches * Jon A. Cruz * Abhishek Sharma + * insaner * * Copyright (C) 2007 Authors * @@ -1360,8 +1361,15 @@ FilterEffectsDialog::FilterModifier::FilterModifier(FilterEffectsDialog& d) ((Gtk::CellRendererText*)_list.get_column(1)->get_first_cell())-> signal_edited().connect(sigc::mem_fun(*this, &FilterEffectsDialog::FilterModifier::on_name_edited)); + _list.append_column("#", _columns.count); + _list.get_column(2)->set_sizing(Gtk::TREE_VIEW_COLUMN_AUTOSIZE); + _list.get_column(2)->set_expand(false); + sw->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); _list.get_column(1)->set_resizable(true); + _list.get_column(1)->set_sizing(Gtk::TREE_VIEW_COLUMN_AUTOSIZE); + _list.get_column(1)->set_expand(true); + _list.set_reorderable(true); _list.enable_model_drag_dest (Gdk::ACTION_MOVE); @@ -1494,6 +1502,7 @@ void FilterEffectsDialog::FilterModifier::update_selection(Selection *sel) (*iter)[_columns.sel] = 0; } } + update_counts(); } void FilterEffectsDialog::FilterModifier::on_filter_selection_changed() @@ -1565,6 +1574,15 @@ void FilterEffectsDialog::FilterModifier::on_selection_toggled(const Glib::ustri } } + +void FilterEffectsDialog::FilterModifier::update_counts() +{ + for(Gtk::TreeModel::iterator i = _model->children().begin(); i != _model->children().end(); ++i) { + SPFilter* f = SP_FILTER((*i)[_columns.filter]); + (*i)[_columns.count] = f->getRefCount(); + } +} + /* Add all filters in the document to the combobox. Keeps the same selection if possible, otherwise selects the first element */ void FilterEffectsDialog::FilterModifier::update_filters() @@ -2419,7 +2437,7 @@ bool FilterEffectsDialog::PrimitiveList::on_motion_notify_event(GdkEventMotion* get_visible_rect(vis); int vis_x, vis_y; - int vis_x2, vis_y2; // NOTE: insaner added -- necessary to get the scrolling while dragging to work + int vis_x2, vis_y2; convert_widget_to_tree_coords(vis.get_x(), vis.get_y(), vis_x2, vis_y2); convert_tree_to_widget_coords(vis.get_x(), vis.get_y(), vis_x, vis_y); @@ -2439,7 +2457,6 @@ bool FilterEffectsDialog::PrimitiveList::on_motion_notify_event(GdkEventMotion* else _autoscroll_y = 0; - // NOTE: insaner added -- necessary to get the scrolling while dragging to work double e2 = ( e->x - vis_x2/2); // horizontal scrolling if(e2 < vis_x) @@ -2752,20 +2769,22 @@ FilterEffectsDialog::FilterEffectsDialog() Gtk::ScrolledWindow* sw_infobox = Gtk::manage(new Gtk::ScrolledWindow); Gtk::HBox* infobox = Gtk::manage(new Gtk::HBox(/*homogeneous:*/false, /*spacing:*/4)); Gtk::HBox* hb_prims = Gtk::manage(new Gtk::HBox); + Gtk::VBox* vb_prims = Gtk::manage(new Gtk::VBox); _getContents()->add(*hpaned); hpaned->pack1(_filter_modifier); hpaned->pack2(_primitive_box); _primitive_box.pack_start(*sw_prims); - _primitive_box.pack_start(*hb_prims, false, false); _primitive_box.pack_start(*sw_infobox, false, false); sw_prims->add(_primitive_list); - sw_infobox->add(*infobox); + sw_infobox->add(*vb_prims); infobox->pack_start(_infobox_icon, false, false); infobox->pack_start(_infobox_desc, false, false); _infobox_desc.set_line_wrap(true); - _infobox_desc.set_size_request(200, -1); + _infobox_desc.set_size_request(250, -1); + vb_prims->pack_start(*hb_prims); + vb_prims->pack_start(*infobox); hb_prims->pack_start(_add_primitive, false, false); hb_prims->pack_start(_add_primitive_type, false, false); @@ -2781,7 +2800,7 @@ FilterEffectsDialog::FilterEffectsDialog() _add_primitive_type.signal_changed().connect( sigc::mem_fun(*this, &FilterEffectsDialog::update_primitive_infobox)); - sw_prims->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); /* NOTE: insaner -- SCROLL the connections panel thing!!! */ + sw_prims->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); sw_prims->set_shadow_type(Gtk::SHADOW_IN); sw_infobox->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_NEVER); diff --git a/src/ui/dialog/filter-effects-dialog.h b/src/ui/dialog/filter-effects-dialog.h index 3fc19e7de..a067cd70c 100644 --- a/src/ui/dialog/filter-effects-dialog.h +++ b/src/ui/dialog/filter-effects-dialog.h @@ -4,6 +4,7 @@ /* Authors: * Nicholas Bishop * Rodrigo Kumpera + * insaner * * Copyright (C) 2007 Authors * @@ -69,11 +70,13 @@ private: add(filter); add(label); add(sel); + add(count); } Gtk::TreeModelColumn filter; Gtk::TreeModelColumn label; Gtk::TreeModelColumn sel; + Gtk::TreeModelColumn count; }; void setTargetDesktop(SPDesktop *desktop); @@ -89,6 +92,7 @@ private: bool on_filter_move(const Glib::RefPtr& /*context*/, int x, int y, guint /*time*/); void on_selection_toggled(const Glib::ustring&); + void update_counts(); void update_filters(); void filter_list_button_release(GdkEventButton*); void add_filter(); -- cgit v1.2.3 From 6957740e11e8604b8439c3ef331cf3c44400d1fb Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Wed, 6 May 2015 01:48:53 -0700 Subject: Changed return type to be consistent with other calls and to make header stand-alone. (bzr r14112) --- src/dir-util.cpp | 2 +- src/dir-util.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/dir-util.cpp b/src/dir-util.cpp index c9b88b007..64f7ab7e7 100644 --- a/src/dir-util.cpp +++ b/src/dir-util.cpp @@ -217,7 +217,7 @@ erange: return (NULL); } -gchar *prepend_current_dir_if_relative(gchar const *uri) +char *prepend_current_dir_if_relative(gchar const *uri) { if (!uri) { return NULL; diff --git a/src/dir-util.h b/src/dir-util.h index e78cad6a6..327e1ad5f 100644 --- a/src/dir-util.h +++ b/src/dir-util.h @@ -12,7 +12,7 @@ #include #include -/** +/** * Returns a form of \a path relative to \a base if that is easy to construct (eg if \a path * appears to be in the directory specified by \a base), otherwise returns \a path. * @@ -49,7 +49,7 @@ char *inkscape_rel2abs(char const *path, char const *base, char *result, size_t char *inkscape_abs2rel(char const *path, char const *base, char *result, size_t const size); -gchar *prepend_current_dir_if_relative(char const *filename); +char *prepend_current_dir_if_relative(char const *filename); #endif // !SEEN_DIR_UTIL_H -- cgit v1.2.3 From 12fb2762bc936c08538f041be261c79f43ee80e0 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 6 May 2015 13:55:31 +0200 Subject: Compromise solution for dot grid visibilty. See bug #1357611. (bzr r14114) --- src/display/canvas-grid.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp index 4eda9b194..decf93626 100644 --- a/src/display/canvas-grid.cpp +++ b/src/display/canvas-grid.cpp @@ -906,7 +906,7 @@ CanvasXYGrid::Render (SPCanvasBuf *buf) gdouble const syg = floor ((buf->rect.top() - ow[Geom::Y]) / sw[Geom::Y]) * sw[Geom::Y] + ow[Geom::Y]; gint const ylinestart = round((syg - ow[Geom::Y]) / sw[Geom::Y]); - //set correct coloring, depending preference (when zoomed out, always major coloring or minor coloring) + // no_emphasize_when_zoomedout determines color (minor or major) when only major grid lines/dots shown. Inkscape::Preferences *prefs = Inkscape::Preferences::get(); guint32 _empcolor; bool no_emp_when_zoomed_out = prefs->getBool("/options/grids/no_emphasize_when_zoomedout", false); @@ -922,6 +922,7 @@ CanvasXYGrid::Render (SPCanvasBuf *buf) cairo_set_line_cap(buf->ct, CAIRO_LINE_CAP_SQUARE); if (!render_dotted) { + // Line grid gint ylinenum; gdouble y; for (y = syg, ylinenum = ylinestart; y < buf->rect.bottom(); y += sw[Geom::Y], ylinenum++) { @@ -944,8 +945,23 @@ CanvasXYGrid::Render (SPCanvasBuf *buf) } } } else { + // Dotted grid gint ylinenum; gdouble y; + + // alpha needs to be larger than in the line case to maintain a similar visual impact but + // setting it to the maximal value makes the dots dominant in some cases. Solution, + // increase the alpha by a factor of 4. This then allows some user adjustment. + guint32 _empdot = (_empcolor & 0xff) << 2; + if (_empdot > 0xff) + _empdot = 0xff; + _empdot += (_empcolor & 0xffffff00); + + guint32 _colordot = (color & 0xff) << 2; + if (_colordot > 0xff) + _colordot = 0xff; + _colordot += (color & 0xffffff00); + for (y = syg, ylinenum = ylinestart; y < buf->rect.bottom(); y += sw[Geom::Y], ylinenum++) { gint const iy = round(y); @@ -957,13 +973,15 @@ CanvasXYGrid::Render (SPCanvasBuf *buf) || (!scaled[Geom::Y] && (ylinenum % empspacing) != 0) || ((scaled[Geom::X] || scaled[Geom::Y]) && no_emp_when_zoomed_out) ) { - grid_dot (buf, ix, iy, color | (guint32)0x000000FF); // put alpha to max value + // Minor point: dot only + grid_dot (buf, ix, iy, _colordot); // | (guint32)0x000000FF); // put alpha to max value } else { + // Major point: small cross gint const pitch = 1; grid_dot (buf, ix-pitch, iy, _empcolor); grid_dot (buf, ix+pitch, iy, _empcolor); - grid_dot (buf, ix, iy, _empcolor | (guint32)0x000000FF); // put alpha to max value + grid_dot (buf, ix, iy, _empdot ); // | (guint32)0x000000FF); // put alpha to max value grid_dot (buf, ix, iy-pitch, _empcolor); grid_dot (buf, ix, iy+pitch, _empcolor); -- cgit v1.2.3 From d71254cf07e2258ab3f8b80fc09b565e4a90f422 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 6 May 2015 15:44:14 +0200 Subject: Start of implementing CSS 3 font variants (access to OpenType features). (bzr r14115) --- src/attributes.cpp | 24 ++++++++-- src/attributes.h | 23 +++++++-- src/style-enums.h | 137 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/style.cpp | 57 ++++++++++++++++++++-- src/style.h | 18 ++++++- 5 files changed, 245 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/attributes.cpp b/src/attributes.cpp index 568f0528a..af19360c1 100644 --- a/src/attributes.cpp +++ b/src/attributes.cpp @@ -419,6 +419,16 @@ static SPStyleProp const props[] = { {SP_PROP_FONT_STYLE, "font-style"}, {SP_PROP_FONT_VARIANT, "font-variant"}, {SP_PROP_FONT_WEIGHT, "font-weight"}, + + /* Font Variants CSS 3 */ + {SP_PROP_FONT_VARIANT_LIGATURES, "font-variant-ligatures"}, + {SP_PROP_FONT_VARIANT_POSITION, "font-variant-position"}, + {SP_PROP_FONT_VARIANT_CAPS, "font-variant-caps"}, + {SP_PROP_FONT_VARIANT_NUMERIC, "font-variant-numeric"}, + {SP_PROP_FONT_VARIANT_ALTERNATES, "font-variant-alternates"}, + {SP_PROP_FONT_VARIANT_EAST_ASIAN, "font-variant-east-asian"}, + {SP_PROP_FONT_FEATURE_SETTINGS, "font-feature-settings"}, + /* Text */ {SP_PROP_TEXT_INDENT, "text-indent"}, {SP_PROP_TEXT_ALIGN, "text-align"}, @@ -426,6 +436,7 @@ static SPStyleProp const props[] = { {SP_PROP_LETTER_SPACING, "letter-spacing"}, {SP_PROP_WORD_SPACING, "word-spacing"}, {SP_PROP_TEXT_TRANSFORM, "text-transform"}, + /* Text (css3) */ {SP_PROP_DIRECTION, "direction"}, {SP_PROP_BLOCK_PROGRESSION, "block-progression"}, @@ -439,16 +450,21 @@ static SPStyleProp const props[] = { {SP_PROP_KERNING, "kerning"}, {SP_PROP_TEXT_ANCHOR, "text-anchor"}, {SP_PROP_WHITE_SPACE, "white-space"}, + /* SVG 2 Text Wrapping */ {SP_PROP_SHAPE_INSIDE, "shape-inside"}, {SP_PROP_SHAPE_OUTSIDE, "shape-outside"}, {SP_PROP_SHAPE_PADDING, "shape-padding"}, {SP_PROP_SHAPE_MARGIN, "shape-margin"}, + /* Text Decoration */ - {SP_PROP_TEXT_DECORATION, "text-decoration"}, - {SP_PROP_TEXT_DECORATION_LINE, "text-decoration-line"}, - {SP_PROP_TEXT_DECORATION_STYLE,"text-decoration-style"}, - {SP_PROP_TEXT_DECORATION_COLOR,"text-decoration-color"}, + {SP_PROP_TEXT_DECORATION, "text-decoration"}, + {SP_PROP_TEXT_DECORATION_LINE, "text-decoration-line"}, + {SP_PROP_TEXT_DECORATION_STYLE, "text-decoration-style"}, + {SP_PROP_TEXT_DECORATION_COLOR, "text-decoration-color"}, + {SP_PROP_TEXT_DECORATION_FILL, "text-decoration-fill"}, + {SP_PROP_TEXT_DECORATION_STROKE,"text-decoration-stroke"}, + /* Misc */ {SP_PROP_CLIP, "clip"}, {SP_PROP_COLOR, "color"}, diff --git a/src/attributes.h b/src/attributes.h index 91c8868f9..7d6ea70a0 100644 --- a/src/attributes.h +++ b/src/attributes.h @@ -424,6 +424,15 @@ enum SPAttributeEnum { SP_PROP_FONT_VARIANT, SP_PROP_FONT_WEIGHT, + /* Font Variants CSS 3 */ + SP_PROP_FONT_VARIANT_LIGATURES, + SP_PROP_FONT_VARIANT_POSITION, + SP_PROP_FONT_VARIANT_CAPS, + SP_PROP_FONT_VARIANT_NUMERIC, + SP_PROP_FONT_VARIANT_ALTERNATES, + SP_PROP_FONT_VARIANT_EAST_ASIAN, + SP_PROP_FONT_FEATURE_SETTINGS, + /* Text Layout */ SP_PROP_TEXT_INDENT, SP_PROP_TEXT_ALIGN, @@ -446,16 +455,20 @@ enum SPAttributeEnum { SP_PROP_TEXT_ANCHOR, SP_PROP_WHITE_SPACE, + /* SVG 2 Text Wrapping */ SP_PROP_SHAPE_INSIDE, SP_PROP_SHAPE_OUTSIDE, SP_PROP_SHAPE_PADDING, SP_PROP_SHAPE_MARGIN, - /* Text Decoration */ - SP_PROP_TEXT_DECORATION, /* SVG 1 underline etc.( no color or style) OR SVG2 with _LINE, _STYLE, _COLOR values */ - SP_PROP_TEXT_DECORATION_LINE, /* SVG 2 underline etc. */ - SP_PROP_TEXT_DECORATION_STYLE, /* SVG 2 proposed solid [SVG 1], dotted, etc.)*/ - SP_PROP_TEXT_DECORATION_COLOR, /* SVG 2 proposed same as text [SVG 1], specified*/ + /* Text Decoration CSS 2/CSS 3 Shorthand */ + SP_PROP_TEXT_DECORATION, + /* Text Decoration CSS 3/SVG 2 */ + SP_PROP_TEXT_DECORATION_LINE, + SP_PROP_TEXT_DECORATION_STYLE, + SP_PROP_TEXT_DECORATION_COLOR, + SP_PROP_TEXT_DECORATION_FILL, + SP_PROP_TEXT_DECORATION_STROKE, /* Misc */ SP_PROP_CLIP, diff --git a/src/style-enums.h b/src/style-enums.h index f52752018..f235b6699 100644 --- a/src/style-enums.h +++ b/src/style-enums.h @@ -72,6 +72,72 @@ enum SPCSSFontStretch { SP_CSS_FONT_STRETCH_WIDER }; +// Can select more than one +enum SPCSSFontVariantLigatures { + SP_CSS_FONT_VARIANT_LIGATURES_NORMAL, + SP_CSS_FONT_VARIANT_LIGATURES_NONE, + SP_CSS_FONT_VARIANT_LIGATURES_COMMON, + SP_CSS_FONT_VARIANT_LIGATURES_NO_COMMON, + SP_CSS_FONT_VARIANT_LIGATURES_DISCRETIONARY, + SP_CSS_FONT_VARIANT_LIGATURES_NO_DISCRETIONARY, + SP_CSS_FONT_VARIANT_LIGATURES_HISTORICAL, + SP_CSS_FONT_VARIANT_LIGATURES_NO_HISTORICAL, + SP_CSS_FONT_VARIANT_LIGATURES_CONTEXTUAL, + SP_CSS_FONT_VARIANT_LIGATURES_NO_CONTEXTUAL +}; + +enum SPCSSFontVariantPosition { + SP_CSS_FONT_VARIANT_POSITION_NORMAL, + SP_CSS_FONT_VARIANT_POSITION_SUB, + SP_CSS_FONT_VARIANT_POSITION_SUPER +}; + +enum SPCSSFontVariantCaps { + SP_CSS_FONT_VARIANT_CAPS_NORMAL, + SP_CSS_FONT_VARIANT_CAPS_SMALL, + SP_CSS_FONT_VARIANT_CAPS_ALL_SMALL, + SP_CSS_FONT_VARIANT_CAPS_PETITE, + SP_CSS_FONT_VARIANT_CAPS_ALL_PETITE, + SP_CSS_FONT_VARIANT_CAPS_UNICASE, + SP_CSS_FONT_VARIANT_CAPS_TITLING, +}; + +enum SPCSSFontVariantNumeric { + SP_CSS_FONT_VARIANT_NUMERIC_NORMAL, + SP_CSS_FONT_VARIANT_NUMERIC_LINING_NUMS, + SP_CSS_FONT_VARIANT_NUMERIC_OLDSTYLE_NUMS, + SP_CSS_FONT_VARIANT_NUMERIC_PROPORTIONAL_NUMS, + SP_CSS_FONT_VARIANT_NUMERIC_TABULAR_NUMS, + SP_CSS_FONT_VARIANT_NUMERIC_DIAGONAL_FRACTIONS, + SP_CSS_FONT_VARIANT_NUMERIC_STACKED_FRACTIONS, + SP_CSS_FONT_VARIANT_NUMERIC_ORDINAL, + SP_CSS_FONT_VARIANT_NUMERIC_SLASHED_ZERO +}; + +enum SPCSSFontVariantAlternates { + SP_CSS_FONT_VARIANT_ALTERNATES_NORMAL, + SP_CSS_FONT_VARIANT_ALTERNATES_HISTORICAL_FORMS, + SP_CSS_FONT_VARIANT_ALTERNATES_STYLISTIC, + SP_CSS_FONT_VARIANT_ALTERNATES_STYLESET, + SP_CSS_FONT_VARIANT_ALTERNATES_CHARACTER_VARIANT, + SP_CSS_FONT_VARIANT_ALTERNATES_SWASH, + SP_CSS_FONT_VARIANT_ALTERNATES_ORNAMENTS, + SP_CSS_FONT_VARIANT_ALTERNATES_ANNOTATION +}; + +enum SPCSSFontVariantEastAsian { + SP_CSS_FONT_VARIANT_EAST_ASIAN_NORMAL, + SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS78, + SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS83, + SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS90, + SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS04, + SP_CSS_FONT_VARIANT_EAST_ASIAN_SIMPLIFIED, + SP_CSS_FONT_VARIANT_EAST_ASIAN_TRADITIONAL, + SP_CSS_FONT_VARIANT_EAST_ASIAN_FULL_WIDTH, + SP_CSS_FONT_VARIANT_EAST_ASIAN_PROPORTIONAL_WIDTH, + SP_CSS_FONT_VARIANT_EAST_ASIAN_RUBY +}; + enum SPCSSTextAlign { SP_CSS_TEXT_ALIGN_START, SP_CSS_TEXT_ALIGN_END, @@ -309,6 +375,77 @@ static SPStyleEnum const enum_font_stretch[] = { {NULL, -1} }; +static SPStyleEnum const enum_font_variant_ligatures[] = { + {"normal", SP_CSS_FONT_VARIANT_LIGATURES_NORMAL}, + {"none", SP_CSS_FONT_VARIANT_LIGATURES_NONE}, + {"common-ligatures", SP_CSS_FONT_VARIANT_LIGATURES_COMMON}, + {"no-common-ligatures", SP_CSS_FONT_VARIANT_LIGATURES_NO_COMMON}, + {"discretionary-ligatures", SP_CSS_FONT_VARIANT_LIGATURES_DISCRETIONARY}, + {"no-discretionary-ligatures", SP_CSS_FONT_VARIANT_LIGATURES_NO_DISCRETIONARY}, + {"historical-ligatures", SP_CSS_FONT_VARIANT_LIGATURES_HISTORICAL}, + {"nohistorical-ligatures", SP_CSS_FONT_VARIANT_LIGATURES_NO_HISTORICAL}, + {"contextual", SP_CSS_FONT_VARIANT_LIGATURES_CONTEXTUAL}, + {"no-contextual", SP_CSS_FONT_VARIANT_LIGATURES_NO_CONTEXTUAL}, + {NULL, -1} +}; + +static SPStyleEnum const enum_font_variant_position[] = { + {"normal", SP_CSS_FONT_VARIANT_POSITION_NORMAL}, + {"sub", SP_CSS_FONT_VARIANT_POSITION_SUB}, + {"super", SP_CSS_FONT_VARIANT_POSITION_SUPER}, + {NULL, -1} +}; + +static SPStyleEnum const enum_font_variant_caps[] = { + {"normal", SP_CSS_FONT_VARIANT_CAPS_NORMAL}, + {"small-caps", SP_CSS_FONT_VARIANT_CAPS_SMALL}, + {"all-small-caps", SP_CSS_FONT_VARIANT_CAPS_ALL_SMALL}, + {"petite-caps", SP_CSS_FONT_VARIANT_CAPS_PETITE}, + {"all_petite-caps", SP_CSS_FONT_VARIANT_CAPS_ALL_PETITE}, + {"unicase", SP_CSS_FONT_VARIANT_CAPS_UNICASE}, + {"titling", SP_CSS_FONT_VARIANT_CAPS_TITLING}, + {NULL, -1} +}; + +static SPStyleEnum const enum_font_variant_numeric[] = { + {"normal", SP_CSS_FONT_VARIANT_NUMERIC_NORMAL}, + {"lining-nums", SP_CSS_FONT_VARIANT_NUMERIC_LINING_NUMS}, + {"oldstyle-nums", SP_CSS_FONT_VARIANT_NUMERIC_OLDSTYLE_NUMS}, + {"proportional-nums", SP_CSS_FONT_VARIANT_NUMERIC_PROPORTIONAL_NUMS}, + {"tabular-nums", SP_CSS_FONT_VARIANT_NUMERIC_TABULAR_NUMS}, + {"diagonal-fractions", SP_CSS_FONT_VARIANT_NUMERIC_DIAGONAL_FRACTIONS}, + {"stacked-fractions", SP_CSS_FONT_VARIANT_NUMERIC_STACKED_FRACTIONS}, + {"ordinal", SP_CSS_FONT_VARIANT_NUMERIC_ORDINAL}, + {"slashed-zero", SP_CSS_FONT_VARIANT_NUMERIC_SLASHED_ZERO}, + {NULL, -1} +}; + +static SPStyleEnum const enum_font_variant_alternates[] = { + {"normal", SP_CSS_FONT_VARIANT_ALTERNATES_NORMAL}, + {"historical-forms", SP_CSS_FONT_VARIANT_ALTERNATES_HISTORICAL_FORMS}, + {"stylistic", SP_CSS_FONT_VARIANT_ALTERNATES_STYLISTIC}, + {"styleset", SP_CSS_FONT_VARIANT_ALTERNATES_STYLESET}, + {"character_variant", SP_CSS_FONT_VARIANT_ALTERNATES_CHARACTER_VARIANT}, + {"swash", SP_CSS_FONT_VARIANT_ALTERNATES_SWASH}, + {"ornaments", SP_CSS_FONT_VARIANT_ALTERNATES_ORNAMENTS}, + {"annotation", SP_CSS_FONT_VARIANT_ALTERNATES_ANNOTATION}, + {NULL, -1} +}; + +static SPStyleEnum const enum_font_variant_east_asian[] = { + {"normal", SP_CSS_FONT_VARIANT_EAST_ASIAN_NORMAL}, + {"jis78", SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS78}, + {"jis83", SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS83}, + {"jis90", SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS90}, + {"jis04", SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS04}, + {"simplified", SP_CSS_FONT_VARIANT_EAST_ASIAN_SIMPLIFIED}, + {"traditional", SP_CSS_FONT_VARIANT_EAST_ASIAN_TRADITIONAL}, + {"full-width", SP_CSS_FONT_VARIANT_EAST_ASIAN_FULL_WIDTH}, + {"proportional-width", SP_CSS_FONT_VARIANT_EAST_ASIAN_PROPORTIONAL_WIDTH}, + {"ruby", SP_CSS_FONT_VARIANT_EAST_ASIAN_RUBY}, + {NULL, -1} +}; + static SPStyleEnum const enum_text_align[] = { {"start", SP_CSS_TEXT_ALIGN_START}, {"end", SP_CSS_TEXT_ALIGN_END}, diff --git a/src/style.cpp b/src/style.cpp index fa8aed68e..49a13604b 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -14,7 +14,7 @@ * Copyright (C) 2001 Ximian, Inc. * Copyright (C) 2005 Monash University * Copyright (C) 2012 Kris De Gussem - * Copyright (C) 2014 Tavmjong Bah + * Copyright (C) 2014-2015 Tavmjong Bah * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -118,6 +118,15 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) : font(), // SPIFont font_specification( "-inkscape-font-specification" ), // SPIString + // Font variants + font_variant_ligatures( "font-variant-ligatures", enum_font_variant_ligatures, SP_CSS_FONT_VARIANT_LIGATURES_NORMAL ), + font_variant_position( "font-variant-position", enum_font_variant_position, SP_CSS_FONT_VARIANT_POSITION_NORMAL ), + font_variant_caps( "font-variant-caps", enum_font_variant_caps, SP_CSS_FONT_VARIANT_CAPS_NORMAL ), + font_variant_numeric( "font-variant-numeric", enum_font_variant_numeric, SP_CSS_FONT_VARIANT_NUMERIC_NORMAL ), + font_variant_alternates("font-variant-alternates", enum_font_variant_alternates, SP_CSS_FONT_VARIANT_ALTERNATES_NORMAL ), + font_variant_east_asian("font-variant-east_asian", enum_font_variant_east_asian, SP_CSS_FONT_VARIANT_EAST_ASIAN_NORMAL ), + font_feature_settings( "font-feature-settings", "normal" ), + // Text related properties text_indent( "text-indent", 0.0 ), // SPILength text_align( "text-align", enum_text_align, SP_CSS_TEXT_ALIGN_START ), @@ -288,6 +297,15 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) : _properties.push_back( &font ); _properties.push_back( &font_specification ); + // Font variants + _properties.push_back( &font_variant_ligatures ); + _properties.push_back( &font_variant_position ); + _properties.push_back( &font_variant_caps ); + _properties.push_back( &font_variant_numeric ); + _properties.push_back( &font_variant_alternates ); + _properties.push_back( &font_variant_east_asian ); + _properties.push_back( &font_feature_settings ); + _properties.push_back( &text_indent ); _properties.push_back( &text_align ); @@ -374,6 +392,14 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) : // _propmap.insert( std::make_pair( font.name, reinterpret_cast(&SPStyle::font ) ) ); // _propmap.insert( std::make_pair( font_specification.name, reinterpret_cast(&SPStyle::font_specification ) ) ); + // font_variant_ligatures ); + // font_variant_position ); + // font_variant_caps ); + // font_variant_numeric ); + // font_variant_alternates ); + // font_variant_east_asian ); + // font_feature_settings ); + // _propmap.insert( std::make_pair( text_indent.name, reinterpret_cast(&SPStyle::text_indent ) ) ); // _propmap.insert( std::make_pair( text_align.name, reinterpret_cast(&SPStyle::text_align ) ) ); @@ -574,9 +600,9 @@ SPStyle::read( SPObject *object, Inkscape::XML::Node *repr ) { // std::cout << " MERGING PRESENTATION ATTRIBUTES" << std::endl; for(std::vector::size_type i = 0; i != _properties.size(); ++i) { - // Shorthands are not allowed as presentation properites. - // Note: text-decoration is converted to a shorthand in CSS 3 but can still be - // read as a non-shorthand so it should not be in this list. + // Shorthands are not allowed as presentation properites. Note: text-decoration and + // font-variant are converted to shorthands in CSS 3 but can still be read as a + // non-shorthand for compatability with older renders, so they should not be in this list. // We could add a flag to SPIBase to avoid string comparison. if( _properties[i]->name.compare( "font" ) != 0 && _properties[i]->name.compare( "marker" ) != 0 ) { @@ -694,6 +720,29 @@ SPStyle::readIfUnset( gint id, gchar const *val ) { font.readIfUnset( val ); break; + /* Font Variants CSS 3 */ + case SP_PROP_FONT_VARIANT_LIGATURES: + font_variant_ligatures.readIfUnset( val ); + break; + case SP_PROP_FONT_VARIANT_POSITION: + font_variant_position.readIfUnset( val ); + break; + case SP_PROP_FONT_VARIANT_CAPS: + font_variant_caps.readIfUnset( val ); + break; + case SP_PROP_FONT_VARIANT_NUMERIC: + font_variant_numeric.readIfUnset( val ); + break; + case SP_PROP_FONT_VARIANT_ALTERNATES: + font_variant_alternates.readIfUnset( val ); + break; + case SP_PROP_FONT_VARIANT_EAST_ASIAN: + font_variant_east_asian.readIfUnset( val ); + break; + case SP_PROP_FONT_FEATURE_SETTINGS: + font_feature_settings.readIfUnset( val ); + break; + /* Text */ case SP_PROP_TEXT_INDENT: text_indent.readIfUnset( val ); diff --git a/src/style.h b/src/style.h index ab34476b3..2618662f5 100644 --- a/src/style.h +++ b/src/style.h @@ -94,7 +94,7 @@ public: /** Font style */ SPIEnum font_style; - /** Which substyle of the font */ + /** Which substyle of the font (CSS 2. CSS 3 redefines as shorthand) */ SPIEnum font_variant; /** Weight of the font */ SPIEnum font_weight; @@ -111,6 +111,22 @@ public: /** Full font name, as font_factory::ConstructFontSpecification would give, for internal use. */ SPIString font_specification; + /* Font variants -------------------- */ + /** Font variant ligatures */ + SPIEnum font_variant_ligatures; + /** Font variant position (subscript/superscript) */ + SPIEnum font_variant_position; + /** Font variant caps (small caps) */ + SPIEnum font_variant_caps; + /** Font variant numeric (numerical formatting) */ + SPIEnum font_variant_numeric; + /** Font variant alternates (alternates/swatches) */ + SPIEnum font_variant_alternates; + /** Font variant East Asian */ + SPIEnum font_variant_east_asian; + /** Font feature settings (Low level access to TrueType tables) */ + SPIString font_feature_settings; + /* Text ----------------------------- */ /** First line indent of paragraphs (css2 16.1) */ -- cgit v1.2.3 From 9c2dcd93aa8c7e2975bda72f92603fcd0a343a95 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Wed, 6 May 2015 17:21:03 +0200 Subject: UI. Fix for Bug #1450877 (GUI glitch in Object Properties) Fixed bugs: - https://launchpad.net/bugs/1450877 (bzr r14116) --- src/ui/dialog/object-properties.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/object-properties.cpp b/src/ui/dialog/object-properties.cpp index dfe211e94..fc21a30d4 100644 --- a/src/ui/dialog/object-properties.cpp +++ b/src/ui/dialog/object-properties.cpp @@ -467,14 +467,14 @@ void ObjectProperties::_labelChanged() gchar *id = g_strdup(_entry_id.get_text().c_str()); g_strcanon(id, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.:", '_'); if (strcmp(id, item->getId()) == 0) { - _label_id.set_markup_with_mnemonic(_("_ID:")); + _label_id.set_markup_with_mnemonic(_("_ID:") + Glib::ustring(" ")); } else if (!*id || !isalnum (*id)) { _label_id.set_text(_("Id invalid! ")); } else if (SP_ACTIVE_DOCUMENT->getObjectById(id) != NULL) { _label_id.set_text(_("Id exists! ")); } else { SPException ex; - _label_id.set_markup_with_mnemonic(_("_ID:")); + _label_id.set_markup_with_mnemonic(_("_ID:") + Glib::ustring(" ")); SP_EXCEPTION_INIT(&ex); item->setAttribute("id", id, &ex); DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM, _("Set object ID")); -- cgit v1.2.3 From 8c3f982781088c386acb4105119b19d9c7160502 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 7 May 2015 00:10:23 +0200 Subject: fix crash due to logic error in Selection::_removeObjectDescendants (bzr r14117) --- src/selection.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/selection.cpp b/src/selection.cpp index 53772c381..f728f3381 100644 --- a/src/selection.cpp +++ b/src/selection.cpp @@ -481,17 +481,21 @@ std::vector Selection::getSnapPoints(SnapPreferenc } void Selection::_removeObjectDescendants(SPObject *obj) { + std::vector toremove; for ( std::list::const_iterator iter=_objs.begin();iter!=_objs.end();iter++ ) { SPObject *sel_obj= *iter; SPObject *parent = sel_obj->parent; while (parent) { if ( parent == obj ) { - _remove(sel_obj); + toremove.push_back(sel_obj); break; } parent = parent->parent; } } + for ( std::vector::const_iterator iter=toremove.begin();iter!=toremove.end();iter++ ) { + _remove(*iter); + } } void Selection::_removeObjectAncestors(SPObject *obj) { -- cgit v1.2.3 From fe6f8f1b7976197de20964be02e594d058aead84 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 7 May 2015 00:39:26 +0200 Subject: "select same..." no longer returns groups. (bzr r14118) --- src/selection-chemistry.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index f444f4217..7a5c2c2d5 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -1837,6 +1837,15 @@ void sp_select_same_fill_stroke_style(SPDesktop *desktop, gboolean fill, gboolea Inkscape::Selection *selection = desktop->getSelection(); std::vector items = selection->itemList(); + + std::vector tmp; + for (std::vector::const_iterator iter=all_list.begin();iter!=all_list.end();iter++) { + if(!SP_IS_GROUP(*iter)){ + tmp.push_back(*iter); + } + } + all_list=tmp; + for (std::vector::const_iterator sel_iter=items.begin();sel_iter!=items.end();sel_iter++) { SPItem *sel = *sel_iter; std::vector matches = all_list; -- cgit v1.2.3 From c8aad8eba683cd12ddfde4acca3870e859216f21 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 7 May 2015 01:18:59 +0200 Subject: fix sorts (bzr r14119) --- src/selection-chemistry.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 7a5c2c2d5..8bc62d4b9 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -927,7 +927,7 @@ static SPObject *prev_sibling(SPObject *child) return prev; } -int sp_item_repr_compare_position_obj(SPObject const *first, SPObject const *second) +bool sp_item_repr_compare_position_bool(SPObject const *first, SPObject const *second) { return sp_repr_compare_position(((SPItem*)first)->getRepr(), ((SPItem*)second)->getRepr())<0; @@ -952,7 +952,7 @@ sp_selection_raise(Inkscape::Selection *selection, SPDesktop *desktop) /* Construct reverse-ordered list of selected children. */ std::vector rev(items); - sort(rev.begin(),rev.end(),sp_item_repr_compare_position); + sort(rev.begin(),rev.end(),sp_item_repr_compare_position_bool); // Determine the common bbox of the selected items. Geom::OptRect selected = enclose_items(items); @@ -1034,7 +1034,7 @@ void sp_selection_lower(Inkscape::Selection *selection, SPDesktop *desktop) /* Construct direct-ordered list of selected children. */ std::vector rev(items); - sort(rev.begin(),rev.end(),sp_item_repr_compare_position); + sort(rev.begin(),rev.end(),sp_item_repr_compare_position_bool); // Iterate over all objects in the selection (starting from top). if (selected) { @@ -3518,7 +3518,7 @@ void sp_selection_create_bitmap_copy(SPDesktop *desktop) std::vector items(selection->itemList()); // Sort items so that the topmost comes last - sort(items.begin(),items.end(),sp_item_repr_compare_position); + sort(items.begin(),items.end(),sp_item_repr_compare_position_bool); // Generate a random value from the current time (you may create bitmap from the same object(s) // multiple times, and this is done so that they don't clash) -- cgit v1.2.3 From a06c4852edb10e38fce19fd2df3833c03b6a15e4 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 8 May 2015 00:12:09 +0200 Subject: fix crash when converting a group of objects to path (bzr r14121) --- src/path-chemistry.cpp | 8 ++++++-- src/selection-chemistry.cpp | 16 ++++++++++++---- src/ui/tools/eraser-tool.cpp | 4 +++- 3 files changed, 21 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index 8d2695b85..98148b916 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -388,7 +388,9 @@ sp_item_list_to_curves(const std::vector &items, std::vector& if (repr) { to_select.insert(to_select.begin(),repr); did = true; - selected.erase(find(selected.begin(),selected.end(),item)); + std::vector::iterator element=find(selected.begin(),selected.end(),item); + if(element != selected.end()) + selected.erase(find(selected.begin(),selected.end(),item)); } continue; @@ -413,7 +415,9 @@ sp_item_list_to_curves(const std::vector &items, std::vector& continue; did = true; - selected.erase(find(selected.begin(),selected.end(),item)); + std::vector::iterator element=find(selected.begin(),selected.end(),item); + if(element != selected.end()) + selected.erase(element); // remember the position of the item gint pos = item->getRepr()->position(); diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 8bc62d4b9..3a68b03e5 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -3922,7 +3922,9 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ for (GSList *i = apply_to_items ; NULL != i ; i = i->next) { reprs_to_group.push_back(static_cast(i->data)->getRepr()); - items_to_select.erase(find(items_to_select.begin(),items_to_select.end(),static_cast(i->data))); + std::vector::iterator element = find(items_to_select.begin(),items_to_select.end(),static_cast(i->data)); + if(element != items_to_select.end()) + items_to_select.erase(element); } sp_selection_group_impl(reprs_to_group, group, xml_doc, doc); @@ -3972,7 +3974,9 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ Inkscape::XML::Node *spnew = current->duplicate(xml_doc); gint position = current->position(); - items_to_select.erase(find(items_to_select.begin(),items_to_select.end(),item)); + std::vector::iterator element = find(items_to_select.begin(),items_to_select.end(),item); + if(element != items_to_select.end()) + items_to_select.erase(element); current->parent()->appendChild(group); sp_repr_unparent(current); group->appendChild(spnew); @@ -3996,7 +4000,9 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ for (GSList *i = items_to_delete; NULL != i; i = i->next) { SPObject *item = reinterpret_cast(i->data); item->deleteObject(false); - items_to_select.erase(find(items_to_select.begin(),items_to_select.end(),item)); + std::vector::iterator element = find(items_to_select.begin(),items_to_select.end(),item); + if(element != items_to_select.end()) + items_to_select.erase(element); } g_slist_free(items_to_delete); @@ -4121,7 +4127,9 @@ void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) { for (GSList *i = items_to_ungroup ; NULL != i ; i = i->next) { SPGroup *group = dynamic_cast(static_cast(i->data)); if (group) { - items_to_select.erase(find(items_to_select.begin(),items_to_select.end(),group)); + std::vector::iterator element = find(items_to_select.begin(),items_to_select.end(),group); + if(element != items_to_select.end()) + items_to_select.erase(element); std::vector children; sp_item_group_ungroup(group, children, false); items_to_select.insert(items_to_select.end(),children.rbegin(),children.rend()); diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index 01b75fdb4..0af347bef 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -674,7 +674,9 @@ void EraserTool::set_to_accumulated() { Inkscape::Rubberband *r = Inkscape::Rubberband::get(desktop); toWorkOn = desktop->getDocument()->getItemsAtPoints(desktop->dkey, r->getPoints()); } - toWorkOn.erase(find(toWorkOn.begin(),toWorkOn.end(),acid)); + std::vector::iterator element = find(toWorkOn.begin(),toWorkOn.end(),acid); + if(element != toWorkOn.end()) + toWorkOn.erase(element); } else { toWorkOn= selection->itemList(); wasSelection = true; -- cgit v1.2.3 From fbe59eb1913a779115d9c4769a4066d08e30ff44 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 8 May 2015 00:25:20 +0200 Subject: better fix, using std::remove instead of std::erase (bzr r14122) --- src/path-chemistry.cpp | 8 ++------ src/selection-chemistry.cpp | 16 ++++------------ src/ui/tools/eraser-tool.cpp | 4 +--- 3 files changed, 7 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index 98148b916..ff307cd66 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -388,9 +388,7 @@ sp_item_list_to_curves(const std::vector &items, std::vector& if (repr) { to_select.insert(to_select.begin(),repr); did = true; - std::vector::iterator element=find(selected.begin(),selected.end(),item); - if(element != selected.end()) - selected.erase(find(selected.begin(),selected.end(),item)); + remove(selected.begin(),selected.end(),item); } continue; @@ -415,9 +413,7 @@ sp_item_list_to_curves(const std::vector &items, std::vector& continue; did = true; - std::vector::iterator element=find(selected.begin(),selected.end(),item); - if(element != selected.end()) - selected.erase(element); + remove(selected.begin(),selected.end(),item); // remember the position of the item gint pos = item->getRepr()->position(); diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 3a68b03e5..1e3afc6a8 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -3922,9 +3922,7 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ for (GSList *i = apply_to_items ; NULL != i ; i = i->next) { reprs_to_group.push_back(static_cast(i->data)->getRepr()); - std::vector::iterator element = find(items_to_select.begin(),items_to_select.end(),static_cast(i->data)); - if(element != items_to_select.end()) - items_to_select.erase(element); + remove(items_to_select.begin(),items_to_select.end(),static_cast(i->data)); } sp_selection_group_impl(reprs_to_group, group, xml_doc, doc); @@ -3974,9 +3972,7 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ Inkscape::XML::Node *spnew = current->duplicate(xml_doc); gint position = current->position(); - std::vector::iterator element = find(items_to_select.begin(),items_to_select.end(),item); - if(element != items_to_select.end()) - items_to_select.erase(element); + remove(items_to_select.begin(),items_to_select.end(),item); current->parent()->appendChild(group); sp_repr_unparent(current); group->appendChild(spnew); @@ -4000,9 +3996,7 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ for (GSList *i = items_to_delete; NULL != i; i = i->next) { SPObject *item = reinterpret_cast(i->data); item->deleteObject(false); - std::vector::iterator element = find(items_to_select.begin(),items_to_select.end(),item); - if(element != items_to_select.end()) - items_to_select.erase(element); + remove(items_to_select.begin(),items_to_select.end(),item); } g_slist_free(items_to_delete); @@ -4127,9 +4121,7 @@ void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) { for (GSList *i = items_to_ungroup ; NULL != i ; i = i->next) { SPGroup *group = dynamic_cast(static_cast(i->data)); if (group) { - std::vector::iterator element = find(items_to_select.begin(),items_to_select.end(),group); - if(element != items_to_select.end()) - items_to_select.erase(element); + remove(items_to_select.begin(),items_to_select.end(),group); std::vector children; sp_item_group_ungroup(group, children, false); items_to_select.insert(items_to_select.end(),children.rbegin(),children.rend()); diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index 0af347bef..8a9db6c72 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -674,9 +674,7 @@ void EraserTool::set_to_accumulated() { Inkscape::Rubberband *r = Inkscape::Rubberband::get(desktop); toWorkOn = desktop->getDocument()->getItemsAtPoints(desktop->dkey, r->getPoints()); } - std::vector::iterator element = find(toWorkOn.begin(),toWorkOn.end(),acid); - if(element != toWorkOn.end()) - toWorkOn.erase(element); + std::remove(toWorkOn.begin(),toWorkOn.end(),acid); } else { toWorkOn= selection->itemList(); wasSelection = true; -- cgit v1.2.3 From 57808dd1abe86ae0088a74bd88041321f5df5fb8 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 8 May 2015 00:45:15 +0200 Subject: fix for stl "remove" (bzr r14123) --- src/path-chemistry.cpp | 4 ++-- src/selection-chemistry.cpp | 8 ++++---- src/ui/tools/eraser-tool.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index ff307cd66..7bd5b6298 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -388,7 +388,7 @@ sp_item_list_to_curves(const std::vector &items, std::vector& if (repr) { to_select.insert(to_select.begin(),repr); did = true; - remove(selected.begin(),selected.end(),item); + selected.erase(remove(selected.begin(), selected.end(), item), selected.end()); } continue; @@ -413,7 +413,7 @@ sp_item_list_to_curves(const std::vector &items, std::vector& continue; did = true; - remove(selected.begin(),selected.end(),item); + selected.erase(remove(selected.begin(), selected.end(), item), selected.end()); // remember the position of the item gint pos = item->getRepr()->position(); diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 1e3afc6a8..2cd4f6b4e 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -3922,7 +3922,7 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ for (GSList *i = apply_to_items ; NULL != i ; i = i->next) { reprs_to_group.push_back(static_cast(i->data)->getRepr()); - remove(items_to_select.begin(),items_to_select.end(),static_cast(i->data)); + items_to_select.erase(remove(items_to_select.begin(), items_to_select.end(), static_cast(i->data)), items_to_select.end()); } sp_selection_group_impl(reprs_to_group, group, xml_doc, doc); @@ -3972,7 +3972,7 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ Inkscape::XML::Node *spnew = current->duplicate(xml_doc); gint position = current->position(); - remove(items_to_select.begin(),items_to_select.end(),item); + items_to_select.erase(remove(items_to_select.begin(), items_to_select.end(), item), items_to_select.end()); current->parent()->appendChild(group); sp_repr_unparent(current); group->appendChild(spnew); @@ -3996,7 +3996,7 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ for (GSList *i = items_to_delete; NULL != i; i = i->next) { SPObject *item = reinterpret_cast(i->data); item->deleteObject(false); - remove(items_to_select.begin(),items_to_select.end(),item); + items_to_select.erase(remove(items_to_select.begin(), items_to_select.end(), item), items_to_select.end()); } g_slist_free(items_to_delete); @@ -4121,7 +4121,7 @@ void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) { for (GSList *i = items_to_ungroup ; NULL != i ; i = i->next) { SPGroup *group = dynamic_cast(static_cast(i->data)); if (group) { - remove(items_to_select.begin(),items_to_select.end(),group); + items_to_select.erase(remove(items_to_select.begin(), items_to_select.end(), group), items_to_select.end()); std::vector children; sp_item_group_ungroup(group, children, false); items_to_select.insert(items_to_select.end(),children.rbegin(),children.rend()); diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index 8a9db6c72..10f8c8694 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -674,7 +674,7 @@ void EraserTool::set_to_accumulated() { Inkscape::Rubberband *r = Inkscape::Rubberband::get(desktop); toWorkOn = desktop->getDocument()->getItemsAtPoints(desktop->dkey, r->getPoints()); } - std::remove(toWorkOn.begin(),toWorkOn.end(),acid); + toWorkOn.erase(std::remove(toWorkOn.begin(), toWorkOn.end(), acid), toWorkOn.end()); } else { toWorkOn= selection->itemList(); wasSelection = true; -- cgit v1.2.3 From 0f23d91bdb4d8fca7be0c695e65a10b205fee1fc Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 8 May 2015 02:49:43 +0200 Subject: Fixed the layer blends (bzr r14124) --- src/ui/widget/object-composite-settings.cpp | 4 ++-- src/ui/widget/style-subject.cpp | 24 ++++++++++++------------ src/ui/widget/style-subject.h | 10 +++------- 3 files changed, 17 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/ui/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp index 598a90e95..8acf083d0 100644 --- a/src/ui/widget/object-composite-settings.cpp +++ b/src/ui/widget/object-composite-settings.cpp @@ -125,8 +125,8 @@ ObjectCompositeSettings::_blendBlurValueChanged() const Glib::ustring blendmode = _fe_cb.get_blend_mode(); //apply created filter to every selected item - std::vector sel=_subject->getDesktop()->getSelection()->itemList(); - for (std::vector::const_iterator i = sel.begin() ; i != sel.end() ; ++i ) { + std::vector sel=_subject->list(); + for (std::vector::const_iterator i = sel.begin() ; i != sel.end() ; ++i ) { if (!SP_IS_ITEM(*i)) { continue; } diff --git a/src/ui/widget/style-subject.cpp b/src/ui/widget/style-subject.cpp index 95b89bf5f..da3bbcd20 100644 --- a/src/ui/widget/style-subject.cpp +++ b/src/ui/widget/style-subject.cpp @@ -54,15 +54,13 @@ Inkscape::Selection *StyleSubject::Selection::_getSelection() const { return NULL; } } -/* -StyleSubject::iterator StyleSubject::Selection::begin() { + +std::vector StyleSubject::Selection::list(){ Inkscape::Selection *selection = _getSelection(); - if (selection) { - return iterator(selection->list()); - } else { - return iterator(NULL); - } -}*/ + if(selection) + return selection->list(); + else return std::vector(); +} Geom::OptRect StyleSubject::Selection::getBounds(SPItem::BBoxType type) { Inkscape::Selection *selection = _getSelection(); @@ -133,10 +131,12 @@ SPObject *StyleSubject::CurrentLayer::_getLayerSList() const { return _element; } -/* -StyleSubject::iterator StyleSubject::CurrentLayer::begin() { - return iterator(_getLayerSList()); -}*/ + +std::vector StyleSubject::CurrentLayer::list(){ + std::vector list; + list.push_back(_element); + return list; +} Geom::OptRect StyleSubject::CurrentLayer::getBounds(SPItem::BBoxType type) { SPObject *layer = _getLayer(); diff --git a/src/ui/widget/style-subject.h b/src/ui/widget/style-subject.h index 60f979eb0..15a072f44 100644 --- a/src/ui/widget/style-subject.h +++ b/src/ui/widget/style-subject.h @@ -10,7 +10,6 @@ #ifndef SEEN_INKSCAPE_UI_WIDGET_STYLE_SUBJECT_H #define SEEN_INKSCAPE_UI_WIDGET_STYLE_SUBJECT_H -#include "util/glib-list-iterators.h" #include #include <2geom/rect.h> #include "sp-item.h" @@ -35,8 +34,6 @@ public: class Selection; class CurrentLayer; - //typedef Util::GSListConstIterator iterator; - typedef std::list::iterator iterator; StyleSubject(); virtual ~StyleSubject(); @@ -44,11 +41,10 @@ public: void setDesktop(SPDesktop *desktop); SPDesktop *getDesktop() const { return _desktop; } -// virtual iterator begin() = 0; -// virtual iterator end() { return iterator(NULL); } virtual Geom::OptRect getBounds(SPItem::BBoxType type) = 0; virtual int queryStyle(SPStyle *query, int property) = 0; virtual void setCSS(SPCSSAttr *css) = 0; + virtual std::vector list(){return std::vector();}; sigc::connection connectChanged(sigc::signal::slot_type slot) { return _changed_signal.connect(slot); @@ -68,10 +64,10 @@ public: Selection(); ~Selection(); -// virtual iterator begin(); virtual Geom::OptRect getBounds(SPItem::BBoxType type); virtual int queryStyle(SPStyle *query, int property); virtual void setCSS(SPCSSAttr *css); + virtual std::vector list(); protected: virtual void _afterDesktopSwitch(SPDesktop *desktop); @@ -89,10 +85,10 @@ public: CurrentLayer(); ~CurrentLayer(); -// virtual iterator begin(); virtual Geom::OptRect getBounds(SPItem::BBoxType type); virtual int queryStyle(SPStyle *query, int property); virtual void setCSS(SPCSSAttr *css); + virtual std::vector list(); protected: virtual void _afterDesktopSwitch(SPDesktop *desktop); -- cgit v1.2.3 From 9102ee49b968e55e93a7f6ccfb563c8571bf458c Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 8 May 2015 03:22:12 +0200 Subject: forgotten dynamic cast (bzr r14125) --- src/extension/internal/latex-text-renderer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp index ab863f8b1..1026f51ad 100644 --- a/src/extension/internal/latex-text-renderer.cpp +++ b/src/extension/internal/latex-text-renderer.cpp @@ -230,7 +230,7 @@ void LaTeXTextRenderer::sp_group_render(SPGroup *group) { std::vector l = (group->childList(false)); for(std::vector::const_iterator x = l.begin(); x != l.end(); x++){ - SPItem *item = static_cast(*x); + SPItem *item = dynamic_cast(*x); if (item) { renderItem(item); } -- cgit v1.2.3 From 48e0423afcb02fe4a0f705d828a0dbdb3106b397 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 8 May 2015 15:46:25 +0200 Subject: fixes a few of jenkins warnings (bzr r14126) --- src/desktop.cpp | 1 - src/display/canvas-arena.cpp | 2 +- src/document.cpp | 2 +- src/extension/implementation/script.cpp | 16 ++++++++++------ src/extension/internal/cairo-render-context.cpp | 1 + src/extension/internal/wmf-inout.cpp | 6 ++---- src/file.cpp | 6 +++--- src/gradient-drag.cpp | 2 +- src/helper-fns.h | 2 +- src/helper/geom.cpp | 9 ++------- src/inkview.cpp | 2 +- src/libavoid/connector.cpp | 6 +----- src/libavoid/graph.cpp | 4 +++- src/libavoid/orthogonal.cpp | 1 - src/live_effects/lpe-gears.cpp | 2 +- src/live_effects/lpe-taperstroke.cpp | 4 ---- src/live_effects/parameter/filletchamferpointarray.cpp | 1 - src/selection.cpp | 3 ++- src/sp-item-transform.cpp | 6 +++--- src/trace/siox.cpp | 2 +- src/ui/dialog/document-properties.cpp | 4 ++-- src/ui/dialog/floating-behavior.cpp | 2 +- src/ui/dialog/grid-arrange-tab.cpp | 1 - src/ui/dialog/icon-preview.cpp | 2 +- src/ui/interface.cpp | 2 +- src/ui/tools/box3d-tool.cpp | 2 +- src/ui/tools/flood-tool.cpp | 2 +- src/ui/tools/pen-tool.cpp | 15 ++++----------- src/ui/tools/pencil-tool.cpp | 3 --- src/ui/tools/rect-tool.cpp | 1 - src/ui/tools/select-tool.cpp | 1 - src/util/ziptool.cpp | 2 +- src/widgets/desktop-widget.cpp | 4 +++- src/widgets/ege-adjustment-action.cpp | 2 +- src/widgets/gradient-vector.cpp | 1 + 35 files changed, 51 insertions(+), 71 deletions(-) (limited to 'src') diff --git a/src/desktop.cpp b/src/desktop.cpp index 5a1558b0f..02df50c6b 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -947,7 +947,6 @@ void SPDesktop::zoom_quick(bool enable) if (!zoomed) { zoom_relative(_quick_zoom_stored_area.midpoint()[Geom::X], _quick_zoom_stored_area.midpoint()[Geom::Y], 2.0); - zoomed = true; } } else { set_display_area(_quick_zoom_stored_area, false); diff --git a/src/display/canvas-arena.cpp b/src/display/canvas-arena.cpp index 8738b93e4..ec99eca9a 100644 --- a/src/display/canvas-arena.cpp +++ b/src/display/canvas-arena.cpp @@ -290,7 +290,7 @@ sp_canvas_arena_event (SPCanvasItem *item, GdkEvent *event) ret = sp_canvas_arena_send_event (arena, (GdkEvent *) &ec); } } - ret = sp_canvas_arena_send_event (arena, event); + ret = ret || sp_canvas_arena_send_event (arena, event); break; case GDK_SCROLL: { diff --git a/src/document.cpp b/src/document.cpp index f06953e34..741e7c812 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -1591,7 +1591,7 @@ static void vacuum_document_recursive(SPObject *obj) unsigned int SPDocument::vacuumDocument() { unsigned int start = objects_in_document(this); - unsigned int end = start; + unsigned int end; unsigned int newend = start; unsigned int iterations = 0; diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index 5cab3a2b2..e07a3963c 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -812,6 +812,12 @@ void Script::copy_doc (Inkscape::XML::Node * oldroot, Inkscape::XML::Node * newr } } + if(!oldroot_namedview) + { + g_warning("Error on copy_doc: No namedview on destination document."); + return; + } + // Unparent (delete) for (unsigned int i = 0; i < delete_list.size(); i++) { sp_repr_unparent(delete_list[i]); @@ -823,12 +829,10 @@ void Script::copy_doc (Inkscape::XML::Node * oldroot, Inkscape::XML::Node * newr child = child->next()) { if (!strcmp("sodipodi:namedview", child->name())) { newroot_namedview = child; - if (oldroot_namedview != NULL) { - for (Inkscape::XML::Node * newroot_namedview_child = child->firstChild(); - newroot_namedview_child != NULL; - newroot_namedview_child = newroot_namedview_child->next()) { - oldroot_namedview->appendChild(newroot_namedview_child->duplicate(oldroot->document())); - } + for (Inkscape::XML::Node * newroot_namedview_child = child->firstChild(); + newroot_namedview_child != NULL; + newroot_namedview_child = newroot_namedview_child->next()) { + oldroot_namedview->appendChild(newroot_namedview_child->duplicate(oldroot->document())); } } else { oldroot->appendChild(child->duplicate(oldroot->document())); diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 2d6619e1e..27e34dbcf 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -1393,6 +1393,7 @@ CairoRenderContext::_setStrokeStyle(SPStyle const *style, Geom::OptRect const &p dashes[i] = style->stroke_dasharray.values[i]; } cairo_set_dash(_cr, dashes, ndashes, style->stroke_dashoffset.value); + free(dashes); } else { cairo_set_dash(_cr, NULL, 0, 0.0); // disable dashing } diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp index 3ab7a4e89..f76fa16b4 100644 --- a/src/extension/internal/wmf-inout.cpp +++ b/src/extension/internal/wmf-inout.cpp @@ -95,7 +95,6 @@ Wmf::print_document_to_file(SPDocument *doc, const gchar *filename) SPPrintContext context; const gchar *oldconst; gchar *oldoutput; - unsigned int ret; doc->ensureUpToDate(); @@ -114,13 +113,12 @@ Wmf::print_document_to_file(SPDocument *doc, const gchar *filename) mod->root = mod->base->invoke_show(drawing, mod->dkey, SP_ITEM_SHOW_DISPLAY); drawing.setRoot(mod->root); /* Print document */ - ret = mod->begin(doc); - if (ret) { + if (mod->begin(doc)) { g_free(oldoutput); throw Inkscape::Extension::Output::save_failed(); } mod->base->invoke_print(&context); - ret = mod->finish(); + mod->finish(); /* Release arena */ mod->base->invoke_hide(mod->dkey); mod->base = NULL; diff --git a/src/file.cpp b/src/file.cpp index d1dd2bcd6..984bf7e08 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -769,7 +769,7 @@ file_save_remote(SPDocument */*doc*/, return false; } - result = gnome_vfs_create (&to_handle, uri_local, GNOME_VFS_OPEN_WRITE, FALSE, GNOME_VFS_PERM_USER_ALL); + gnome_vfs_create (&to_handle, uri_local, GNOME_VFS_OPEN_WRITE, FALSE, GNOME_VFS_PERM_USER_ALL); result = gnome_vfs_open (&to_handle, uri_local, GNOME_VFS_OPEN_WRITE); if (result != GNOME_VFS_OK) { @@ -782,8 +782,8 @@ file_save_remote(SPDocument */*doc*/, result = gnome_vfs_read (from_handle, buffer, 8192, &bytes_read); if ((result == GNOME_VFS_ERROR_EOF) &&(!bytes_read)){ - result = gnome_vfs_close (from_handle); - result = gnome_vfs_close (to_handle); + gnome_vfs_close (from_handle); + gnome_vfs_close (to_handle); return true; } diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index 169710114..b22714959 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -1155,7 +1155,7 @@ static void gr_knot_clicked_handler(SPKnot */*knot*/, guint state, gpointer data break; default: - break; + return; } diff --git a/src/helper-fns.h b/src/helper-fns.h index 2f1829c37..79771a001 100644 --- a/src/helper-fns.h +++ b/src/helper-fns.h @@ -78,7 +78,7 @@ inline std::vector helperfns_read_vector(const gchar* value){ g_warning("helper-fns::helperfns_read_vector() Unable to convert \"%s\" to number", beg); // We could leave this out, too. If strtod can't convert // anything, it will return zero. - ret = 0; + // ret = 0; break; } v.push_back(ret); diff --git a/src/helper/geom.cpp b/src/helper/geom.cpp index 91689375f..77cba4736 100644 --- a/src/helper/geom.cpp +++ b/src/helper/geom.cpp @@ -266,14 +266,13 @@ geom_cubic_bbox_wind_distance (Geom::Coord x000, Geom::Coord y000, Geom::Coord tolerance) { Geom::Coord x0, y0, x1, y1, len2; - int needdist, needwind, needline; + int needdist, needwind; const Geom::Coord Px = pt[X]; const Geom::Coord Py = pt[Y]; needdist = 0; needwind = 0; - needline = 0; if (bbox) cubic_bbox (x000, y000, x001, y001, x011, y011, x111, y111, *bbox); @@ -303,8 +302,6 @@ geom_cubic_bbox_wind_distance (Geom::Coord x000, Geom::Coord y000, /* fixme: (Lauris) */ if (((y1 - y0) > 5.0) || ((x1 - x0) > 5.0)) { needdist = 1; - } else { - needline = 1; } } } @@ -315,8 +312,6 @@ geom_cubic_bbox_wind_distance (Geom::Coord x000, Geom::Coord y000, /* fixme: (Lauris) */ if (((y1 - y0) > 5.0) || ((x1 - x0) > 5.0)) { needwind = 1; - } else { - needline = 1; } } } @@ -345,7 +340,7 @@ geom_cubic_bbox_wind_distance (Geom::Coord x000, Geom::Coord y000, geom_cubic_bbox_wind_distance (x000, y000, x00t, y00t, x0tt, y0tt, xttt, yttt, pt, NULL, wind, best, tolerance); geom_cubic_bbox_wind_distance (xttt, yttt, x1tt, y1tt, x11t, y11t, x111, y111, pt, NULL, wind, best, tolerance); - } else if (1 || needline) { + } else { geom_line_wind_distance (x000, y000, x111, y111, pt, wind, best); } } diff --git a/src/inkview.cpp b/src/inkview.cpp index 2c667237e..8b7492798 100644 --- a/src/inkview.cpp +++ b/src/inkview.cpp @@ -274,7 +274,7 @@ main (int argc, const char **argv) gchar *last_filename = jar_file_reader.get_last_filename(); if (ss.doc) { ss.slides[ss.length++] = strdup (last_filename); - (ss.doc)->setUri (strdup(last_filename)); + (ss.doc)->setUri (last_filename); } g_byte_array_free(gba, TRUE); g_free(last_filename); diff --git a/src/libavoid/connector.cpp b/src/libavoid/connector.cpp index 40ded7498..36892c668 100644 --- a/src/libavoid/connector.cpp +++ b/src/libavoid/connector.cpp @@ -1476,7 +1476,6 @@ CrossingsInfoPair countRealCrossings(Avoid::Polygon& poly, int prevTurnDir = -1; int startCornerSide = 1; int endCornerSide = 1; - bool reversed = false; if (!front_same) { // If there is a divergence at the beginning, @@ -1485,7 +1484,6 @@ CrossingsInfoPair countRealCrossings(Avoid::Polygon& poly, startCornerSide = Avoid::cornerSide(*c_path[0], *c_path[1], *c_path[2], *p_path[0]) * segDir(*c_path[1], *c_path[2]); - reversed = (startCornerSide != -prevTurnDir); } if (!back_same) { @@ -1497,7 +1495,6 @@ CrossingsInfoPair countRealCrossings(Avoid::Polygon& poly, *c_path[size - 2], *c_path[size - 1], *p_path[size - 1]) * segDir(*c_path[size - 3], *c_path[size - 2]); - reversed = (endCornerSide != -prevTurnDir); } else { @@ -1578,10 +1575,9 @@ CrossingsInfoPair countRealCrossings(Avoid::Polygon& poly, } } #endif - prevTurnDir = 0; if (pointOrders) { - reversed = false; + bool reversed = false; size_t startPt = (front_same) ? 0 : 1; // Orthogonal should always have at least one segment. diff --git a/src/libavoid/graph.cpp b/src/libavoid/graph.cpp index 728f8c085..5b617f123 100644 --- a/src/libavoid/graph.cpp +++ b/src/libavoid/graph.cpp @@ -129,7 +129,9 @@ static inline int orthogTurnOrder(const Point& a, const Point& b, // Note: This method assumes the two Edges that share a common point. bool EdgeInf::rotationLessThan(const VertInf *lastV, const EdgeInf *rhs) const { - if ((_v1 == rhs->_v1) && (_v2 == rhs->_v2)) + assert(_v1 == rhs->_v1 || _v1 == rhs->_v2 || _v2 == rhs->_v1 || _v2 == rhs->_v2 ); + + if ((_v1 == rhs->_v1) && (_v2 == rhs->_v2)) { // Effectively the same visibility edge, so they are equal. return false; diff --git a/src/libavoid/orthogonal.cpp b/src/libavoid/orthogonal.cpp index b5ef8d7e8..466d1dd58 100644 --- a/src/libavoid/orthogonal.cpp +++ b/src/libavoid/orthogonal.cpp @@ -1548,7 +1548,6 @@ extern void generateStaticOrthogonalVisGraph(Router *router) // Process the horizontal sweep thisPos = (totalEvents > 0) ? events[0]->pos : 0; posStartIndex = 0; - posFinishIndex = 0; for (unsigned i = 0; i <= totalEvents; ++i) { // If we have finished the current scanline or all events, then we diff --git a/src/live_effects/lpe-gears.cpp b/src/live_effects/lpe-gears.cpp index 003e22567..fafe143b5 100644 --- a/src/live_effects/lpe-gears.cpp +++ b/src/live_effects/lpe-gears.cpp @@ -168,7 +168,7 @@ Geom::Path Gear::path() { D2 root = _arc(cursor, cursor+root_advance, root_radius()); makeContinuous(root, prev); pb.append(SBasisCurve(root)); - cursor += root_advance; + //cursor += root_advance; prev = root.at1(); if (base_radius() > root_radius()) { diff --git a/src/live_effects/lpe-taperstroke.cpp b/src/live_effects/lpe-taperstroke.cpp index 2c74af6d6..451810d04 100644 --- a/src/live_effects/lpe-taperstroke.cpp +++ b/src/live_effects/lpe-taperstroke.cpp @@ -389,13 +389,9 @@ Piecewise > stretch_along(Piecewise > pwd2_in, Geom::Path x0 -= pattBndsX->min(); y0 -= pattBndsY->middle(); - double xspace = 0; double noffset = 0; double toffset = 0; // Prevent more than 90% overlap... - if (xspace < -pattBndsX->extent()*.9) { - xspace = -pattBndsX->extent()*.9; - } y0+=noffset; diff --git a/src/live_effects/parameter/filletchamferpointarray.cpp b/src/live_effects/parameter/filletchamferpointarray.cpp index e9d375b93..f05f401e4 100644 --- a/src/live_effects/parameter/filletchamferpointarray.cpp +++ b/src/live_effects/parameter/filletchamferpointarray.cpp @@ -506,7 +506,6 @@ std::vector FilletChamferPointArrayParam::get_times(int index, std::vect time_it1 = 0; } double resultLenght = 0; - time_it1_B = 1; if (subpaths[positions.first].closed() && last) { time_it2 = modf(to_time(index - positions.second , _vector[index - positions.second ][X]), &intpart); resultLenght = it1_length + to_len(index - positions.second, _vector[index - positions.second ][X]); diff --git a/src/selection.cpp b/src/selection.cpp index f728f3381..7979b5d61 100644 --- a/src/selection.cpp +++ b/src/selection.cpp @@ -178,6 +178,7 @@ void Selection::_add(SPObject *obj) { // (to prevent double-selection) _removeObjectDescendants(obj); _removeObjectAncestors(obj); + g_return_if_fail(SP_IS_OBJECT(obj)); _objs.push_front(obj); _objs_set.insert(obj); @@ -483,7 +484,7 @@ std::vector Selection::getSnapPoints(SnapPreferenc void Selection::_removeObjectDescendants(SPObject *obj) { std::vector toremove; for ( std::list::const_iterator iter=_objs.begin();iter!=_objs.end();iter++ ) { - SPObject *sel_obj= *iter; + SPObject *sel_obj= dynamic_cast(*iter); SPObject *parent = sel_obj->parent; while (parent) { if ( parent == obj ) { diff --git a/src/sp-item-transform.cpp b/src/sp-item-transform.cpp index 767f0ed91..f1c69cdf6 100644 --- a/src/sp-item-transform.cpp +++ b/src/sp-item-transform.cpp @@ -152,7 +152,7 @@ Geom::Affine get_scale_transform_for_uniform_stroke(Geom::Rect const &bbox_visua gdouble scale_x = 1; gdouble scale_y = 1; - gdouble r1 = r0; + gdouble r1; if ((fabs(w0 - stroke_x) < 1e-6) || w1 == 0) { // We have a vertical line at hand scale_y = h1/h0; @@ -310,8 +310,8 @@ Geom::Affine get_scale_transform_for_variable_stroke(Geom::Rect const &bbox_visu gdouble scale_x = 1; gdouble scale_y = 1; - gdouble r1h = r0h; - gdouble r1w = r0w; + gdouble r1h; + gdouble r1w; if ((fabs(w0 - r0w) < 1e-6) || w1 == 0) { // We have a vertical line at hand scale_y = h1/h0; diff --git a/src/trace/siox.cpp b/src/trace/siox.cpp index 065e891ed..9df4e561c 100644 --- a/src/trace/siox.cpp +++ b/src/trace/siox.cpp @@ -682,7 +682,7 @@ GdkPixbuf *SioxImage::getGdkPixbuf() } row += rowstride; } - + free(pixdata); return buf; } diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index c381ed755..b04e8ecc1 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -1672,10 +1672,10 @@ void DocumentProperties::onDocUnitChange() Inkscape::XML::Node *repr = getDesktop()->getNamedView()->getRepr(); - Inkscape::Util::Unit const *old_doc_unit = unit_table.getUnit("px"); + /*Inkscape::Util::Unit const *old_doc_unit = unit_table.getUnit("px"); if(repr->attribute("inkscape:document-units")) { old_doc_unit = unit_table.getUnit(repr->attribute("inkscape:document-units")); - } + }*/ Inkscape::Util::Unit const *doc_unit = _rum_deflt.getUnit(); // Set document unit diff --git a/src/ui/dialog/floating-behavior.cpp b/src/ui/dialog/floating-behavior.cpp index 740acd989..55ef0c5bb 100644 --- a/src/ui/dialog/floating-behavior.cpp +++ b/src/ui/dialog/floating-behavior.cpp @@ -112,7 +112,7 @@ bool FloatingBehavior::_trans_timer (void) { } float goal, current; - goal = current = _d->get_opacity(); + current = _d->get_opacity(); if (_dialog_active.get_value()) { goal = _trans_focus; diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp index 4465d73a9..c44f66a4d 100644 --- a/src/ui/dialog/grid-arrange-tab.cpp +++ b/src/ui/dialog/grid-arrange-tab.cpp @@ -170,7 +170,6 @@ void GridArrangeTab::arrange() Inkscape::Selection *selection = desktop->getSelection(); const std::vector items = selection ? selection->itemList() : std::vector(); - cnt=0; for(std::vector::const_iterator i = items.begin();i!=items.end();i++){ SPItem *item = *i; Geom::OptRect b = item->documentVisualBounds(); diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp index 7dc55c95c..77f120e1a 100644 --- a/src/ui/dialog/icon-preview.cpp +++ b/src/ui/dialog/icon-preview.cpp @@ -312,7 +312,7 @@ void IconPreviewPanel::setDesktop( SPDesktop* desktop ) if ( this->desktop ) { docReplacedConn = this->desktop->connectDocumentReplaced(sigc::hide<0>(sigc::mem_fun(this, &IconPreviewPanel::setDocument))); if ( this->desktop->selection && Inkscape::Preferences::get()->getBool("/iconpreview/autoRefresh", true) ) { - selChangedConn = desktop->selection->connectChanged(sigc::hide(sigc::mem_fun(this, &IconPreviewPanel::queueRefresh))); + selChangedConn = this->desktop->selection->connectChanged(sigc::hide(sigc::mem_fun(this, &IconPreviewPanel::queueRefresh))); } } } diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index 760d19e89..a129d4b92 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -439,7 +439,7 @@ sp_ui_dialog_title_string(Inkscape::Verb *verb, gchar *c) gchar* key = sp_shortcut_get_label(shortcut); s = g_stpcpy(s, " ("); s = g_stpcpy(s, key); - s = g_stpcpy(s, ")"); + g_stpcpy(s, ")"); g_free(key); } } diff --git a/src/ui/tools/box3d-tool.cpp b/src/ui/tools/box3d-tool.cpp index 538e0c7e2..27e755add 100644 --- a/src/ui/tools/box3d-tool.cpp +++ b/src/ui/tools/box3d-tool.cpp @@ -165,7 +165,7 @@ bool Box3dTool::item_handler(SPItem* item, GdkEvent* event) { case GDK_BUTTON_PRESS: if ( event->button.button == 1 && !this->space_panning) { Inkscape::setup_for_drag_start(desktop, this, event); - ret = TRUE; + //ret = TRUE; } break; // motion and release are always on root (why?) diff --git a/src/ui/tools/flood-tool.cpp b/src/ui/tools/flood-tool.cpp index ffd41d97d..748c82717 100644 --- a/src/ui/tools/flood-tool.cpp +++ b/src/ui/tools/flood-tool.cpp @@ -932,7 +932,7 @@ static void sp_flood_do_flood_fill(ToolBase *event_context, GdkEvent *event, boo std::deque::iterator start_sort = fill_queue.begin(); std::deque::iterator end_sort = fill_queue.begin(); unsigned int sort_y = (unsigned int)cp[Geom::Y]; - unsigned int current_y = sort_y; + unsigned int current_y; for (std::deque::iterator i = fill_queue.begin(); i != fill_queue.end(); ++i) { Geom::Point current = *i; diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index daffc7032..be6156fa2 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -762,14 +762,12 @@ bool PenTool::_handleButtonRelease(GdkEventButton const &revent) { } } this->state = PenTool::CONTROL; - ret = true; break; case PenTool::CONTROL: // End current segment this->_endpointSnap(p, revent.state); this->_finishSegment(p, revent.state); this->state = PenTool::POINT; - ret = true; break; case PenTool::CLOSE: // End current segment @@ -783,12 +781,10 @@ bool PenTool::_handleButtonRelease(GdkEventButton const &revent) { } this->_finish(true); this->state = PenTool::POINT; - ret = true; break; case PenTool::STOP: // This is allowed, if we just canceled curve this->state = PenTool::POINT; - ret = true; break; default: break; @@ -823,7 +819,6 @@ bool PenTool::_handleButtonRelease(GdkEventButton const &revent) { break; } this->state = PenTool::POINT; - ret = true; break; default: break; @@ -1432,8 +1427,7 @@ void PenTool::_bsplineSpiroStartAnchorOn() { using Geom::X; using Geom::Y; - SPCurve *tmp_curve = new SPCurve(); - tmp_curve = this->sa->curve->copy(); + SPCurve *tmp_curve = this->sa->curve->copy(); if(this->sa->start) tmp_curve = tmp_curve ->create_reverse(); Geom::CubicBezier const * cubic = dynamic_cast(&*tmp_curve ->last_segment()); @@ -1465,8 +1459,7 @@ void PenTool::_bsplineSpiroStartAnchorOn() void PenTool::_bsplineSpiroStartAnchorOff() { - SPCurve *tmp_curve = new SPCurve(); - tmp_curve = this->sa->curve->copy(); + SPCurve *tmp_curve = this->sa->curve->copy(); if(this->sa->start) tmp_curve = tmp_curve ->create_reverse(); Geom::CubicBezier const * cubic = dynamic_cast(&*tmp_curve ->last_segment()); @@ -1564,7 +1557,7 @@ void PenTool::_bsplineSpiroEndAnchorOn() using Geom::Y; this->p[2] = this->p[3] + (1./3)*(this->p[0] - this->p[3]); this->p[2] = Geom::Point(this->p[2][X] + HANDLE_CUBIC_GAP,this->p[2][Y] + HANDLE_CUBIC_GAP); - SPCurve *tmp_curve = new SPCurve(); + SPCurve *tmp_curve; SPCurve *last_segment = new SPCurve(); Geom::Point point_c(0,0); bool reverse = false; @@ -1621,7 +1614,7 @@ void PenTool::_bsplineSpiroEndAnchorOn() void PenTool::_bsplineSpiroEndAnchorOff() { - SPCurve *tmp_curve = new SPCurve(); + SPCurve *tmp_curve; SPCurve *last_segment = new SPCurve(); bool reverse = false; this->p[2] = this->p[3]; diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp index 008804162..ba103fa8e 100644 --- a/src/ui/tools/pencil-tool.cpp +++ b/src/ui/tools/pencil-tool.cpp @@ -357,7 +357,6 @@ bool PencilTool::_handleButtonRelease(GdkEventButton const &revent) { // Ctrl+click creates a single point so only set context in ADDLINE mode when Ctrl isn't pressed this->state = SP_PENCIL_CONTEXT_ADDLINE; } - ret = true; break; case SP_PENCIL_CONTEXT_ADDLINE: /* Finish segment now */ @@ -371,7 +370,6 @@ bool PencilTool::_handleButtonRelease(GdkEventButton const &revent) { this->_finishEndpoint(); this->state = SP_PENCIL_CONTEXT_IDLE; sp_event_context_discard_delayed_snap_event(this); - ret = true; break; case SP_PENCIL_CONTEXT_FREEHAND: if (revent.state & GDK_MOD1_MASK) { @@ -413,7 +411,6 @@ bool PencilTool::_handleButtonRelease(GdkEventButton const &revent) { // reset sketch mode too this->sketch_n = 0; } - ret = true; break; case SP_PENCIL_CONTEXT_SKETCH: default: diff --git a/src/ui/tools/rect-tool.cpp b/src/ui/tools/rect-tool.cpp index 62a9006ea..844965c4d 100644 --- a/src/ui/tools/rect-tool.cpp +++ b/src/ui/tools/rect-tool.cpp @@ -143,7 +143,6 @@ bool RectTool::item_handler(SPItem* item, GdkEvent* event) { case GDK_BUTTON_PRESS: if ( event->button.button == 1 && !this->space_panning) { Inkscape::setup_for_drag_start(desktop, this, event); - ret = TRUE; } break; // motion and release are always on root (why?) diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index f8375a1bb..f06b03d91 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -777,7 +777,6 @@ bool SelectTool::root_handler(GdkEvent* event) { } rb_escaped = 0; - ret = TRUE; } } } diff --git a/src/util/ziptool.cpp b/src/util/ziptool.cpp index cf024008f..2eb516b2e 100644 --- a/src/util/ziptool.cpp +++ b/src/util/ziptool.cpp @@ -2605,7 +2605,7 @@ bool ZipFile::readFileData() if (gpBitFlag & 0x8)//bit 3 was set. means we dont know compressed size { unsigned char c1, c2, c3, c4; - c1 = c2 = c3 = c4 = 0; + c2 = c3 = c4 = 0; while (true) { unsigned char ch; diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index fd3756220..e19f56e48 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -1433,8 +1433,10 @@ sp_desktop_widget_maximize(SPDesktopWidget *dtw) if (!dtw->desktop->is_iconified() && !dtw->desktop->is_fullscreen()) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - gint w, h, x, y; + gint w = -1; + gint h, x, y; dtw->getWindowGeometry(x, y, w, h); + g_assert(w != -1); prefs->setInt("/desktop/geometry/width", w); prefs->setInt("/desktop/geometry/height", h); prefs->setInt("/desktop/geometry/x", x); diff --git a/src/widgets/ege-adjustment-action.cpp b/src/widgets/ege-adjustment-action.cpp index d89a6e3f1..a91149f4c 100644 --- a/src/widgets/ege-adjustment-action.cpp +++ b/src/widgets/ege-adjustment-action.cpp @@ -742,7 +742,7 @@ static GtkWidget* create_popup_number_menu( EgeAdjustmentAction* act ) if ( act->private_data->descriptions ) { gdouble value = ((EgeAdjustmentDescr*)act->private_data->descriptions->data)->value; - addOns = flush_explicit_items( addOns, G_CALLBACK(process_menu_action), BUMP_CUSTOM, menu, act, &single, &group, value ); + flush_explicit_items( addOns, G_CALLBACK(process_menu_action), BUMP_CUSTOM, menu, act, &single, &group, value ); } return menu; diff --git a/src/widgets/gradient-vector.cpp b/src/widgets/gradient-vector.cpp index d2c46ffec..10d1cc107 100644 --- a/src/widgets/gradient-vector.cpp +++ b/src/widgets/gradient-vector.cpp @@ -548,6 +548,7 @@ static void verify_grad(SPGradient *gradient) child->setAttribute("style", os.str().c_str()); gradient->getRepr()->addChild(child, NULL); Inkscape::GC::release(child); + return; } if (i < 2) { sp_repr_set_css_double(stop->getRepr(), "offset", 0.0); -- cgit v1.2.3 From 72d3556428cd68013cb604a708f27d3de0f60855 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 8 May 2015 17:19:23 +0200 Subject: fix for bug 1391374. apparently, libnrtype drastically misses unit tests. Fixed bugs: - https://launchpad.net/bugs/1391374 (bzr r14127) --- src/libnrtype/Layout-TNG-OutIter.cpp | 4 ++-- src/libnrtype/Layout-TNG.h | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/libnrtype/Layout-TNG-OutIter.cpp b/src/libnrtype/Layout-TNG-OutIter.cpp index c9c318960..707897f50 100644 --- a/src/libnrtype/Layout-TNG-OutIter.cpp +++ b/src/libnrtype/Layout-TNG-OutIter.cpp @@ -788,12 +788,12 @@ bool Layout::iterator::prevLineCursor(int n) { if (!_cursor_moving_vertically) beginCursorUpDown(); - unsigned line_index; + int line_index; if (_char_index == _parent_layout->_characters.size()) line_index = _parent_layout->_lines.size() - 1; else line_index = _parent_layout->_characters[_char_index].chunk(_parent_layout).in_line; - if (line_index == 0) + if (line_index <= 0) return false; // nowhere to go else n = MIN (n, static_cast(line_index)); diff --git a/src/libnrtype/Layout-TNG.h b/src/libnrtype/Layout-TNG.h index e91c32ebe..26db1fad9 100644 --- a/src/libnrtype/Layout-TNG.h +++ b/src/libnrtype/Layout-TNG.h @@ -701,7 +701,11 @@ private: /** The overall block-progression of the whole flow. */ inline Direction _blockProgression() const - {return static_cast(_input_stream.front())->styleGetBlockProgression();} + { + if(!_input_stream.empty()) + return static_cast(_input_stream.front())->styleGetBlockProgression(); + return TOP_TO_BOTTOM; + } /** so that LEFT_TO_RIGHT == RIGHT_TO_LEFT but != TOP_TO_BOTTOM */ static bool _directions_are_orthogonal(Direction d1, Direction d2); -- cgit v1.2.3 From 1caee668eff9e8afe58a7592eb78908c96b530ba Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 8 May 2015 19:16:19 +0200 Subject: fix for bug 168013 and its mask counterpart Fixed bugs: - https://launchpad.net/bugs/168013 (bzr r14129) --- src/sp-use.cpp | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/sp-use.cpp b/src/sp-use.cpp index 239f487a4..c8a0830c1 100644 --- a/src/sp-use.cpp +++ b/src/sp-use.cpp @@ -22,6 +22,8 @@ #include "display/drawing-group.h" #include "attributes.h" #include "document.h" +#include "sp-clippath.h" +#include "sp-mask.h" #include "sp-factory.h" #include "sp-flowregion.h" #include "uri.h" @@ -426,16 +428,43 @@ void SPUse::move_compensate(Geom::Affine const *mp) { return; Geom::Affine m(*mp); + Geom::Affine t = this->get_parent_transform(); + Geom::Affine clone_move = t.inverse() * m * t; // this is not a simple move, do not try to compensate - if (!(m.isTranslation())) + if (!(m.isTranslation())){ + //BUT move clippaths accordingly. + //if clone has a clippath, move it accordingly + if(clip_ref->getObject()){ + SPObject *clip = clip_ref->getObject()->firstChild() ; + while(clip){ + SPItem *item = (SPItem*) clip; + if(item){ + item->transform *= m; + Geom::Affine identity; + item->doWriteTransform(clip->getRepr(),item->transform, &identity); + } + clip = clip->getNext(); + } + } + if(mask_ref->getObject()){ + SPObject *mask = mask_ref->getObject()->firstChild() ; + while(mask){ + SPItem *item = (SPItem*) mask; + if(item){ + item->transform *= m; + Geom::Affine identity; + item->doWriteTransform(mask->getRepr(),item->transform, &identity); + } + mask = mask->getNext(); + } + } return; + } // restore item->transform field from the repr, in case it was changed by seltrans this->readAttr ("transform"); - Geom::Affine t = this->get_parent_transform(); - Geom::Affine clone_move = t.inverse() * m * t; // calculate the compensation matrix and the advertized movement matrix Geom::Affine advertized_move; @@ -449,6 +478,33 @@ void SPUse::move_compensate(Geom::Affine const *mp) { g_assert_not_reached(); } + //if clone has a clippath, move it accordingly + if(clip_ref->getObject()){ + SPObject *clip = clip_ref->getObject()->firstChild() ; + while(clip){ + SPItem *item = (SPItem*) clip; + if(item){ + item->transform *= clone_move.inverse(); + Geom::Affine identity; + item->doWriteTransform(clip->getRepr(),item->transform, &identity); + } + clip = clip->getNext(); + } + } + if(mask_ref->getObject()){ + SPObject *mask = mask_ref->getObject()->firstChild() ; + while(mask){ + SPItem *item = (SPItem*) mask; + if(item){ + item->transform *= clone_move.inverse(); + Geom::Affine identity; + item->doWriteTransform(mask->getRepr(),item->transform, &identity); + } + mask = mask->getNext(); + } + } + + // commit the compensation this->transform *= clone_move; this->doWriteTransform(this->getRepr(), this->transform, &advertized_move); -- cgit v1.2.3 From 76268cdf97916d0de571586ff1111b90c1a65286 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Sat, 9 May 2015 00:04:46 +0200 Subject: fixes various bugs with clipping and masking Fixed bugs: - https://launchpad.net/bugs/569281 - https://launchpad.net/bugs/1319171 - https://launchpad.net/bugs/1177650 (bzr r14130) --- src/selection-chemistry.cpp | 34 ++++++++++++++++------------------ src/sp-clippath.cpp | 3 +-- src/sp-mask.cpp | 3 +-- 3 files changed, 18 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 2cd4f6b4e..f72bd1259 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -3893,14 +3893,17 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ items_to_select.push_back(*i); } } else { - SPItem *i = NULL; - for (std::vector::const_iterator j=items.begin();j!=items.end();j++) { - i=*j; + SPItem *i = items.front(); + for (std::vector::const_iterator j=items.begin();(j+1)!=items.end();j++) { apply_to_items = g_slist_prepend(apply_to_items, i); items_to_select.push_back(i); + i=*(j+1); } - + Geom::Affine oldtr=i->transform; + i->doWriteTransform(i->getRepr(), i->i2doc_affine()); Inkscape::XML::Node *dup = SP_OBJECT(i)->getRepr()->duplicate(xml_doc); + i->doWriteTransform(i->getRepr(), oldtr); + mask_items = g_slist_prepend(mask_items, dup); if (remove_original) { @@ -3922,8 +3925,9 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ for (GSList *i = apply_to_items ; NULL != i ; i = i->next) { reprs_to_group.push_back(static_cast(i->data)->getRepr()); - items_to_select.erase(remove(items_to_select.begin(), items_to_select.end(), static_cast(i->data)), items_to_select.end()); + //items_to_select.erase(remove(items_to_select.begin(), items_to_select.end(), static_cast(i->data)), items_to_select.end()); } + items_to_select.clear(); sp_selection_group_impl(reprs_to_group, group, xml_doc, doc); @@ -3936,30 +3940,25 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ Inkscape::GC::release(group); } + if (grouping == PREFS_MASKOBJECT_GROUPING_SEPARATE) { + items_to_select.clear(); + } + gchar const *attributeName = apply_clip_path ? "clip-path" : "mask"; for (GSList *i = apply_to_items; NULL != i; i = i->next) { SPItem *item = reinterpret_cast(i->data); // inverted object transform should be applied to a mask object, // as mask is calculated in user space (after applying transform) - Geom::Affine maskTransform(item->transform.inverse()); - - GSList *mask_items_dup = NULL; - for (GSList *mask_item = mask_items; NULL != mask_item; mask_item = mask_item->next) { - Inkscape::XML::Node *dup = reinterpret_cast(mask_item->data)->duplicate(xml_doc); - mask_items_dup = g_slist_prepend(mask_items_dup, dup); - } + Geom::Affine maskTransform(item->i2doc_affine().inverse()); gchar const *mask_id = NULL; if (apply_clip_path) { - mask_id = SPClipPath::create(mask_items_dup, doc, &maskTransform); + mask_id = SPClipPath::create(mask_items, doc, &maskTransform); } else { - mask_id = sp_mask_create(mask_items_dup, doc, &maskTransform); + mask_id = sp_mask_create(mask_items, doc, &maskTransform); } - g_slist_free(mask_items_dup); - mask_items_dup = NULL; - Inkscape::XML::Node *current = SP_OBJECT(i->data)->getRepr(); // Node to apply mask to Inkscape::XML::Node *apply_mask_to = current; @@ -3972,7 +3971,6 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ Inkscape::XML::Node *spnew = current->duplicate(xml_doc); gint position = current->position(); - items_to_select.erase(remove(items_to_select.begin(), items_to_select.end(), item), items_to_select.end()); current->parent()->appendChild(group); sp_repr_unparent(current); group->appendChild(spnew); diff --git a/src/sp-clippath.cpp b/src/sp-clippath.cpp index 3c6167438..0c13ca80d 100644 --- a/src/sp-clippath.cpp +++ b/src/sp-clippath.cpp @@ -313,8 +313,7 @@ const gchar *SPClipPath::create (GSList *reprs, SPDocument *document, Geom::Affi SPItem *item = SP_ITEM(clip_path_object->appendChildRepr(node)); if (NULL != applyTransform) { - Geom::Affine transform (item->transform); - transform *= (*applyTransform); + Geom::Affine transform (item->transform * (*applyTransform)); item->doWriteTransform(item->getRepr(), transform); } } diff --git a/src/sp-mask.cpp b/src/sp-mask.cpp index d60473e1d..c36c3c005 100644 --- a/src/sp-mask.cpp +++ b/src/sp-mask.cpp @@ -226,8 +226,7 @@ sp_mask_create (GSList *reprs, SPDocument *document, Geom::Affine const* applyTr SPItem *item = SP_ITEM(mask_object->appendChildRepr(node)); if (NULL != applyTransform) { - Geom::Affine transform (item->transform); - transform *= (*applyTransform); + Geom::Affine transform (item->transform * (*applyTransform)); item->doWriteTransform(item->getRepr(), transform); } } -- cgit v1.2.3 From 7cb183695ed9eec9fb3e08045e4a265d10eca76e Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Sat, 9 May 2015 01:05:06 +0200 Subject: refactor sp_selection_set_mask (bzr r14131) --- src/selection-chemistry.cpp | 94 +++++++++++++++------------------------------ src/sp-clippath.cpp | 6 +-- src/sp-clippath.h | 2 +- src/sp-mask.cpp | 6 +-- src/sp-mask.h | 2 +- 5 files changed, 40 insertions(+), 70 deletions(-) (limited to 'src') diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index f72bd1259..7be1e3ec0 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -3787,13 +3787,11 @@ void sp_selection_set_clipgroup(SPDesktop *desktop) clone->setAttribute("inkscape:transform-center-y", inner->attribute("inkscape:transform-center-y"), false); const Geom::Affine maskTransform(Geom::Affine::identity()); - GSList *templist = NULL; - - templist = g_slist_append(templist, clone); + std::vector templist; + templist.push_back(clone); // add the new clone to the top of the original's parent gchar const *mask_id = SPClipPath::create(templist, doc, &maskTransform); - g_slist_free(templist); outer->setAttribute("clip-path", g_strdup_printf("url(#%s)", mask_id)); @@ -3851,9 +3849,9 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ selection->clear(); // create a list of duplicates - GSList *mask_items = NULL; - GSList *apply_to_items = NULL; - GSList *items_to_delete = NULL; + std::vector mask_items; + std::vector apply_to_items; + std::vector items_to_delete; std::vector items_to_select; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -3863,57 +3861,36 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ if (apply_to_layer) { // all selected items are used for mask, which is applied to a layer - apply_to_items = g_slist_prepend(apply_to_items, desktop->currentLayer()); + apply_to_items.push_back(SP_ITEM(desktop->currentLayer())); + } + + for (std::vector::const_iterator i=items.begin();i!=items.end();i++) { + if((!topmost && !apply_to_layer && *i == items.front()) + || (topmost && !apply_to_layer && *i == items.back()) + || apply_to_layer){ - for (std::vector::const_iterator i=items.begin();i!=items.end();i++) { + Geom::Affine oldtr=(*i)->transform; + (*i)->doWriteTransform((*i)->getRepr(), (*i)->i2doc_affine()); Inkscape::XML::Node *dup = (*i)->getRepr()->duplicate(xml_doc); - mask_items = g_slist_prepend(mask_items, dup); + (*i)->doWriteTransform((*i)->getRepr(), oldtr); + mask_items.push_back(dup); - SPObject *item = *i; if (remove_original) { - items_to_delete = g_slist_prepend(items_to_delete, item); + items_to_delete.push_back(*i); } else { - items_to_select.push_back((SPItem*)item); + items_to_select.push_back(*i); } - } - } else if (!topmost) { - // topmost item is used as a mask, which is applied to other items in a selection - Inkscape::XML::Node *dup = items[0]->getRepr()->duplicate(xml_doc); - mask_items = g_slist_prepend(mask_items, dup); - - if (remove_original) { - SPObject *item = items.front(); - items_to_delete = g_slist_prepend(items_to_delete, item); - } - - for (std::vector::const_iterator i=items.begin();i!=items.end();i++) { - if(i==items.begin())continue; - apply_to_items = g_slist_prepend(apply_to_items, *i); + continue; + }else{ + apply_to_items.push_back(*i); items_to_select.push_back(*i); } - } else { - SPItem *i = items.front(); - for (std::vector::const_iterator j=items.begin();(j+1)!=items.end();j++) { - apply_to_items = g_slist_prepend(apply_to_items, i); - items_to_select.push_back(i); - i=*(j+1); - } - Geom::Affine oldtr=i->transform; - i->doWriteTransform(i->getRepr(), i->i2doc_affine()); - Inkscape::XML::Node *dup = SP_OBJECT(i)->getRepr()->duplicate(xml_doc); - i->doWriteTransform(i->getRepr(), oldtr); - - mask_items = g_slist_prepend(mask_items, dup); - - if (remove_original) { - SPObject *item = reinterpret_cast(i); - items_to_delete = g_slist_prepend(items_to_delete, item); - } } + items.clear(); - if (apply_to_items && grouping == PREFS_MASKOBJECT_GROUPING_ALL) { + if (grouping == PREFS_MASKOBJECT_GROUPING_ALL) { // group all those objects into one group // and apply mask to that Inkscape::XML::Node *group = xml_doc->createElement("svg:g"); @@ -3922,19 +3899,16 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ group->setAttribute("inkscape:groupmode", "maskhelper"); std::vector reprs_to_group; - - for (GSList *i = apply_to_items ; NULL != i ; i = i->next) { - reprs_to_group.push_back(static_cast(i->data)->getRepr()); - //items_to_select.erase(remove(items_to_select.begin(), items_to_select.end(), static_cast(i->data)), items_to_select.end()); + for (std::vector::const_iterator i = apply_to_items.begin(); i != apply_to_items.end(); i++) { + reprs_to_group.push_back(static_cast(*i)->getRepr()); } items_to_select.clear(); sp_selection_group_impl(reprs_to_group, group, xml_doc, doc); // apply clip/mask only to newly created group - g_slist_free(apply_to_items); - apply_to_items = NULL; - apply_to_items = g_slist_prepend(apply_to_items, doc->getObjectByRepr(group)); + apply_to_items.clear(); + apply_to_items.push_back(dynamic_cast(doc->getObjectByRepr(group))); items_to_select.push_back((SPItem*)(doc->getObjectByRepr(group))); @@ -3946,8 +3920,8 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ gchar const *attributeName = apply_clip_path ? "clip-path" : "mask"; - for (GSList *i = apply_to_items; NULL != i; i = i->next) { - SPItem *item = reinterpret_cast(i->data); + for (std::vector::const_reverse_iterator i = apply_to_items.rbegin(); i != apply_to_items.rend(); i++) { + SPItem *item = reinterpret_cast(*i); // inverted object transform should be applied to a mask object, // as mask is calculated in user space (after applying transform) Geom::Affine maskTransform(item->i2doc_affine().inverse()); @@ -3959,7 +3933,7 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ mask_id = sp_mask_create(mask_items, doc, &maskTransform); } - Inkscape::XML::Node *current = SP_OBJECT(i->data)->getRepr(); + Inkscape::XML::Node *current = SP_OBJECT(*i)->getRepr(); // Node to apply mask to Inkscape::XML::Node *apply_mask_to = current; @@ -3988,15 +3962,11 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ } - g_slist_free(mask_items); - g_slist_free(apply_to_items); - - for (GSList *i = items_to_delete; NULL != i; i = i->next) { - SPObject *item = reinterpret_cast(i->data); + for (std::vector::const_iterator i = items_to_delete.begin(); i != items_to_delete.end(); i++) { + SPObject *item = reinterpret_cast(*i); item->deleteObject(false); items_to_select.erase(remove(items_to_select.begin(), items_to_select.end(), item), items_to_select.end()); } - g_slist_free(items_to_delete); selection->addList(items_to_select); diff --git a/src/sp-clippath.cpp b/src/sp-clippath.cpp index 0c13ca80d..d66508eae 100644 --- a/src/sp-clippath.cpp +++ b/src/sp-clippath.cpp @@ -296,7 +296,7 @@ sp_clippath_view_list_remove(SPClipPathView *list, SPClipPathView *view) } // Create a mask element (using passed elements), add it to -const gchar *SPClipPath::create (GSList *reprs, SPDocument *document, Geom::Affine const* applyTransform) +const gchar *SPClipPath::create (std::vector &reprs, SPDocument *document, Geom::Affine const* applyTransform) { Inkscape::XML::Node *defsrepr = document->getDefs()->getRepr(); @@ -308,8 +308,8 @@ const gchar *SPClipPath::create (GSList *reprs, SPDocument *document, Geom::Affi const gchar *id = repr->attribute("id"); SPObject *clip_path_object = document->getObjectById(id); - for (GSList *it = reprs; it != NULL; it = it->next) { - Inkscape::XML::Node *node = (Inkscape::XML::Node *)(it->data); + for (std::vector::const_iterator it = reprs.begin(); it != reprs.end(); it++) { + Inkscape::XML::Node *node = (*it); SPItem *item = SP_ITEM(clip_path_object->appendChildRepr(node)); if (NULL != applyTransform) { diff --git a/src/sp-clippath.h b/src/sp-clippath.h index eb8b14174..91dcfd625 100644 --- a/src/sp-clippath.h +++ b/src/sp-clippath.h @@ -45,7 +45,7 @@ public: unsigned int clipPathUnits : 1; SPClipPathView *display; - static char const *create(GSList *reprs, SPDocument *document, Geom::Affine const* applyTransform); + static char const *create(std::vector &reprs, SPDocument *document, Geom::Affine const* applyTransform); //static GType sp_clippath_get_type(void); Inkscape::DrawingItem *show(Inkscape::Drawing &drawing, unsigned int key); diff --git a/src/sp-mask.cpp b/src/sp-mask.cpp index c36c3c005..f8fb7aff4 100644 --- a/src/sp-mask.cpp +++ b/src/sp-mask.cpp @@ -209,7 +209,7 @@ Inkscape::XML::Node* SPMask::write(Inkscape::XML::Document* xml_doc, Inkscape::X // Create a mask element (using passed elements), add it to const gchar * -sp_mask_create (GSList *reprs, SPDocument *document, Geom::Affine const* applyTransform) +sp_mask_create (std::vector &reprs, SPDocument *document, Geom::Affine const* applyTransform) { Inkscape::XML::Node *defsrepr = document->getDefs()->getRepr(); @@ -221,8 +221,8 @@ sp_mask_create (GSList *reprs, SPDocument *document, Geom::Affine const* applyTr const gchar *mask_id = repr->attribute("id"); SPObject *mask_object = document->getObjectById(mask_id); - for (GSList *it = reprs; it != NULL; it = it->next) { - Inkscape::XML::Node *node = (Inkscape::XML::Node *)(it->data); + for (std::vector::const_iterator it = reprs.begin(); it != reprs.end(); it++) { + Inkscape::XML::Node *node = (*it); SPItem *item = SP_ITEM(mask_object->appendChildRepr(node)); if (NULL != applyTransform) { diff --git a/src/sp-mask.h b/src/sp-mask.h index e991fedb6..3559483bb 100644 --- a/src/sp-mask.h +++ b/src/sp-mask.h @@ -108,6 +108,6 @@ protected: } }; -const char *sp_mask_create (GSList *reprs, SPDocument *document, Geom::Affine const* applyTransform); +const char *sp_mask_create (std::vector &reprs, SPDocument *document, Geom::Affine const* applyTransform); #endif // SEEN_SP_MASK_H -- cgit v1.2.3 From 31c3977006f63720ca6aa473585760da7d59a833 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Sat, 9 May 2015 01:50:13 +0200 Subject: fixed logic error in earlier fix (bzr r14132) --- src/selection-chemistry.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 7be1e3ec0..4352878d6 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -3924,15 +3924,6 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ SPItem *item = reinterpret_cast(*i); // inverted object transform should be applied to a mask object, // as mask is calculated in user space (after applying transform) - Geom::Affine maskTransform(item->i2doc_affine().inverse()); - - gchar const *mask_id = NULL; - if (apply_clip_path) { - mask_id = SPClipPath::create(mask_items, doc, &maskTransform); - } else { - mask_id = sp_mask_create(mask_items, doc, &maskTransform); - } - Inkscape::XML::Node *current = SP_OBJECT(*i)->getRepr(); // Node to apply mask to Inkscape::XML::Node *apply_mask_to = current; @@ -3953,11 +3944,22 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ // Apply clip/mask to group instead apply_mask_to = group; - items_to_select.push_back((SPItem*)(doc->getObjectByRepr(group))); + items_to_select.push_back(item = (SPItem*)(doc->getObjectByRepr(group))); Inkscape::GC::release(spnew); Inkscape::GC::release(group); } + + + Geom::Affine maskTransform(item->i2doc_affine().inverse()); + + gchar const *mask_id = NULL; + if (apply_clip_path) { + mask_id = SPClipPath::create(mask_items, doc, &maskTransform); + } else { + mask_id = sp_mask_create(mask_items, doc, &maskTransform); + } + apply_mask_to->setAttribute(attributeName, Glib::ustring("url(#") + mask_id + ')'); } -- cgit v1.2.3 From 13fc1db22c959600f7b179abf1a70ca42ab587de Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Sat, 9 May 2015 02:57:05 +0200 Subject: fix crash introduces by recent rev when clipping (bzr r14133) --- src/selection-chemistry.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 4352878d6..a21a82983 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -3924,6 +3924,9 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ SPItem *item = reinterpret_cast(*i); // inverted object transform should be applied to a mask object, // as mask is calculated in user space (after applying transform) + std::vector mask_items_dup; + for(std::vector::const_iterator it=mask_items.begin();it!=mask_items.end();it++) + mask_items_dup.push_back((*it)->duplicate(xml_doc)); Inkscape::XML::Node *current = SP_OBJECT(*i)->getRepr(); // Node to apply mask to Inkscape::XML::Node *apply_mask_to = current; @@ -3949,15 +3952,13 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ Inkscape::GC::release(group); } - - Geom::Affine maskTransform(item->i2doc_affine().inverse()); gchar const *mask_id = NULL; if (apply_clip_path) { - mask_id = SPClipPath::create(mask_items, doc, &maskTransform); + mask_id = SPClipPath::create(mask_items_dup, doc, &maskTransform); } else { - mask_id = sp_mask_create(mask_items, doc, &maskTransform); + mask_id = sp_mask_create(mask_items_dup, doc, &maskTransform); } apply_mask_to->setAttribute(attributeName, Glib::ustring("url(#") + mask_id + ')'); -- cgit v1.2.3