Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::Selection Class Reference

The set of selected SPObjects for a given document and layer model. More...

#include <selection.h>

Inheritance diagram for Inkscape::Selection:
Inkscape::ObjectSet

Public Member Functions

 Selection (SPDesktop *desktop)
 Constructs an selection object, bound to a particular layer model.
 
 Selection (SPDocument *document)
 
 ~Selection () override
 
SPObjectactiveContext ()
 Returns active layer for selection (currentLayer or its parent).
 
void add (XML::Node *repr)
 Add an XML node's SPObject to the set of selected objects.
 
void set (XML::Node *repr)
 Set the selection to an XML node's SPObject.
 
void remove (XML::Node *repr)
 Removes an item from the set of selected objects.
 
bool includes (XML::Node *repr, bool anyAncestor=false)
 Returns true if the given item is selected.
 
SPObjectincludesAncestor (XML::Node *repr)
 Returns ancestor if the given object has ancestor selected.
 
size_t numberOfLayers ()
 Returns the number of layers in which there are selected objects.
 
size_t numberOfParents ()
 Returns the number of parents to which the selected objects belong.
 
std::vector< Inkscape::SnapCandidatePointgetSnapPoints (SnapPreferences const *snapprefs) const
 Compute the list of points in the selection that are to be considered for snapping from.
 
void emitModified ()
 
sigc::connection connectChanged (sigc::slot< void(Selection *)> slot)
 Connects a slot to be notified of selection changes.
 
sigc::connection connectChangedFirst (sigc::slot< void(Selection *)> slot)
 Similar to connectChanged, but will be run first.
 
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.
 
void scaleAnchored (double amount, bool fixed=true)
 Scale the selection, anchoring it against the center, or a selected anchor.
 
void rotateAnchored (double angle_degrees, double zoom=1.0)
 Rotate the selection, anchoring it against the center, or a selected anchor.
 
sigc::connection connectModified (sigc::slot< void(Selection *, unsigned)> slot)
 Connects a slot to be notified of selected object modifications.
 
sigc::connection connectModifiedFirst (sigc::slot< void(Selection *, unsigned)> slot)
 Similar to connectModified, but will be run first.
 
SelectionState getState ()
 Returns the current selection state including selected objects and nodes.
 
void setState (SelectionState const &state)
 Restores a selection state previously obtained from getState()
 
void setChangeLayer (bool option)
 Decide if the selection changing should change the layer and page selection too.
 
void setChangePage (bool option)
 
bool add (SPObject *object, bool nosignal=false)
 Add an SPObject to the set of selected objects.
 
void add (XML::Node *repr)
 Add an XML node's SPObject to the set of selected objects.
 
template<typename InputIterator >
void add (InputIterator from, InputIterator to)
 Add items from an STL iterator range to the selection.
 
void set (SPObject *object, bool persist_selection_context=false)
 Set the selection to a single specific object.
 
void set (XML::Node *repr)
 
bool remove (SPObject *object)
 Removes an item from the set of selected objects.
 
bool includes (SPObject *object, bool anyAncestor=false)
 Returns true if the given object is selected.
 
bool includes (Inkscape::XML::Node *node, bool anyAncestor=false)
 
SPObjectincludesAncestor (SPObject *object)
 Returns ancestor if the given object has ancestor selected.
 
- Public Member Functions inherited from Inkscape::ObjectSet
 ObjectSet (SPDesktop *desktop)
 
 ObjectSet (SPDocument *doc)
 
 ObjectSet ()
 
virtual ~ObjectSet ()
 
 ObjectSet (ObjectSet const &)=delete
 
ObjectSetoperator= (ObjectSet const &)=delete
 
void setDocument (SPDocument *doc)
 
bool add (SPObject *object, bool nosignal=false)
 Add an SPObject to the set of selected objects.
 
void add (XML::Node *repr)
 Add an XML node's SPObject to the set of selected objects.
 
template<typename InputIterator >
void add (InputIterator from, InputIterator to)
 Add items from an STL iterator range to the selection.
 
bool remove (SPObject *object)
 Removes an item from the set of selected objects.
 
bool includes (SPObject *object, bool anyAncestor=false)
 Returns true if the given object is selected.
 
bool includes (Inkscape::XML::Node *node, bool anyAncestor=false)
 
SPObjectincludesAncestor (SPObject *object)
 Returns ancestor if the given object has ancestor selected.
 
