From: nicholasbishop Date: Sat, 28 Jul 2007 00:57:35 +0000 (+0000) Subject: Filter effects dialog: X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e3b2acf99faddc117281614b33fe55e7c8141278;p=inkscape.git Filter effects dialog: * Added settings widgets for feConvolveMatrix's target attribute * Changed the order attribute to show both spin widgets on the same row --- diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index ca68667dc..5e69fc456 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -167,6 +167,14 @@ public: } } + ~Settings() + { + for(int i = 0; i < NR_FILTER_ENDPRIMITIVETYPE; ++i) { + for(unsigned j = 0; j < _attrwidgets[i].size(); ++j) + delete _attrwidgets[i][j]; + } + } + // Show the active settings group and update all the AttrWidgets with new values void show_and_update(const NR::FilterPrimitiveType t) { @@ -241,6 +249,24 @@ public: sigc::bind(sigc::mem_fun(_dialog, &FilterEffectsDialog::set_attr_direct), attr, combo)); return combo; } + + // Combine the two most recent settings widgets in to the same row + void combine() + { + Gtk::VBox& vb = _groups[_current_type]; + const int size = vb.children().size(); + if(size >= 2) { + Gtk::HBox* h1 = dynamic_cast(vb.children()[size - 2].get_widget()); + Gtk::HBox* h2 = dynamic_cast(vb.children()[size - 1].get_widget()); + Gtk::Widget* c1 = h1->children()[1].get_widget(); + Gtk::Widget* c2 = h2->children()[1].get_widget(); + h1->remove(*c1); + h2->remove(*c2); + h1->pack_start(*c1, false, false); + h1->pack_start(*c2, false, false); + vb.remove(*h2); + } + } private: /* Adds a new settings widget using the specified label. The label will be formatted with a colon and all widgets within the setting group are aligned automatically. */ @@ -1149,12 +1175,17 @@ void FilterEffectsDialog::init_settings_widgets() _k4 = _settings->add(SP_ATTR_K4, _("K4"), -10, 10, 1, 0.01, 1); _settings->type(NR_FILTER_CONVOLVEMATRIX); - DualSpinSlider* order = _settings->add(SP_ATTR_ORDER, _("Rows"), _("Columns"), 1, 5, 1, 1, 0); + DualSpinSlider* order = _settings->add(SP_ATTR_ORDER, _("Size"), "", 1, 5, 1, 1, 0); + order->remove_scale(); + _settings->combine(); + SpinSlider* tx = _settings->add(SP_ATTR_TARGETX, _("Target"), 1, 5, 1, 1, 0); + tx->remove_scale(); + SpinSlider* ty = _settings->add(SP_ATTR_TARGETY, "", 1, 5, 1, 1, 0); + ty->remove_scale(); + _settings->combine(); ConvolveMatrix* convmat = _settings->add(SP_ATTR_KERNELMATRIX, _("Kernel")); order->signal_value_changed().connect( sigc::bind(sigc::mem_fun(*convmat, &ConvolveMatrix::update_direct), this)); - order->get_spinslider1().remove_scale(); - order->get_spinslider2().remove_scale(); _settings->add(SP_ATTR_DIVISOR, _("Divisor"), 0.01, 10, 1, 0.01, 1); _settings->add(SP_ATTR_BIAS, _("Bias"), -10, 10, 1, 0.01, 1); diff --git a/src/ui/widget/spin-slider.cpp b/src/ui/widget/spin-slider.cpp index 71c5921a9..e777542e3 100644 --- a/src/ui/widget/spin-slider.cpp +++ b/src/ui/widget/spin-slider.cpp @@ -166,6 +166,12 @@ void DualSpinSlider::set_update_policy(const Gtk::UpdateType u) _s2.set_update_policy(u); } +void DualSpinSlider::remove_scale() +{ + _s1.remove_scale(); + _s2.remove_scale(); +} + } // namespace Widget } // namespace UI } // namespace Inkscape diff --git a/src/ui/widget/spin-slider.h b/src/ui/widget/spin-slider.h index 1abc7cf3e..5c0272d2a 100644 --- a/src/ui/widget/spin-slider.h +++ b/src/ui/widget/spin-slider.h @@ -74,6 +74,8 @@ public: SpinSlider& get_spinslider2(); void set_update_policy(const Gtk::UpdateType); + + void remove_scale(); private: sigc::signal _signal_value_changed; SpinSlider _s1, _s2;