X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fselection.h;h=c78a1fdbb04fd09fa0219768b1addd85a55b062b;hb=2d5f45472d142796f87b8b737cc0b56fc9de3bf7;hp=48d1112a80815c2ff2f8770026e286531e1a16ef;hpb=6b15695578f07a3f72c4c9475c1a261a3021472a;p=inkscape.git diff --git a/src/selection.h b/src/selection.h index 48d1112a8..c78a1fdbb 100644 --- a/src/selection.h +++ b/src/selection.h @@ -25,6 +25,7 @@ #include "gc-managed.h" #include "gc-finalized.h" #include "gc-anchored.h" +#include "gc-soft-ptr.h" #include "util/list.h" class SPItem; @@ -75,12 +76,19 @@ public: */ SPDesktop *desktop() { return _desktop; } + /** + * @brief Returns active layer for selection (currentLayer or its parent) + * + * @return layer item the selection is bound to + */ + SPObject *activeContext(); + /** * @brief Add an SPObject to the set of selected objects * * @param obj the SPObject to add */ - void add(SPObject *obj); + void add(SPObject *obj, bool persist_selection_context = false); /** * @brief Add an XML node's SPObject to the set of selected objects @@ -94,7 +102,7 @@ public: * * @param obj the object to select */ - void set(SPObject *obj); + void set(SPObject *obj, bool persist_selection_context = false); /** * @brief Set the selection to an XML node's SPObject @@ -218,10 +226,13 @@ public: /** @brief Returns the number of layers in which there are selected objects */ guint numberOfLayers(); + /** @brief Returns the number of parents to which the selected objects belong */ + guint numberOfParents(); + /** @brief Returns the bounding rectangle of the selection */ NRRect *bounds(NRRect *dest) const; /** @brief Returns the bounding rectangle of the selection */ - NR::Rect bounds() const; + ::NR::Rect bounds() const; /** * @brief Returns the bounding rectangle of the selection @@ -235,7 +246,12 @@ public: * * \todo how is this different from bounds()? */ - NR::Rect boundsInDocument() const; + ::NR::Rect boundsInDocument() const; + + /** + * @brief Returns the rotation/skew center of the selection + */ + ::NR::Point center() const; /** * @brief Gets the selection's snap points. @@ -299,11 +315,13 @@ private: 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); /** @brief Issues modified selection signal */ void _emitModified(guint flags); /** @brief Issues changed selection signal */ - void _emitChanged(); + void _emitChanged(bool persist_selection_context = false); void _invalidateCachedLists(); @@ -319,12 +337,16 @@ private: void _remove(SPObject *obj); /** @brief returns the SPObject corresponding to an xml node (if any) */ SPObject *_objectForXMLNode(XML::Node *repr) const; + /** @brief Releases an active layer object that is being removed */ + void _releaseContext(SPObject *obj); mutable GSList *_objs; mutable GSList *_reprs; mutable GSList *_items; - SPDesktop *_desktop; + GC::soft_ptr _desktop; + SPObject* _selection_context; + gulong _context_release_handler_id; guint _flags; guint _idle;