diff options
| author | Jabiertxof <jtx@jtx> | 2017-05-29 00:11:53 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx> | 2017-05-29 00:11:53 +0000 |
| commit | 802385842d5a2fbe8def45b72ce433260720c954 (patch) | |
| tree | 12d3247409e5e3fb5f6858fdef7c0e0b72dad570 /src/live_effects/parameter | |
| parent | Order LPE parameters (diff) | |
| download | inkscape-802385842d5a2fbe8def45b72ce433260720c954.tar.gz inkscape-802385842d5a2fbe8def45b72ce433260720c954.zip | |
Initial release
(bzr r15704)
Diffstat (limited to 'src/live_effects/parameter')
| -rw-r--r-- | src/live_effects/parameter/bool.cpp | 6 | ||||
| -rw-r--r-- | src/live_effects/parameter/bool.h | 4 | ||||
| -rw-r--r-- | src/live_effects/parameter/hidden.cpp | 8 | ||||
| -rw-r--r-- | src/live_effects/parameter/hidden.h | 5 | ||||
| -rw-r--r-- | src/live_effects/parameter/parameter.cpp | 13 | ||||
| -rw-r--r-- | src/live_effects/parameter/parameter.h | 9 | ||||
| -rw-r--r-- | src/live_effects/parameter/path.cpp | 104 | ||||
| -rw-r--r-- | src/live_effects/parameter/path.h | 6 | ||||
| -rw-r--r-- | src/live_effects/parameter/satellitesarray.cpp | 1 | ||||
| -rw-r--r-- | src/live_effects/parameter/satellitesarray.h | 1 |
10 files changed, 92 insertions, 65 deletions
diff --git a/src/live_effects/parameter/bool.cpp b/src/live_effects/parameter/bool.cpp index 3184bfa80..954947cf4 100644 --- a/src/live_effects/parameter/bool.cpp +++ b/src/live_effects/parameter/bool.cpp @@ -21,8 +21,8 @@ namespace LivePathEffect { BoolParam::BoolParam( const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Inkscape::UI::Widget::Registry* wr, - Effect* effect, bool default_value , bool no_widget) - : Parameter(label, tip, key, wr, effect), value(default_value), defvalue(default_value), hide_widget(no_widget) + Effect* effect, bool default_value) + : Parameter(label, tip, key, wr, effect), value(default_value), defvalue(default_value) { } @@ -65,7 +65,7 @@ BoolParam::param_getSVGValue() const Gtk::Widget * BoolParam::param_newWidget() { - if(!hide_widget){ + if(widget_is_visible){ Inkscape::UI::Widget::RegisteredCheckButton * checkwdg = Gtk::manage( new Inkscape::UI::Widget::RegisteredCheckButton( param_label, param_tooltip, diff --git a/src/live_effects/parameter/bool.h b/src/live_effects/parameter/bool.h index 39f328eaa..417752050 100644 --- a/src/live_effects/parameter/bool.h +++ b/src/live_effects/parameter/bool.h @@ -25,8 +25,7 @@ public: const Glib::ustring& key, Inkscape::UI::Widget::Registry* wr, Effect* effect, - bool default_value = false, - bool no_widget = false); + bool default_value = false); virtual ~BoolParam(); virtual Gtk::Widget * param_newWidget(); @@ -47,7 +46,6 @@ private: bool value; bool defvalue; - bool hide_widget; }; diff --git a/src/live_effects/parameter/hidden.cpp b/src/live_effects/parameter/hidden.cpp index 2f218847a..e8c55ebd3 100644 --- a/src/live_effects/parameter/hidden.cpp +++ b/src/live_effects/parameter/hidden.cpp @@ -22,11 +22,12 @@ namespace LivePathEffect { HiddenParam::HiddenParam( const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Inkscape::UI::Widget::Registry* wr, - Effect* effect, const Glib::ustring default_value ) + Effect* effect, const Glib::ustring default_value, bool is_visible) : Parameter(label, tip, key, wr, effect), value(default_value), defvalue(default_value) { + param_widget_is_visible(is_visible); } void @@ -65,9 +66,12 @@ HiddenParam::param_newWidget() } void -HiddenParam::param_setValue(const Glib::ustring newvalue) +HiddenParam::param_setValue(const Glib::ustring newvalue, bool write) { value = newvalue; + if (write) { + param_write_to_repr(value.c_str()); + } } } /* namespace LivePathEffect */ diff --git a/src/live_effects/parameter/hidden.h b/src/live_effects/parameter/hidden.h index d565272b6..c3fba5575 100644 --- a/src/live_effects/parameter/hidden.h +++ b/src/live_effects/parameter/hidden.h @@ -29,7 +29,8 @@ public: const Glib::ustring& key, Inkscape::UI::Widget::Registry* wr, Effect* effect, - const Glib::ustring default_value = ""); + const Glib::ustring default_value = "", + bool widget_is_visible = false); virtual ~HiddenParam() {} virtual Gtk::Widget * param_newWidget(); @@ -37,7 +38,7 @@ public: virtual bool param_readSVGValue(const gchar * strvalue); virtual gchar * param_getSVGValue() const; - void param_setValue(Glib::ustring newvalue); + void param_setValue(Glib::ustring newvalue, bool write = false); virtual void param_set_default(); virtual void param_update_default(const gchar * default_value); diff --git a/src/live_effects/parameter/parameter.cpp b/src/live_effects/parameter/parameter.cpp index 45f46a0a7..2f73488aa 100644 --- a/src/live_effects/parameter/parameter.cpp +++ b/src/live_effects/parameter/parameter.cpp @@ -55,7 +55,7 @@ void Parameter::write_to_SVG(void) */ ScalarParam::ScalarParam( const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Inkscape::UI::Widget::Registry* wr, - Effect* effect, gdouble default_value, bool no_widget) + Effect* effect, gdouble default_value) : Parameter(label, tip, key, wr, effect), value(default_value), min(-SCALARPARAM_G_MAXDOUBLE), @@ -66,8 +66,7 @@ ScalarParam::ScalarParam( const Glib::ustring& label, const Glib::ustring& tip, inc_step(0.1), inc_page(1), add_slider(false), - overwrite_widget(false), - hide_widget(no_widget) + _set_undo(true) { } @@ -164,15 +163,15 @@ ScalarParam::param_make_integer(bool yes) } void -ScalarParam::param_overwrite_widget(bool overwrite_widget) +ScalarParam::param_set_undo(bool set_undo) { - this->overwrite_widget = overwrite_widget; + _set_undo = set_undo; } Gtk::Widget * ScalarParam::param_newWidget() { - if(!hide_widget){ + if(widget_is_visible){ Inkscape::UI::Widget::RegisteredScalar *rsu = Gtk::manage( new Inkscape::UI::Widget::RegisteredScalar( param_label, param_tooltip, param_key, *param_wr, param_effect->getRepr(), param_effect->getSPDoc() ) ); @@ -184,7 +183,7 @@ ScalarParam::param_newWidget() if (add_slider) { rsu->addSlider(); } - if(!overwrite_widget){ + if(_set_undo){ rsu->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change scalar parameter")); } return dynamic_cast<Gtk::Widget *> (rsu); diff --git a/src/live_effects/parameter/parameter.h b/src/live_effects/parameter/parameter.h index ee1d2d547..7ab7e30dd 100644 --- a/src/live_effects/parameter/parameter.h +++ b/src/live_effects/parameter/parameter.h @@ -57,6 +57,7 @@ public: virtual bool param_readSVGValue(const gchar * strvalue) = 0; // returns true if new value is valid / accepted. virtual gchar * param_getSVGValue() const = 0; + virtual void param_widget_is_visible(bool is_visible) {widget_is_visible = is_visible;} void write_to_SVG(); virtual void param_set_default() = 0; @@ -103,8 +104,7 @@ public: const Glib::ustring& key, Inkscape::UI::Widget::Registry* wr, Effect* effect, - gdouble default_value = 1.0, - bool no_widget = false); + gdouble default_value = 1.0); virtual ~ScalarParam(); virtual bool param_readSVGValue(const gchar * strvalue); @@ -121,7 +121,7 @@ public: void addSlider(bool add_slider_widget) { add_slider = add_slider_widget; }; double param_get_max() { return max; }; double param_get_min() { return min; }; - void param_overwrite_widget(bool overwrite_widget); + void param_set_undo(bool set_undo); virtual Gtk::Widget * param_newWidget(); inline operator gdouble() const { return value; }; @@ -136,8 +136,7 @@ protected: double inc_step; double inc_page; bool add_slider; - bool overwrite_widget; - bool hide_widget; + bool _set_undo; private: ScalarParam(const ScalarParam&); diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp index 6e90c9279..54f5d93e8 100644 --- a/src/live_effects/parameter/path.cpp +++ b/src/live_effects/parameter/path.cpp @@ -69,7 +69,10 @@ PathParam::PathParam( const Glib::ustring& label, const Glib::ustring& tip, defvalue = g_strdup(default_value); param_readSVGValue(defvalue); oncanvas_editable = true; - + _edit_button = true; + _copy_button = true; + _paste_button = true; + _link_button = true; ref_changed_connection = ref.changedSignal().connect(sigc::mem_fun(*this, &PathParam::ref_changed)); } @@ -167,6 +170,15 @@ PathParam::param_getSVGValue() const } } +void +PathParam::set_buttons(bool edit_button, bool copy_button, bool paste_button, bool link_button) +{ + _edit_button = edit_button; + _copy_button = copy_button; + _paste_button = paste_button; + _link_button = link_button; +} + Gtk::Widget * PathParam::param_newWidget() { @@ -175,47 +187,55 @@ PathParam::param_newWidget() Gtk::Label* pLabel = Gtk::manage(new Gtk::Label(param_label)); static_cast<Gtk::HBox*>(_widget)->pack_start(*pLabel, true, true); pLabel->set_tooltip_text(param_tooltip); - - Gtk::Widget* pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("tool-node-editor"), Inkscape::ICON_SIZE_BUTTON) ); - Gtk::Button * pButton = Gtk::manage(new Gtk::Button()); - pButton->set_relief(Gtk::RELIEF_NONE); - pIcon->show(); - pButton->add(*pIcon); - pButton->show(); - pButton->signal_clicked().connect(sigc::mem_fun(*this, &PathParam::on_edit_button_click)); - static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true); - pButton->set_tooltip_text(_("Edit on-canvas")); - - pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("edit-copy"), Inkscape::ICON_SIZE_BUTTON) ); - pButton = Gtk::manage(new Gtk::Button()); - pButton->set_relief(Gtk::RELIEF_NONE); - pIcon->show(); - pButton->add(*pIcon); - pButton->show(); - pButton->signal_clicked().connect(sigc::mem_fun(*this, &PathParam::on_copy_button_click)); - static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true); - pButton->set_tooltip_text(_("Copy path")); - - pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("edit-paste"), Inkscape::ICON_SIZE_BUTTON) ); - pButton = Gtk::manage(new Gtk::Button()); - pButton->set_relief(Gtk::RELIEF_NONE); - pIcon->show(); - pButton->add(*pIcon); - pButton->show(); - pButton->signal_clicked().connect(sigc::mem_fun(*this, &PathParam::on_paste_button_click)); - static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true); - pButton->set_tooltip_text(_("Paste path")); - - pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("edit-clone"), Inkscape::ICON_SIZE_BUTTON) ); - pButton = Gtk::manage(new Gtk::Button()); - pButton->set_relief(Gtk::RELIEF_NONE); - pIcon->show(); - pButton->add(*pIcon); - pButton->show(); - pButton->signal_clicked().connect(sigc::mem_fun(*this, &PathParam::on_link_button_click)); - static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true); - pButton->set_tooltip_text(_("Link to path on clipboard")); - + Gtk::Widget * pIcon = NULL; + Gtk::Button * pButton = NULL; + if (_edit_button) { + pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("tool-node-editor"), Inkscape::ICON_SIZE_BUTTON) ); + pButton = Gtk::manage(new Gtk::Button()); + pButton->set_relief(Gtk::RELIEF_NONE); + pIcon->show(); + pButton->add(*pIcon); + pButton->show(); + pButton->signal_clicked().connect(sigc::mem_fun(*this, &PathParam::on_edit_button_click)); + static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true); + pButton->set_tooltip_text(_("Edit on-canvas")); + } + + if (_copy_button) { + pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("edit-copy"), Inkscape::ICON_SIZE_BUTTON) ); + pButton = Gtk::manage(new Gtk::Button()); + pButton->set_relief(Gtk::RELIEF_NONE); + pIcon->show(); + pButton->add(*pIcon); + pButton->show(); + pButton->signal_clicked().connect(sigc::mem_fun(*this, &PathParam::on_copy_button_click)); + static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true); + pButton->set_tooltip_text(_("Copy path")); + } + + if (_paste_button) { + pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("edit-paste"), Inkscape::ICON_SIZE_BUTTON) ); + pButton = Gtk::manage(new Gtk::Button()); + pButton->set_relief(Gtk::RELIEF_NONE); + pIcon->show(); + pButton->add(*pIcon); + pButton->show(); + pButton->signal_clicked().connect(sigc::mem_fun(*this, &PathParam::on_paste_button_click)); + static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true); + pButton->set_tooltip_text(_("Paste path")); + } + if (_link_button) { + pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("edit-clone"), Inkscape::ICON_SIZE_BUTTON) ); + pButton = Gtk::manage(new Gtk::Button()); + pButton->set_relief(Gtk::RELIEF_NONE); + pIcon->show(); + pButton->add(*pIcon); + pButton->show(); + pButton->signal_clicked().connect(sigc::mem_fun(*this, &PathParam::on_link_button_click)); + static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true); + pButton->set_tooltip_text(_("Link to path on clipboard")); + } + static_cast<Gtk::HBox*>(_widget)->show_all_children(); return dynamic_cast<Gtk::Widget *> (_widget); diff --git a/src/live_effects/parameter/path.h b/src/live_effects/parameter/path.h index 5381a6b36..ff5e4f1b8 100644 --- a/src/live_effects/parameter/path.h +++ b/src/live_effects/parameter/path.h @@ -44,7 +44,7 @@ public: void param_set_and_write_default(); void set_new_value (Geom::PathVector const &newpath, bool write_to_svg); void set_new_value (Geom::Piecewise<Geom::D2<Geom::SBasis> > const &newpath, bool write_to_svg); - + void set_buttons(bool edit_button, bool copy_button, bool paste_button, bool link_button); virtual void param_editOncanvas(SPItem * item, SPDesktop * dt); virtual void param_setup_nodepath(Inkscape::NodePath::Path *np); virtual void addCanvasIndicators(SPLPEItem const* lpeitem, std::vector<Geom::PathVector> &hp_vec); @@ -91,6 +91,10 @@ protected: gchar * defvalue; private: + bool _edit_button; + bool _copy_button; + bool _paste_button; + bool _link_button; PathParam(const PathParam&); PathParam& operator=(const PathParam&); }; diff --git a/src/live_effects/parameter/satellitesarray.cpp b/src/live_effects/parameter/satellitesarray.cpp index 7626317a1..ce4da243e 100644 --- a/src/live_effects/parameter/satellitesarray.cpp +++ b/src/live_effects/parameter/satellitesarray.cpp @@ -37,6 +37,7 @@ SatellitesArrayParam::SatellitesArrayParam(const Glib::ustring &label, _current_zoom = 0; _effectType = FILLET_CHAMFER; _last_pathvector_satellites = NULL; + param_widget_is_visible(false); } diff --git a/src/live_effects/parameter/satellitesarray.h b/src/live_effects/parameter/satellitesarray.h index 5ae372ac2..300a7a9dd 100644 --- a/src/live_effects/parameter/satellitesarray.h +++ b/src/live_effects/parameter/satellitesarray.h @@ -57,6 +57,7 @@ public: void setEffectType(EffectType et); void setPathVectorSatellites(PathVectorSatellites *pathVectorSatellites, bool write = true); void set_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color); + bool widget_is_visible; friend class FilletChamferKnotHolderEntity; friend class LPEFilletChamfer; |