void set (SPObject *object, bool persist_selection_context=false)
 Set the selection to a single specific object.
 
void set (XML::Node *repr)
 
void clear ()
 Unselects all selected objects.
 
int size ()
 Returns size of the selection.
 
bool isEmpty ()
 Returns true if no items are selected.
 
void toggle (SPObject *obj)
 Removes an item if selected, adds otherwise.
 
SPObjectsingle ()
 Returns a single selected object.
 
SPItemsingleItem ()
 Returns a single selected item.
 
SPItemfirstItem () const
 Returns the first selected item, returns nullptr if no items selected.
 
SPItemlastItem () const
 Returns the last selected item, returns nullptr if no items selected.
 
SPItemsmallestItem (CompareSize compare)
 Returns the smallest item from this selection.
 
SPItemlargestItem (CompareSize compare)
 Returns the largest item from this selection.
 
SPObjectRange objects ()
 Returns the list of selected objects.
 
SPItemRange items ()
 Returns a range of selected SPItems.
 
std::vector< SPItem * > items_vector ()
 
SPGroupRange groups ()
 Returns a range of selected groups.
 
XMLNodeRange xmlNodes ()
 Returns a range of the xml nodes of all selected objects.
 
XML::NodesingleRepr ()
 Returns a single selected object's xml node.
 
XML::NodetopRepr () const
 The top-most item, or NULL if the selection is empty.
 
template<class T >
boost::enable_if< boost::is_base_of< SPObject, T >, void >::type setList (const std::vector< T * > &objs)
 Selects exactly the specified objects.
 
void setReprList (std::vector< XML::Node * > const &list)
 Selects the objects with the same IDs as those in list.
 
void enforceIds ()
 Assign IDs to selected objects that don't have an ID attribute Checks if the object's id attribute is NULL.
 
template<class T >
boost::enable_if< boost::is_base_of< SPObject, T >, void >::type addList (const std::vector< T * > &objs)
 Adds the specified objects to selection, without deselecting first.
 
template<class T >
boost::enable_if< boost::is_base_of< SPObject, T >, void >::type removeList (const std::vector< T * > &objs)
 Remove the specified objects from selection.
 
Geom::OptRect bounds (SPItem::BBoxType type) const
 Returns the bounding rectangle of the selection.
 
Geom::OptRect visualBounds () const
 
Geom::OptRect geometricBounds () const
 
Geom::OptRect strokedBounds () const
 
Geom::OptRect preferredBounds () const
 Returns either the visual or geometric bounding rectangle of the selection, based on the preferences specified for the selector tool.
 
Geom::OptRect documentBounds (SPItem::BBoxType type) const
 
Geom::OptRect documentPreferredBounds () const
 Returns either the visual or geometric bounding rectangle of selection in document coordinates based on preferences specified for the selector tool.
 
std::optional< Geom::Pointcenter () const
 Returns the rotation/skew center of the selection.
 
std::list< Persp3D * > const perspList ()
 Returns a list of all perspectives which have a 3D box in the current selection.
 
std::list< SPBox3D * > const box3DList (Persp3D *persp=nullptr)
 Returns a list of all 3D boxes in the current selection which are associated to persp.
 
SPDesktopdesktop ()
 Returns the desktop the selection is bound to.
 
SPDocumentdocument ()
 Returns the document the selection is bound to.
 
void deleteItems (bool skip_undo=false)
 
void duplicate (bool suppressDone=false, bool duplicateLayer=false)
 
void clone (bool skip_undo=false)
 
bool unlink (const bool skip_undo=false, const bool silent=false)
 Unlink all directly selected clones.
 
bool unlinkRecursive (const bool skip_undo=false, const bool force=false, const bool silent=false)
 Recursively unlink any clones present in the current selection, including clones which are used to clip other objects, groups of clones etc.
 
void removeLPESRecursive (bool keep_paths)
 
void relink ()
 
void cloneOriginal ()
 
void cloneOriginalPathLPE (bool allow_transforms=false, bool sync=false, bool skip_undo=false)
 This applies the Fill Between Many LPE, and has it refer to the selection.
 
Inkscape::XML::Nodegroup (bool is_anchor=false)
 
void popFromGroup ()
 
void ungroup (bool skip_undo=false)
 
void ungroup_all (bool skip_undo=false)
 Keep ungrouping until there are no more groups.
 
void stackUp (bool skip_undo=false)
 
void raise (bool skip_undo=false)
 
