index 68f7be4a946a05a79bc2d962ea91ece3e5362c0f..09b0ff5d40cc4216c382cdad10d86bbc2f86d2ea 100644 (file)
#include "node-context.h"
#include "desktop-handles.h"
#include "selection.h"
+#include "nodepath.h"
namespace Inkscape {
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;
PathParam::~PathParam()
{
- if (_tooltips)
- delete _tooltips;
- // _widget is managed by GTK so do not delete!
-
g_free(defvalue);
}
param_readSVGValue(defvalue);
}
+void
+PathParam::param_set_and_write_default()
+{
+ param_write_to_repr(defvalue);
+}
+
bool
PathParam::param_readSVGValue(const gchar * strvalue)
{
}
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<Gtk::HBox*>(_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<Gtk::HBox*>(_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<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true);
- _tooltips->set_tip(*pButton, _("Paste path"));
-
- static_cast<Gtk::HBox*>(_widget)->show_all_children();
+ Gtk::HBox * _widget = Gtk::manage(new Gtk::HBox());
+
+ Gtk::Label* pLabel = Gtk::manage(new Gtk::Label(param_label));
+ static_cast<Gtk::HBox*>(_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<Gtk::HBox*>(_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<Gtk::HBox*>(_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<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true);
+ tooltips->set_tip(*pButton, _("Paste path"));
+
+ static_cast<Gtk::HBox*>(_widget)->show_all_children();
- }
return dynamic_cast<Gtk::Widget *> (_widget);
}
}
void
-PathParam::param_write_to_repr(const char * svgd)
+PathParam::param_setup_nodepath(Inkscape::NodePath::Path *np)
{
- param_effect->getRepr()->setAttribute(param_key.c_str(), svgd);
+ np->show_helperpath = true;
+ np->helperpath_rgba = 0x009000ff;
+ np->helperpath_width = 1.0;
}
+void
+PathParam::param_transform_multiply(Geom::Matrix const& postmul, bool /*set*/)
+{
+ param_set_and_write_new_value( (*this) * postmul );
+}
void
PathParam::param_set_and_write_new_value (Geom::Piecewise<Geom::D2<Geom::SBasis> > newpath)
}
}
+void
+PathParam::on_copy_button_click()
+{
+ sp_selection_copy_lpe_pathparam(this);
+}
} /* namespace LivePathEffect */