X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Flive_effects%2Fparameter%2Fpath.cpp;h=09b0ff5d40cc4216c382cdad10d86bbc2f86d2ea;hb=74ed5bd66f5d8a1465b69bd0450f2af030b638f0;hp=1f0e6f3be181c658c9404ee42bc717bd52e1af8a;hpb=0903335a0099bd7ee779925f43a15a2216a0e863;p=inkscape.git diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp index 1f0e6f3be..09b0ff5d4 100644 --- a/src/live_effects/parameter/path.cpp +++ b/src/live_effects/parameter/path.cpp @@ -42,9 +42,6 @@ PathParam::PathParam( const Glib::ustring& label, const Glib::ustring& tip, Effect* effect, const gchar * default_value) : Parameter(label, tip, key, wr, effect) { - _widget = NULL; - _tooltips = NULL; - edit_button = NULL; defvalue = g_strdup(default_value); param_readSVGValue(defvalue); oncanvas_editable = true; @@ -52,10 +49,6 @@ PathParam::PathParam( const Glib::ustring& label, const Glib::ustring& tip, PathParam::~PathParam() { - if (_tooltips) - delete _tooltips; - // _widget is managed by GTK so do not delete! - g_free(defvalue); } @@ -65,6 +58,12 @@ PathParam::param_set_default() param_readSVGValue(defvalue); } +void +PathParam::param_set_and_write_default() +{ + param_write_to_repr(defvalue); +} + bool PathParam::param_readSVGValue(const gchar * strvalue) { @@ -92,40 +91,46 @@ PathParam::param_writeSVGValue() const } Gtk::Widget * -PathParam::param_getWidget() +PathParam::param_newWidget(Gtk::Tooltips * tooltips) { - if (!_widget) { - _widget = Gtk::manage(new Gtk::HBox()); - _tooltips = new Gtk::Tooltips(); - - Gtk::Label* pLabel = Gtk::manage(new Gtk::Label(param_label)); - static_cast(_widget)->pack_start(*pLabel, true, true); - _tooltips->set_tip(*pLabel, param_tooltip); - - Gtk::Widget* pIcon = Gtk::manage( sp_icon_get_icon( "draw_node", 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(_widget)->pack_start(*pButton, true, true); - _tooltips->set_tip(*pButton, _("Edit on-canvas")); - edit_button = pButton; - - pIcon = Gtk::manage( sp_icon_get_icon( GTK_STOCK_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(_widget)->pack_start(*pButton, true, true); - _tooltips->set_tip(*pButton, _("Paste path")); - - static_cast(_widget)->show_all_children(); + Gtk::HBox * _widget = Gtk::manage(new Gtk::HBox()); + + Gtk::Label* pLabel = Gtk::manage(new Gtk::Label(param_label)); + static_cast(_widget)->pack_start(*pLabel, true, true); + tooltips->set_tip(*pLabel, param_tooltip); + + Gtk::Widget* pIcon = Gtk::manage( sp_icon_get_icon( "draw_node", 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(_widget)->pack_start(*pButton, true, true); + tooltips->set_tip(*pButton, _("Edit on-canvas")); + + pIcon = Gtk::manage( sp_icon_get_icon( GTK_STOCK_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(_widget)->pack_start(*pButton, true, true); + tooltips->set_tip(*pButton, _("Copy path")); + + pIcon = Gtk::manage( sp_icon_get_icon( GTK_STOCK_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(_widget)->pack_start(*pButton, true, true); + tooltips->set_tip(*pButton, _("Paste path")); + + static_cast(_widget)->show_all_children(); - } return dynamic_cast (_widget); } @@ -205,6 +210,11 @@ PathParam::on_paste_button_click() } } +void +PathParam::on_copy_button_click() +{ + sp_selection_copy_lpe_pathparam(this); +} } /* namespace LivePathEffect */