void raiseToTop (bool skip_undo=false)
 
void stackDown (bool skip_undo=false)
 
void lower (bool skip_undo=false)
 
void lowerToBottom (bool skip_undo=false)
 
void toNextLayer (bool skip_undo=false)
 
void toPrevLayer (bool skip_undo=false)
 
void toLayer (SPObject *layer)
 Move selection to group moveto, after the last child of moveto (if it has any children).
 
void toLayer (SPObject *layer, Inkscape::XML::Node *after)
 Move selection to group moveto, after child after.
 
void copy ()
 
void cut ()
 
void pasteStyle ()
 
void pasteSize (bool apply_x, bool apply_y)
 
void pasteSizeSeparately (bool apply_x, bool apply_y)
 
void pastePathEffect ()
 
void combine (bool skip_undo=false, bool silent=false)
 
void breakApart (bool skip_undo=false, bool overlapping=true, bool silent=false)
 
void toCurves (bool skip_undo=false, bool clonesjustunlink=false)
 
void toLPEItems ()
 Converts the selected items to LPEItems if they are not already so; e.g.
 
void pathReverse ()
 
bool strokesToPaths (bool legacy=false, bool skip_undo=false)
 
bool simplifyPaths (bool skip_undo=false)
 
void pathUnion (bool skip_undo=false, bool silent=false)
 
void pathIntersect (bool skip_undo=false, bool silent=false)
 
void pathDiff (bool skip_undo=false, bool silent=false)
 
void pathSymDiff (bool skip_undo=false, bool silent=false)
 
void pathCut (bool skip_undo=false, bool silent=false)
 
void pathSlice (bool skip_undo=false, bool silent=false)
 
void toMarker (bool apply=true)
 
void toGuides ()
 
void toSymbol ()
 
void unSymbol ()
 
void tile (bool apply=true)
 
void untile ()
 
void createBitmapCopy ()
 
void setMask (bool apply_clip_path, bool apply_to_layer, bool remove_original)
 Creates a mask or clipPath from selection.
 
void editMask (bool clip)
 
void unsetMask (const bool apply_clip_path, const bool delete_helper_group, bool remove_original)
 
void setClipGroup ()
 
void chameleonFill ()
 
void removeLPE ()
 
void removeFilter ()
 
void reapplyAffine ()
 Reapply the same transform again.
 
void clearLastAffine ()
 
void applyAffine (Geom::Affine const &affine, bool set_i2d=true, bool compensate=true, bool adjust_transf_center=true)
 Apply matrix to the selection.
 
void removePathTransforms ()
 
void removeTransform ()
 
void setScaleAbsolute (double, double, double, double)
 
void scaleRelative (const Geom::Point &, const Geom::Scale &)
 
void rotateRelative (const Geom::Point &, double)
 
void skewRelative (const Geom::Point &, double, double)
 
void moveRelative (const Geom::Point &move, bool compensate=true)
 
void moveRelative (double dx, double dy)
 
void move (double dx, double dy)
 
void moveScreen (double dx, double dy)
 
void move (double dx, double dy, bool rotated)
 
void move (double dx, double dy, bool rotated, bool screen)
 
void moveScreen (double dx, double dy, bool rotated)
 
bool fitCanvas (bool with_margins, bool skip_undo=false)
 
void swapFillStroke ()
 
void fillBetweenMany ()
 Creates a linked fill between all the objects in the current selection using the "Fill Between Many" LPE.
 
SiblingState getSiblingState (SPItem *item)
 Associates the given SPItem with a SiblingState enum Needed for handling special cases while transforming objects Inserts the [SPItem, SiblingState] pair to ObjectSet._sibling_state map.
 
void insertSiblingState (SPObject *object, SiblingState state)
 
void clearSiblingStates ()
 

Public Attributes

bool has_anchor = false
 
Geom::Point anchor
 

Protected Member Functions

void _connectSignals (SPObject *object) override
 
void _releaseSignals (SPObject *object) override
 
- Protected Member Functions inherited from Inkscape::ObjectSet
void _add (SPObject *object)
 
void _clear ()
 
void _remove (SPObject *object)
 
bool _anyAncestorIsInSet (SPObject *object)
 
void _removeDescendantsFromSet (SPObject *object)
 
void _removeAncestorsFromSet (SPObject *object)
 
SPItem_sizeistItem (bool sml, CompareSize compare)
 
