summaryrefslogtreecommitdiffstats
path: root/src/widgets/stroke-style.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/stroke-style.cpp')
-rw-r--r--src/widgets/stroke-style.cpp73
1 files changed, 5 insertions, 68 deletions
diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp
index 84a6e77ad..4a658c5dc 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"
@@ -155,17 +152,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 +170,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>(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 +196,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 +208,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<Gtk::AttachOptions>(0), 0, 0);
-#endif
-
dashSelector->changed_signal.connect(sigc::mem_fun(*this, &StrokeStyle::lineDashChangedCB));
i++;
@@ -323,28 +295,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>(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 */
@@ -515,8 +473,8 @@ void StrokeStyle::markerSelectCB(MarkerComboBox *marker_combo, StrokeStyle *spw,
//spw->updateMarkerHist(which);
Inkscape::Selection *selection = spw->desktop->getSelection();
- std::vector<SPItem*> itemlist=selection->itemList();
- for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();++i){
+ auto itemlist= selection->items();
+ for(auto 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 <path>
continue;
@@ -927,17 +885,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 +908,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 ) {
@@ -988,7 +934,7 @@ StrokeStyle::updateLine()
if (!sel || sel->isEmpty())
return;
- std::vector<SPItem*> const objects = sel->itemList();
+ std::vector<SPItem*> const objects(sel->items().begin(), sel->items().end());
SPObject * const object = objects[0];
SPStyle * const style = object->style;
@@ -1044,19 +990,14 @@ StrokeStyle::scaleLine()
SPDocument *document = desktop->getDocument();
Inkscape::Selection *selection = desktop->getSelection();
- std::vector<SPItem*> items=selection->itemList();
+ auto items= selection->items();
/* TODO: Create some standardized method */
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();
@@ -1064,7 +1005,7 @@ StrokeStyle::scaleLine()
int ndash;
dashSelector->get_dash(&ndash, &dash, &offset);
- for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();++i){
+ for(auto i=items.begin();i!=items.end();++i){
/* Set stroke width */
double width;
if (unit->type == Inkscape::Util::UNIT_TYPE_LINEAR) {
@@ -1096,11 +1037,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
}
}