Code

fix inheriting paintservers
[inkscape.git] / src / selection.h
index c78a1fdbb04fd09fa0219768b1addd85a55b062b..d8427108f344eece726a6846e5e5b66f2ded30ed 100644 (file)
@@ -17,6 +17,7 @@
  */
 
 #include <vector>
+#include <map>
 #include <sigc++/sigc++.h>
 
 #include "libnr/nr-rect.h"
@@ -27,6 +28,7 @@
 #include "gc-anchored.h"
 #include "gc-soft-ptr.h"
 #include "util/list.h"
+#include "sp-item.h"
 
 class SPItem;
 
@@ -70,7 +72,7 @@ public:
     ~Selection();
 
     /**
-     * @brief Returns the desktop the seoection is bound to
+     * @brief Returns the desktop the selection is bound to
      *
      * @return the desktop the selection is bound to
      */
@@ -230,28 +232,28 @@ public:
     guint numberOfParents();
 
     /** @brief Returns the bounding rectangle of the selection */
-    NRRect *bounds(NRRect *dest) const;
+    NRRect *bounds(NRRect *dest, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) const;
     /** @brief Returns the bounding rectangle of the selection */
-    ::NR::Rect bounds() const;
+    NR::Maybe<NR::Rect> bounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) const;
 
     /**
      * @brief Returns the bounding rectangle of the selection
      *
      * \todo how is this different from bounds()?
      */ 
-    NRRect *boundsInDocument(NRRect *dest) const;
+    NRRect *boundsInDocument(NRRect *dest, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) const;
 
     /**
      * @brief Returns the bounding rectangle of the selection
      *
      * \todo how is this different from bounds()?
      */
-    ::NR::Rect boundsInDocument() const;
+    NR::Maybe<NR::Rect> boundsInDocument(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) const;
 
     /**
      * @brief Returns the rotation/skew center of the selection
      */
-    ::NR::Point center() const;
+    NR::Maybe<NR::Point> center() const;
 
     /**
      * @brief Gets the selection's snap points.
@@ -265,12 +267,6 @@ public:
      */
     std::vector<NR::Point> getSnapPointsConvexHull() const;
 
-    /**
-     * @return A vector containing the top-left and bottom-right
-     * corners of each selected object's bounding box.
-     */
-    std::vector<NR::Point> getBBoxPoints() const;
-
     /**
      * @brief Connects a slot to be notified of selection changes
      *
@@ -312,11 +308,7 @@ private:
     /** @brief Issues modification notification signals */
     static gboolean _emit_modified(Selection *selection);
     /** @brief Schedules an item modification signal to be sent */
-    static void _schedule_modified(SPObject *obj, guint flags, Selection *selection);
-    /** @brief Releases a selected object that is being removed */
-    static void _release(SPObject *obj, Selection *selection);
-    /** @brief Releases an active layer object that is being removed */
-    static void _releaseSelectionContext(SPObject *obj, Selection *selection);
+    void _schedule_modified(SPObject *obj, guint flags);
 
     /** @brief Issues modified selection signal */
     void _emitModified(guint flags);
@@ -346,10 +338,13 @@ private:
 
     GC::soft_ptr<SPDesktop> _desktop;
     SPObject* _selection_context;
-    gulong _context_release_handler_id;
     guint _flags;
     guint _idle;
 
+    std::map<SPObject *, sigc::connection> _modified_connections;
+    std::map<SPObject *, sigc::connection> _release_connections;
+    sigc::connection _context_release_connection;
+
     sigc::signal<void, Selection *> _changed_signal;
     sigc::signal<void, Selection *, guint> _modified_signal;
 };