SPObject_getMutualAncestor (SPObject *object)
 
virtual void _add3DBoxesRecursively (SPObject *obj)
 
virtual void _remove3DBoxesRecursively (SPObject *obj)
 

Private Member Functions

void _schedule_modified (SPObject *obj, unsigned int flags)
 Schedules an item modification signal to be sent.
 
void _emitModified (unsigned int flags)
 Issues modified selection signal.
 
void _emitChanged (bool persist_selection_context=false) override
 Issues changed selection signal.
 
SPObject_objectForXMLNode (XML::Node *repr) const
 returns the SPObject corresponding to an xml node (if any).
 
void _releaseContext (SPObject *obj)
 Releases an active layer object that is being removed.
 

Static Private Member Functions

static int _emit_modified (Selection *selection)
 Issues modification notification signals.
 

Private Attributes

SPObject_selection_context = nullptr
 
unsigned _flags = 0
 
unsigned _idle = 0
 
bool _change_layer = true
 
bool _change_page = true
 
std::unordered_map< SPObject *, sigc::scoped_connection > _modified_connections
 
sigc::scoped_connection _context_release_connection
 
sigc::signal< void(Selection *)> _changed_signal
 
sigc::signal< void(Selection *, unsigned)> _modified_signal
 
Geom::Point _previous_rotate_anchor
 

Additional Inherited Members

- Public Types inherited from Inkscape::ObjectSet
enum  CompareSize { HORIZONTAL , VERTICAL , AREA }
 
typedef decltype(MultiIndexContainer().get< random_access >()|boost::adaptors::filtered(is_item())|boost::adaptors::transformed(object_to_item())) SPItemRange
 
typedef decltype(MultiIndexContainer().get< random_access >()|boost::adaptors::filtered(is_group())|boost::adaptors::transformed(object_to_group())) SPGroupRange
 
typedef decltype(MultiIndexContainer().get< random_access >()|boost::adaptors::filtered(is_item())|boost::adaptors::transformed(object_to_node())) XMLNodeRange
 
- Protected Attributes inherited from Inkscape::ObjectSet
MultiIndexContainer _container
 
SPDesktop_desktop = nullptr
 
SPDocument_document = nullptr
 
std::list< SPBox3D * > _3dboxes
 
std::unordered_map< SPObject *, sigc::connection > _releaseConnections
 

Detailed Description

The set of selected SPObjects for a given document and layer model.

This class represents the set of selected SPItems for a given document.

An SPObject and its parent cannot be simultaneously selected; selecting an SPObjects has the side-effect of unselecting any of its children which might have been selected.

This is a per-desktop object that keeps the list of selected objects at the given desktop. Both SPItem and SPRepr lists can be retrieved from the selection. Many actions operate on the selection, so it is widely used throughout the code. It also implements its own asynchronous notification signals that UI elements can listen to.

Definition at line 79 of file selection.h.

Constructor & Destructor Documentation

◆ Selection() [1/2]

Inkscape::Selection::Selection ( SPDesktop desktop)

Constructs an selection object, bound to a particular layer model.

Parameters
layersthe layer model (for the SPDesktop, if GUI)
desktopthe desktop associated with the layer model, or NULL if in console mode

Definition at line 46 of file selection.cpp.

◆ Selection() [2/2]

Inkscape::Selection::Selection ( SPDocument document)

Definition at line 50 of file selection.cpp.

◆ ~Selection()

Inkscape::Selection::~Selection ( )
override

Definition at line 54 of file selection.cpp.

References _idle.

Member Function Documentation

◆ _connectSignals()

void Inkscape::Selection::_connectSignals ( SPObject object)
overrideprotectedvirtual

Reimplemented from Inkscape::ObjectSet.

Definition at line 299 of file selection.cpp.

References _modified_connections, _schedule_modified(), and SPObject::connectModified().

◆ _emit_modified()

gboolean Inkscape::Selection::_emit_modified ( Selection selection)
staticprivate

Issues modification notification signals.

Definition at line 73 of file selection.cpp.

References _emitModified(), _flags, and _idle.

Referenced by _schedule_modified().

◆ _emitChanged()

◆ _emitModified()

◆ _objectForXMLNode()

SPObject * Inkscape::Selection::_objectForXMLNode ( XML::Node repr) const
private

returns the SPObject corresponding to an xml node (if any).

Definition at line 271 of file selection.cpp.

