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/tools | |
| 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/tools')
| -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 |
7 files changed, 35 insertions, 35 deletions
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; |
