X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fui%2Ftool%2Ftransform-handle-set.cpp;h=1af848b964d0a0930d6088df5365ef150dfcc55b;hb=f83661e8aeee6ba14365a52f184800033cd00609;hp=cf8907299cbe60af7f5e31f174d83b349718bea7;hpb=9c07ca6fa6d1f672d40c8c11a907c6bbc3592a6f;p=inkscape.git diff --git a/src/ui/tool/transform-handle-set.cpp b/src/ui/tool/transform-handle-set.cpp index cf8907299..1af848b96 100644 --- a/src/ui/tool/transform-handle-set.cpp +++ b/src/ui/tool/transform-handle-set.cpp @@ -84,17 +84,6 @@ public: , _th(th) { setVisible(false); - signal_grabbed.connect( - sigc::bind_return( - sigc::hide( - sigc::mem_fun(*this, &TransformHandle::_grabbedHandler)), - false)); - signal_dragged.connect( - sigc::hide<0>( - sigc::mem_fun(*this, &TransformHandle::_draggedHandler))); - signal_ungrabbed.connect( - sigc::hide( - sigc::mem_fun(*this, &TransformHandle::_ungrabbedHandler))); } protected: virtual void startTransform() {} @@ -106,7 +95,7 @@ protected: Geom::Point _origin; TransformHandleSet &_th; private: - void _grabbedHandler() { + virtual bool grabbed(GdkEventMotion *) { _origin = position(); _last_transform.setIdentity(); startTransform(); @@ -114,8 +103,9 @@ private: _th._setActiveHandle(this); _cset = &invisible_cset; _setState(_state); + return false; } - void _draggedHandler(Geom::Point &new_pos, GdkEventMotion *event) + virtual void dragged(Geom::Point &new_pos, GdkEventMotion *event) { Geom::Matrix t = computeTransform(new_pos, event); // protect against degeneracies @@ -125,7 +115,7 @@ private: _th.signal_transform.emit(incr); _last_transform = t; } - void _ungrabbedHandler() { + virtual void ungrabbed(GdkEventButton *) { _th._clearActiveHandle(); _cset = &thandle_cset; _setState(_state); @@ -160,10 +150,12 @@ protected: } return C_("Transform handle tip", "Scale handle: drag to scale the selection"); } - virtual Glib::ustring _getDragTip(GdkEventMotion *event) { + + virtual Glib::ustring _getDragTip(GdkEventMotion */*event*/) { return format_tip(C_("Transform handle tip", "Scale by %.2f%% x %.2f%%"), _last_scale_x * 100, _last_scale_y * 100); } + virtual bool _hasDragTips() { return true; } static double _last_scale_x, _last_scale_y; @@ -289,11 +281,13 @@ public: , _corner(corner) {} protected: + virtual void startTransform() { _rot_center = _th.rotationCenter(); _rot_opposite = _th.bounds().corner(_corner + 2); _last_angle = 0; } + virtual Geom::Matrix computeTransform(Geom::Point const &new_pos, GdkEventMotion *event) { Geom::Point rotc = held_shift(*event) ? _rot_opposite : _rot_center; @@ -307,7 +301,9 @@ protected: * Geom::Translate(rotc); return t; } + virtual CommitEvent getCommitEvent() { return COMMIT_MOUSE_ROTATE; } + virtual Glib::ustring _getTip(unsigned state) { if (state_held_shift(state)) { if (state_held_control(state)) { @@ -324,11 +320,14 @@ protected: return C_("Transform handle tip", "Rotation handle: drag to rotate " "the selection around the rotation center"); } - virtual Glib::ustring _getDragTip(GdkEventMotion *event) { + + virtual Glib::ustring _getDragTip(GdkEventMotion */*event*/) { return format_tip(C_("Transform handle tip", "Rotate by %.2f°"), _last_angle * 360.0); } + virtual bool _hasDragTips() { return true; } + private: static Glib::RefPtr _corner_to_pixbuf(unsigned c) { sp_select_context_get_type(); @@ -352,7 +351,9 @@ public: : TransformHandle(th, side_to_anchor(side), _side_to_pixbuf(side)) , _side(side) {} + protected: + virtual void startTransform() { _skew_center = _th.rotationCenter(); Geom::Rect b = _th.bounds(); @@ -360,6 +361,7 @@ protected: _last_angle = 0; _last_horizontal = _side % 2; } + virtual Geom::Matrix computeTransform(Geom::Point const &new_pos, GdkEventMotion *event) { Geom::Point scc = held_shift(*event) ? _skew_center : _skew_opposite; @@ -403,11 +405,13 @@ protected: * Geom::Translate(scc); return t; } + virtual CommitEvent getCommitEvent() { return _side % 2 ? COMMIT_MOUSE_SKEW_Y : COMMIT_MOUSE_SKEW_X; } + virtual Glib::ustring _getTip(unsigned state) { if (state_held_shift(state)) { if (state_held_control(state)) { @@ -425,7 +429,8 @@ protected: "Skew handle: drag to skew (shear) selection about " "the opposite handle"); } - virtual Glib::ustring _getDragTip(GdkEventMotion *event) { + + virtual Glib::ustring _getDragTip(GdkEventMotion */*event*/) { if (_last_horizontal) { return format_tip(C_("Transform handle tip", "Skew horizontally by %.2f°"), _last_angle * 360.0); @@ -434,8 +439,11 @@ protected: _last_angle * 360.0); } } + virtual bool _hasDragTips() { return true; } + private: + static Glib::RefPtr _side_to_pixbuf(unsigned s) { sp_select_context_get_type(); switch (s % 4) { @@ -463,16 +471,21 @@ public: { setVisible(false); } + protected: - virtual Glib::ustring _getTip(unsigned state) { + + virtual Glib::ustring _getTip(unsigned /*state*/) { return C_("Transform handle tip", "Rotation center: drag to change the origin of transforms"); } + private: + static Glib::RefPtr _get_pixbuf() { sp_select_context_get_type(); return Glib::wrap(handles[12], true); } + TransformHandleSet &_th; };