References Inkscape::ObjectSet::_document, Inkscape::XML::Node::attribute(), SPDocument::getObjectById(), and SPDocument::getObjectByRepr().

Referenced by add(), includes(), includesAncestor(), remove(), and set().

◆ _releaseContext()

void Inkscape::Selection::_releaseContext ( SPObject obj)
private

Releases an active layer object that is being removed.

Definition at line 145 of file selection.cpp.

References _context_release_connection, _selection_context, and sp_object_unref().

Referenced by _emitChanged().

◆ _releaseSignals()

void Inkscape::Selection::_releaseSignals ( SPObject object)
overrideprotectedvirtual

Reimplemented from Inkscape::ObjectSet.

Definition at line 303 of file selection.cpp.

References _modified_connections.

◆ _schedule_modified()

void Inkscape::Selection::_schedule_modified ( SPObject obj,
unsigned int  flags 
)
private

Schedules an item modification signal to be sent.

Definition at line 63 of file selection.cpp.

References _emit_modified(), _flags, _idle, and SP_SELECTION_UPDATE_PRIORITY.

Referenced by _connectSignals().

◆ activeContext()

SPObject * Inkscape::Selection::activeContext ( )

Returns active layer for selection (currentLayer or its parent).

Returns
layer item the selection is bound to

Definition at line 157 of file selection.cpp.

References Inkscape::ObjectSet::_desktop, _selection_context, Inkscape::LayerManager::currentLayer(), and SPDesktop::layerManager().

Referenced by Inkscape::UI::Dialog::Prototype::selectionChanged(), sp_select_same_fill_stroke_style(), sp_selection_item_next(), and sp_selection_item_prev().

◆ add() [1/4]

template<typename InputIterator >
void Inkscape::ObjectSet::add ( InputIterator  from,
InputIterator  to 
)
inline

Add items from an STL iterator range to the selection.

Parameters
fromthe begin iterator
tothe end iterator

Definition at line 159 of file object-set.h.

◆ add() [2/4]

bool Inkscape::ObjectSet::add ( SPObject object,
bool  nosignal = false 
)

Add an SPObject to the set of selected objects.

Parameters
objthe SPObject to add
nosignaltrue if no signals should be sent

Definition at line 145 of file object-set.cpp.

References Inkscape::ObjectSet::_remove(), child, and Inkscape::ObjectSet::includes().

◆ add() [3/4]

void Inkscape::ObjectSet::add ( XML::Node repr)

Add an XML node's SPObject to the set of selected objects.

Parameters
thexml node of the item to add

Definition at line 152 of file object-set.cpp.

◆ add() [4/4]

◆ connectChanged()

sigc::connection Inkscape::Selection::connectChanged ( sigc::slot< void(Selection *)>  slot)
inline

Connects a slot to be notified of selection changes.

This method connects the given slot such that it will be called upon any change in the set of selected objects.

Parameters
slotthe slot to connect
Returns
the resulting connection

Definition at line 179 of file selection.h.

References _changed_signal.

Referenced by Inkscape::UI::Widget::StyleSubject::Selection::_afterDesktopSwitch(), Inkscape::UI::Tools::ArcTool::ArcTool(), Inkscape::UI::Tools::Box3dTool::Box3dTool(), Inkscape::Extension::Implementation::Script::PreviewObserver::connect(), Inkscape::UI::Tools::ConnectorTool::ConnectorTool(), Inkscape::UI::Tools::FloodTool::FloodTool(), Inkscape::UI::Tools::FreehandBase::FreehandBase(), Inkscape::UI::Tools::GradientTool::GradientTool(), Inkscape::UI::Tools::LpeTool::LpeTool(), Inkscape::UI::Tools::MarkerTool::MarkerTool(), Inkscape::UI::Tools::MeshTool::MeshTool(), Inkscape::UI::Tools::NodeTool::NodeTool(), Inkscape::UI::Tools::RectTool::RectTool(), Inkscape::SelCue::SelCue(), Inkscape::SelectionDescriber::SelectionDescriber(), Inkscape::SelTrans::SelTrans(), Inkscape::UI::Widget::SelectedStyle::setDesktop(), Inkscape::UI::Toolbar::ArcToolbar::setDesktop(), Inkscape::UI::Toolbar::Box3DToolbar::setDesktop(), Inkscape::UI::Toolbar::ConnectorToolbar::setDesktop(), Inkscape::UI::Toolbar::LPEToolbar::setDesktop(), Inkscape::UI::Toolbar::NodeToolbar::setDesktop(), Inkscape::UI::Toolbar::RectToolbar::setDesktop(), Inkscape::UI::Toolbar::SelectToolbar::setDesktop(), Inkscape::UI::Toolbar::SpiralToolbar::setDesktop(), Inkscape::UI::Toolbar::StarToolbar::setDesktop(), Inkscape::UI::Dialog::DialogBase::setDesktop(), Inkscape::UI::Tools::SpiralTool::SpiralTool(), Inkscape::UI::Tools::StarTool::StarTool(), and Box3D::VPDrag::VPDrag().

