X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fselection.h;h=f9368f5eef5e5898e72460f2abf218057b84151e;hb=e900b46f3a8707abddd24803da7f25eecf09a942;hp=6d403c426986c084be840f32dc751b237d3a16ff;hpb=c89c32714737c143061a055b951c7b3ef6819bdd;p=inkscape.git diff --git a/src/selection.h b/src/selection.h index 6d403c426..f9368f5ee 100644 --- a/src/selection.h +++ b/src/selection.h @@ -17,6 +17,7 @@ */ #include +#include #include #include "libnr/nr-rect.h" @@ -76,12 +77,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 @@ -95,7 +103,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 @@ -225,7 +233,7 @@ public: /** @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::Maybe bounds() const; /** * @brief Returns the bounding rectangle of the selection @@ -239,12 +247,12 @@ public: * * \todo how is this different from bounds()? */ - ::NR::Rect boundsInDocument() const; + NR::Maybe boundsInDocument() const; /** * @brief Returns the rotation/skew center of the selection */ - ::NR::Point center() const; + NR::Maybe center() const; /** * @brief Gets the selection's snap points. @@ -258,12 +266,6 @@ public: */ std::vector getSnapPointsConvexHull() const; - /** - * @return A vector containing the top-left and bottom-right - * corners of each selected object's bounding box. - */ - std::vector getBBoxPoints() const; - /** * @brief Connects a slot to be notified of selection changes * @@ -305,14 +307,12 @@ 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); + void _schedule_modified(SPObject *obj, guint flags); /** @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(); @@ -328,15 +328,22 @@ 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; GC::soft_ptr _desktop; + SPObject* _selection_context; guint _flags; guint _idle; + std::map _modified_connections; + std::map _release_connections; + sigc::connection _context_release_connection; + sigc::signal _changed_signal; sigc::signal _modified_signal; };