diff --git a/src/selection.h b/src/selection.h
index 6d403c426986c084be840f32dc751b237d3a16ff..1dcaa53ff3d836082dc63d253d128dcd6171b524 100644 (file)
--- a/src/selection.h
+++ b/src/selection.h
*/
#include <vector>
+#include <map>
#include <sigc++/sigc++.h>
#include "libnr/nr-rect.h"
*/
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
*
* @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
*/
std::vector<NR::Point> getBBoxPoints() const;
+ /**
+ * @return A vector containing the 2 (top-left and bottom-right)
+ * corners of the selection bounding box.
+ */
+ std::vector<NR::Point> getBBoxPointsOuter() const;
+
/**
* @brief Connects a slot to be notified of selection changes
*
/** @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();
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<SPDesktop> _desktop;
+ SPObject* _selection_context;
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;
};