◆ connectChangedFirst()

sigc::connection Inkscape::Selection::connectChangedFirst ( sigc::slot< void(Selection *)>  slot)
inline

Similar to connectChanged, but will be run first.

This is a hack; see cf86d4abd17 for explanation.

Definition at line 188 of file selection.h.

References _changed_signal.

Referenced by Inkscape::LivePathEffect::Parameter::connect_selection_changed(), GrDrag::GrDrag(), Inkscape::UI::Toolbar::TextToolbar::setDesktop(), and Inkscape::UI::Tools::TextTool::TextTool().

◆ connectModified()

sigc::connection Inkscape::Selection::connectModified ( sigc::slot< void(Selection *, unsigned)>  slot)
inline

Connects a slot to be notified of selected object modifications.

This method connects the given slot such that it will receive notifications whenever any selected item is modified.

Parameters
slotthe slot to connect
Returns
the resulting connection

Definition at line 232 of file selection.h.

References _modified_signal.

Referenced by Inkscape::UI::Widget::StyleSubject::Selection::_afterDesktopSwitch(), Inkscape::UI::Tools::FreehandBase::FreehandBase(), Inkscape::SelCue::SelCue(), Inkscape::SelTrans::SelTrans(), Inkscape::UI::Toolbar::LPEToolbar::setDesktop(), Inkscape::UI::Toolbar::NodeToolbar::setDesktop(), Inkscape::UI::Dialog::DialogBase::setDesktop(), and Box3D::VPDrag::VPDrag().

◆ connectModifiedFirst()

sigc::connection Inkscape::Selection::connectModifiedFirst ( sigc::slot< void(Selection *, unsigned)>  slot)
inline

Similar to connectModified, but will be run first.

Definition at line 239 of file selection.h.

References _modified_signal.

Referenced by GrDrag::GrDrag(), and Inkscape::UI::Tools::TextTool::TextTool().

◆ emitModified()

void Inkscape::Selection::emitModified ( )
inline

Definition at line 167 of file selection.h.

References _emitModified(), and _flags.

Referenced by Inkscape::LivePathEffect::ToggleButtonParam::toggled().

◆ getSnapPoints()

std::vector< Inkscape::SnapCandidatePoint > Inkscape::Selection::getSnapPoints ( SnapPreferences const *  snapprefs) const

◆ getState()

SelectionState Inkscape::Selection::getState ( )

◆ includes() [1/3]

bool Inkscape::ObjectSet::includes ( Inkscape::XML::Node node,
bool  anyAncestor = false 
)

Definition at line 181 of file object-set.cpp.

◆ includes() [2/3]

bool Inkscape::ObjectSet::includes ( SPObject object,
bool  anyAncestor = false 
)

Returns true if the given object is selected.

Definition at line 180 of file object-set.cpp.

◆ includes() [3/3]

◆ includesAncestor() [1/2]

SPObject * Inkscape::ObjectSet::includesAncestor ( SPObject object)

Returns ancestor if the given object has ancestor selected.

Definition at line 186 of file object-set.cpp.

References child, and Inkscape::ObjectSet::includes().

◆ includesAncestor() [2/2]

SPObject * Inkscape::Selection::includesAncestor ( XML::Node repr)
inline

Returns ancestor if the given object has ancestor selected.

Definition at line 149 of file selection.h.

References _objectForXMLNode(), and includesAncestor().

Referenced by includesAncestor(), and Inkscape::UI::Dialog::ObjectsPanel::on_drag_motion().

◆ numberOfLayers()

size_t Inkscape::Selection::numberOfLayers ( )

Returns the number of layers in which there are selected objects.

Definition at line 278 of file selection.cpp.

References Inkscape::ObjectSet::_desktop, Inkscape::ObjectSet::items(), Inkscape::LayerManager::layerForObject(), and SPDesktop::layerManager().

