summaryrefslogtreecommitdiffstats
path: root/src/selection-chemistry.cpp
diff options
context:
space:
mode:
authorsu_v <suv-sf@users.sourceforge.net>2014-12-31 14:36:09 +0000
committer~suv <suv-sf@users.sourceforge.net>2014-12-31 14:36:09 +0000
commit02cb649c0ceebd254dde302eeba71406fb25a24c (patch)
tree4ccb52d7f06a7160adb2aaf1428d3a5a2acef9a5 /src/selection-chemistry.cpp
parentpackaging/macosx: update local python ports (MacPorts drops support for Pytho... (diff)
parentFix for bug #758718 (Color Picker/Dropper: Color selection area not lined up ... (diff)
downloadinkscape-02cb649c0ceebd254dde302eeba71406fb25a24c.tar.gz
inkscape-02cb649c0ceebd254dde302eeba71406fb25a24c.zip
update to trunk (r13829)
(bzr r13798.1.2)
Diffstat (limited to 'src/selection-chemistry.cpp')
-rw-r--r--src/selection-chemistry.cpp185
1 files changed, 93 insertions, 92 deletions
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index 83a943f53..c9837aabe 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -38,7 +38,7 @@ SPCycleType SP_CYCLING = SP_CYCLE_FOCUS;
#include "layer-model.h"
#include "selection.h"
#include "ui/tools-switch.h"
-#include "desktop-handles.h"
+
#include "message-stack.h"
#include "sp-item-transform.h"
#include "sp-marker.h"
@@ -177,8 +177,8 @@ void SelectionHelper::selectNone(SPDesktop *dt)
if (nt && !nt->_selected_nodes->empty()) {
nt->_selected_nodes->clear();
- } else if (!sp_desktop_selection(dt)->isEmpty()) {
- sp_desktop_selection(dt)->clear();
+ } else if (!dt->getSelection()->isEmpty()) {
+ dt->getSelection()->clear();
} else {
// If nothing selected switch to selection tool
tools_switch(dt, TOOLS_SELECT);
@@ -277,7 +277,7 @@ void SelectionHelper::fixSelection(SPDesktop *dt)
if(!dt)
return;
- Inkscape::Selection *selection = sp_desktop_selection(dt);
+ Inkscape::Selection *selection = dt->getSelection();
GSList *items = NULL;
@@ -402,12 +402,12 @@ void sp_selection_delete(SPDesktop *desktop)
if (tools_isactive(desktop, TOOLS_TEXT))
if (Inkscape::UI::Tools::sp_text_delete_selection(desktop->event_context)) {
- DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT,
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT,
_("Delete text"));
return;
}
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
// check if something is selected
if (selection->isEmpty()) {
@@ -429,7 +429,7 @@ void sp_selection_delete(SPDesktop *desktop)
*/
tools_switch( desktop, tools_active( desktop ) );
- DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_DELETE,
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_DELETE,
_("Delete"));
}
@@ -454,7 +454,7 @@ void sp_selection_duplicate(SPDesktop *desktop, bool suppressDone)
SPDocument *doc = desktop->doc();
Inkscape::XML::Document* xml_doc = doc->getReprDoc();
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
// check if something is selected
if (selection->isEmpty()) {
@@ -542,7 +542,7 @@ void sp_selection_duplicate(SPDesktop *desktop, bool suppressDone)
if ( !suppressDone ) {
- DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_DUPLICATE,
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_DUPLICATE,
_("Duplicate"));
}
@@ -609,7 +609,7 @@ static void sp_edit_select_all_full(SPDesktop *dt, bool force_all_layers, bool i
if (!dt)
return;
- Inkscape::Selection *selection = sp_desktop_selection(dt);
+ Inkscape::Selection *selection = dt->getSelection();
g_return_if_fail(dynamic_cast<SPGroup *>(dt->currentLayer()));
@@ -1142,7 +1142,7 @@ sp_undo(SPDesktop *desktop, SPDocument *)
// No re/undo while dragging, too dangerous.
if(desktop->getCanvas()->is_dragging) return;
- if (!DocumentUndo::undo(sp_desktop_document(desktop))) {
+ if (!DocumentUndo::undo(desktop->getDocument())) {
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Nothing to undo."));
}
}
@@ -1153,7 +1153,7 @@ sp_redo(SPDesktop *desktop, SPDocument *)
// No re/undo while dragging, too dangerous.
if(desktop->getCanvas()->is_dragging) return;
- if (!DocumentUndo::redo(sp_desktop_document(desktop))) {
+ if (!DocumentUndo::redo(desktop->getDocument())) {
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Nothing to redo."));
}
}
@@ -1226,7 +1226,7 @@ void sp_selection_paste(SPDesktop *desktop, bool in_place)
{
Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get();
if (cm->paste(desktop, in_place)) {
- DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE, _("Paste"));
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_PASTE, _("Paste"));
}
}
@@ -1234,7 +1234,7 @@ void sp_selection_paste_style(SPDesktop *desktop)
{
Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get();
if (cm->pasteStyle(desktop)) {
- DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_STYLE, _("Paste style"));
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_PASTE_STYLE, _("Paste style"));
}
}
@@ -1243,7 +1243,7 @@ void sp_selection_paste_livepatheffect(SPDesktop *desktop)
{
Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get();
if (cm->pastePathEffect(desktop)) {
- DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_LIVEPATHEFFECT,
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_PASTE_LIVEPATHEFFECT,
_("Paste live path effect"));
}
}
@@ -1262,7 +1262,7 @@ void sp_selection_remove_livepatheffect(SPDesktop *desktop)
{
if (desktop == NULL) return;
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
// check if something is selected
if (selection->isEmpty()) {
@@ -1277,7 +1277,7 @@ void sp_selection_remove_livepatheffect(SPDesktop *desktop)
}
- DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_REMOVE_LIVEPATHEFFECT,
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_REMOVE_LIVEPATHEFFECT,
_("Remove live path effect"));
}
@@ -1285,7 +1285,7 @@ void sp_selection_remove_filter(SPDesktop *desktop)
{
if (desktop == NULL) return;
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
// check if something is selected
if (selection->isEmpty()) {
@@ -1298,7 +1298,7 @@ void sp_selection_remove_filter(SPDesktop *desktop)
sp_desktop_set_style(desktop, css);
sp_repr_css_attr_unref(css);
- DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_REMOVE_FILTER,
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_REMOVE_FILTER,
_("Remove filter"));
}
@@ -1307,7 +1307,7 @@ void sp_selection_paste_size(SPDesktop *desktop, bool apply_x, bool apply_y)
{
Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get();
if (cm->pasteSize(desktop, false, apply_x, apply_y)) {
- DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_SIZE,
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_PASTE_SIZE,
_("Paste size"));
}
}
@@ -1316,14 +1316,14 @@ void sp_selection_paste_size_separately(SPDesktop *desktop, bool apply_x, bool a
{
Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get();
if (cm->pasteSize(desktop, true, apply_x, apply_y)) {
- DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_SIZE_SEPARATELY,
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_PASTE_SIZE_SEPARATELY,
_("Paste size separately"));
}
}
void sp_selection_to_next_layer(SPDesktop *dt, bool suppressDone)
{
- Inkscape::Selection *selection = sp_desktop_selection(dt);
+ Inkscape::Selection *selection = dt->getSelection();
// check if something is selected
if (selection->isEmpty()) {
@@ -1342,9 +1342,9 @@ void sp_selection_to_next_layer(SPDesktop *dt, bool suppressDone)
next=Inkscape::next_layer(dt->currentRoot(), dt->currentLayer()); // Fixes bug 1482973: crash while moving layers
GSList *copied;
if (next) {
- copied = sp_selection_paste_impl(sp_desktop_document(dt), next, &temp_clip);
+ copied = sp_selection_paste_impl(dt->getDocument(), next, &temp_clip);
} else {
- copied = sp_selection_paste_impl(sp_desktop_document(dt), dt->currentLayer(), &temp_clip);
+ copied = sp_selection_paste_impl(dt->getDocument(), dt->currentLayer(), &temp_clip);
no_more = true;
}
selection->setReprList((GSList const *) copied);
@@ -1352,7 +1352,7 @@ void sp_selection_to_next_layer(SPDesktop *dt, bool suppressDone)
if (temp_clip) g_slist_free(temp_clip);
if (next) dt->setCurrentLayer(next);
if ( !suppressDone ) {
- DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_MOVE_TO_NEXT,
+ DocumentUndo::done(dt->getDocument(), SP_VERB_LAYER_MOVE_TO_NEXT,
_("Raise to next layer"));
}
} else {
@@ -1368,7 +1368,7 @@ void sp_selection_to_next_layer(SPDesktop *dt, bool suppressDone)
void sp_selection_to_prev_layer(SPDesktop *dt, bool suppressDone)
{
- Inkscape::Selection *selection = sp_desktop_selection(dt);
+ Inkscape::Selection *selection = dt->getSelection();
// check if something is selected
if (selection->isEmpty()) {
@@ -1387,9 +1387,9 @@ void sp_selection_to_prev_layer(SPDesktop *dt, bool suppressDone)
next=Inkscape::previous_layer(dt->currentRoot(), dt->currentLayer()); // Fixes bug 1482973: crash while moving layers
GSList *copied;
if (next) {
- copied = sp_selection_paste_impl(sp_desktop_document(dt), next, &temp_clip);
+ copied = sp_selection_paste_impl(dt->getDocument(), next, &temp_clip);
} else {
- copied = sp_selection_paste_impl(sp_desktop_document(dt), dt->currentLayer(), &temp_clip);
+ copied = sp_selection_paste_impl(dt->getDocument(), dt->currentLayer(), &temp_clip);
no_more = true;
}
selection->setReprList((GSList const *) copied);
@@ -1397,7 +1397,7 @@ void sp_selection_to_prev_layer(SPDesktop *dt, bool suppressDone)
if (temp_clip) g_slist_free(temp_clip);
if (next) dt->setCurrentLayer(next);
if ( !suppressDone ) {
- DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_MOVE_TO_PREV,
+ DocumentUndo::done(dt->getDocument(), SP_VERB_LAYER_MOVE_TO_PREV,
_("Lower to previous layer"));
}
} else {
@@ -1413,7 +1413,7 @@ void sp_selection_to_prev_layer(SPDesktop *dt, bool suppressDone)
void sp_selection_to_layer(SPDesktop *dt, SPObject *moveto, bool suppressDone)
{
- Inkscape::Selection *selection = sp_desktop_selection(dt);
+ Inkscape::Selection *selection = dt->getSelection();
// check if something is selected
if (selection->isEmpty()) {
@@ -1427,13 +1427,13 @@ void sp_selection_to_layer(SPDesktop *dt, SPObject *moveto, bool suppressDone)
GSList *temp_clip = NULL;
sp_selection_copy_impl(items, &temp_clip, dt->doc()->getReprDoc()); // we're in the same doc, so no need to copy defs
sp_selection_delete_impl(items, false, false);
- GSList *copied = sp_selection_paste_impl(sp_desktop_document(dt), moveto, &temp_clip);
+ GSList *copied = sp_selection_paste_impl(dt->getDocument(), moveto, &temp_clip);
selection->setReprList((GSList const *) copied);
g_slist_free(copied);
if (temp_clip) g_slist_free(temp_clip);
if (moveto) dt->setCurrentLayer(moveto);
if ( !suppressDone ) {
- DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_MOVE_TO,
+ DocumentUndo::done(dt->getDocument(), SP_VERB_LAYER_MOVE_TO,
_("Move selection to layer"));
}
}
@@ -1686,7 +1686,7 @@ void sp_selection_remove_transform(SPDesktop *desktop)
if (desktop == NULL)
return;
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
GSList const *l = const_cast<GSList *>(selection->reprList());
while (l != NULL) {
@@ -1694,7 +1694,7 @@ void sp_selection_remove_transform(SPDesktop *desktop)
l = l->next;
}
- DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_OBJECT_FLATTEN,
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_OBJECT_FLATTEN,
_("Remove transform"));
}
@@ -1784,7 +1784,7 @@ void sp_selection_move_relative(Inkscape::Selection *selection, double dx, doubl
*/
void sp_selection_rotate_90(SPDesktop *desktop, bool ccw)
{
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
if (selection->isEmpty())
return;
@@ -1800,7 +1800,7 @@ void sp_selection_rotate_90(SPDesktop *desktop, bool ccw)
}
}
- DocumentUndo::done(sp_desktop_document(desktop),
+ DocumentUndo::done(desktop->getDocument(),
ccw ? SP_VERB_OBJECT_ROTATE_90_CCW : SP_VERB_OBJECT_ROTATE_90_CW,
ccw ? _("Rotate 90\xc2\xb0 CCW") : _("Rotate 90\xc2\xb0 CW"));
}
@@ -1818,7 +1818,7 @@ sp_selection_rotate(Inkscape::Selection *selection, gdouble const angle_degrees)
sp_selection_rotate_relative(selection, *center, angle_degrees);
- DocumentUndo::maybeDone(sp_desktop_document(selection->desktop()),
+ DocumentUndo::maybeDone(selection->desktop()->getDocument(),
( ( angle_degrees > 0 )
? "selector:rotate:ccw"
: "selector:rotate:cw" ),
@@ -1852,7 +1852,7 @@ void sp_select_same_fill_stroke_style(SPDesktop *desktop, gboolean fill, gboolea
GSList *all_list = get_all_items(NULL, desktop->currentRoot(), desktop, onlyvisible, onlysensitive, ingroups, NULL);
GSList *all_matches = NULL;
- Inkscape::Selection *selection = sp_desktop_selection (desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
for (GSList const* sel_iter = selection->itemList(); sel_iter; sel_iter = sel_iter->next) {
SPItem *sel = dynamic_cast<SPItem *>(static_cast<SPObject *>(sel_iter->data));
@@ -1905,7 +1905,7 @@ void sp_select_same_object_type(SPDesktop *desktop)
GSList *all_list = get_all_items(NULL, desktop->currentRoot(), desktop, onlyvisible, onlysensitive, ingroups, NULL);
GSList *matches = all_list;
- Inkscape::Selection *selection = sp_desktop_selection (desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
for (GSList const* sel_iter = selection->itemList(); sel_iter; sel_iter = sel_iter->next) {
SPItem *sel = dynamic_cast<SPItem *>(static_cast<SPObject *>(sel_iter->data));
@@ -1947,7 +1947,7 @@ void sp_select_same_stroke_style(SPDesktop *desktop)
GSList *all_list = get_all_items(NULL, desktop->currentRoot(), desktop, onlyvisible, onlysensitive, ingroups, NULL);
GSList *matches = all_list;
- Inkscape::Selection *selection = sp_desktop_selection (desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
for (GSList const* sel_iter = selection->itemList(); sel_iter; sel_iter = sel_iter->next) {
SPItem *sel = dynamic_cast<SPItem *>(static_cast<SPObject *>(sel_iter->data));
@@ -2110,7 +2110,7 @@ GSList *sp_get_same_stroke_style(SPItem *sel, GSList *src, SPSelectStrokeStyleTy
SPStyle *sel_style_for_width = NULL;
if (type == SP_STROKE_STYLE_WIDTH) {
objects = g_slist_prepend(objects, sel);
- sel_style_for_width = sp_style_new (SP_ACTIVE_DOCUMENT);
+ sel_style_for_width = new SPStyle(SP_ACTIVE_DOCUMENT);
objects_query_strokewidth (objects, sel_style_for_width);
}
@@ -2125,11 +2125,11 @@ GSList *sp_get_same_stroke_style(SPItem *sel, GSList *src, SPSelectStrokeStyleTy
if (sel_style->stroke_width.set && iter_style->stroke_width.set) {
GSList *objects = NULL;
objects = g_slist_prepend(objects, iter);
- SPStyle *iter_style_for_width = sp_style_new (SP_ACTIVE_DOCUMENT);
- objects_query_strokewidth (objects, iter_style_for_width);
+ SPStyle tmp_style(SP_ACTIVE_DOCUMENT);
+ objects_query_strokewidth (objects, &tmp_style);
if (sel_style_for_width) {
- match = (sel_style_for_width->stroke_width.computed == iter_style_for_width->stroke_width.computed);
+ match = (sel_style_for_width->stroke_width.computed == tmp_style.stroke_width.computed);
}
g_slist_free(objects);
}
@@ -2161,6 +2161,7 @@ GSList *sp_get_same_stroke_style(SPItem *sel, GSList *src, SPSelectStrokeStyleTy
}
}
+ if( sel_style_for_width != NULL ) delete sel_style_for_width;
g_slist_free(objects);
return matches;
@@ -2205,7 +2206,7 @@ sp_selection_rotate_screen(Inkscape::Selection *selection, gdouble angle)
sp_selection_rotate_relative(selection, *center, zangle);
- DocumentUndo::maybeDone(sp_desktop_document(selection->desktop()),
+ DocumentUndo::maybeDone(selection->desktop()->getDocument(),
( (angle > 0)
? "selector:rotate:ccw"
: "selector:rotate:cw" ),
@@ -2235,7 +2236,7 @@ sp_selection_scale(Inkscape::Selection *selection, gdouble grow)
double const times = 1.0 + grow / max_len;
sp_selection_scale_relative(selection, center, Geom::Scale(times, times));
- DocumentUndo::maybeDone(sp_desktop_document(selection->desktop()),
+ DocumentUndo::maybeDone(selection->desktop()->getDocument(),
( (grow > 0)
? "selector:scale:larger"
: "selector:scale:smaller" ),
@@ -2264,7 +2265,7 @@ sp_selection_scale_times(Inkscape::Selection *selection, gdouble times)
Geom::Point const center(sel_bbox->midpoint());
sp_selection_scale_relative(selection, center, Geom::Scale(times, times));
- DocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_CONTEXT_SELECT,
+ DocumentUndo::done(selection->desktop()->getDocument(), SP_VERB_CONTEXT_SELECT,
_("Scale by whole factor"));
}
@@ -2376,7 +2377,7 @@ void
sp_selection_item_next(SPDesktop *desktop)
{
g_return_if_fail(desktop != NULL);
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
PrefsSelectionContext inlayer = (PrefsSelectionContext)prefs->getInt("/options/kbselection/inlayer", PREFS_SELECTION_LAYER);
@@ -2403,10 +2404,10 @@ sp_selection_item_next(SPDesktop *desktop)
void
sp_selection_item_prev(SPDesktop *desktop)
{
- SPDocument *document = sp_desktop_document(desktop);
+ SPDocument *document = desktop->getDocument();
g_return_if_fail(document != NULL);
g_return_if_fail(desktop != NULL);
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
PrefsSelectionContext inlayer = (PrefsSelectionContext) prefs->getInt("/options/kbselection/inlayer", PREFS_SELECTION_LAYER);
@@ -2434,7 +2435,7 @@ void sp_selection_next_patheffect_param(SPDesktop * dt)
{
if (!dt) return;
- Inkscape::Selection *selection = sp_desktop_selection(dt);
+ Inkscape::Selection *selection = dt->getSelection();
if ( selection && !selection->isEmpty() ) {
SPItem *item = selection->singleItem();
if ( SPLPEItem *lpeitem = dynamic_cast<SPLPEItem*>(item) ) {
@@ -2467,7 +2468,7 @@ void sp_selection_edit_clip_or_mask(SPDesktop * /*dt*/, bool /*clip*/)
/*if (!dt) return;
using namespace Inkscape::UI;
- Inkscape::Selection *selection = sp_desktop_selection(dt);
+ Inkscape::Selection *selection = dt->getSelection();
if (!selection || selection->isEmpty()) return;
GSList const *items = selection->itemList();
@@ -2607,7 +2608,7 @@ void sp_selection_clone(SPDesktop *desktop)
return;
}
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc();
@@ -2648,7 +2649,7 @@ void sp_selection_clone(SPDesktop *desktop)
Inkscape::GC::release(clone);
}
- DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_CLONE,
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_CLONE,
C_("Action", "Clone"));
selection->setReprList(newsel);
@@ -2662,7 +2663,7 @@ sp_selection_relink(SPDesktop *desktop)
if (!desktop)
return;
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
if (selection->isEmpty()) {
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>clones</b> to relink."));
@@ -2697,7 +2698,7 @@ sp_selection_relink(SPDesktop *desktop)
if (!relinked) {
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No clones to relink</b> in the selection."));
} else {
- DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_UNLINK_CLONE,
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_UNLINK_CLONE,
_("Relink clone"));
}
}
@@ -2709,7 +2710,7 @@ sp_selection_unlink(SPDesktop *desktop)
if (!desktop)
return;
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
if (selection->isEmpty()) {
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>clones</b> to unlink."));
@@ -2771,7 +2772,7 @@ sp_selection_unlink(SPDesktop *desktop)
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No clones to unlink</b> in the selection."));
}
- DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_UNLINK_CLONE,
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_UNLINK_CLONE,
_("Unlink clone"));
}
@@ -2781,7 +2782,7 @@ sp_select_clone_original(SPDesktop *desktop)
if (desktop == NULL)
return;
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
SPItem *item = selection->singleItem();
@@ -2856,7 +2857,7 @@ sp_select_clone_original(SPDesktop *desktop)
curve->moveto(a->midpoint());
curve->lineto(b->midpoint());
- SPCanvasItem * canvasitem = sp_canvas_bpath_new(sp_desktop_tempgroup(desktop), curve);
+ SPCanvasItem * canvasitem = sp_canvas_bpath_new(desktop->getTempGroup(), curve);
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(canvasitem), 0x0000ddff, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT, 5, 3);
sp_canvas_item_show(canvasitem);
curve->unref();
@@ -2881,7 +2882,7 @@ void sp_selection_clone_original_path_lpe(SPDesktop *desktop)
return;
}
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
Inkscape::SVGOStringStream os;
SPObject * firstItem = NULL;
@@ -2922,7 +2923,7 @@ void sp_selection_clone_original_path_lpe(SPDesktop *desktop)
}
}
- DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_CLONE_ORIGINAL_PATH_LPE, _("Fill between many"));
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_CLONE_ORIGINAL_PATH_LPE, _("Fill between many"));
// select the new object:
selection->set(clone);
@@ -2939,10 +2940,10 @@ void sp_selection_to_marker(SPDesktop *desktop, bool apply)
return;
}
- SPDocument *doc = sp_desktop_document(desktop);
+ SPDocument *doc = desktop->getDocument();
Inkscape::XML::Document *xml_doc = doc->getReprDoc();
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
// check if something is selected
if (selection->isEmpty()) {
@@ -3040,8 +3041,8 @@ void sp_selection_to_guides(SPDesktop *desktop)
if (desktop == NULL)
return;
- SPDocument *doc = sp_desktop_document(desktop);
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ SPDocument *doc = desktop->getDocument();
+ Inkscape::Selection *selection = desktop->getSelection();
// we need to copy the list because it gets reset when objects are deleted
GSList *items = g_slist_copy(const_cast<GSList *>(selection->itemList()));
@@ -3098,10 +3099,10 @@ void sp_selection_symbol(SPDesktop *desktop, bool /*apply*/ )
return;
}
- SPDocument *doc = sp_desktop_document(desktop);
+ SPDocument *doc = desktop->getDocument();
Inkscape::XML::Document *xml_doc = doc->getReprDoc();
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
// Check if something is selected.
if (selection->isEmpty()) {
@@ -3220,10 +3221,10 @@ void sp_selection_unsymbol(SPDesktop *desktop)
return;
}
- SPDocument *doc = sp_desktop_document(desktop);
+ SPDocument *doc = desktop->getDocument();
Inkscape::XML::Document *xml_doc = doc->getReprDoc();
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
// Check if something is selected.
if (selection->isEmpty()) {
@@ -3287,7 +3288,7 @@ void sp_selection_unsymbol(SPDesktop *desktop)
symbol->deleteObject(true);
// Change selection to new <g> element.
- SPItem *group_item = static_cast<SPItem *>(sp_desktop_document(desktop)->getObjectByRepr(group));
+ SPItem *group_item = static_cast<SPItem *>(desktop->getDocument()->getObjectByRepr(group));
selection->set(group_item);
// Clean up
@@ -3305,10 +3306,10 @@ sp_selection_tile(SPDesktop *desktop, bool apply)
return;
}
- SPDocument *doc = sp_desktop_document(desktop);
+ SPDocument *doc = desktop->getDocument();
Inkscape::XML::Document *xml_doc = doc->getReprDoc();
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
// check if something is selected
if (selection->isEmpty()) {
@@ -3400,7 +3401,7 @@ sp_selection_tile(SPDesktop *desktop, bool apply)
// restore parent and position
parent->getRepr()->appendChild(rect);
rect->setPosition(pos > 0 ? pos : 0);
- SPItem *rectangle = static_cast<SPItem *>(sp_desktop_document(desktop)->getObjectByRepr(rect));
+ SPItem *rectangle = static_cast<SPItem *>(desktop->getDocument()->getObjectByRepr(rect));
Inkscape::GC::release(rect);
@@ -3420,10 +3421,10 @@ void sp_selection_untile(SPDesktop *desktop)
return;
}
- SPDocument *doc = sp_desktop_document(desktop);
+ SPDocument *doc = desktop->getDocument();
Inkscape::XML::Document *xml_doc = doc->getReprDoc();
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
// check if something is selected
if (selection->isEmpty()) {
@@ -3490,7 +3491,7 @@ void sp_selection_untile(SPDesktop *desktop)
if (!did) {
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No pattern fills</b> in the selection."));
} else {
- DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_UNTILE,
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_EDIT_UNTILE,
_("Pattern to objects"));
selection->setList(new_select);
}
@@ -3575,10 +3576,10 @@ void sp_selection_create_bitmap_copy(SPDesktop *desktop)
return;
}
- SPDocument *document = sp_desktop_document(desktop);
+ SPDocument *document = desktop->getDocument();
Inkscape::XML::Document *xml_doc = document->getReprDoc();
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
// check if something is selected
if (selection->isEmpty()) {
@@ -3793,10 +3794,10 @@ void sp_selection_set_clipgroup(SPDesktop *desktop)
if (desktop == NULL) {
return;
}
- SPDocument* doc = sp_desktop_document(desktop);
+ SPDocument* doc = desktop->getDocument();
Inkscape::XML::Document *xml_doc = doc->getReprDoc();
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
if (selection->isEmpty()) {
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to create clippath or mask from."));
return;
@@ -3909,10 +3910,10 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_
return;
}
- SPDocument *doc = sp_desktop_document(desktop);
+ SPDocument *doc = desktop->getDocument();
Inkscape::XML::Document *xml_doc = doc->getReprDoc();
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
// check if something is selected
bool is_empty = selection->isEmpty();
@@ -4112,9 +4113,9 @@ void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) {
return;
}
- SPDocument *doc = sp_desktop_document(desktop);
+ SPDocument *doc = desktop->getDocument();
Inkscape::XML::Document *xml_doc = doc->getReprDoc();
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
// check if something is selected
if (selection->isEmpty()) {
@@ -4205,7 +4206,7 @@ void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) {
parent->appendChild(repr);
repr->setPosition((pos + 1) > 0 ? (pos + 1) : 0);
- SPItem *mask_item = static_cast<SPItem *>(sp_desktop_document(desktop)->getObjectByRepr(repr));
+ SPItem *mask_item = static_cast<SPItem *>(desktop->getDocument()->getObjectByRepr(repr));
items_to_select = g_slist_prepend(items_to_select, mask_item);
// transform mask, so it is moved the same spot where mask was applied
@@ -4253,7 +4254,7 @@ bool
fit_canvas_to_selection(SPDesktop *desktop, bool with_margins)
{
g_return_val_if_fail(desktop != NULL, false);
- SPDocument *doc = sp_desktop_document(desktop);
+ SPDocument *doc = desktop->getDocument();
g_return_val_if_fail(doc != NULL, false);
g_return_val_if_fail(desktop->selection != NULL, false);
@@ -4278,7 +4279,7 @@ void
verb_fit_canvas_to_selection(SPDesktop *const desktop)
{
if (fit_canvas_to_selection(desktop)) {
- DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_FIT_CANVAS_TO_SELECTION,
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_FIT_CANVAS_TO_SELECTION,
_("Fit Page to Selection"));
}
}
@@ -4306,8 +4307,8 @@ fit_canvas_to_drawing(SPDocument *doc, bool with_margins)
void
verb_fit_canvas_to_drawing(SPDesktop *desktop)
{
- if (fit_canvas_to_drawing(sp_desktop_document(desktop))) {
- DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_FIT_CANVAS_TO_DRAWING,
+ if (fit_canvas_to_drawing(desktop->getDocument())) {
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_FIT_CANVAS_TO_DRAWING,
_("Fit Page to Drawing"));
}
}
@@ -4319,7 +4320,7 @@ verb_fit_canvas_to_drawing(SPDesktop *desktop)
*/
void fit_canvas_to_selection_or_drawing(SPDesktop *desktop) {
g_return_if_fail(desktop != NULL);
- SPDocument *doc = sp_desktop_document(desktop);
+ SPDocument *doc = desktop->getDocument();
g_return_if_fail(doc != NULL);
g_return_if_fail(desktop->selection != NULL);
@@ -4328,7 +4329,7 @@ void fit_canvas_to_selection_or_drawing(SPDesktop *desktop) {
? fit_canvas_to_drawing(doc, true)
: fit_canvas_to_selection(desktop, true) );
if (changed) {
- DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING,
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING,
_("Fit Page to Selection or Drawing"));
}
};