Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
selection-chemistry.cpp File Reference

Miscellaneous operations on selected items. More...

Go to the source code of this file.

Namespaces

namespace  Inkscape
 Helper class to stream background task notifications as a series of messages.
 

Functions

static void selection_display_message (SPDesktop *desktop, Inkscape::MessageType msgType, Glib::ustring const &msg)
 
static void sp_selection_copy_one (Inkscape::XML::Node *repr, Geom::Affine full_t, std::vector< Inkscape::XML::Node * > &clip, Inkscape::XML::Document *xml_doc)
 Copies repr and its inherited css style elements, along with the accumulated transform 'full_t', then prepends the copy to 'clip'.
 
static void sp_selection_copy_impl (std::vector< SPItem * > const &items, std::vector< Inkscape::XML::Node * > &clip, Inkscape::XML::Document *xml_doc)
 
static std::vector< Inkscape::XML::Node * > sp_selection_paste_impl (SPDocument *doc, SPObject *parent, std::vector< Inkscape::XML::Node * > &clip, Inkscape::XML::Node *after=nullptr)
 
static void sp_selection_delete_impl (std::vector< SPItem * > const &items, bool propagate=true, bool propagate_descendants=true)
 
static void add_ids_recursive (std::vector< const gchar * > &ids, SPObject *obj)
 
void sp_edit_clear_all (Inkscape::Selection *selection)
 
static void get_all_items_recursive (std::vector< SPItem * > &list, SPObject *from, SPDesktop *desktop, bool onlyvisible, bool onlysensitive, bool ingroups, std::vector< SPItem * > const &exclude)
 
std::vector< SPItem * > get_all_items (SPObject *from, SPDesktop *desktop, bool onlyvisible, bool onlysensitive, bool ingroups, std::vector< SPItem * > const &exclude)
 
static void sp_edit_select_all_full (SPDesktop *dt, bool force_all_layers, bool invert)
 
void sp_edit_select_all (SPDesktop *desktop)
 
void sp_edit_select_all_in_all_layers (SPDesktop *desktop)
 
void sp_edit_invert (SPDesktop *desktop)
 
void sp_edit_invert_in_all_layers (SPDesktop *desktop)
 
template<typename Objects >
static SPUsefind_clone_to_group (Objects const &objects, std::set< SPGroup * > const &groups)
 Finds the first clone in objects which references an item in groups.
 
static void ungroup_impl (ObjectSet *set)
 Ungroup all groups in an object set.
 
static SPGroupsp_item_list_common_parent_group (const SPItemRange &items)
 If items in the list have a common parent, return it, otherwise return NULL.
 
static Geom::OptRect enclose_items (std::vector< SPItem * > const &items)
 Finds out the minimum common bbox of the selected items.
 
static SPObjectprev_sibling (SPObject *child)
 
SPCSSAttrtake_style_from_item (SPObject *object)
 
void sp_selection_paste (SPDesktop *desktop, bool in_place, bool on_page)
 
static void sp_selection_remove_livepatheffect_impl (SPItem *item)
 
void sp_selection_change_layer_maintain_clones (std::vector< SPItem * > const &items, SPObject *where)
 Ensures that the clones of objects are not modified when moving objects between layers.
 
static bool object_set_contains_original (SPItem *item, ObjectSet *set)
 
static bool object_set_contains_both_clone_and_original (ObjectSet *set)
 
void sp_select_same_fill_stroke_style (SPDesktop *desktop, gboolean fill, gboolean stroke, gboolean style)
 
void sp_select_same_object_type (SPDesktop *desktop)
 
std::vector< SPItem * > sp_get_same_fill_or_stroke_color (SPItem *sel, std::vector< SPItem * > &src, SPSelectStrokeStyleType type)
 
static bool item_type_match (SPItem *i, SPItem *j)
 
std::vector< SPItem * > sp_get_same_object_type (SPItem *sel, std::vector< SPItem * > &src)
 
std::vector< SPItem * > sp_get_same_style (SPItem *sel, std::vector< SPItem * > &src, SPSelectStrokeStyleType type)
 