Referenced by Inkscape::SelectionDescriber::updateMessage().

◆ numberOfParents()

size_t Inkscape::Selection::numberOfParents ( )

Returns the number of parents to which the selected objects belong.

Definition at line 289 of file selection.cpp.

References Inkscape::ObjectSet::items(), parent, and SPObject::parent.

Referenced by Inkscape::SelectionDescriber::updateMessage().

◆ remove() [1/2]

bool Inkscape::ObjectSet::remove ( SPObject object)

Removes an item from the set of selected objects.

It is ok to call this method for an unselected item.

Parameters
itemthe item to unselect
Returns
is success

Definition at line 175 of file object-set.cpp.

◆ remove() [2/2]

void Inkscape::Selection::remove ( XML::Node repr)
inline

Removes an item from the set of selected objects.

It is ok to call this method for an unselected item.

Parameters
reprthe xml node of the item to remove

Definition at line 131 of file selection.h.

References _objectForXMLNode(), and remove().

Referenced by remove(), Inkscape::UI::Dialog::ObjectsPanel::selectCursorItem(), Inkscape::UI::Dialog::ObjectsPanel::selectRange(), sp_selected_path_do_offset(), Inkscape::UI::Tools::sp_tweak_dilate_recursive(), Inkscape::UI::Tools::spdc_check_for_and_apply_waiting_LPE(), and unselect_by_id().

◆ rotateAnchored()

void Inkscape::Selection::rotateAnchored ( double  angle_degrees,
double  zoom = 1.0 
)

Rotate the selection, anchoring it against the center, or a selected anchor.

Parameters
angle_degrees- The amount to rotate by in degrees.
zoom- The zoom amount for screen based rotation amount.

Definition at line 222 of file selection.cpp.

References _previous_rotate_anchor, SPDocument::action_key(), anchor, Inkscape::ObjectSet::center(), Inkscape::ObjectSet::desktop(), Inkscape::ObjectSet::document(), has_anchor, Geom::L2(), Inkscape::DocumentUndo::maybeDone(), Inkscape::ObjectSet::rotateRelative(), Inkscape::ObjectSet::visualBounds(), Geom::X, and Geom::Y.

Referenced by transform_rotate(), transform_rotate_screen(), and transform_rotate_step().

◆ scaleAnchored()

void Inkscape::Selection::scaleAnchored ( double  amount,
bool  fixed = true 
)

Scale the selection, anchoring it against the center, or a selected anchor.

Parameters
amount- The amount to scale by, in a fixed or related amount.
fixed- If true (default) scales by fixed document units instead of by factors of the size of the object.

Definition at line 201 of file selection.cpp.

References anchor, Inkscape::ObjectSet::center(), Inkscape::ObjectSet::document(), has_anchor, Inkscape::DocumentUndo::maybeDone(), Inkscape::ObjectSet::scaleRelative(), and Inkscape::ObjectSet::visualBounds().

Referenced by transform_grow(), transform_grow_screen(), transform_grow_step(), and transform_scale().

◆ set() [1/3]

void Inkscape::ObjectSet::set ( SPObject object,
bool  persist_selection_context = false 
)

Set the selection to a single specific object.

Parameters
objthe object to select

Definition at line 193 of file object-set.cpp.

◆ set() [2/3]

void Inkscape::ObjectSet::set ( XML::Node repr)

Definition at line 194 of file object-set.cpp.

◆ set() [3/3]

void Inkscape::Selection::set ( XML::Node repr)
inline

Set the selection to an XML node's SPObject.

Parameters
reprthe xml node of the item to select

Definition at line 118 of file selection.h.

References _objectForXMLNode(), and set.

