diff options
| author | Marc Jeanmougin <marc@jeanmougin.fr> | 2016-10-24 22:58:43 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marcjeanmougin@free.fr> | 2016-10-24 22:58:43 +0000 |
| commit | 532f77b14a76fc04e6bdeca3625f9a55b5f11bdf (patch) | |
| tree | b70df28300f24edde9b04d0c7704c11c295c4c62 /src/ui | |
| parent | [Bug #1636086] Update Catalan translation for Inkscape 0.92. (diff) | |
| download | inkscape-532f77b14a76fc04e6bdeca3625f9a55b5f11bdf.tar.gz inkscape-532f77b14a76fc04e6bdeca3625f9a55b5f11bdf.zip | |
CPPification: almost all sp_object_set_whatever and sp_selection_whatever global functions are now methods of ObjectSet*, with these additional benefits:
- They can now act on any SelectionSet, not just the current selection;
- Whenever possible, they don't need a desktop anymore and can run if called from GUI.
I hope I did not break too many things in the process.
*: So instead of callink sp_selection_move(desktop,x,y), you call myobjectset->move(x,y)
(bzr r15189)
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/clipboard.cpp | 187 | ||||
| -rw-r--r-- | src/ui/clipboard.h | 10 | ||||
| -rw-r--r-- | src/ui/dialog/export.cpp | 2 | ||||
| -rw-r--r-- | src/ui/dialog/layer-properties.cpp | 2 | ||||
| -rw-r--r-- | src/ui/dialog/livepatheffect-editor.cpp | 4 | ||||
| -rw-r--r-- | src/ui/dialog/transformation.cpp | 20 | ||||
| -rw-r--r-- | src/ui/interface.cpp | 16 | ||||
| -rw-r--r-- | src/ui/tools/box3d-tool.cpp | 2 | ||||
| -rw-r--r-- | src/ui/tools/eraser-tool.cpp | 14 | ||||
| -rw-r--r-- | src/ui/tools/freehand-base.cpp | 2 | ||||
| -rw-r--r-- | src/ui/tools/pen-tool.cpp | 2 | ||||
| -rw-r--r-- | src/ui/tools/pencil-tool.cpp | 2 | ||||
| -rw-r--r-- | src/ui/tools/rect-tool.cpp | 2 | ||||
| -rw-r--r-- | src/ui/tools/select-tool.cpp | 46 |
14 files changed, 155 insertions, 156 deletions
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 66b13ed9d..0a671cc8a 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -74,6 +74,7 @@ #include "svg/svg-color.h" #include "sp-namedview.h" #include "persp3d.h" +#include "object-set.h" /// Made up mimetype to represent Gdk::Pixbuf clipboard contents. #define CLIPBOARD_GDK_PIXBUF_TARGET "image/x-gdk-pixbuf" @@ -93,13 +94,13 @@ namespace UI { */ class ClipboardManagerImpl : public ClipboardManager { public: - virtual void copy(SPDesktop *desktop); + virtual void copy(ObjectSet *set); virtual void copyPathParameter(Inkscape::LivePathEffect::PathParam *); virtual void copySymbol(Inkscape::XML::Node* symbol, gchar const* style, bool user_symbol); virtual bool paste(SPDesktop *desktop, bool in_place); - virtual bool pasteStyle(SPDesktop *desktop); - virtual bool pasteSize(SPDesktop *desktop, bool separately, bool apply_x, bool apply_y); - virtual bool pastePathEffect(SPDesktop *desktop); + virtual bool pasteStyle(ObjectSet *set); + virtual bool pasteSize(ObjectSet *set, bool separately, bool apply_x, bool apply_y); + virtual bool pastePathEffect(ObjectSet *set); virtual Glib::ustring getPathParameter(SPDesktop* desktop); virtual Glib::ustring getShapeOrTextObjectId(SPDesktop *desktop); virtual const gchar *getFirstObjectID(); @@ -108,7 +109,7 @@ public: ~ClipboardManagerImpl(); private: - void _copySelection(Inkscape::Selection *); + void _copySelection(ObjectSet *); void _copyUsedDefs(SPItem *); void _copyGradient(SPGradient *); void _copyPattern(SPPattern *); @@ -183,76 +184,74 @@ ClipboardManagerImpl::~ClipboardManagerImpl() {} /** * Copy selection contents to the clipboard. */ -void ClipboardManagerImpl::copy(SPDesktop *desktop) +void ClipboardManagerImpl::copy(ObjectSet *set) { - if ( desktop == NULL ) { - return; - } - Inkscape::Selection *selection = desktop->getSelection(); + if ( set->desktop() ) { + SPDesktop *desktop = set->desktop(); + + // Special case for when the gradient dragger is active - copies gradient color + if (desktop->event_context->get_drag()) { + GrDrag *drag = desktop->event_context->get_drag(); + if (drag->hasSelection()) { + guint32 col = drag->getColor(); + + // set the color as clipboard content (text in RRGGBBAA format) + _setClipboardColor(col); + + // create a style with this color on fill and opacity in master opacity, so it can be + // pasted on other stops or objects + if (_text_style) { + sp_repr_css_attr_unref(_text_style); + _text_style = NULL; + } + _text_style = sp_repr_css_attr_new(); + // print and set properties + gchar color_str[16]; + g_snprintf(color_str, 16, "#%06x", col >> 8); + sp_repr_css_set_property(_text_style, "fill", color_str); + float opacity = SP_RGBA32_A_F(col); + if (opacity > 1.0) { + opacity = 1.0; // safeguard + } + Inkscape::CSSOStringStream opcss; + opcss << opacity; + sp_repr_css_set_property(_text_style, "opacity", opcss.str().data()); - // Special case for when the gradient dragger is active - copies gradient color - if (desktop->event_context->get_drag()) { - GrDrag *drag = desktop->event_context->get_drag(); - if (drag->hasSelection()) { - guint32 col = drag->getColor(); + _discardInternalClipboard(); + return; + } + } - // set the color as clipboard content (text in RRGGBBAA format) - _setClipboardColor(col); + // Special case for when the color picker ("dropper") is active - copies color under cursor + if (tools_isactive(desktop, TOOLS_DROPPER)) { + //_setClipboardColor(sp_dropper_context_get_color(desktop->event_context)); + _setClipboardColor(SP_DROPPER_CONTEXT(desktop->event_context)->get_color()); + _discardInternalClipboard(); + return; + } - // create a style with this color on fill and opacity in master opacity, so it can be - // pasted on other stops or objects + // Special case for when the text tool is active - if some text is selected, copy plain text, + // not the object that holds it; also copy the style at cursor into + if (tools_isactive(desktop, TOOLS_TEXT)) { + _discardInternalClipboard(); + Glib::ustring selected_text = Inkscape::UI::Tools::sp_text_get_selected_text(desktop->event_context); + _clipboard->set_text(selected_text); if (_text_style) { sp_repr_css_attr_unref(_text_style); _text_style = NULL; } - _text_style = sp_repr_css_attr_new(); - // print and set properties - gchar color_str[16]; - g_snprintf(color_str, 16, "#%06x", col >> 8); - sp_repr_css_set_property(_text_style, "fill", color_str); - float opacity = SP_RGBA32_A_F(col); - if (opacity > 1.0) { - opacity = 1.0; // safeguard - } - Inkscape::CSSOStringStream opcss; - opcss << opacity; - sp_repr_css_set_property(_text_style, "opacity", opcss.str().data()); - - _discardInternalClipboard(); + _text_style = Inkscape::UI::Tools::sp_text_get_style_at_cursor(desktop->event_context); return; } } - - // Special case for when the color picker ("dropper") is active - copies color under cursor - if (tools_isactive(desktop, TOOLS_DROPPER)) { - //_setClipboardColor(sp_dropper_context_get_color(desktop->event_context)); - _setClipboardColor(SP_DROPPER_CONTEXT(desktop->event_context)->get_color()); - _discardInternalClipboard(); - return; - } - - // Special case for when the text tool is active - if some text is selected, copy plain text, - // not the object that holds it; also copy the style at cursor into - if (tools_isactive(desktop, TOOLS_TEXT)) { - _discardInternalClipboard(); - Glib::ustring selected_text = Inkscape::UI::Tools::sp_text_get_selected_text(desktop->event_context); - _clipboard->set_text(selected_text); - if (_text_style) { - sp_repr_css_attr_unref(_text_style); - _text_style = NULL; - } - _text_style = Inkscape::UI::Tools::sp_text_get_style_at_cursor(desktop->event_context); - return; - } - - if (selection->isEmpty()) { // check whether something is selected - _userWarn(desktop, _("Nothing was copied.")); + if (set->isEmpty()) { // check whether something is selected + _userWarn(set->desktop(), _("Nothing was copied.")); return; } _discardInternalClipboard(); _createInternalClipboard(); // construct a new clipboard document - _copySelection(selection); // copy all items in the selection to the internal clipboard + _copySelection(set); // copy all items in the selection to the internal clipboard fit_canvas_to_drawing(_clipboardSPDoc); _setClipboardTargets(); @@ -426,16 +425,15 @@ const gchar *ClipboardManagerImpl::getFirstObjectID() /** * Implements the Paste Style action. */ -bool ClipboardManagerImpl::pasteStyle(SPDesktop *desktop) +bool ClipboardManagerImpl::pasteStyle(ObjectSet *set) { - if (desktop == NULL) { + if (set->desktop() == NULL) { return false; } // check whether something is selected - Inkscape::Selection *selection = desktop->getSelection(); - if (selection->isEmpty()) { - _userWarn(desktop, _("Select <b>object(s)</b> to paste style to.")); + if (set->isEmpty()) { + _userWarn(set->desktop(), _("Select <b>object(s)</b> to paste style to.")); return false; } @@ -443,10 +441,10 @@ bool ClipboardManagerImpl::pasteStyle(SPDesktop *desktop) if ( tempdoc == NULL ) { // no document, but we can try _text_style if (_text_style) { - sp_desktop_set_style(desktop, _text_style); + sp_desktop_set_style(set, set->desktop(), _text_style); return true; } else { - _userWarn(desktop, _("No style on the clipboard.")); + _userWarn(set->desktop(), _("No style on the clipboard.")); return false; } } @@ -457,13 +455,13 @@ bool ClipboardManagerImpl::pasteStyle(SPDesktop *desktop) bool pasted = false; if (clipnode) { - desktop->doc()->importDefs(tempdoc); + set->document()->importDefs(tempdoc); SPCSSAttr *style = sp_repr_css_attr(clipnode, "style"); - sp_desktop_set_style(desktop, style); + sp_desktop_set_style(set, set->desktop(), style); pasted = true; } else { - _userWarn(desktop, _("No style on the clipboard.")); + _userWarn(set->desktop(), _("No style on the clipboard.")); } tempdoc->doUnref(); @@ -477,29 +475,31 @@ bool ClipboardManagerImpl::pasteStyle(SPDesktop *desktop) * @param apply_x Whether to scale the width of objects / selection * @param apply_y Whether to scale the height of objects / selection */ -bool ClipboardManagerImpl::pasteSize(SPDesktop *desktop, bool separately, bool apply_x, bool apply_y) +bool ClipboardManagerImpl::pasteSize(ObjectSet *set, bool separately, bool apply_x, bool apply_y) { if (!apply_x && !apply_y) { return false; // pointless parameters } - if ( desktop == NULL ) { +/* if ( desktop == NULL ) { return false; } - Inkscape::Selection *selection = desktop->getSelection(); - if (selection->isEmpty()) { - _userWarn(desktop, _("Select <b>object(s)</b> to paste size to.")); + Inkscape::Selection *selection = desktop->getSelection();*/ + if (set->isEmpty()) { + if(set->desktop()) + _userWarn(set->desktop(), _("Select <b>object(s)</b> to paste size to.")); return false; } // FIXME: actually, this should accept arbitrary documents SPDocument *tempdoc = _retrieveClipboard("image/x-inkscape-svg"); if ( tempdoc == NULL ) { - _userWarn(desktop, _("No size on the clipboard.")); + if(set->desktop()) + _userWarn(set->desktop(), _("No size on the clipboard.")); return false; } - // retrieve size ifomration from the clipboard + // retrieve size information from the clipboard Inkscape::XML::Node *root = tempdoc->getReprRoot(); Inkscape::XML::Node *clipnode = sp_repr_lookup_name(root, "inkscape:clipboard", 1); bool pasted = false; @@ -510,13 +510,13 @@ bool ClipboardManagerImpl::pasteSize(SPDesktop *desktop, bool separately, bool a // resize each object in the selection if (separately) { - auto itemlist= selection->items(); + auto itemlist= set->items(); for(auto i=itemlist.begin();i!=itemlist.end();++i){ SPItem *item = *i; if (item) { Geom::OptRect obj_size = item->desktopVisualBounds(); if ( obj_size ) { - sp_item_scale_rel(item, _getScale(desktop, min, max, *obj_size, apply_x, apply_y)); + sp_item_scale_rel(item, _getScale(set->desktop(), min, max, *obj_size, apply_x, apply_y)); } } else { g_assert_not_reached(); @@ -525,10 +525,10 @@ bool ClipboardManagerImpl::pasteSize(SPDesktop *desktop, bool separately, bool a } // resize the selection as a whole else { - Geom::OptRect sel_size = selection->visualBounds(); + Geom::OptRect sel_size = set->visualBounds(); if ( sel_size ) { - sp_object_set_scale_relative(selection, sel_size->midpoint(), - _getScale(desktop, min, max, *sel_size, apply_x, apply_y)); + set->setScaleRelative(sel_size->midpoint(), + _getScale(set->desktop(), min, max, *sel_size, apply_x, apply_y)); } } pasted = true; @@ -541,18 +541,18 @@ bool ClipboardManagerImpl::pasteSize(SPDesktop *desktop, bool separately, bool a /** * Applies a path effect from the clipboard to the selected path. */ -bool ClipboardManagerImpl::pastePathEffect(SPDesktop *desktop) +bool ClipboardManagerImpl::pastePathEffect(ObjectSet *set) { /** @todo FIXME: pastePathEffect crashes when moving the path with the applied effect, segfaulting in fork_private_if_necessary(). */ - if ( desktop == NULL ) { + if ( set->desktop() == NULL ) { return false; } - Inkscape::Selection *selection = desktop->getSelection(); - if (!selection || selection->isEmpty()) { - _userWarn(desktop, _("Select <b>object(s)</b> to paste live path effect to.")); + //Inkscape::Selection *selection = desktop->getSelection(); + if (!set || set->isEmpty()) { + _userWarn(set->desktop(), _("Select <b>object(s)</b> to paste live path effect to.")); return false; } @@ -563,10 +563,10 @@ bool ClipboardManagerImpl::pastePathEffect(SPDesktop *desktop) if ( clipnode ) { gchar const *effectstack = clipnode->attribute("inkscape:path-effect"); if ( effectstack ) { - desktop->doc()->importDefs(tempdoc); + set->document()->importDefs(tempdoc); // make sure all selected items are converted to paths first (i.e. rectangles) - sp_selected_to_lpeitems(desktop); - auto itemlist= selection->items(); + set->toLPEItems(); + auto itemlist= set->items(); for(auto i=itemlist.begin();i!=itemlist.end();++i){ SPItem *item = *i; _applyPathEffect(item, effectstack); @@ -578,7 +578,7 @@ bool ClipboardManagerImpl::pastePathEffect(SPDesktop *desktop) } // no_effect: - _userWarn(desktop, _("No effect on the clipboard.")); + _userWarn(set->desktop(), _("No effect on the clipboard.")); return false; } @@ -646,7 +646,7 @@ Glib::ustring ClipboardManagerImpl::getShapeOrTextObjectId(SPDesktop *desktop) /** * Iterate over a list of items and copy them to the clipboard. */ -void ClipboardManagerImpl::_copySelection(Inkscape::Selection *selection) +void ClipboardManagerImpl::_copySelection(ObjectSet *selection) { // copy the defs used by all items auto itemlist= selection->items(); @@ -1270,7 +1270,7 @@ Geom::Scale ClipboardManagerImpl::_getScale(SPDesktop *desktop, Geom::Point cons } // If the "lock aspect ratio" button is pressed and we paste only a single coordinate, // resize the second one by the same ratio too - if (desktop->isToolboxButtonActive("lock")) { + if (desktop && desktop->isToolboxButtonActive("lock")) { if (apply_x && !apply_y) { scale_y = scale_x; } @@ -1432,7 +1432,8 @@ void ClipboardManagerImpl::_setClipboardColor(guint32 color) */ void ClipboardManagerImpl::_userWarn(SPDesktop *desktop, char const *msg) { - desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, msg); + if(desktop) + desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, msg); } /* ####################################### diff --git a/src/ui/clipboard.h b/src/ui/clipboard.h index 9f3b6cbdb..32a49867c 100644 --- a/src/ui/clipboard.h +++ b/src/ui/clipboard.h @@ -24,7 +24,7 @@ // forward declarations class SPDesktop; namespace Inkscape { -class Selection; +class ObjectSet; namespace XML { class Node; } namespace LivePathEffect { class PathParam; } @@ -42,13 +42,13 @@ namespace UI { class ClipboardManager { public: - virtual void copy(SPDesktop *desktop) = 0; + virtual void copy(ObjectSet *set) = 0; virtual void copyPathParameter(Inkscape::LivePathEffect::PathParam *) = 0; virtual void copySymbol(Inkscape::XML::Node* symbol, gchar const* style, bool user_symbol = true) = 0; virtual bool paste(SPDesktop *desktop, bool in_place = false) = 0; - virtual bool pasteStyle(SPDesktop *desktop) = 0; - virtual bool pasteSize(SPDesktop *desktop, bool separately, bool apply_x, bool apply_y) = 0; - virtual bool pastePathEffect(SPDesktop *desktop) = 0; + virtual bool pasteStyle(ObjectSet *set) = 0; + virtual bool pasteSize(ObjectSet *set, bool separately, bool apply_x, bool apply_y) = 0; + virtual bool pastePathEffect(ObjectSet *set) = 0; virtual Glib::ustring getPathParameter(SPDesktop* desktop) = 0; virtual Glib::ustring getShapeOrTextObjectId(SPDesktop *desktop) = 0; virtual const gchar *getFirstObjectID() = 0; diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 64a5d9866..98ecf6db7 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -785,7 +785,7 @@ void Export::onAreaToggled () case SELECTION_SELECTION: if ((SP_ACTIVE_DESKTOP->getSelection())->isEmpty() == false) { - sp_object_set_get_export_hints(SP_ACTIVE_DESKTOP->getSelection(), filename, &xdpi, &ydpi); + SP_ACTIVE_DESKTOP->getSelection()->getExportHints(filename, &xdpi, &ydpi); /* If we still don't have a filename -- let's build one that's nice */ diff --git a/src/ui/dialog/layer-properties.cpp b/src/ui/dialog/layer-properties.cpp index 4aa86cc48..f28f8336a 100644 --- a/src/ui/dialog/layer-properties.cpp +++ b/src/ui/dialog/layer-properties.cpp @@ -384,7 +384,7 @@ void LayerPropertiesDialog::Move::setup(LayerPropertiesDialog &dialog) { void LayerPropertiesDialog::Move::perform(LayerPropertiesDialog &dialog) { SPObject *moveto = dialog._selectedLayer(); - sp_selection_to_layer(dialog._desktop, moveto, false); + dialog._desktop->selection->toLayer(moveto); } void LayerPropertiesDialog::_setDesktop(SPDesktop *desktop) { diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 73f8debd6..b97b0e63a 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -419,7 +419,7 @@ LivePathEffectEditor::onAdd() // If item is a SPRect, convert it to path first: if ( dynamic_cast<SPRect *>(item) ) { - sp_selected_path_to_curves(sel, current_desktop, false); + sel->toCurves(); item = sel->singleItem(); // get new item } @@ -451,7 +451,7 @@ LivePathEffectEditor::onAdd() item = NULL; // run sp_selection_clone_original_path_lpe - sp_selection_clone_original_path_lpe(current_desktop); + sel->cloneOriginalPathLPE(); SPItem *new_item = sel->singleItem(); // Check that the cloning was successful. We don't want to change the ID of the original referenced path! diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index 7f1492cd7..5ec47b0dc 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -617,12 +617,11 @@ void Transformation::applyPageMove(Inkscape::Selection *selection) if (!prefs->getBool("/dialogs/transformation/applyseparately")) { // move selection as a whole if (_check_move_relative.get_active()) { - sp_object_set_move_relative(selection, x, y); + selection->moveRelative(x, y); } else { Geom::OptRect bbox = selection->preferredBounds(); if (bbox) { - sp_object_set_move_relative(selection, - x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]); + selection->moveRelative(x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]); } } } else { @@ -685,8 +684,7 @@ void Transformation::applyPageMove(Inkscape::Selection *selection) } else { Geom::OptRect bbox = selection->preferredBounds(); if (bbox) { - sp_object_set_move_relative(selection, - x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]); + selection->moveRelative(x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]); } } } @@ -750,7 +748,7 @@ void Transformation::applyPageScale(Inkscape::Selection *selection) double y1 = bbox_pref->midpoint()[Geom::Y] + new_height/2; Geom::Affine scaler = get_scale_transform_for_variable_stroke (*bbox_pref, *bbox_geom, transform_stroke, preserve, x0, y0, x1, y1); - sp_object_set_apply_affine(selection, scaler); + selection->applyAffine(scaler); } } @@ -776,7 +774,7 @@ void Transformation::applyPageRotate(Inkscape::Selection *selection) } else { boost::optional<Geom::Point> center = selection->center(); if (center) { - sp_object_set_rotate_relative(selection, *center, angle); + selection->rotateRelative(*center, angle); } } @@ -843,7 +841,7 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) getDesktop()->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>.")); return; } - sp_object_set_skew_relative(selection, *center, 0.01 * skewX, 0.01 * skewY); + selection->skewRelative(*center, 0.01 * skewX, 0.01 * skewY); } else if (_units_skew.isRadial()) { //deg or rad double angleX = _scalar_skew_horizontal.getValue("rad"); double angleY = _scalar_skew_vertical.getValue("rad"); @@ -856,7 +854,7 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) } double skewX = tan(-angleX); double skewY = tan(angleY); - sp_object_set_skew_relative(selection, *center, skewX, skewY); + selection->skewRelative(*center, skewX, skewY); } else { // absolute displacement double skewX = _scalar_skew_horizontal.getValue("px"); double skewY = _scalar_skew_vertical.getValue("px"); @@ -864,7 +862,7 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) getDesktop()->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>.")); return; } - sp_object_set_skew_relative(selection, *center, skewX / height, skewY / width); + selection->skewRelative(*center, skewX / height, skewY / width); } } } @@ -897,7 +895,7 @@ void Transformation::applyPageTransform(Inkscape::Selection *selection) item->updateRepr(); } } else { - sp_object_set_apply_affine(selection, displayed); // post-multiply each object's transform + selection->applyAffine(displayed); // post-multiply each object's transform } DocumentUndo::done(selection->desktop()->getDocument(), SP_VERB_DIALOG_TRANSFORM, diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index b47e66451..e0c767509 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -1210,7 +1210,7 @@ sp_ui_drag_data_received(GtkWidget *widget, Geom::OptRect sel_bbox = selection->visualBounds(); if (sel_bbox) { Geom::Point m( desktop->point() - sel_bbox->midpoint() ); - sp_object_set_move_relative(selection, m, false); + selection->moveRelative(m, false); } } @@ -1841,28 +1841,28 @@ void ContextMenu::ItemCreateLink(void) void ContextMenu::SetMask(void) { - sp_selection_set_mask(_desktop, false, false); + _desktop->selection->setMask(false, false); } void ContextMenu::ReleaseMask(void) { - sp_selection_unset_mask(_desktop, false); + _desktop->selection->unsetMask(false); } void ContextMenu::CreateGroupClip(void) { - sp_selection_set_clipgroup(_desktop); + _desktop->selection->setClipGroup(); } void ContextMenu::SetClip(void) { - sp_selection_set_mask(_desktop, true, false); + _desktop->selection->setMask(true, false); } void ContextMenu::ReleaseClip(void) { - sp_selection_unset_mask(_desktop, true); + _desktop->selection->unsetMask(true); } void ContextMenu::MakeGroupMenu(void) @@ -1876,7 +1876,7 @@ void ContextMenu::MakeGroupMenu(void) void ContextMenu::ActivateGroup(void) { - sp_selection_group(_desktop->selection, _desktop); + _desktop->selection->group(); } void ContextMenu::ActivateUngroup(void) @@ -1889,7 +1889,7 @@ void ContextMenu::ActivateUngroup(void) void ContextMenu::ActivateUngroupPopSelection(void) { - sp_selection_ungroup_pop_selection(_desktop->selection, _desktop); + _desktop->selection->popFromGroup(); } diff --git a/src/ui/tools/box3d-tool.cpp b/src/ui/tools/box3d-tool.cpp index 94488a700..425695a2c 100644 --- a/src/ui/tools/box3d-tool.cpp +++ b/src/ui/tools/box3d-tool.cpp @@ -400,7 +400,7 @@ bool Box3dTool::root_handler(GdkEvent* event) { case GDK_KEY_g: case GDK_KEY_G: if (MOD__SHIFT_ONLY(event)) { - sp_selection_to_guides(desktop); + desktop->selection->toGuides(); ret = true; } break; diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index 12686160b..4f941e534 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -732,10 +732,10 @@ void EraserTool::set_to_accumulated() { workDone = true; // TODO set this only if something was cut. bool break_apart = prefs->getBool("/tools/eraser/break_apart", false); if(!break_apart){ - sp_selected_path_combine(this->desktop, true); + selection->combine(true); } else { if(!this->nowidth){ - sp_selected_path_break_apart(this->desktop, true); + selection->breakApart(true); } } if ( !selection->isEmpty() ) { @@ -784,7 +784,7 @@ void EraserTool::set_to_accumulated() { sp_object_ref(clip_path, 0); clip_path->deleteObject(true); sp_object_unref(clip_path); - sp_selection_raise_to_top(selection, this->desktop, true); + selection->raiseToTop(true); selection->add(dup_clip); sp_selected_path_diff_skip_undo(selection); SPItem * clip = SP_ITEM(*(selection->items().begin())); @@ -800,13 +800,13 @@ void EraserTool::set_to_accumulated() { rect->transform = SP_ITEM(rect->parent)->i2dt_affine().inverse(); rect->updateRepr(); rect->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); - sp_selection_raise_to_top(selection, this->desktop, true); + selection->raiseToTop(true); selection->add(rect); sp_selected_path_diff_skip_undo(selection); } - sp_selection_raise_to_top(selection, this->desktop, true); + selection->raiseToTop(true); selection->add(item); - sp_selection_set_mask(this->desktop, true, false, true); + selection->setMask(true, false, true); } else { SPItem *erase_clip = selection->singleItem(); if (erase_clip) { @@ -836,7 +836,7 @@ void EraserTool::set_to_accumulated() { } if (eraser_mode == ERASER_MODE_DELETE) { - sp_selection_delete(this->desktop); + selection->deleteItems(); remainingItems.clear(); } diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index a7cd39a89..300324467 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -435,7 +435,7 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item, if(bend_item != NULL && bend_item->getRepr() != NULL){ gchar const *svgd = item->getRepr()->attribute("d"); dc->selection->add(SP_OBJECT(bend_item)); - sp_selection_duplicate(dc->desktop); + dc->selection->duplicate(); dc->selection->remove(SP_OBJECT(bend_item)); bend_item = dc->selection->singleItem(); if(bend_item){ diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index b7579b1fb..312338882 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -1233,7 +1233,7 @@ bool PenTool::_handleKeyPress(GdkEvent *event) { case GDK_KEY_g: case GDK_KEY_G: if (MOD__SHIFT_ONLY(event)) { - sp_selection_to_guides(this->desktop); + this->desktop->selection->toGuides(); ret = true; } break; diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp index 9e8005be8..54106437c 100644 --- a/src/ui/tools/pencil-tool.cpp +++ b/src/ui/tools/pencil-tool.cpp @@ -487,7 +487,7 @@ bool PencilTool::_handleKeyPress(GdkEventKey const &event) { case GDK_KEY_g: case GDK_KEY_G: if (Inkscape::UI::held_only_shift(event)) { - sp_selection_to_guides(this->desktop); + this->desktop->selection->toGuides(); ret = true; } break; diff --git a/src/ui/tools/rect-tool.cpp b/src/ui/tools/rect-tool.cpp index 00330ef57..272531945 100644 --- a/src/ui/tools/rect-tool.cpp +++ b/src/ui/tools/rect-tool.cpp @@ -294,7 +294,7 @@ bool RectTool::root_handler(GdkEvent* event) { case GDK_KEY_g: case GDK_KEY_G: if (MOD__SHIFT_ONLY(event)) { - sp_selection_to_guides(desktop); + desktop->selection->toGuides(); ret = true; } break; diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index 0cdeda0b6..6c450b3dc 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -902,15 +902,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(desktop->getSelection(), mul*-10, 0); // shift + desktop->getSelection()->moveScreen(mul*-10, 0); // shift } else { - sp_selection_move_screen(desktop->getSelection(), mul*-1, 0); // no shift + desktop->getSelection()->moveScreen(mul*-1, 0); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(desktop->getSelection(), mul*-10*nudge, 0); // shift + desktop->getSelection()->move(mul*-10*nudge, 0); // shift } else { - sp_selection_move(desktop->getSelection(), mul*-nudge, 0); // no shift + desktop->getSelection()->move(mul*-nudge, 0); // no shift } } @@ -925,15 +925,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(desktop->getSelection(), 0, mul*10); // shift + desktop->getSelection()->moveScreen(0, mul*10); // shift } else { - sp_selection_move_screen(desktop->getSelection(), 0, mul*1); // no shift + desktop->getSelection()->moveScreen(0, mul*1); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(desktop->getSelection(), 0, mul*10*nudge); // shift + desktop->getSelection()->move(0, mul*10*nudge); // shift } else { - sp_selection_move(desktop->getSelection(), 0, mul*nudge); // no shift + desktop->getSelection()->move(0, mul*nudge); // no shift } } @@ -948,15 +948,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(desktop->getSelection(), mul*10, 0); // shift + desktop->getSelection()->moveScreen(mul*10, 0); // shift } else { - sp_selection_move_screen(desktop->getSelection(), mul*1, 0); // no shift + desktop->getSelection()->moveScreen(mul*1, 0); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(desktop->getSelection(), mul*10*nudge, 0); // shift + desktop->getSelection()->move(mul*10*nudge, 0); // shift } else { - sp_selection_move(desktop->getSelection(), mul*nudge, 0); // no shift + desktop->getSelection()->move(mul*nudge, 0); // no shift } } @@ -971,15 +971,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(desktop->getSelection(), 0, mul*-10); // shift + desktop->getSelection()->moveScreen(0, mul*-10); // shift } else { - sp_selection_move_screen(desktop->getSelection(), 0, mul*-1); // no shift + desktop->getSelection()->moveScreen(0, mul*-1); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(desktop->getSelection(), 0, mul*-10*nudge); // shift + desktop->getSelection()->move(0, mul*-10*nudge); // shift } else { - sp_selection_move(desktop->getSelection(), 0, mul*-nudge); // no shift + desktop->getSelection()->move(0, mul*-nudge); // no shift } } @@ -1023,11 +1023,11 @@ bool SelectTool::root_handler(GdkEvent* event) { case GDK_KEY_bracketleft: if (MOD__ALT(event)) { gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask - sp_selection_rotate_screen(selection, mul*1); + selection->rotateScreen(mul*1); } else if (MOD__CTRL(event)) { - sp_selection_rotate(selection, 90); + selection->rotate(90); } else if (snaps) { - sp_selection_rotate(selection, 180.0/snaps); + selection->rotate(180.0/snaps); } ret = TRUE; @@ -1036,11 +1036,11 @@ bool SelectTool::root_handler(GdkEvent* event) { case GDK_KEY_bracketright: if (MOD__ALT(event)) { gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask - sp_selection_rotate_screen(selection, -1*mul); + selection->rotateScreen(-1*mul); } else if (MOD__CTRL(event)) { - sp_selection_rotate(selection, -90); + selection->rotate(-90); } else if (snaps) { - sp_selection_rotate(selection, -180.0/snaps); + selection->rotate(-180.0/snaps); } ret = TRUE; @@ -1084,7 +1084,7 @@ bool SelectTool::root_handler(GdkEvent* event) { case GDK_KEY_g: case GDK_KEY_G: if (MOD__SHIFT_ONLY(event)) { - sp_selection_to_guides(desktop); + desktop->selection->toGuides(); ret = true; } break; |
