Inkscape
Vector Graphics Editor
|
The set of selected SPObjects for a given document and layer model. More...
#include <selection.h>
Public Member Functions | |
Selection (SPDesktop *desktop) | |
Constructs an selection object, bound to a particular layer model. | |
Selection (SPDocument *document) | |
~Selection () override | |
SPObject * | activeContext () |
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. | |
SPObject * | includesAncestor (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::SnapCandidatePoint > | getSnapPoints (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) |
SPObject * | includesAncestor (SPObject *object) |
Returns ancestor if the given object has ancestor selected. | |
![]() | |
ObjectSet (SPDesktop *desktop) | |
ObjectSet (SPDocument *doc) | |
ObjectSet () | |
virtual | ~ObjectSet () |
ObjectSet (ObjectSet const &)=delete | |
ObjectSet & | operator= (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) |
SPObject * | includesAncestor (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. | |
SPObject * | single () |
Returns a single selected object. | |
SPItem * | singleItem () |
Returns a single selected item. | |
SPItem * | firstItem () const |
Returns the first selected item, returns nullptr if no items selected. | |
SPItem * | lastItem () const |
Returns the last selected item, returns nullptr if no items selected. | |
SPItem * | smallestItem (CompareSize compare) |
Returns the smallest item from this selection. | |
SPItem * | largestItem (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::Node * | singleRepr () |
Returns a single selected object's xml node. | |
XML::Node * | topRepr () 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::Point > | center () 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 . | |
SPDesktop * | desktop () |
Returns the desktop the selection is bound to. | |
SPDocument * | document () |
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::Node * | group (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 |
![]() | |
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 | |
![]() | |
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 |
![]() | |
MultiIndexContainer | _container |
SPDesktop * | _desktop = nullptr |
SPDocument * | _document = nullptr |
std::list< SPBox3D * > | _3dboxes |
std::unordered_map< SPObject *, sigc::connection > | _releaseConnections |
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.
Inkscape::Selection::Selection | ( | SPDesktop * | desktop | ) |
Constructs an selection object, bound to a particular layer model.
layers | the layer model (for the SPDesktop, if GUI) |
desktop | the desktop associated with the layer model, or NULL if in console mode |
Definition at line 46 of file selection.cpp.
Inkscape::Selection::Selection | ( | SPDocument * | document | ) |
Definition at line 50 of file selection.cpp.
|
override |
Definition at line 54 of file selection.cpp.
References _idle.
|
overrideprotectedvirtual |
Reimplemented from Inkscape::ObjectSet.
Definition at line 299 of file selection.cpp.
References _modified_connections, _schedule_modified(), and SPObject::connectModified().
|
staticprivate |
Issues modification notification signals.
Definition at line 73 of file selection.cpp.
References _emitModified(), _flags, and _idle.
Referenced by _schedule_modified().
|
overrideprivatevirtual |
Issues changed selection signal.
Change the layer selection to the item selection TODO: Should it only change if there's a single object?
Reimplemented from Inkscape::ObjectSet.
Definition at line 110 of file selection.cpp.
References _change_layer, _change_page, _changed_signal, _context_release_connection, Inkscape::ObjectSet::_desktop, Inkscape::ObjectSet::_document, Inkscape::ObjectSet::_emitChanged(), _releaseContext(), _selection_context, SPObject::connectRelease(), Inkscape::LayerManager::currentLayer(), SPDocument::getPageManager(), item, Inkscape::LayerManager::layerForObject(), SPDesktop::layerManager(), Inkscape::DocumentUndo::resetKey(), Inkscape::PageManager::selectPage(), Inkscape::LayerManager::setCurrentLayer(), Inkscape::ObjectSet::singleItem(), and sp_object_ref().
|
private |
Issues modified selection signal.
Definition at line 86 of file selection.cpp.
References Inkscape::ObjectSet::_desktop, Inkscape::ObjectSet::_document, _modified_signal, Inkscape::ObjectSet::firstItem(), SPDocument::getPageManager(), Inkscape::ObjectSet::isEmpty(), item, Inkscape::ObjectSet::items(), page, Inkscape::PageManager::selectPage(), and Inkscape::ObjectSet::singleItem().
Referenced by _emit_modified(), emitModified(), and setAnchor().
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().
|
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().
|
overrideprotectedvirtual |
Reimplemented from Inkscape::ObjectSet.
Definition at line 303 of file selection.cpp.
References _modified_connections.
|
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().
SPObject * Inkscape::Selection::activeContext | ( | ) |
Returns active layer for selection (currentLayer or its parent).
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().
|
inline |
Add items from an STL iterator range to the selection.
from | the begin iterator |
to | the end iterator |
Definition at line 159 of file object-set.h.
bool Inkscape::ObjectSet::add | ( | SPObject * | object, |
bool | nosignal = false |
||
) |
Add an SPObject to the set of selected objects.
obj | the SPObject to add |
nosignal | true if no signals should be sent |
Definition at line 145 of file object-set.cpp.
References Inkscape::ObjectSet::_remove(), child, and Inkscape::ObjectSet::includes().
void Inkscape::ObjectSet::add | ( | XML::Node * | repr | ) |
Add an XML node's SPObject to the set of selected objects.
the | xml node of the item to add |
Definition at line 152 of file object-set.cpp.
|
inline |
Add an XML node's SPObject to the set of selected objects.
the | xml node of the item to add |
Definition at line 107 of file selection.h.
References _objectForXMLNode(), and add().
Referenced by Inkscape::UI::Tools::EraserTool::_doWork(), Inkscape::UI::Tools::PenTool::_handleButtonRelease(), Inkscape::UI::Tools::PencilTool::_handleButtonRelease(), add(), Inkscape::UI::Tools::do_trace(), Inkscape::Extension::Internal::BlurEdge::effect(), Inkscape::UI::Tools::LpeTool::item_handler(), query_dimension(), select_by_class(), select_by_element(), select_by_id(), select_by_selector(), Inkscape::UI::Dialog::ObjectsPanel::selectCursorItem(), Inkscape::UI::Dialog::ObjectsPanel::selectRange(), Inkscape::UI::Tools::MeasureTool::setMeasureItem(), setState(), Inkscape::UI::Tools::SelectTool::sp_select_context_cycle_through_items(), sp_selected_path_do_offset(), Inkscape::UI::Tools::sp_tweak_dilate_recursive(), and Inkscape::UI::Tools::spdc_check_for_and_apply_waiting_LPE().
|
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.
slot | the slot to connect |
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().
|
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().
|
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.
slot | the slot to connect |
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().
|
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().
|
inline |
Definition at line 167 of file selection.h.
References _emitModified(), and _flags.
Referenced by Inkscape::LivePathEffect::ToggleButtonParam::toggled().
std::vector< Inkscape::SnapCandidatePoint > Inkscape::Selection::getSnapPoints | ( | SnapPreferences const * | snapprefs | ) | const |
Compute the list of points in the selection that are to be considered for snapping from.
Definition at line 165 of file selection.cpp.
References SPItem::getCenter(), SPItem::getSnappoints(), Inkscape::SnapPreferences::isTargetSnappable(), Inkscape::ObjectSet::items(), Inkscape::SnapPreferences::setTargetSnappable(), Inkscape::SNAPSOURCE_ROTATION_CENTER, and Inkscape::SNAPTARGET_ROTATION_CENTER.
Referenced by Inkscape::SelTrans::grab().
SelectionState Inkscape::Selection::getState | ( | ) |
Returns the current selection state including selected objects and nodes.
Definition at line 307 of file selection.cpp.
References Inkscape::ObjectSet::desktop(), SPObject::getId(), SPDesktop::getTool(), item, Inkscape::ObjectSet::items(), node, Inkscape::SelectionState::selected_ids, and Inkscape::SelectionState::selected_nodes.
Referenced by Inkscape::UI::Tools::PagesTool::PagesTool().
bool Inkscape::ObjectSet::includes | ( | Inkscape::XML::Node * | node, |
bool | anyAncestor = false |
||
) |
Definition at line 181 of file object-set.cpp.
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.
|
inline |
Returns true if the given item is selected.
Definition at line 140 of file selection.h.
References _objectForXMLNode(), and includes().
Referenced by Inkscape::UI::Dialog::SelectorsDialog::_selectRow(), ContextMenu::ContextMenu(), Inkscape::LivePathEffect::LPEBool::doBeforeEffect(), includes(), Inkscape::UI::Dialog::ObjectsPanel::on_click(), Inkscape::UI::Dialog::ObjectsPanel::on_drag_motion(), Inkscape::UI::Dialog::ObjectsPanel::selectCursorItem(), Inkscape::UI::Tools::MeasureTool::showCanvasItems(), Inkscape::UI::Tools::MeasureTool::showInfoBox(), Inkscape::UI::Tools::sp_tweak_dilate_recursive(), Inkscape::SelTrans::stamp(), Inkscape::UI::Dialog::ObjectsPanel::toggleLocked(), Inkscape::UI::Dialog::ObjectsPanel::toggleVisible(), Inkscape::LivePathEffect::LPEBendPath::transform_multiply(), Inkscape::LivePathEffect::LPEBool::transform_multiply(), Inkscape::LivePathEffect::LPEFillBetweenMany::transform_multiply_nested(), Inkscape::LivePathEffect::LPEFillBetweenStrokes::transform_multiply_nested(), and Inkscape::LivePathEffect::Parameter::update_satellites().
Returns ancestor if the given object has ancestor selected.
Definition at line 186 of file object-set.cpp.
References child, and Inkscape::ObjectSet::includes().
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().
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().
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().
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.
item | the item to unselect |
Definition at line 175 of file object-set.cpp.
|
inline |
Removes an item from the set of selected objects.
It is ok to call this method for an unselected item.
repr | the 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().
void Inkscape::Selection::rotateAnchored | ( | double | angle_degrees, |
double | zoom = 1.0 |
||
) |
Rotate the selection, anchoring it against the center, or a selected anchor.
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().
void Inkscape::Selection::scaleAnchored | ( | double | amount, |
bool | fixed = true |
||
) |
Scale the selection, anchoring it against the center, or a selected anchor.
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().
void Inkscape::ObjectSet::set | ( | SPObject * | object, |
bool | persist_selection_context = false |
||
) |
Set the selection to a single specific object.
obj | the object to select |
Definition at line 193 of file object-set.cpp.
void Inkscape::ObjectSet::set | ( | XML::Node * | repr | ) |
Definition at line 194 of file object-set.cpp.
|
inline |
Set the selection to an XML node's SPObject.
repr | the 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().
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.
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.
|
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().
|
inline |
Definition at line 257 of file selection.h.
References _change_page, and option.
Referenced by Inkscape::UI::Tools::ToolBase::set().
void Inkscape::Selection::setState | ( | SelectionState const & | state | ) |
Restores a selection state previously obtained from getState()
Definition at line 364 of file selection.cpp.
References Inkscape::UI::Tools::NodeTool::_selected_nodes, add(), Inkscape::ObjectSet::clear(), Inkscape::ObjectSet::desktop(), Inkscape::ObjectSet::document(), SPDocument::getDefs(), SPDocument::getObjectById(), SPDesktop::getTool(), SPObject::isAncestorOf(), item, node, Inkscape::UI::ControlPointSelection::selectAll(), Inkscape::SelectionState::selected_ids, Inkscape::SelectionState::selected_nodes, and Inkscape::ObjectSet::size().
|
private |
Definition at line 281 of file selection.h.
Referenced by _emitChanged(), and setChangeLayer().
|
private |
Definition at line 282 of file selection.h.
Referenced by _emitChanged(), and setChangePage().
|
private |
Definition at line 286 of file selection.h.
Referenced by _emitChanged(), connectChanged(), and connectChangedFirst().
|
private |
Definition at line 284 of file selection.h.
Referenced by _emitChanged(), and _releaseContext().
|
private |
Definition at line 279 of file selection.h.
Referenced by _emit_modified(), _schedule_modified(), and emitModified().
|
private |
Definition at line 280 of file selection.h.
Referenced by _emit_modified(), _schedule_modified(), and ~Selection().
|
private |
Definition at line 283 of file selection.h.
Referenced by _connectSignals(), and _releaseSignals().
|
private |
Definition at line 287 of file selection.h.
Referenced by _emitModified(), connectModified(), and connectModifiedFirst().
|
private |
Definition at line 289 of file selection.h.
Referenced by rotateAnchored().
|
private |
Definition at line 278 of file selection.h.
Referenced by _emitChanged(), _releaseContext(), and activeContext().
Geom::Point Inkscape::Selection::anchor |
Definition at line 201 of file selection.h.
Referenced by Inkscape::SelCue::_newItemLines(), Inkscape::UI::Toolbar::SelectToolbar::layout_widget_update(), rotateAnchored(), scaleAnchored(), and setAnchor().
bool Inkscape::Selection::has_anchor = false |
Definition at line 200 of file selection.h.
Referenced by Inkscape::SelCue::_newItemLines(), rotateAnchored(), scaleAnchored(), and setAnchor().