Referenced by Inkscape::UI::Dialog::StyleDialog::_onLinkObj(), Inkscape::UI::Tools::TextTool::_setupText(), ContextMenu::ContextMenu(), Inkscape::UI::Dialog::delete_object(), Inkscape::UI::Tools::do_trace(), Inkscape::UI::Dialog::DocumentResources::DocumentResources(), file_import(), Inkscape::UI::Tools::ArcTool::finishItem(), Inkscape::UI::Tools::RectTool::finishItem(), Inkscape::UI::Tools::SpiralTool::finishItem(), Inkscape::UI::Tools::StarTool::finishItem(), Inkscape::UI::Tools::ConnectorTool::item_handler(), Inkscape::UI::Tools::TextTool::item_handler(), layer_to_group(), Inkscape::UI::Dialog::SpellCheck::nextWord(), Inkscape::UI::Dialog::ObjectsPanel::on_drag_begin(), Inkscape::LivePathEffect::OriginalPathParam::on_select_original_button_click(), Inkscape::LivePathEffect::OriginalSatelliteParam::on_select_original_button_click(), Inkscape::UI::Tools::TextTool::placeCursor(), Inkscape::UI::Tools::TextTool::placeCursorAt(), Inkscape::UI::Tools::Box3dTool::root_handler(), Inkscape::UI::Tools::TextTool::root_handler(), select_object_link(), Inkscape::UI::Dialog::ObjectsPanel::selectCursorItem(), Inkscape::UI::Dialog::XmlTree::set_dt_select(), Inkscape::UI::Tools::SelectTool::sp_select_context_cycle_through_items(), Inkscape::UI::Tools::sp_select_context_up_one_layer(), sp_selected_path_create_offset_object(), sp_selection_item_next(), sp_selection_item_prev(), Inkscape::UI::Tools::spdc_apply_powerstroke_shape(), Inkscape::UI::Tools::spdc_create_single_dot(), Inkscape::UI::Tools::spdc_flush_white(), and text_flow_into_shape().

◆ setAnchor()

void Inkscape::Selection::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.

Parameters
x,y- Coordinates for the anchor between 0..1 of the bounding box
set- If set to false, causes the anchor to become unset (default)

Definition at line 187 of file selection.cpp.

References _emitModified(), anchor, Inkscape::ObjectSet::document(), has_anchor, Geom::LInfty(), Inkscape::DocumentUndo::resetKey(), and set.

◆ setChangeLayer()

void Inkscape::Selection::setChangeLayer ( bool  option)
inline

Decide if the selection changing should change the layer and page selection too.

Definition at line 256 of file selection.h.

References _change_layer, and option.

Referenced by Inkscape::UI::Tools::ToolBase::set().

◆ setChangePage()

void Inkscape::Selection::setChangePage ( bool  option)
inline

Definition at line 257 of file selection.h.

References _change_page, and option.

Referenced by Inkscape::UI::Tools::ToolBase::set().

◆ setState()

Member Data Documentation

◆ _change_layer

bool Inkscape::Selection::_change_layer = true
private

Definition at line 281 of file selection.h.

Referenced by _emitChanged(), and setChangeLayer().

◆ _change_page

bool Inkscape::Selection::_change_page = true
private

Definition at line 282 of file selection.h.

Referenced by _emitChanged(), and setChangePage().

◆ _changed_signal

sigc::signal<void (Selection *)> Inkscape::Selection::_changed_signal
private

Definition at line 286 of file selection.h.

Referenced by _emitChanged(), connectChanged(), and connectChangedFirst().

◆ _context_release_connection

sigc::scoped_connection Inkscape::Selection::_context_release_connection
private

Definition at line 284 of file selection.h.

Referenced by _emitChanged(), and _releaseContext().

◆ _flags

unsigned Inkscape::Selection::_flags = 0
private

Definition at line 279 of file selection.h.

Referenced by _emit_modified(), _schedule_modified(), and emitModified().

◆ _idle

unsigned Inkscape::Selection::_idle = 0
private

Definition at line 280 of file selection.h.

Referenced by _emit_modified(), _schedule_modified(), and ~Selection().

◆ _modified_connections

std::unordered_map<SPObject *, sigc::scoped_connection> Inkscape::Selection::_modified_connections
private

Definition at line 283 of file selection.h.

Referenced by _connectSignals(), and _releaseSignals().

◆ _modified_signal

sigc::signal<void (Selection *, unsigned)> Inkscape::Selection::_modified_signal
private

Definition at line 287 of file selection.h.

Referenced by _emitModified(), connectModified(), and connectModifiedFirst().

◆ _previous_rotate_anchor

Geom::Point Inkscape::Selection::_previous_rotate_anchor
private

Definition at line 289 of file selection.h.

Referenced by rotateAnchored().

◆ _selection_context

SPObject* Inkscape::Selection::_selection_context = nullptr
private

Definition at line 278 of file selection.h.

Referenced by _emitChanged(), _releaseContext(), and activeContext().

◆ anchor

◆ has_anchor

bool Inkscape::Selection::has_anchor = false

The documentation for this class was generated from the following files: