From f313394fee34e964f4088211bdf5fb82cce31378 Mon Sep 17 00:00:00 2001 From: nicholasbishop Date: Sat, 28 Jul 2007 01:55:25 +0000 Subject: [PATCH] Filter effects dialog: * Limited the upper bounds of the feConvolveMatrix attributes targetX and targetY so that they match the value of Order. --- src/ui/dialog/filter-effects-dialog.cpp | 51 +++++++++++++------------ src/ui/dialog/filter-effects-dialog.h | 7 ++++ 2 files changed, 33 insertions(+), 25 deletions(-) diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 19e6a9d3d..6a634449f 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -89,9 +89,18 @@ public: return _signal_changed; } - void update_direct(FilterEffectsDialog* d) + void update(SPFeConvolveMatrix* conv) { - update(SP_FECONVOLVEMATRIX(d->_primitive_list.get_selected())); + if(conv) { + int cols, rows; + + cols = (int)conv->order.getNumber(); + if(cols > 5) + cols = 5; + rows = conv->order.optNumber_set ? (int)conv->order.getOptNumber() : cols; + + update(conv, cols, rows); + } } private: class ConvolveMatrixColumns : public Gtk::TreeModel::ColumnRecord @@ -106,20 +115,6 @@ private: std::vector > cols; }; - void update(SPFeConvolveMatrix* conv) - { - if(conv) { - int cols, rows; - - cols = (int)conv->order.getNumber(); - if(cols > 5) - cols = 5; - rows = conv->order.optNumber_set ? (int)conv->order.getOptNumber() : cols; - - update(conv, cols, rows); - } - } - void update(SPFeConvolveMatrix* conv, const int rows, const int cols) { _model->clear(); @@ -1176,17 +1171,16 @@ 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, _("Size"), "", 1, 5, 1, 1, 0); - order->remove_scale(); + _convolve_order = _settings->add(SP_ATTR_ORDER, _("Size"), "", 1, 5, 1, 1, 0); + _convolve_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(); + _convolve_tx = _settings->add(SP_ATTR_TARGETX, _("Target"), 0, 4, 1, 1, 0); + _convolve_tx->remove_scale(); + _convolve_ty = _settings->add(SP_ATTR_TARGETY, "", 0, 4, 1, 1, 0); + _convolve_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)); + _convolve_matrix = _settings->add(SP_ATTR_KERNELMATRIX, _("Kernel")); + _convolve_order->signal_value_changed().connect(sigc::mem_fun(*this, &FilterEffectsDialog::convolve_order_changed)); _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); @@ -1258,6 +1252,13 @@ void FilterEffectsDialog::duplicate_primitive() } } +void FilterEffectsDialog::convolve_order_changed() +{ + _convolve_matrix->update(SP_FECONVOLVEMATRIX(_primitive_list.get_selected())); + _convolve_tx->get_adjustment().set_upper(_convolve_order->get_spinslider1().get_value()); + _convolve_ty->get_adjustment().set_upper(_convolve_order->get_spinslider2().get_value()); +} + void FilterEffectsDialog::set_attr_color(const SPAttributeEnum attr, const Gtk::ColorButton* input) { if(input->is_sensitive()) { diff --git a/src/ui/dialog/filter-effects-dialog.h b/src/ui/dialog/filter-effects-dialog.h index 51c1cc5fc..9e9a02f47 100644 --- a/src/ui/dialog/filter-effects-dialog.h +++ b/src/ui/dialog/filter-effects-dialog.h @@ -173,6 +173,7 @@ private: void add_primitive(); void remove_primitive(); void duplicate_primitive(); + void convolve_order_changed(); void set_attr_color(const SPAttributeEnum attr, const Gtk::ColorButton*); void set_attr_direct(const SPAttributeEnum attr, const AttrWidget*); @@ -198,6 +199,12 @@ private: class ConvolveMatrix; Settings* _settings; + // Convolve Matrix + ConvolveMatrix* _convolve_matrix; + DualSpinSlider* _convolve_order; + SpinSlider* _convolve_tx; + SpinSlider* _convolve_ty; + // For controlling setting sensitivity Gtk::Widget* _k1, *_k2, *_k3, *_k4; -- 2.30.2