summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNathan Lee <2431820-nathanal@users.noreply.gitlab.com>2019-05-23 14:47:28 +0000
committerThomas Holder <thomas@thomas-holder.de>2019-05-26 07:45:16 +0000
commita4f0db6313fe187d96f9c25011de28903d8337d5 (patch)
treed39a7c46dd495b6699b8404d83a6799fed08d5e3 /src
parentRename wrong named function (diff)
downloadinkscape-a4f0db6313fe187d96f9c25011de28903d8337d5.tar.gz
inkscape-a4f0db6313fe187d96f9c25011de28903d8337d5.zip
Fix gradient toolbar comboboxes and reverse
https://gitlab.com/inkscape/inkscape/issues/224
Diffstat (limited to 'src')
-rw-r--r--src/gradient-chemistry.cpp11
-rw-r--r--src/ui/toolbar/gradient-toolbar.cpp6
-rw-r--r--src/ui/toolbar/gradient-toolbar.h2
-rw-r--r--src/ui/widget/combo-tool-item.cpp7
4 files changed, 11 insertions, 15 deletions
diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp
index 63bdb397d..cde2d45e7 100644
--- a/src/gradient-chemistry.cpp
+++ b/src/gradient-chemistry.cpp
@@ -980,12 +980,11 @@ void sp_item_gradient_reverse_vector(SPItem *item, Inkscape::PaintTarget fill_or
i->deleteObject();
}
- std::vector<double>::iterator iter = offsets.end() - 1;
- for (auto copy:child_copies) {
- vector->appendChildRepr(copy);
- sp_repr_set_svg_double (copy, "offset", 1 - *iter);
- --iter;
- Inkscape::GC::release(copy);
+ std::vector<double>::reverse_iterator o_it = offsets.rbegin();
+ for (auto c_it = child_copies.rbegin(); c_it != child_copies.rend(); ++c_it, ++o_it) {
+ vector->appendChildRepr(*c_it);
+ sp_repr_set_svg_double (*c_it, "offset", 1 - *o_it);
+ Inkscape::GC::release(*c_it);
}
}
diff --git a/src/ui/toolbar/gradient-toolbar.cpp b/src/ui/toolbar/gradient-toolbar.cpp
index 60779f03a..afd613c83 100644
--- a/src/ui/toolbar/gradient-toolbar.cpp
+++ b/src/ui/toolbar/gradient-toolbar.cpp
@@ -447,7 +447,7 @@ GradientToolbar::GradientToolbar(SPDesktop *desktop)
// Gradient Spread type (how a gradient is drawn outside its nominal area)
{
- add_label(_("Repeat"));
+ _spread_lbl = add_label(_("Repeat: "));
_spread_cb = Gtk::manage(new Gtk::ComboBoxText());
_spread_cb->append(C_("Gradient repeat type", "None"));
@@ -461,7 +461,8 @@ GradientToolbar::GradientToolbar(SPDesktop *desktop)
"(spreadMethod=\"pad\"), or repeat the gradient in the same direction "
"(spreadMethod=\"repeat\"), or repeat the gradient in alternating opposite "
"directions (spreadMethod=\"reflect\")"));
- spread_item->set_sensitive(false);
+ _spread_lbl->set_sensitive(false);
+ _spread_cb->set_sensitive(false);
spread_item->add(*_spread_cb);
add(*spread_item);
@@ -934,6 +935,7 @@ GradientToolbar::selection_changed(Inkscape::Selection * /*selection*/)
}
// Spread menu
+ _spread_lbl->set_sensitive( gr_selected && !gr_multi );
_spread_cb->set_sensitive( gr_selected && !gr_multi );
_spread_cb->set_active( gr_selected ? (int)spr_selected : 0 );
diff --git a/src/ui/toolbar/gradient-toolbar.h b/src/ui/toolbar/gradient-toolbar.h
index f02dbdc46..40bd1acc0 100644
--- a/src/ui/toolbar/gradient-toolbar.h
+++ b/src/ui/toolbar/gradient-toolbar.h
@@ -23,6 +23,7 @@ class SPGradient;
namespace Gtk {
class ComboBoxText;
class ToolButton;
+class ToolItem;
}
namespace Inkscape {
@@ -44,6 +45,7 @@ private:
std::vector<Gtk::RadioToolButton *> _new_type_buttons;
std::vector<Gtk::RadioToolButton *> _new_fillstroke_buttons;
UI::Widget::ComboToolItem *_select_cb;
+ Gtk::ToolItem *_spread_lbl;
Gtk::ComboBoxText *_spread_cb;
UI::Widget::ComboToolItem *_stop_cb;
diff --git a/src/ui/widget/combo-tool-item.cpp b/src/ui/widget/combo-tool-item.cpp
index eb26e5c6e..a6c44f7eb 100644
--- a/src/ui/widget/combo-tool-item.cpp
+++ b/src/ui/widget/combo-tool-item.cpp
@@ -100,12 +100,6 @@ ComboToolItem::ComboToolItem(Glib::ustring group_label,
void
ComboToolItem::set_active (gint active) {
-
- if (active < 0) {
- std::cerr << "ComboToolItem::set_active: active < 0: " << active << std::endl;
- return;
- }
-
if (_active != active) {
_active = active;
@@ -176,7 +170,6 @@ void
ComboToolItem::on_changed_combobox() {
int row = _combobox->get_active_row_number();
- if (row < 0) row = 0; // Happens when Gtk::ListStore reconstructed
set_active( row );
_changed.emit (_active);
_changed_after.emit (_active);