47 _selection_context(nullptr),
57 _selection_context(nullptr),
67 g_source_remove(
_idle);
88 guint flags = selection->
_flags;
103 it->emit(
this, flags);
119 for (
auto this_item : this->
items()) {
120 if (page != pm.getPageFor(this_item,
true)) {
130 if (persist_selection_context) {
187 std::vector<Inkscape::SnapCandidatePoint> p;
189 if (snapprefs !=
nullptr){
193 for (
auto iter =
items.begin(); iter !=
items.end(); ++iter) {
194 SPItem *this_item = *iter;
242 g_return_val_if_fail(repr !=
nullptr, NULL);
250 std::set<SPObject*> layers;
251 for (
auto iter =
items.begin(); iter !=
items.end(); ++iter) {
253 layers.insert(layer);
256 return layers.size();
261 std::set<SPObject*> parents;
262 for (
auto iter =
items.begin(); iter !=
items.end(); ++iter) {
266 return parents.size();
297 for (
auto const *
const item :
items()) {
301 std::string selected_id;
302 selected_id +=
"--id=";
304 params.push_back(std::move(selected_id));
315 auto const &nodeList =
node->nodeList();
316 auto const &subpathList = nodeList.subpathList();
319 bool found_sp =
false;
320 for (
auto i = subpathList.begin(), e = subpathList.end(); i != e; ++i, ++sp) {
321 if (&**i == &nodeList) {
328 bool found_nl =
false;
329 for (
auto j = nodeList.begin(), e = nodeList.end(); j != e; ++j, ++nl) {
336 if (!(found_nl && found_sp)) {
337 g_warning(
"Something went wrong while trying to pass selected nodes to extension. Please report a bug.");
341 auto id = subpathList.pm().item()->getId();
343 _seldata.emplace_back(std::move(
id), std::make_pair(sp, nl));
361 std::vector<SPItem *> new_selection;
365 new_selection.push_back(
item);
369 add(new_selection.begin(), new_selection.end());
370 new_selection.clear();
376 auto const point = !cps->_points_list.empty() ? cps->_points_list.front() :
nullptr;
383 auto const &sp =
node->nodeList().subpathList();
386 for (
auto j = sp.begin(); j != sp.end(); ++j, ++sp_count) {
387 if (sp_count != l.second.first)
continue;
390 for (
auto k = (*j)->begin(); k != (*j)->end(); ++k, ++nt_count) {
391 if (nt_count == l.second.second) {
392 cps->insert(k.ptr());
static void resetKey(SPDocument *document)
SPObject * layerForObject(SPObject *object)
Return layer that contains object.
void setCurrentLayer(SPObject *object, bool clear=false)
Sets the current layer of the desktop.
SPGroup * currentLayer() const
Returns current top layer.
SPDesktop * desktop()
Returns the desktop the selection is bound to.
GC::soft_ptr< SPDocument > _document
SPItemRange items()
Returns a range of selected SPItems.
GC::soft_ptr< SPDesktop > _desktop
void clear()
Unselects all selected objects.
virtual void _emitChanged(bool persist_selection_context=false)
bool isEmpty()
Returns true if no items are selected.
SPDocument * document()
Returns the document the selection is bound to.
SPItem * firstItem() const
Returns the first selected item, returns nullptr if no items selected.
SPItem * singleItem()
Returns a single selected item.
bool selectPage(SPPage *page)
Set the given page as the selected page.
The set of selected SPObjects for a given document and layer model.
SPObject * _selection_context
void _releaseSignals(SPObject *object) override
void add(XML::Node *repr)
Add an XML node's SPObject to the set of selected objects.
void setBackup()
Set a backup of current selection and store it also to be command line readable by extension system.
std::vector< Inkscape::SnapCandidatePoint > getSnapPoints(SnapPreferences const *snapprefs) const
Compute the list of points in the selection that are to be considered for snapping from.
auto_connection _context_release_connection
void _releaseContext(SPObject *obj)
Releases an active layer object that is being removed.
void setAnchor(double x, double y, bool set=true)
Set the anchor point of the selection, used for telling it how transforms should be anchored against.
SPObject * activeContext()
Returns active layer for selection (currentLayer or its parent).
void set(XML::Node *repr)
Set the selection to an XML node's SPObject.
std::list< sigc::signal< void(Selection *, unsigned int)> > _modified_signals
std::vector< std::pair< std::string, std::pair< int, int > > > _seldata
void _connectSignals(SPObject *object) override
size_t numberOfLayers()
Returns the number of layers in which there are selected objects.
void _emitChanged(bool persist_selection_context=false) override
Issues changed selection signal.
std::unordered_map< SPObject *, auto_connection > _modified_connections
static int _emit_modified(Selection *selection)
Issues modification notification signals.
sigc::connection connectModifiedFirst(sigc::slot< void(Selection *, unsigned)> slot)
std::list< std::string > params
Here store a paramlist when set backup.
std::list< sigc::signal< void(Selection *)> > _changed_signals
void _emitModified(unsigned int flags)
Issues modified selection signal.
std::vector< std::string > _selected_ids
size_t numberOfParents()
Returns the number of parents to which the selected objects belong.
sigc::connection connectChangedFirst(sigc::slot< void(Selection *)> slot)
void _schedule_modified(SPObject *obj, unsigned int flags)
Schedules an item modification signal to be sent.
sigc::connection connectChanged(sigc::slot< void(Selection *)> slot)
Connects a slot to be notified of selection changes.
Selection(SPDesktop *desktop)
Constructs an selection object, bound to a particular layer model.
void restoreBackup()
Restore a selection from a existing backup.
SPObject * _objectForXMLNode(XML::Node *repr) const
returns the SPObject corresponding to an xml node (if any).
void emptyBackup()
Clear backup of current selection.
sigc::connection connectModified(sigc::slot< void(Selection *, unsigned)> slot)
Connects a slot to be notified of selected object modifications.
Storing of snapping preferences.
void setTargetSnappable(Inkscape::SnapTargetType const target, bool enabled)
bool isTargetSnappable(Inkscape::SnapTargetType const target) const
std::list< SelectableControlPoint * > _points_list
void selectAll()
Select all points that this selection can contain.
Interface for refcounted XML nodes.
virtual char const * attribute(char const *key) const =0
Get the string representation of a node's attribute.
To do: update description of desktop.
SPDocument * getDocument() const
Inkscape::UI::Tools::ToolBase * getTool() const
Inkscape::LayerManager & layerManager()
Typed SVG document implementation.
SPObject * getObjectById(std::string const &id) const
Inkscape::PageManager & getPageManager()
SPDefs * getDefs()
Return the main defs object for the document.
SPObject * getObjectByRepr(Inkscape::XML::Node *repr) const
Base class for visual SVG elements.
Geom::Point getCenter() const
void getSnappoints(std::vector< Inkscape::SnapCandidatePoint > &p, Inkscape::SnapPreferences const *snapprefs=nullptr) const
SPObject is an abstract base class of all of the document nodes at the SVG document level.
char const * getId() const
Returns the objects current ID string.
sigc::connection connectRelease(sigc::slot< void(SPObject *)> slot)
Connects to the release request signal.
bool isAncestorOf(SPObject const *object) const
True if object is non-NULL and this is some in/direct parent of object.
Control point selection - stores a set of control points and applies transformations to them.
Editable view implementation.
TODO: insert short description here.
Inkscape::XML::Node * node
D2< T > compose(D2< T > const &a, T const &b)
CMYK to sRGB conversion routines.
@ SNAPSOURCE_ROTATION_CENTER
@ SNAPTARGET_ROTATION_CENTER
Path manipulator - a component that edits a single path on-canvas.
static constexpr auto SP_SELECTION_UPDATE_PRIORITY
SPObject * sp_object_unref(SPObject *object, SPObject *owner)
Decrease reference count of object, with possible debugging and finalization.
SPObject * sp_object_ref(SPObject *object, SPObject *owner)
Increase reference count of object, with possible debugging.