template<typename D >
SPItemnext_item (SPDesktop *desktop, std::vector< SPObject * > &path, SPObject *root, bool only_in_viewport, PrefsSelectionContext inlayer, bool onlyvisible, bool onlysensitive)
 
template<typename D >
SPItemnext_item_from_list (SPDesktop *desktop, std::vector< SPItem * > const &items, SPObject *root, bool only_in_viewport, PrefsSelectionContext inlayer, bool onlyvisible, bool onlysensitive)
 
void sp_selection_item_next (SPDesktop *desktop)
 
void sp_selection_item_prev (SPDesktop *desktop)
 
void sp_selection_next_patheffect_param (SPDesktop *dt)
 
void scroll_to_show_item (SPDesktop *desktop, SPItem *item)
 If item is not entirely visible then adjust visible area to centre on the centre on of item.
 
static void sp_selection_to_guides_recursive (SPItem *item, bool wholegroups)
 
bool fit_canvas_to_drawing (SPDocument *doc, bool with_margins)
 
void fit_canvas_to_drawing (SPDesktop *desktop)
 
static void itemtree_map (void(*f)(SPItem *, SPDesktop *), SPObject *root, SPDesktop *desktop)
 
static void unlock (SPItem *item, SPDesktop *)
 
static void unhide (SPItem *item, SPDesktop *desktop)
 
static void process_all (void(*f)(SPItem *, SPDesktop *), SPDesktop *dt, bool layer_only)
 
void unlock_all (SPDesktop *dt)
 
void unlock_all_in_all_layers (SPDesktop *dt)
 
void unhide_all (SPDesktop *dt)
 
void unhide_all_in_all_layers (SPDesktop *dt)
 

Variables

SPCycleType SP_CYCLING = SP_CYCLE_FOCUS
 

Detailed Description

Miscellaneous operations on selected items.

Definition in file selection-chemistry.cpp.

Function Documentation

◆ add_ids_recursive()

static void add_ids_recursive ( std::vector< const gchar * > &  ids,
SPObject obj 
)
static

◆ enclose_items()

static Geom::OptRect enclose_items ( std::vector< SPItem * > const &  items)
static

Finds out the minimum common bbox of the selected items.

Definition at line 978 of file selection-chemistry.cpp.

References SPItem::documentVisualBounds(), item, items, and Geom::GenericOptRect< C >::unionWith().

Referenced by Inkscape::ObjectSet::lower(), and Inkscape::ObjectSet::raise().

◆ find_clone_to_group()

template<typename Objects >
static SPUse * find_clone_to_group ( Objects const &  objects,
std::set< SPGroup * > const &  groups 
)
static

Finds the first clone in objects which references an item in groups.

The search is recursive, the children of objects are searched as well. Return NULL if no such clone is found.

Definition at line 870 of file selection-chemistry.cpp.

References find_clone_to_group(), and root.

Referenced by find_clone_to_group(), and ungroup_impl().

◆ fit_canvas_to_drawing() [1/2]

void fit_canvas_to_drawing ( SPDesktop desktop)

◆ fit_canvas_to_drawing() [2/2]

bool fit_canvas_to_drawing ( SPDocument doc,
bool  with_margins 
)
Parameters
with_marginsmargins defined in the xml under <sodipodi:namedview> "fit-margin-..." attributes. See SPDocument::fitToRect.

WARNING: this is a page naive and it will break multi page documents.

Definition at line 4225 of file selection-chemistry.cpp.

References SPDocument::ensureUpToDate(), SPDocument::fitToRect(), SPDocument::getRoot(), and root.

Referenced by InkFileExportCmd::do_export_vector(), fit_canvas_drawing(), fit_canvas_to_drawing(), Inkscape::Extension::Internal::GdkpixbufInput::open(), and Inkscape::Extension::Internal::Svg::open().

◆ get_all_items()

std::vector< SPItem * > get_all_items ( SPObject from,
SPDesktop desktop,
bool  onlyvisible,
bool  onlysensitive,
bool  ingroups,
std::vector< SPItem * > const &  exclude 
)

