diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2014-04-22 19:44:02 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2014-04-22 19:44:02 +0000 |
| commit | bb9297f7e0a297c85b5d40eab49677293effc88f (patch) | |
| tree | 72f4f3eb8fad7f0975e25ee010b88f6de0c3bc5c /src | |
| parent | align two buttons in LPE widget (diff) | |
| download | inkscape-bb9297f7e0a297c85b5d40eab49677293effc88f.tar.gz inkscape-bb9297f7e0a297c85b5d40eab49677293effc88f.zip | |
Redesign of the BSpline LPE widgets
(bzr r11950.1.335)
Diffstat (limited to 'src')
| -rw-r--r-- | src/live_effects/lpe-bspline.cpp | 57 | ||||
| -rw-r--r-- | src/live_effects/lpe-bspline.h | 4 |
2 files changed, 42 insertions, 19 deletions
diff --git a/src/live_effects/lpe-bspline.cpp b/src/live_effects/lpe-bspline.cpp index 00ebcd9ba..edf19d1e5 100644 --- a/src/live_effects/lpe-bspline.cpp +++ b/src/live_effects/lpe-bspline.cpp @@ -2,7 +2,8 @@ /* * Released under GNU GPL, read the file 'COPYING' for more information */ - +#include <gtkmm/box.h> +#include <gtkmm/entry.h> #include <gtkmm/box.h> #include <gtkmm/button.h> #include <gtkmm/checkbutton.h> @@ -59,10 +60,10 @@ LPEBSpline::LPEBSpline(LivePathEffectObject *lpeobject) false), weight(_("Change weight:"), _("Change weight of the effect"), "weight", &wr, this, 0.3334) { - registerParameter(dynamic_cast<Parameter *>(&ignoreCusp)); - registerParameter(dynamic_cast<Parameter *>(&onlySelected)); registerParameter(dynamic_cast<Parameter *>(&weight)); registerParameter(dynamic_cast<Parameter *>(&steps)); + registerParameter(dynamic_cast<Parameter *>(&ignoreCusp)); + registerParameter(dynamic_cast<Parameter *>(&onlySelected)); weight.param_set_range(0.0000, 1); weight.param_set_increments(0.1, 0.1); weight.param_set_digits(4); @@ -287,12 +288,32 @@ Gtk::Widget *LPEBSpline::newWidget() { if ((*it)->widget_is_visible) { Parameter *param = *it; Gtk::Widget *widg = dynamic_cast<Gtk::Widget *>(param->param_newWidget()); + if (param->param_key == "weight"){ + Gtk::HBox * buttons = Gtk::manage(new Gtk::HBox(true,0)); + Gtk::Button *defaultWeight = + Gtk::manage(new Gtk::Button(Glib::ustring(_("Default weight")))); + defaultWeight->signal_clicked() + .connect(sigc::bind<Gtk::Widget *>(sigc::mem_fun(*this, &LPEBSpline::toDefaultWeight), widg)); + buttons->pack_start(*defaultWeight, true, true, 2); + Gtk::Button *makeCusp = + Gtk::manage(new Gtk::Button(Glib::ustring(_("Make cusp")))); + makeCusp->signal_clicked() + .connect(sigc::bind<Gtk::Widget *>(sigc::mem_fun(*this, &LPEBSpline::toMakeCusp), widg)); + buttons->pack_start(*makeCusp, true, true, 2); + vbox->pack_start(*buttons, true, true, 2); + } if (param->param_key == "weight" || param->param_key == "steps") { Inkscape::UI::Widget::Scalar *widgRegistered = Gtk::manage(dynamic_cast<Inkscape::UI::Widget::Scalar *>(widg)); widgRegistered->signal_value_changed() .connect(sigc::mem_fun(*this, &LPEBSpline::toWeight)); widg = dynamic_cast<Gtk::Widget *>(widgRegistered); + if (widg){ + Gtk::HBox * scalarParameter = dynamic_cast<Gtk::HBox *>(widg); + std::vector< Gtk::Widget* > childList = scalarParameter->get_children(); + Gtk::Entry* entryWidg = dynamic_cast<Gtk::Entry *>(childList[1]); + entryWidg->set_width_chars(6); + } } if (param->param_key == "onlySelected") { Gtk::CheckButton *widgRegistered = @@ -318,24 +339,26 @@ Gtk::Widget *LPEBSpline::newWidget() { ++it; } - Gtk::HBox * buttons = Gtk::manage(new Gtk::HBox(true,0)); - Gtk::Button *defaultWeight = - Gtk::manage(new Gtk::Button(Glib::ustring(_("Default weight 0.3334")))); - defaultWeight->signal_clicked() - .connect(sigc::mem_fun(*this, &LPEBSpline::toDefaultWeight)); - buttons->pack_start(*defaultWeight, true, true, 2); - Gtk::Button *makeCusp = - Gtk::manage(new Gtk::Button(Glib::ustring(_("Make cusp")))); - makeCusp->signal_clicked() - .connect(sigc::mem_fun(*this, &LPEBSpline::toMakeCusp)); - buttons->pack_start(*makeCusp, true, true, 2); - vbox->pack_start(*buttons, true, true, 2); return dynamic_cast<Gtk::Widget *>(vbox); } -void LPEBSpline::toDefaultWeight() { changeWeight(0.3334); } +void LPEBSpline::toDefaultWeight(Gtk::Widget *widgWeight) { + weight.param_set_value(0.3334); + changeWeight(0.3334); + Gtk::HBox * scalarParameter = dynamic_cast<Gtk::HBox *>(widgWeight); + std::vector< Gtk::Widget* > childList = scalarParameter->get_children(); + Gtk::Entry* entryWidg = dynamic_cast<Gtk::Entry *>(childList[1]); + entryWidg->set_text("0.3334"); +} -void LPEBSpline::toMakeCusp() { changeWeight(0.0000); } +void LPEBSpline::toMakeCusp(Gtk::Widget *widgWeight) { + weight.param_set_value(0.0000); + changeWeight(0.0000); + Gtk::HBox * scalarParameter = dynamic_cast<Gtk::HBox *>(widgWeight); + std::vector< Gtk::Widget* > childList = scalarParameter->get_children(); + Gtk::Entry* entryWidg = dynamic_cast<Gtk::Entry *>(childList[1]); + entryWidg->set_text("0.0000"); +} void LPEBSpline::toWeight() { changeWeight(weight); } diff --git a/src/live_effects/lpe-bspline.h b/src/live_effects/lpe-bspline.h index 167810c49..aff4ce812 100644 --- a/src/live_effects/lpe-bspline.h +++ b/src/live_effects/lpe-bspline.h @@ -34,9 +34,9 @@ public: virtual void changeWeight(double weightValue); - virtual void toDefaultWeight(); + virtual void toDefaultWeight(Gtk::Widget *widgWeight); - virtual void toMakeCusp(); + virtual void toMakeCusp(Gtk::Widget *widgWeight); virtual void toWeight(); |
