summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 62b8487)
raw | patch | inline | side by side (parent: 62b8487)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Sat, 22 Mar 2008 21:19:28 +0000 (21:19 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Sat, 22 Mar 2008 21:19:28 +0000 (21:19 +0000) |
index 9b48327f693026713da3fb36b9dd9cf5866bfc2e..1dbdbd6aacb53ccf170cb1ee0c01e0d275958ed9 100644 (file)
Gtk::Widget *
PointParam::param_newWidget(Gtk::Tooltips * tooltips)
{
- Inkscape::UI::Widget::RegisteredPoint * pointwdg = Gtk::manage(
- new Inkscape::UI::Widget::RegisteredPoint( param_label,
- param_tooltip,
- param_key,
- *param_wr,
- param_effect->getRepr(),
- param_effect->getSPDoc() ) );
- pointwdg->setValue( (*this)[0], (*this)[1] );
+ Inkscape::UI::Widget::RegisteredTransformedPoint * pointwdg = Gtk::manage(
+ new Inkscape::UI::Widget::RegisteredTransformedPoint( param_label,
+ param_tooltip,
+ param_key,
+ *param_wr,
+ param_effect->getRepr(),
+ param_effect->getSPDoc() ) );
+ pointwdg->setValue( *this );
pointwdg->clearProgrammatically();
pointwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change point parameter"));
index 1efb26a78ae3c3749b892fdc3d07cf670eac61e0..508a8d96186abc0d68d26ee6a22f25f5b802d012 100644 (file)
--- a/src/ui/widget/point.cpp
+++ b/src/ui/widget/point.cpp
/** Sets the value of the spin button */
void
-Point::setValue(double xvalue, double yvalue)
+Point::setValue(Geom::Point & p)
{
- xwidget.setValue(xvalue);
- ywidget.setValue(yvalue);
+ xwidget.setValue(p[0]);
+ ywidget.setValue(p[1]);
}
/** Manually forces an update of the spin button */
diff --git a/src/ui/widget/point.h b/src/ui/widget/point.h
index a9be05afcec6aa44af9b703c60e6d6218c6b2bb2..57a46de766eb12263d42fc34742fa43412717519 100644 (file)
--- a/src/ui/widget/point.h
+++ b/src/ui/widget/point.h
void setDigits(unsigned digits);
void setIncrements(double step, double page);
void setRange(double min, double max);
- void setValue(double xvalue, double yvalue);
+ void setValue(Geom::Point & p);
void update();
index 1de084f5dfe2589e528ac19a7320b761302d00b4..1fd956897ea9f12982737148eb35d404faf76fa1 100644 (file)
@@ -481,7 +481,7 @@ RegisteredTransformedPoint::RegisteredTransformedPoint ( const Glib::ustring& la
const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in,
SPDocument* doc_in )
: RegisteredWidget<Point> (label, tip),
- transform(Geom::identity())
+ to_svg(Geom::identity())
{
init_parent(key, wr, repr_in, doc_in);
@@ -492,6 +492,25 @@ RegisteredTransformedPoint::RegisteredTransformedPoint ( const Glib::ustring& la
_value_y_changed_connection = signal_y_value_changed().connect (sigc::mem_fun (*this, &RegisteredTransformedPoint::on_value_changed));
}
+void
+RegisteredTransformedPoint::setValue(Geom::Point & p)
+{
+ Geom::Point new_p = p * to_svg.inverse();
+ Point::setValue(new_p); // the Point widget should display things in canvas coordinates
+}
+
+void
+RegisteredTransformedPoint::setTransform(Geom::Matrix & canvas_to_svg)
+{
+ // check if matrix is singular / has inverse
+ if ( ! canvas_to_svg.isSingular() ) {
+ to_svg = canvas_to_svg;
+ } else {
+ // set back to default
+ to_svg = Geom::identity();
+ }
+}
+
void
RegisteredTransformedPoint::on_value_changed()
{
_wr->setUpdating (true);
- Geom::Point pos = getValue() * transform;
+ Geom::Point pos = getValue() * to_svg;
Inkscape::SVGOStringStream os;
os << pos;
index f348956201c64c57d095884c798dc038fdb710fb..d5f7591eecb0bb85e30383bbfdaae2a15d930a55 100644 (file)
Inkscape::XML::Node* repr_in = NULL,
SPDocument *doc_in = NULL );
+ // redefine setValue, because transform must be applied
+ void setValue(Geom::Point & p);
+
+ void setTransform(Geom::Matrix & canvas_to_svg);
+
protected:
sigc::connection _value_x_changed_connection;
sigc::connection _value_y_changed_connection;
void on_value_changed();
- Geom::Matrix transform;
+ Geom::Matrix to_svg;
};