◆ get_all_items_recursive()

static void get_all_items_recursive ( std::vector< SPItem * > &  list,
SPObject from,
SPDesktop desktop,
bool  onlyvisible,
bool  onlysensitive,
bool  ingroups,
std::vector< SPItem * > const &  exclude 
)
static

◆ item_type_match()

static bool item_type_match ( SPItem i,
SPItem j 
)
static

Definition at line 2085 of file selection-chemistry.cpp.

Referenced by sp_get_same_object_type().

◆ itemtree_map()

static void itemtree_map ( void(*)(SPItem *, SPDesktop *)  f,
SPObject root,
SPDesktop desktop 
)
static

◆ next_item()

template<typename D >
SPItem * next_item ( SPDesktop desktop,
std::vector< SPObject * > &  path,
SPObject root,
bool  only_in_viewport,
PrefsSelectionContext  inlayer,
bool  onlyvisible,
bool  onlysensitive 
)

◆ next_item_from_list()

template<typename D >
SPItem * next_item_from_list ( SPDesktop desktop,
std::vector< SPItem * > const &  items,
SPObject root,
bool  only_in_viewport,
PrefsSelectionContext  inlayer,
bool  onlyvisible,
bool  onlysensitive 
)

◆ object_set_contains_both_clone_and_original()

static bool object_set_contains_both_clone_and_original ( ObjectSet set)
static

Definition at line 1588 of file selection-chemistry.cpp.

References item, items, object_set_contains_original(), and set.

Referenced by Inkscape::ObjectSet::setMask().

◆ object_set_contains_original()

static bool object_set_contains_original ( SPItem item,
ObjectSet set 
)
static

◆ prev_sibling()

static SPObject * prev_sibling ( SPObject child)
static

Definition at line 990 of file selection-chemistry.cpp.

References child, and SPObject::getPrev().

Referenced by Inkscape::ObjectSet::lower().

◆ process_all()

static void process_all ( void(*)(SPItem *, SPDesktop *)  f,
SPDesktop dt,
bool  layer_only 
)
static

◆ scroll_to_show_item()

void scroll_to_show_item ( SPDesktop desktop,
SPItem item 
)

◆ selection_display_message()

◆ sp_edit_clear_all()

◆ sp_edit_invert()

void sp_edit_invert ( SPDesktop desktop)

Definition at line 739 of file selection-chemistry.cpp.

References desktop, and sp_edit_select_all_full().

Referenced by Inkscape::SelectionHelper::invert().

◆ sp_edit_invert_in_all_layers()

void sp_edit_invert_in_all_layers ( SPDesktop desktop)

◆ sp_edit_select_all()

void sp_edit_select_all ( SPDesktop desktop)

Definition at line 729 of file selection-chemistry.cpp.

References desktop, and sp_edit_select_all_full().

Referenced by Inkscape::SelectionHelper::selectAll().

◆ sp_edit_select_all_full()

◆ sp_edit_select_all_in_all_layers()

void sp_edit_select_all_in_all_layers ( SPDesktop desktop)

◆ sp_get_same_fill_or_stroke_color()

◆ sp_get_same_object_type()

std::vector< SPItem * > sp_get_same_object_type ( SPItem sel,
std::vector< SPItem * > &  src 
)

Definition at line 2126 of file selection-chemistry.cpp.

References SPObject::cloned, item, and item_type_match().

Referenced by sp_select_same_object_type().

◆ sp_get_same_style()

◆ sp_item_list_common_parent_group()

static SPGroup * sp_item_list_common_parent_group ( const SPItemRange items)
static

If items in the list have a common parent, return it, otherwise return NULL.

Definition at line 954 of file selection-chemistry.cpp.

References item, items, parent, and SPObject::parent.

Referenced by Inkscape::ObjectSet::lower(), Inkscape::ObjectSet::lowerToBottom(), Inkscape::ObjectSet::raise(), and Inkscape::ObjectSet::raiseToTop().

◆ sp_select_same_fill_stroke_style()

◆ sp_select_same_object_type()

◆ sp_selection_change_layer_maintain_clones()

