Code

r17645@shi: ted | 2008-01-14 22:05:15 -0800
[inkscape.git] / src / seltrans.h
index ccb00708e70c54a112d4268f8ef8b318590fe81e..58a6d5d29b4fb6e1be2ccaa674f1a47448f6b499 100644 (file)
@@ -8,6 +8,7 @@
  *   Lauris Kaplinski <lauris@kaplinski.com>
  *   Carl Hetherington <inkscape@carlh.net>
  *
+ * Copyright (C) 2006      Johan Engelen <johan@shouraizou.nl>
  * Copyright (C) 1999-2002 Lauris Kaplinski
  *
  * Released under GNU GPL, read the file 'COPYING' for more information
@@ -17,6 +18,7 @@
 #include <libnr/nr-point.h>
 #include <libnr/nr-matrix.h>
 #include <libnr/nr-rect.h>
+#include "knot.h"
 #include "forward.h"
 #include "selcue.h"
 #include "message-context.h"
@@ -57,13 +59,13 @@ public:
     void scale(NR::Point &pt, guint state);
     void skew(SPSelTransHandle const &handle, NR::Point &pt, guint state);
     void rotate(NR::Point &pt, guint state);
-    bool scaleRequest(NR::Point &pt, guint state);
-    bool stretchRequest(SPSelTransHandle const &handle, NR::Point &pt, guint state);
-    bool skewRequest(SPSelTransHandle const &handle, NR::Point &pt, guint state);
-    bool rotateRequest(NR::Point &pt, guint state);
-    bool centerRequest(NR::Point &pt, guint state);
+    gboolean scaleRequest(NR::Point &pt, guint state);
+    gboolean stretchRequest(SPSelTransHandle const &handle, NR::Point &pt, guint state);
+    gboolean skewRequest(SPSelTransHandle const &handle, NR::Point &pt, guint state);
+    gboolean rotateRequest(NR::Point &pt, guint state);
+    gboolean centerRequest(NR::Point &pt, guint state);
 
-    bool handleRequest(SPKnot *knot, NR::Point *position, guint state, SPSelTransHandle const &handle);
+    gboolean handleRequest(SPKnot *knot, NR::Point *position, guint state, SPSelTransHandle const &handle);
     void handleGrab(SPKnot *knot, guint state, SPSelTransHandle const &handle);
     void handleClick(SPKnot *knot, guint state, SPSelTransHandle const &handle);
     void handleNewEvent(SPKnot *knot, NR::Point *position, guint state, SPSelTransHandle const &handle);
@@ -80,7 +82,13 @@ public:
     bool isEmpty() {
         return _empty;
     }
-    
+    bool isGrabbed() {
+        return _grabbed;    
+    }
+       bool centerIsVisible() {
+               return ( _chandle && SP_KNOT_IS_VISIBLE (_chandle) );
+       }
+
 private:
     void _updateHandles();
     void _updateVolatileState();
@@ -113,12 +121,20 @@ private:
     bool _empty;
     bool _changed;
 
-    NR::Rect _box;
+    SPItem::BBoxType _snap_bbox_type;
+    
+    NR::Maybe<NR::Rect> _bbox;
+    NR::Maybe<NR::Rect> _approximate_bbox;
     gdouble _strokewidth;
     NR::Matrix _current;
     NR::Point _opposite; ///< opposite point to where a scale is taking place
 
-    NR::Point _center;
+    NR::Point _opposite_for_specpoints;
+    NR::Point _opposite_for_bboxpoints;
+    NR::Point _origin_for_specpoints;
+    NR::Point _origin_for_bboxpoints;
+
+    NR::Maybe<NR::Point> _center;
     bool _center_is_set; ///< we've already set _center, no need to reread it from items
 
     SPKnot *_shandle[8];
@@ -129,7 +145,7 @@ private:
     SPCanvasItem *_l[4];
     guint _sel_changed_id;
     guint _sel_modified_id;
-    GSList *_stamp_cache;    
+    GSList *_stamp_cache;
 
     NR::Point _origin; ///< position of origin for transforms
     NR::Point _point; ///< original position of the knot being used for the current transform