X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fselection.h;h=f9368f5eef5e5898e72460f2abf218057b84151e;hb=e900b46f3a8707abddd24803da7f25eecf09a942;hp=3c2ec5c3264dd547bab770e15cd9b770f203f367;hpb=cb9b008a8a93da19f2d40795774d10f1bca4423b;p=inkscape.git diff --git a/src/selection.h b/src/selection.h index 3c2ec5c32..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 @@ -219,10 +227,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::Maybe bounds() const; /** * @brief Returns the bounding rectangle of the selection @@ -236,7 +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::Maybe center() const; /** * @brief Gets the selection's snap points. @@ -250,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 * @@ -297,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(); @@ -320,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; };