void sp_selection_change_layer_maintain_clones ( std::vector< SPItem * > const &  items,
SPObject where 
)

Ensures that the clones of objects are not modified when moving objects between layers.

Calls the same function as ungroup

Definition at line 1391 of file selection-chemistry.cpp.

References item, items, SPObject::parent, and sp_item_group_ungroup_handle_clones().

Referenced by Inkscape::ObjectSet::toLayer(), Inkscape::ObjectSet::toNextLayer(), and Inkscape::ObjectSet::toPrevLayer().

◆ sp_selection_copy_impl()

static void sp_selection_copy_impl ( std::vector< SPItem * > const &  items,
std::vector< Inkscape::XML::Node * > &  clip,
Inkscape::XML::Document xml_doc 
)
static

◆ sp_selection_copy_one()

static void sp_selection_copy_one ( Inkscape::XML::Node repr,
Geom::Affine  full_t,
std::vector< Inkscape::XML::Node * > &  clip,
Inkscape::XML::Document xml_doc 
)
static

Copies repr and its inherited css style elements, along with the accumulated transform 'full_t', then prepends the copy to 'clip'.

Definition at line 260 of file selection-chemistry.cpp.

References clip(), css, Inkscape::XML::Node::duplicate(), sp_repr_css_attr_inherited(), sp_repr_css_attr_unref(), sp_repr_css_set(), and sp_svg_transform_write().

Referenced by Inkscape::ObjectSet::group(), Inkscape::ObjectSet::setClipGroup(), and sp_selection_copy_impl().

◆ sp_selection_delete_impl()

static void sp_selection_delete_impl ( std::vector< SPItem * > const &  items,
bool  propagate = true,
bool  propagate_descendants = true 
)
static

◆ sp_selection_item_next()

◆ sp_selection_item_prev()

◆ sp_selection_next_patheffect_param()

◆ sp_selection_paste()

void sp_selection_paste ( SPDesktop desktop,
bool  in_place,
bool  on_page 
)

◆ sp_selection_paste_impl()

◆ sp_selection_remove_livepatheffect_impl()

static void sp_selection_remove_livepatheffect_impl ( SPItem item)
static

Definition at line 1310 of file selection-chemistry.cpp.

References item.

Referenced by Inkscape::ObjectSet::removeLPE().

◆ sp_selection_to_guides_recursive()

static void sp_selection_to_guides_recursive ( SPItem item,
bool  wholegroups 
)
static

◆ take_style_from_item()

◆ ungroup_impl()

static void ungroup_impl ( ObjectSet set)
static

Ungroup all groups in an object set.

Clones of ungrouped groups will be unlinked.

Children of groups will not be ungrouped (operation is not recursive).

Unlinked clones and children of ungrouped groups will be added to the object set.

Definition at line 900 of file selection-chemistry.cpp.

References find_clone_to_group(), set, and sp_item_group_ungroup().

Referenced by Inkscape::ObjectSet::ungroup().

◆ unhide()

static void unhide ( SPItem item,
SPDesktop desktop 
)
static

◆ unhide_all()

void unhide_all ( SPDesktop dt)

Definition at line 4297 of file selection-chemistry.cpp.

References process_all(), and unhide().

◆ unhide_all_in_all_layers()

void unhide_all_in_all_layers ( SPDesktop dt)

Definition at line 4301 of file selection-chemistry.cpp.

References process_all(), and unhide().

◆ unlock()

static void unlock ( SPItem item,
SPDesktop  
)
static

Definition at line 4264 of file selection-chemistry.cpp.

References SPItem::isLocked(), item, and SPItem::setLocked().

Referenced by unlock_all(), and unlock_all_in_all_layers().

◆ unlock_all()

void unlock_all ( SPDesktop dt)

Definition at line 4289 of file selection-chemistry.cpp.

References process_all(), and unlock().

◆ unlock_all_in_all_layers()

void unlock_all_in_all_layers ( SPDesktop dt)

Definition at line 4293 of file selection-chemistry.cpp.

References process_all(), and unlock().

Variable Documentation

◆ SP_CYCLING