summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2016-10-07 20:58:19 +0000
committerjabiertxof <info@marker.es>2016-10-07 20:58:19 +0000
commit4265fc5086c2a7467de2b8d1c26efac1412a5089 (patch)
tree9e9b0ebc465f50b67fbc96ffdd798b57514acea4 /src
parentFix bug:1630796 on flatten button (diff)
downloadinkscape-4265fc5086c2a7467de2b8d1c26efac1412a5089.tar.gz
inkscape-4265fc5086c2a7467de2b8d1c26efac1412a5089.zip
Fix bug:1605334 FeImage X and Y position
Fixed bugs: - https://launchpad.net/bugs/1605334 (bzr r15151)
Diffstat (limited to 'src')
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp46
-rw-r--r--src/ui/dialog/filter-effects-dialog.h8
2 files changed, 53 insertions, 1 deletions
diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp
index a0cd786dc..f657e1b76 100644
--- a/src/ui/dialog/filter-effects-dialog.cpp
+++ b/src/ui/dialog/filter-effects-dialog.cpp
@@ -860,6 +860,17 @@ public:
return dss;
}
+ // SpinButton
+ SpinButtonAttr* add_spinbutton(double defalt_value, const SPAttributeEnum attr, const Glib::ustring& label,
+ const double lo, const double hi, const double step_inc,
+ const double climb, const int digits, char* tip = NULL)
+ {
+ SpinButtonAttr* sb = new SpinButtonAttr(lo, hi, step_inc, climb, digits, attr, defalt_value, tip);
+ add_widget(sb, label);
+ add_attr_widget(sb);
+ return sb;
+ }
+
// DualSpinButton
DualSpinButton* add_dualspinbutton(char* defalt_value, const SPAttributeEnum attr, const Glib::ustring& label,
const double lo, const double hi, const double step_inc,
@@ -2785,8 +2796,14 @@ void FilterEffectsDialog::init_settings_widgets()
_settings->type(NR_FILTER_IMAGE);
_settings->add_fileorelement(SP_ATTR_XLINK_HREF, _("Source of Image:"));
-
+ _image_x = _settings->add_entry(SP_ATTR_X,_("X"),_("X"));
+ _image_x->signal_attr_changed().connect(sigc::mem_fun(*this, &FilterEffectsDialog::image_x_changed));
+ //This commented because we want the default empty value of X or Y and couldent get it from SpinButton
+ //_image_y = _settings->add_spinbutton(0, SP_ATTR_Y, _("Y:"), -DBL_MAX, DBL_MAX, 1, 1, 5, _("Y"));
+ _image_y = _settings->add_entry(SP_ATTR_Y,_("Y"),_("Y"));
+ _image_y->signal_attr_changed().connect(sigc::mem_fun(*this, &FilterEffectsDialog::image_y_changed));
_settings->type(NR_FILTER_OFFSET);
+ _settings->add_checkbutton(false, SP_ATTR_PRESERVEALPHA, _("Preserve Alpha"), "true", "false", _("If set, the alpha channel won't be altered by this filter primitive."));
_settings->add_spinscale(0, SP_ATTR_DX, _("Delta X:"), -100, 100, 1, 0.01, 1, _("This is how far the input image gets shifted to the right"));
_settings->add_spinscale(0, SP_ATTR_DY, _("Delta Y:"), -100, 100, 1, 0.01, 1, _("This is how far the input image gets shifted downwards"));
@@ -2926,6 +2943,33 @@ void FilterEffectsDialog::convolve_order_changed()
_convolve_target->get_spinbuttons()[1]->get_adjustment()->set_upper(_convolve_order->get_spinbutton2().get_value() - 1);
}
+bool number_or_empy(const Glib::ustring& text) {
+ if (text.empty()) {
+ return true;
+ }
+ double n = atof( text.c_str() );
+ if (n == 0.0 && strcmp(text.c_str(), "0") != 0 && strcmp(text.c_str(), "0.0") != 0) {
+ return false;
+ }
+ else {
+ return true;
+ }
+}
+
+void FilterEffectsDialog::image_x_changed()
+{
+ if (number_or_empy(_image_x->get_text())) {
+ _image_x->set_from_attribute(_primitive_list.get_selected());
+ }
+}
+
+void FilterEffectsDialog::image_y_changed()
+{
+ if (number_or_empy(_image_y->get_text())) {
+ _image_y->set_from_attribute(_primitive_list.get_selected());
+ }
+}
+
void FilterEffectsDialog::set_attr_direct(const AttrWidget* input)
{
set_attr(_primitive_list.get_selected(), input->get_attribute(), input->get_as_attribute().c_str());
diff --git a/src/ui/dialog/filter-effects-dialog.h b/src/ui/dialog/filter-effects-dialog.h
index eae0fc317..32fabb741 100644
--- a/src/ui/dialog/filter-effects-dialog.h
+++ b/src/ui/dialog/filter-effects-dialog.h
@@ -35,6 +35,8 @@ namespace Inkscape {
namespace UI {
namespace Dialog {
+class EntryAttr;
+//class SpinButtonAttr;
class DualSpinButton;
class MultiSpinButton;
class FilterEffectsDialog : public UI::Widget::Panel {
@@ -258,6 +260,8 @@ private:
void remove_primitive();
void duplicate_primitive();
void convolve_order_changed();
+ void image_x_changed();
+ void image_y_changed();
void set_attr_direct(const UI::Widget::AttrWidget*);
void set_child_attr_direct(const UI::Widget::AttrWidget*);
@@ -308,6 +312,10 @@ private:
DualSpinButton* _convolve_order;
MultiSpinButton* _convolve_target;
+ // Image
+ EntryAttr* _image_x;
+ EntryAttr* _image_y;
+
// For controlling setting sensitivity
Gtk::Widget* _k1, *_k2, *_k3, *_k4;