Code

RegisteredWidget has been renamed to RegisteredWdg. This is a deprecated class, all...
[inkscape.git] / src / live_effects / parameter / point.cpp
index caa81692fdeb6e57e5cff3be2052a7c649c5aac2..5284bc7975ea9244257de670ae2e1c2989456357 100644 (file)
@@ -80,8 +80,10 @@ PointParam::param_writeSVGValue() const
 }
 
 Gtk::Widget *
-PointParam::param_getWidget()
+PointParam::param_newWidget(Gtk::Tooltips * tooltips)
 {
+    // WIDGET TODO: This implementation is incorrect, it should create a *new* widget for the caller, not just return an already created widget
+    g_warning("PointParam::param_newWidget still needs recoding to work with multiple document views");
     if (!_widget) {
         pointwdg = new Inkscape::UI::Widget::RegisteredPoint();
         pointwdg->init(param_label, param_tooltip, param_key, *param_wr, param_effect->getRepr(), param_effect->getSPDoc());
@@ -104,8 +106,7 @@ PointParam::param_getWidget()
         static_cast<Gtk::HBox*>(_widget)->pack_start(*(pointwdg->getPoint()), true, true);
         static_cast<Gtk::HBox*>(_widget)->show_all_children();
 
-        _tooltips = new Gtk::Tooltips();
-        _tooltips->set_tip(*pButton, _("Edit on-canvas"));
+        tooltips->set_tip(*pButton, _("Edit on-canvas"));
     }
     return dynamic_cast<Gtk::Widget *> (_widget);
 }
@@ -118,6 +119,22 @@ PointParam::param_setValue(Geom::Point newpoint)
         pointwdg->setValue(newpoint[0], newpoint[1]);
 }
 
+void
+PointParam::param_set_and_write_new_value (Geom::Point newpoint)
+{
+    Inkscape::SVGOStringStream os;
+    os << newpoint[0] << "," << newpoint[1];
+    gchar * str = g_strdup(os.str().c_str());
+    param_write_to_repr(str);
+    g_free(str);
+}
+
+void
+PointParam::param_transform_multiply(Geom::Matrix const& postmul, bool /*set*/)
+{
+    param_set_and_write_new_value( (*this) * postmul );
+}
+
 
 // CALLBACKS:
 
@@ -135,7 +152,7 @@ PointParam::on_button_click()
         sp_knot_update_ctrl(knot);
 
         // move knot to the given point
-        sp_knot_set_position (knot, &NR::Point((*this)[0], (*this)[1]), SP_KNOT_STATE_NORMAL);
+        sp_knot_set_position (knot, &NR::Point(*static_cast<Geom::Point*>(this)), SP_KNOT_STATE_NORMAL);
         sp_knot_show (knot);
 /*
         // connect knot's signals