From 1636c1dd1651780d01759676b194312529f211f7 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Sat, 25 Jun 2016 22:24:26 +0200 Subject: Moved next functions, added namespace, renamed range functions (bzr r14954.1.10) --- src/widgets/stroke-style.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/widgets/stroke-style.cpp') diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index 84a6e77ad..7ed2c3180 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -515,7 +515,7 @@ void StrokeStyle::markerSelectCB(MarkerComboBox *marker_combo, StrokeStyle *spw, //spw->updateMarkerHist(which); Inkscape::Selection *selection = spw->desktop->getSelection(); - std::vector itemlist=selection->itemList(); + std::vector itemlist= selection->items(); for(std::vector::const_iterator i=itemlist.begin();i!=itemlist.end();++i){ SPItem *item = *i; if (!SP_IS_SHAPE(item) || SP_IS_RECT(item)) { // can't set marker to rect, until it's converted to using @@ -988,7 +988,7 @@ StrokeStyle::updateLine() if (!sel || sel->isEmpty()) return; - std::vector const objects = sel->itemList(); + std::vector const objects = sel->items(); SPObject * const object = objects[0]; SPStyle * const style = object->style; @@ -1044,7 +1044,7 @@ StrokeStyle::scaleLine() SPDocument *document = desktop->getDocument(); Inkscape::Selection *selection = desktop->getSelection(); - std::vector items=selection->itemList(); + std::vector items= selection->items(); /* TODO: Create some standardized method */ SPCSSAttr *css = sp_repr_css_attr_new(); -- cgit v1.2.3 From f35bb1f74a0ffeb5c6477a25e3c4cde87a97bcf1 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 28 Jul 2016 12:06:06 +0200 Subject: Removed unused includes, decrease compilation time (bzr r15025) --- src/widgets/stroke-style.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/widgets/stroke-style.cpp') diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index 84a6e77ad..b66d97c1d 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -18,11 +18,8 @@ #define noSP_SS_VERBOSE #include "stroke-style.h" -#include "gradient-chemistry.h" -#include "sp-gradient.h" #include "sp-stop.h" #include "svg/svg-color.h" -#include "util/units.h" #include "ui/widget/unit-menu.h" #include "desktop-widget.h" -- cgit v1.2.3 From 43b49e325db73cc19b1731db6c69545664ee8fbe Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 28 Jul 2016 13:26:17 +0200 Subject: Reverted changes to r15024 after many building problems (bzr r15027) --- src/widgets/stroke-style.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/widgets/stroke-style.cpp') diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index b66d97c1d..84a6e77ad 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -18,8 +18,11 @@ #define noSP_SS_VERBOSE #include "stroke-style.h" +#include "gradient-chemistry.h" +#include "sp-gradient.h" #include "sp-stop.h" #include "svg/svg-color.h" +#include "util/units.h" #include "ui/widget/unit-menu.h" #include "desktop-widget.h" -- cgit v1.2.3 From dcd91f59f597ab4af07cee5929ce0e2e1f9104d5 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Thu, 28 Jul 2016 16:16:18 +0100 Subject: Drop remaining GTKMM 2 fallback support (bzr r15023.2.7) --- src/widgets/stroke-style.cpp | 60 -------------------------------------------- 1 file changed, 60 deletions(-) (limited to 'src/widgets/stroke-style.cpp') diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index 84a6e77ad..990ec8d35 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -155,17 +155,9 @@ StrokeStyle::StrokeStyle() : Gtk::HBox *f = new Gtk::HBox(false, 0); f->show(); add(*f); - -#if WITH_GTKMM_3_0 table = new Gtk::Grid(); table->set_border_width(4); table->set_row_spacing(4); -#else - table = new Gtk::Table(3, 6, false); - table->set_border_width(4); - table->set_row_spacings(4); -#endif - table->show(); f->add(*table); @@ -181,13 +173,7 @@ StrokeStyle::StrokeStyle() : // stroke_width_set_unit will be removed (because ScalarUnit takes care of conversions itself), and // with it, the two remaining calls of stroke_average_width, allowing us to get rid of that // function in desktop-style. - -#if WITH_GTKMM_3_0 widthAdj = new Glib::RefPtr(Gtk::Adjustment::create(1.0, 0.0, 1000.0, 0.1, 10.0, 0.0)); -#else - widthAdj = new Gtk::Adjustment(1.0, 0.0, 1000.0, 0.1, 10.0, 0.0); -#endif - widthSpin = new Inkscape::UI::Widget::SpinButton(*widthAdj, 0.1, 3); widthSpin->set_tooltip_text(_("Stroke width")); widthSpin->show(); @@ -213,12 +199,7 @@ StrokeStyle::StrokeStyle() : us->show(); hb->pack_start(*us, FALSE, FALSE, 0); - -#if WITH_GTKMM_3_0 (*widthAdj)->signal_value_changed().connect(sigc::mem_fun(*this, &StrokeStyle::widthChangedCB)); -#else - widthAdj->signal_value_changed().connect(sigc::mem_fun(*this, &StrokeStyle::widthChangedCB)); -#endif i++; /* Dash */ @@ -230,16 +211,10 @@ StrokeStyle::StrokeStyle() : dashSelector = Gtk::manage(new SPDashSelector); dashSelector->show(); - -#if WITH_GTKMM_3_0 dashSelector->set_hexpand(); dashSelector->set_halign(Gtk::ALIGN_FILL); dashSelector->set_valign(Gtk::ALIGN_CENTER); table->attach(*dashSelector, 1, i, 3, 1); -#else - table->attach(*dashSelector, 1, 4, i, i+1, (Gtk::EXPAND | Gtk::FILL), static_cast(0), 0, 0); -#endif - dashSelector->changed_signal.connect(sigc::mem_fun(*this, &StrokeStyle::lineDashChangedCB)); i++; @@ -323,28 +298,14 @@ StrokeStyle::StrokeStyle() : // miter limit is to cut off such spikes (i.e. convert them into bevels) // when they become too long. //spw_label(t, _("Miter _limit:"), 0, i); - -#if WITH_GTKMM_3_0 miterLimitAdj = new Glib::RefPtr(Gtk::Adjustment::create(4.0, 0.0, 100.0, 0.1, 10.0, 0.0)); miterLimitSpin = new Inkscape::UI::Widget::SpinButton(*miterLimitAdj, 0.1, 2); -#else - miterLimitAdj = new Gtk::Adjustment(4.0, 0.0, 100.0, 0.1, 10.0, 0.0); - miterLimitSpin = new Inkscape::UI::Widget::SpinButton(*miterLimitAdj, 0.1, 2); -#endif - miterLimitSpin->set_tooltip_text(_("Maximum length of the miter (in units of stroke width)")); miterLimitSpin->show(); sp_dialog_defocus_on_enter_cpp(miterLimitSpin); hb->pack_start(*miterLimitSpin, false, false, 0); - -#if WITH_GTKMM_3_0 (*miterLimitAdj)->signal_value_changed().connect(sigc::mem_fun(*this, &StrokeStyle::miterLimitChangedCB)); - -#else - miterLimitAdj->signal_value_changed().connect(sigc::mem_fun(*this, &StrokeStyle::miterLimitChangedCB)); -#endif - i++; /* Cap type */ @@ -927,17 +888,9 @@ StrokeStyle::updateLine() if (unit->type == Inkscape::Util::UNIT_TYPE_LINEAR) { double avgwidth = Inkscape::Util::Quantity::convert(query.stroke_width.computed, "px", unit); -#if WITH_GTKMM_3_0 (*widthAdj)->set_value(avgwidth); -#else - widthAdj->set_value(avgwidth); -#endif } else { -#if WITH_GTKMM_3_0 (*widthAdj)->set_value(100); -#else - widthAdj->set_value(100); -#endif } // if none of the selected objects has a stroke, than quite some controls should be disabled @@ -958,11 +911,7 @@ StrokeStyle::updateLine() } if (result_ml != QUERY_STYLE_NOTHING) -#if WITH_GTKMM_3_0 (*miterLimitAdj)->set_value(query.stroke_miterlimit.value); // TODO: reflect averagedness? -#else - miterLimitAdj->set_value(query.stroke_miterlimit.value); // TODO: reflect averagedness? -#endif if (result_join != QUERY_STYLE_MULTIPLE_DIFFERENT && result_join != QUERY_STYLE_NOTHING ) { @@ -1050,13 +999,8 @@ StrokeStyle::scaleLine() SPCSSAttr *css = sp_repr_css_attr_new(); if (!items.empty()) { -#if WITH_GTKMM_3_0 double width_typed = (*widthAdj)->get_value(); double const miterlimit = (*miterLimitAdj)->get_value(); -#else - double width_typed = widthAdj->get_value(); - double const miterlimit = miterLimitAdj->get_value(); -#endif Inkscape::Util::Unit const *const unit = unitSelector->getUnit(); @@ -1096,11 +1040,7 @@ StrokeStyle::scaleLine() if (unit->type != Inkscape::Util::UNIT_TYPE_LINEAR) { // reset to 100 percent -#if WITH_GTKMM_3_0 (*widthAdj)->set_value(100.0); -#else - widthAdj->set_value(100.0); -#endif } } -- cgit v1.2.3 From 35830f456cadaecf8b8e3944e3031a1a93f6cb41 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 3 Aug 2016 15:29:38 +0200 Subject: Removed unused includes, decreased compilation time. Once again (bzr r15034) --- src/widgets/stroke-style.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/widgets/stroke-style.cpp') diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index 84a6e77ad..b66d97c1d 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -18,11 +18,8 @@ #define noSP_SS_VERBOSE #include "stroke-style.h" -#include "gradient-chemistry.h" -#include "sp-gradient.h" #include "sp-stop.h" #include "svg/svg-color.h" -#include "util/units.h" #include "ui/widget/unit-menu.h" #include "desktop-widget.h" -- cgit v1.2.3 From c14ec0bf6954beca505ed58b794632bd1ffe72ca Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Sat, 1 Oct 2016 02:00:59 +0300 Subject: Extract a function to prevent assignment + const-ing. (bzr r15100.1.26) --- src/widgets/stroke-style.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/widgets/stroke-style.cpp') diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index 4a658c5dc..f5735190f 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -976,6 +976,16 @@ StrokeStyle::setScaledDash(SPCSSAttr *css, } } +static inline double calcScaleLineWidth(const double width_typed, SPItem *const item, Inkscape::Util::Unit const *const unit) +{ + if (unit->type == Inkscape::Util::UNIT_TYPE_LINEAR) { + return Inkscape::Util::Quantity::convert(width_typed, unit, "px"); + } else { // percentage + const gdouble old_w = item->style->stroke_width.computed; + return old_w * width_typed / 100; + } +} + /** * Sets line properties like width, dashes, markers, etc. on all currently selected items. */ @@ -1007,13 +1017,7 @@ StrokeStyle::scaleLine() for(auto i=items.begin();i!=items.end();++i){ /* Set stroke width */ - double width; - if (unit->type == Inkscape::Util::UNIT_TYPE_LINEAR) { - width = Inkscape::Util::Quantity::convert(width_typed, unit, "px"); - } else { // percentage - gdouble old_w = (*i)->style->stroke_width.computed; - width = old_w * width_typed / 100; - } + const double width = calcScaleLineWidth(width_typed, (*i), unit); { Inkscape::CSSOStringStream os_width; -- cgit v1.2.3 From 13586717311b38bcddfa82602aa39c73e332dc87 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Sat, 1 Oct 2016 17:27:14 +0300 Subject: Extract a method instead of assigning a temp bool var. (bzr r15100.1.27) --- src/widgets/stroke-style.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/widgets/stroke-style.cpp') diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index f5735190f..47131dec1 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -437,6 +437,12 @@ StrokeStyle::makeRadioButton(Gtk::RadioButtonGroup &grp, return tb; } +bool StrokeStyle::shouldMarkersBeUpdated() +{ + return startMarkerCombo->update() || midMarkerCombo->update() || + endMarkerCombo->update(); +} + /** * Handles when user selects one of the markers from the marker combobox. * Gets the marker uri string and applies it to all selected @@ -444,11 +450,7 @@ StrokeStyle::makeRadioButton(Gtk::RadioButtonGroup &grp, */ void StrokeStyle::markerSelectCB(MarkerComboBox *marker_combo, StrokeStyle *spw, SPMarkerLoc const /*which*/) { - bool markers_update = spw->startMarkerCombo->update() || - spw->midMarkerCombo->update() || - spw->endMarkerCombo->update(); - - if (spw->update || markers_update) { + if (spw->update || spw->shouldMarkersBeUpdated()) { return; } -- cgit v1.2.3 From 086347db66cff034f3e1fdce59a89156c49b5b95 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Sun, 2 Oct 2016 15:26:27 +0300 Subject: Extract a function - is_query_style_updateable. (bzr r15100.1.29) --- src/widgets/stroke-style.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/widgets/stroke-style.cpp') diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index 47131dec1..81a8e8115 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -22,6 +22,7 @@ #include "svg/svg-color.h" #include "ui/widget/unit-menu.h" #include "desktop-widget.h" +#include "widgets/style-utils.h" using Inkscape::DocumentUndo; using Inkscape::Util::unit_table; @@ -912,22 +913,20 @@ StrokeStyle::updateLine() if (result_ml != QUERY_STYLE_NOTHING) (*miterLimitAdj)->set_value(query.stroke_miterlimit.value); // TODO: reflect averagedness? - if (result_join != QUERY_STYLE_MULTIPLE_DIFFERENT && - result_join != QUERY_STYLE_NOTHING ) { + using Inkscape::is_query_style_updateable; + if (! is_query_style_updateable(result_join)) { setJoinType(query.stroke_linejoin.value); } else { setJoinButtons(NULL); } - if (result_cap != QUERY_STYLE_MULTIPLE_DIFFERENT && - result_cap != QUERY_STYLE_NOTHING ) { + if (! is_query_style_updateable(result_cap)) { setCapType (query.stroke_linecap.value); } else { setCapButtons(NULL); } - if (result_order != QUERY_STYLE_MULTIPLE_DIFFERENT && - result_order != QUERY_STYLE_NOTHING ) { + if (! is_query_style_updateable(result_order)) { setPaintOrder (query.paint_order.value); } else { setPaintOrder (NULL); -- cgit v1.2.3 From a322f3bb70c6e4da49d2430a5c09c47ec8fbd2c0 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Sat, 12 Nov 2016 10:54:56 +0100 Subject: Fix rare crash on undo break apart Fixed bugs: - https://launchpad.net/bugs/1449276 (bzr r15241) --- src/widgets/stroke-style.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/widgets/stroke-style.cpp') diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index 81a8e8115..de3e98297 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -940,7 +940,7 @@ StrokeStyle::updateLine() SPStyle * const style = object->style; /* Markers */ - updateAllMarkers(objects); // FIXME: make this desktop query too + updateAllMarkers(objects, true); // FIXME: make this desktop query too /* Dash */ setDashSelectorFromStyle(dashSelector, style); // FIXME: make this desktop query too @@ -1192,7 +1192,7 @@ StrokeStyle::setPaintOrderButtons(Gtk::ToggleButton *active) * that marker. */ void -StrokeStyle::updateAllMarkers(std::vector const &objects) +StrokeStyle::updateAllMarkers(std::vector const &objects, bool skip_undo) { struct { MarkerComboBox *key; int loc; } const keyloc[] = { { startMarkerCombo, SP_MARKER_LOC_START }, @@ -1246,9 +1246,11 @@ StrokeStyle::updateAllMarkers(std::vector const &objects) if (update) { setMarkerColor(marker, combo->get_loc(), SP_ITEM(object)); - SPDocument *document = desktop->getDocument(); - DocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE, + if (!skip_undo) { + SPDocument *document = desktop->getDocument(); + DocumentUndo::maybeDone(document, "UaM", SP_VERB_DIALOG_FILL_STROKE, _("Set marker color")); + } } } else { -- cgit v1.2.3