diff options
Diffstat (limited to 'src')
147 files changed, 565 insertions, 654 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 680d3bae5..617e9dce1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -187,7 +187,6 @@ set(inkscape_SRC console-output-undo-observer.cpp context-fns.cpp desktop-events.cpp - desktop-handles.cpp desktop-style.cpp desktop.cpp device-manager.cpp @@ -299,7 +298,6 @@ set(inkscape_SRC context-fns.h decimal-round.h desktop-events.h - desktop-handles.h desktop-style.h desktop.h device-manager.h diff --git a/src/Makefile_insert b/src/Makefile_insert index 488ab52c5..b07541109 100644 --- a/src/Makefile_insert +++ b/src/Makefile_insert @@ -29,7 +29,6 @@ ink_common_sources += \ decimal-round.h \ desktop.cpp desktop.h \ desktop-events.cpp desktop-events.h \ - desktop-handles.cpp desktop-handles.h \ desktop-style.cpp desktop-style.h \ device-manager.cpp device-manager.h \ dir-util.cpp dir-util.h \ diff --git a/src/box3d.cpp b/src/box3d.cpp index 9ccc969bc..6412a299f 100644 --- a/src/box3d.cpp +++ b/src/box3d.cpp @@ -37,7 +37,7 @@ #include "preferences.h" #include "desktop.h" -#include "desktop-handles.h" + #include "macros.h" static void box3d_ref_changed(SPObject *old_ref, SPObject *ref, SPBox3D *box); diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp index afd1bc407..c13b9a5d3 100644 --- a/src/conn-avoid-ref.cpp +++ b/src/conn-avoid-ref.cpp @@ -32,7 +32,7 @@ #include "xml/node.h" #include "document.h" #include "desktop.h" -#include "desktop-handles.h" + #include "document-undo.h" #include "sp-namedview.h" #include "sp-item-group.h" @@ -91,7 +91,7 @@ void SPAvoidRef::handleSettingChange(void) if (desktop == NULL) { return; } - if (sp_desktop_document(desktop) != item->document) { + if (desktop->getDocument() != item->document) { // We don't want to go any further if the active desktop's document // isn't the same as the document that this item is part of. This // case can happen if a new document is loaded from the file chooser @@ -370,7 +370,7 @@ void init_avoided_shape_geometry(SPDesktop *desktop) { // Don't count this as changes to the document, // it is basically just late initialisation. - SPDocument *document = sp_desktop_document(desktop); + SPDocument *document = desktop->getDocument(); bool saved = DocumentUndo::getUndoSensitive(document); DocumentUndo::setUndoSensitive(document, false); diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp index a5eb3de18..5dbe0f8dc 100644 --- a/src/desktop-events.cpp +++ b/src/desktop-events.cpp @@ -24,7 +24,7 @@ #include "desktop.h" #include "desktop-events.h" -#include "desktop-handles.h" + #include "ui/dialog-events.h" #include "display/canvas-axonomgrid.h" #include "display/canvas-grid.h" @@ -232,7 +232,7 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge sp_repr_set_point(repr, "orientation", normal); desktop->namedview->appendChild(repr); Inkscape::GC::release(repr); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_NONE, _("Create guide")); } desktop->set_coordinate_status(event_dt); @@ -240,7 +240,7 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge if (!dragged) { // Ruler click (without drag) toggle the guide visibility on and off Inkscape::XML::Node *repr = desktop->namedview->getRepr(); - sp_namedview_toggle_guides(sp_desktop_document(desktop), repr); + sp_namedview_toggle_guides(desktop->getDocument(), repr); } @@ -488,14 +488,14 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) assert(false); break; } - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_NONE, _("Move guide")); } else { /* Undo movement of any attached shapes. */ guide->moveto(guide->getPoint(), false); guide->set_normal(guide->getNormal(), false); sp_guide_remove(guide); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_NONE, _("Delete guide")); } moved = false; diff --git a/src/desktop-handles.cpp b/src/desktop-handles.cpp deleted file mode 100644 index 64f75c6a2..000000000 --- a/src/desktop-handles.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Frontends - * - * Author: - * Lauris Kaplinski <lauris@kaplinski.com> - * - * Copyright (C) 2001-2002 Lauris Kaplinski - * Copyright (C) 2001 Ximian, Inc. - * - * Released under GNU GPL, read the file 'COPYING' for more information - */ - -#include "display/sp-canvas.h" -#include "display/sp-canvas-item.h" -#include "desktop.h" -#include "desktop-handles.h" - -SPDocument * -sp_desktop_document (SPDesktop const * desktop) -{ - g_return_val_if_fail (desktop != NULL, NULL); - - return desktop->doc(); -} diff --git a/src/desktop-handles.h b/src/desktop-handles.h deleted file mode 100644 index b5891651b..000000000 --- a/src/desktop-handles.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef SEEN_SP_DESKTOP_HANDLES_H -#define SEEN_SP_DESKTOP_HANDLES_H - -/* - * Frontends - * - * Authors: - * Lauris Kaplinski <lauris@kaplinski.com> - * - * Copyright (C) 1999-2002 Lauris Kaplinski - * Copyright (C) 2000-2001 Ximian, Inc. - * - * Released under GNU GPL, read the file 'COPYING' for more information - */ - - -class SPDesktop; -class SPDocument; - -namespace Inkscape { -namespace UI { -namespace Tools { - -class ToolBase; - -} -} -} - -class SPNamedView; -struct SPCanvas; -struct SPCanvasGroup; -struct SPCanvasItem; - -namespace Inkscape { - class MessageStack; - class Selection; -} - -#define SP_DESKTOP_ZOOM_MAX 256.0 -#define SP_DESKTOP_ZOOM_MIN 0.01 - -#define SP_COORDINATES_UNDERLINE_NONE (0) -#define SP_COORDINATES_UNDERLINE_X (1 << Geom::X) -#define SP_COORDINATES_UNDERLINE_Y (1 << Geom::Y) - -SPDocument * sp_desktop_document (SPDesktop const * desktop); - -#endif // SEEN_SP_DESKTOP_HANDLES_H - -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/desktop.cpp b/src/desktop.cpp index ad6809ea5..cdf8f276c 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -37,7 +37,7 @@ #include "color.h" #include "desktop-events.h" #include "desktop.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "device-manager.h" #include "display/canvas-arena.h" @@ -502,7 +502,7 @@ void SPDesktop::_setDisplayMode(Inkscape::RenderMode mode) { canvas->rendermode = mode; _display_mode = mode; redrawDesktop(); - _widget->setTitle( sp_desktop_document(this)->getName() ); + _widget->setTitle( this->getDocument()->getName() ); } void SPDesktop::_setDisplayColorMode(Inkscape::ColorMode mode) { // reload grayscale matrix from prefs @@ -523,7 +523,7 @@ void SPDesktop::_setDisplayColorMode(Inkscape::ColorMode mode) { canvas->colorrendermode = mode; _display_color_mode = mode; redrawDesktop(); - _widget->setTitle( sp_desktop_document(this)->getName() ); + _widget->setTitle( this->getDocument()->getName() ); } void SPDesktop::displayModeToggle() { @@ -1481,7 +1481,7 @@ void SPDesktop::toggleGrids() } } else { //there is no grid present at the moment. add a rectangular grid and make it visible - namedview->writeNewGrid(sp_desktop_document(this), Inkscape::GRID_RECTANGULAR); + namedview->writeNewGrid(this->getDocument(), Inkscape::GRID_RECTANGULAR); showGrids(true); } } diff --git a/src/desktop.h b/src/desktop.h index 496cc30eb..a0b9592d0 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -103,6 +103,9 @@ namespace Inkscape { } } +#define SP_DESKTOP_ZOOM_MAX 256.0 +#define SP_DESKTOP_ZOOM_MIN 0.01 + /** * SPDesktop is a subclass of View, implementing an editable document * canvas. It is extensively used by many UI controls that need certain diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp index b81400266..05ba71a49 100644 --- a/src/display/canvas-axonomgrid.cpp +++ b/src/display/canvas-axonomgrid.cpp @@ -36,7 +36,7 @@ #include "ui/widget/registered-widget.h" #include "desktop.h" -#include "desktop-handles.h" + #include "display/cairo-utils.h" #include "display/canvas-grid.h" #include "display/sp-canvas-util.h" diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp index fe8d2d98c..1a284b46e 100644 --- a/src/display/canvas-grid.cpp +++ b/src/display/canvas-grid.cpp @@ -36,7 +36,7 @@ #include "desktop.h" #include "sp-canvas-util.h" #include "util/mathfns.h" -#include "desktop-handles.h" + #include "display/cairo-utils.h" #include "display/canvas-axonomgrid.h" #include "display/canvas-grid.h" diff --git a/src/display/nr-filter-primitive.cpp b/src/display/nr-filter-primitive.cpp index b065ac445..3033118e4 100644 --- a/src/display/nr-filter-primitive.cpp +++ b/src/display/nr-filter-primitive.cpp @@ -17,7 +17,7 @@ #include "inkscape.h" #include "desktop.h" -#include "desktop-handles.h" + #include "document.h" #include "sp-root.h" #include "style.h" diff --git a/src/display/snap-indicator.cpp b/src/display/snap-indicator.cpp index 9df29b7b0..bcce81f0b 100644 --- a/src/display/snap-indicator.cpp +++ b/src/display/snap-indicator.cpp @@ -14,7 +14,7 @@ #include "display/snap-indicator.h" #include "desktop.h" -#include "desktop-handles.h" + #include "display/sodipodi-ctrl.h" #include "display/sodipodi-ctrlrect.h" #include "display/canvas-text.h" diff --git a/src/extension/dbus/application-interface.cpp b/src/extension/dbus/application-interface.cpp index 292832a4b..afaf9aedf 100644 --- a/src/extension/dbus/application-interface.cpp +++ b/src/extension/dbus/application-interface.cpp @@ -196,7 +196,7 @@ application_interface_document_close_all (ApplicationInterface *app_interface, SPDesktop *desktop = SP_ACTIVE_DESKTOP; g_assert(desktop != NULL); - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); g_assert(doc != NULL); Inkscape::XML::Node *repr = doc->getReprRoot(); diff --git a/src/extension/dbus/document-interface.cpp b/src/extension/dbus/document-interface.cpp index bd5f826d3..4fde6885f 100644 --- a/src/extension/dbus/document-interface.cpp +++ b/src/extension/dbus/document-interface.cpp @@ -21,7 +21,7 @@ #include <string.h> #include <dbus/dbus-glib.h> #include "desktop.h" -#include "desktop-handles.h" //sp_desktop_document() + //sp_desktop_document() #include "desktop-style.h" //sp_desktop_get_style #include "display/canvas-text.h" //text #include "display/sp-canvas.h" //text diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp index c8f3b2ff9..e7299ba51 100644 --- a/src/extension/effect.cpp +++ b/src/extension/effect.cpp @@ -12,7 +12,7 @@ #include "inkscape.h" #include "helper/action.h" #include "ui/view/view.h" -#include "desktop-handles.h" + #include "selection.h" #include "sp-namedview.h" #include "desktop.h" diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp index 1495b7603..13b8d60c4 100644 --- a/src/extension/execution-env.cpp +++ b/src/extension/execution-env.cpp @@ -31,7 +31,7 @@ #include "desktop.h" #include "ui/view/view.h" #include "sp-namedview.h" -#include "desktop-handles.h" + #include "display/sp-canvas.h" #include "util/glib-list-iterators.h" diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp index e29aed308..52f63499a 100644 --- a/src/extension/implementation/implementation.cpp +++ b/src/extension/implementation/implementation.cpp @@ -21,7 +21,7 @@ #include "selection.h" #include "desktop.h" -#include "desktop-handles.h" + #include "ui/view/view.h" #include "util/glib-list-iterators.h" diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index 6b1abe04c..bbc567f75 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -24,7 +24,7 @@ #include <errno.h> #include <glib/gstdio.h> -#include "desktop-handles.h" + #include "desktop.h" #include "ui/dialog-events.h" #include "extension/effect.h" diff --git a/src/extension/internal/bitmap/imagemagick.cpp b/src/extension/internal/bitmap/imagemagick.cpp index c92264858..76f35415e 100644 --- a/src/extension/internal/bitmap/imagemagick.cpp +++ b/src/extension/internal/bitmap/imagemagick.cpp @@ -25,7 +25,7 @@ #include <glib/gstdio.h> #include "desktop.h" -#include "desktop-handles.h" + #include "selection.h" #include "sp-object.h" #include "util/glib-list-iterators.h" diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index 2ce86c245..270edfe44 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -24,7 +24,7 @@ #include <gtkmm/spinbutton.h> #include "desktop.h" -#include "desktop-handles.h" + #include "document.h" #include "selection.h" #include "sp-object.h" diff --git a/src/file.cpp b/src/file.cpp index d237e06c3..72516d776 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -32,7 +32,7 @@ #include "ui/dialog/ocaldialogs.h" #include "desktop.h" -#include "desktop-handles.h" + #include "dir-util.h" #include "document-private.h" #include "document-undo.h" @@ -289,7 +289,7 @@ bool sp_file_open(const Glib::ustring &uri, if (doc) { - SPDocument *existing = desktop ? sp_desktop_document(desktop) : NULL; + SPDocument *existing = desktop ? desktop->getDocument() : NULL; if (existing && existing->virgin && replace_empty) { // If the current desktop is empty, open the document there @@ -348,7 +348,7 @@ void sp_file_revert_dialog() SPDesktop *desktop = SP_ACTIVE_DESKTOP; g_assert(desktop != NULL); - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); g_assert(doc != NULL); Inkscape::XML::Node *repr = doc->getReprRoot(); @@ -1055,7 +1055,7 @@ void sp_import_document(SPDesktop *desktop, SPDocument *clipdoc, bool in_place) { //TODO: merge with file_import() - SPDocument *target_document = sp_desktop_document(desktop); + SPDocument *target_document = desktop->getDocument(); Inkscape::XML::Node *root = clipdoc->getReprRoot(); Inkscape::XML::Node *target_parent = desktop->currentLayer()->getRepr(); @@ -1232,7 +1232,7 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, // move to mouse pointer { - sp_desktop_document(desktop)->ensureUpToDate(); + desktop->getDocument()->ensureUpToDate(); Geom::OptRect sel_bbox = selection->visualBounds(); if (sel_bbox) { Geom::Point m( desktop->point() - sel_bbox->midpoint() ); diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp index 7b6427a88..0701a9d49 100644 --- a/src/gradient-chemistry.cpp +++ b/src/gradient-chemistry.cpp @@ -31,7 +31,7 @@ #include "document-undo.h" #include "desktop.h" #include "desktop-style.h" -#include "desktop-handles.h" + #include "ui/tools/tool-base.h" #include "selection.h" #include "verbs.h" @@ -1576,7 +1576,7 @@ void sp_gradient_invert_selected_gradients(SPDesktop *desktop, Inkscape::PaintTa } // we did an undoable action - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_GRADIENT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_GRADIENT, _("Invert gradient colors")); } @@ -1602,7 +1602,7 @@ void sp_gradient_reverse_selected_gradients(SPDesktop *desktop) } // we did an undoable action - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_GRADIENT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_GRADIENT, _("Reverse gradient")); } diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index d38ae666e..154b7339b 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -22,11 +22,11 @@ #include <cstring> #include <string> -#include "desktop-handles.h" + #include "selection.h" #include "desktop.h" #include "desktop-style.h" -#include "desktop-handles.h" + #include "document.h" #include "document-undo.h" #include "display/sp-ctrlline.h" @@ -563,7 +563,7 @@ SPStop *GrDrag::addStopNearPoint(SPItem *item, Geom::Point mouse_p, double toler mg->array.built = false; mg->ensureArray(); // How do we do this? - DocumentUndo::done(sp_desktop_document (desktop), SP_VERB_CONTEXT_MESH, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_MESH, _("Added patch row or column")); } // Mesh @@ -796,7 +796,7 @@ static void gr_knot_moved_handler(SPKnot *knot, Geom::Point const &ppointer, gui d_new->updateKnotShape (); d_new->updateTip (); d_new->updateDependencies(true); - DocumentUndo::done(sp_desktop_document (d_new->parent->desktop), SP_VERB_CONTEXT_GRADIENT, _("Merge gradient handles")); + DocumentUndo::done(d_new->parent->desktop->getDocument(), SP_VERB_CONTEXT_GRADIENT, _("Merge gradient handles")); return; } } @@ -1102,8 +1102,7 @@ static void gr_knot_ungrabbed_handler(SPKnot *knot, unsigned int state, gpointer dragger->updateDependencies(true); // we did an undoable action - DocumentUndo::done(sp_desktop_document (dragger->parent->desktop), SP_VERB_CONTEXT_GRADIENT, - _("Move gradient handle")); + DocumentUndo::done(dragger->parent->desktop->getDocument(), SP_VERB_CONTEXT_GRADIENT, _("Move gradient handle")); } /** @@ -2375,7 +2374,7 @@ void GrDrag::selected_move(double x, double y, bool write_repr, bool scale_radia if (write_repr && did) { // we did an undoable action - DocumentUndo::maybeDone(sp_desktop_document (desktop), "grmoveh", SP_VERB_CONTEXT_GRADIENT, + DocumentUndo::maybeDone(desktop->getDocument(), "grmoveh", SP_VERB_CONTEXT_GRADIENT, _("Move gradient handle(s)")); return; } @@ -2411,7 +2410,7 @@ void GrDrag::selected_move(double x, double y, bool write_repr, bool scale_radia if (write_repr && did) { // we did an undoable action - DocumentUndo::maybeDone(sp_desktop_document (desktop), "grmovem", SP_VERB_CONTEXT_GRADIENT, + DocumentUndo::maybeDone(desktop->getDocument(), "grmovem", SP_VERB_CONTEXT_GRADIENT, _("Move gradient mid stop(s)")); } } diff --git a/src/helper/stock-items.cpp b/src/helper/stock-items.cpp index 99dc21e58..5a56b89ff 100644 --- a/src/helper/stock-items.cpp +++ b/src/helper/stock-items.cpp @@ -29,7 +29,7 @@ #include "document-private.h" #include "sp-pattern.h" #include "sp-marker.h" -#include "desktop-handles.h" +#include "desktop.h" #include "inkscape.h" #include "io/sys.h" @@ -196,7 +196,7 @@ SPObject *get_stock_item(gchar const *urn, gboolean stock) gchar * base = g_strndup(e, a); SPDesktop *desktop = SP_ACTIVE_DESKTOP; - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); SPDefs *defs = doc->getDefs(); if (!defs) { g_free(base); @@ -266,7 +266,7 @@ SPObject *get_stock_item(gchar const *urn, gboolean stock) else { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); SPObject *object = doc->getObjectById(urn); return object; diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 6d20c54f8..6a0e0f35a 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -54,7 +54,7 @@ #include <string> #include "desktop.h" -#include "desktop-handles.h" + #include "device-manager.h" #include "document.h" #include "extension/db.h" @@ -1110,7 +1110,7 @@ SPDocument * Application::active_document() { if (SP_ACTIVE_DESKTOP) { - return sp_desktop_document (SP_ACTIVE_DESKTOP); + return SP_ACTIVE_DESKTOP->getDocument(); } else if (!_document_set.empty()) { // If called from the command line there will be no desktop // So 'fall back' to take the first listed document in the Inkscape instance diff --git a/src/knot.cpp b/src/knot.cpp index c35f24a7c..b3813ab53 100644 --- a/src/knot.cpp +++ b/src/knot.cpp @@ -19,7 +19,7 @@ #include <glibmm/i18n.h> #include "display/sodipodi-ctrl.h" #include "desktop.h" -#include "desktop-handles.h" + #include "knot.h" #include "knot-ptr.h" #include "document.h" @@ -342,7 +342,7 @@ static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot knot->ungrabbed_signal.emit(knot, event->button.state); - DocumentUndo::undo(sp_desktop_document(knot->desktop)); + DocumentUndo::undo(knot->desktop->getDocument()); knot->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Node or handle drag canceled.")); transform_escaped = true; consumed = TRUE; diff --git a/src/layer-manager.cpp b/src/layer-manager.cpp index 99e2004da..b1e365fe2 100644 --- a/src/layer-manager.cpp +++ b/src/layer-manager.cpp @@ -15,7 +15,7 @@ #include "gc-finalized.h" #include "document.h" #include "desktop.h" -#include "desktop-handles.h" + #include "layer-manager.h" #include "preferences.h" #include "ui/view/view.h" diff --git a/src/line-geometry.cpp b/src/line-geometry.cpp index a2a2610fd..c5357e213 100644 --- a/src/line-geometry.cpp +++ b/src/line-geometry.cpp @@ -13,7 +13,7 @@ #include "inkscape.h" #include "desktop.h" #include "desktop-style.h" -#include "desktop-handles.h" + #include "display/sp-canvas.h" #include "display/sp-ctrlline.h" #include "display/sodipodi-ctrl.h" diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp index a6d2f1ea5..ba95affd9 100644 --- a/src/live_effects/parameter/path.cpp +++ b/src/live_effects/parameter/path.cpp @@ -30,7 +30,7 @@ // needed for on-canvas editting: #include "ui/tools-switch.h" #include "ui/shape-editor.h" -#include "desktop-handles.h" + #include "selection.h" // clipboard support #include "ui/clipboard.h" diff --git a/src/live_effects/parameter/text.cpp b/src/live_effects/parameter/text.cpp index 8a5f50145..234a6174d 100644 --- a/src/live_effects/parameter/text.cpp +++ b/src/live_effects/parameter/text.cpp @@ -19,7 +19,7 @@ #include "inkscape.h" #include "verbs.h" #include "display/canvas-text.h" -#include "desktop-handles.h" + #include <2geom/sbasis-geometric.h> namespace Inkscape { diff --git a/src/main-cmdlineact.cpp b/src/main-cmdlineact.cpp index 216953f4f..ade83dfda 100644 --- a/src/main-cmdlineact.cpp +++ b/src/main-cmdlineact.cpp @@ -9,7 +9,6 @@ #include <ui/view/view.h> #include <desktop.h> -#include <desktop-handles.h> #include <helper/action.h> #include <helper/action-context.h> #include <selection.h> diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index 37b80f45d..238527465 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -35,7 +35,7 @@ #include "document-undo.h" #include "message-stack.h" #include "selection.h" -#include "desktop-handles.h" + #include "box3d.h" #include <2geom/pathvector.h> #include "selection-chemistry.h" @@ -48,7 +48,7 @@ void sp_selected_path_combine(SPDesktop *desktop) { Inkscape::Selection *selection = desktop->getSelection(); - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); if (g_slist_length((GSList *) selection->itemList()) < 1) { desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to combine.")); @@ -170,7 +170,7 @@ sp_selected_path_combine(SPDesktop *desktop) // move to the position of the topmost, reduced by the number of deleted items repr->setPosition(position > 0 ? position : 0); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_COMBINE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_SELECTION_COMBINE, _("Combine")); selection->set(repr); @@ -283,7 +283,7 @@ sp_selected_path_break_apart(SPDesktop *desktop) desktop->clearWaitingCursor(); if (did) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_BREAK_APART, + DocumentUndo::done(desktop->getDocument(), SP_VERB_SELECTION_BREAK_APART, _("Break apart")); } else { desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No path(s)</b> to break apart in the selection.")); @@ -323,7 +323,7 @@ sp_selected_path_to_curves(Inkscape::Selection *selection, SPDesktop *desktop, b if (interactive && desktop) { desktop->clearWaitingCursor(); if (did) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_OBJECT_TO_CURVE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_OBJECT_TO_CURVE, _("Object to path")); } else { desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No objects</b> to convert to path in the selection.")); @@ -660,7 +660,7 @@ sp_selected_path_reverse(SPDesktop *desktop) desktop->clearWaitingCursor(); if (did) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_REVERSE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_SELECTION_REVERSE, _("Reverse path")); } else { desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No paths</b> to reverse in the selection.")); diff --git a/src/persp3d.cpp b/src/persp3d.cpp index 797e439c0..c761947ad 100644 --- a/src/persp3d.cpp +++ b/src/persp3d.cpp @@ -23,7 +23,7 @@ #include "xml/document.h" #include "xml/node-event-vector.h" #include "desktop.h" -#include "desktop-handles.h" + #include <glibmm/i18n.h> #include "verbs.h" #include "util/units.h" @@ -329,7 +329,7 @@ persp3d_toggle_VP (Persp3D *persp, Proj::Axis axis, bool set_undo) { persp3d_update_box_reprs (persp); persp->updateRepr(SP_OBJECT_WRITE_EXT); if (set_undo) { - DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_3DBOX, + DocumentUndo::done(SP_ACTIVE_DESKTOP->getDocument(), SP_VERB_CONTEXT_3DBOX, _("Toggle vanishing point")); } } @@ -340,7 +340,7 @@ persp3d_toggle_VPs (std::list<Persp3D *> p, Proj::Axis axis) { for (std::list<Persp3D *>::iterator i = p.begin(); i != p.end(); ++i) { persp3d_toggle_VP((*i), axis, false); } - DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_3DBOX, + DocumentUndo::done(SP_ACTIVE_DESKTOP->getDocument(), SP_VERB_CONTEXT_3DBOX, _("Toggle multiple vanishing points")); } diff --git a/src/rubberband.cpp b/src/rubberband.cpp index 4a2b38944..4a171f4a1 100644 --- a/src/rubberband.cpp +++ b/src/rubberband.cpp @@ -12,7 +12,7 @@ #include "display/sodipodi-ctrlrect.h" #include "desktop.h" -#include "desktop-handles.h" + #include "rubberband.h" #include "display/sp-canvas.h" #include "display/sp-canvas-item.h" diff --git a/src/selcue.cpp b/src/selcue.cpp index 67744e1f8..d2fa0970a 100644 --- a/src/selcue.cpp +++ b/src/selcue.cpp @@ -14,7 +14,7 @@ #include <string.h> #include "desktop.h" -#include "desktop-handles.h" + #include "selection.h" #include "display/sp-canvas-util.h" #include "display/sodipodi-ctrl.h" diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 1935cf62f..98ebd1f61 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" @@ -402,7 +402,7 @@ 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; } @@ -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")); } @@ -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")); } @@ -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")); } } @@ -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")); } @@ -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,7 +1316,7 @@ 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")); } } @@ -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 { @@ -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 { @@ -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")); } } @@ -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")); } @@ -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" ), @@ -2205,7 +2205,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 +2235,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 +2264,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")); } @@ -2403,7 +2403,7 @@ 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 = desktop->getSelection(); @@ -2648,7 +2648,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); @@ -2697,7 +2697,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")); } } @@ -2771,7 +2771,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")); } @@ -2922,7 +2922,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,7 +2939,7 @@ 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 = desktop->getSelection(); @@ -3040,7 +3040,7 @@ void sp_selection_to_guides(SPDesktop *desktop) if (desktop == NULL) return; - SPDocument *doc = sp_desktop_document(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,7 +3098,7 @@ 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 = desktop->getSelection(); @@ -3220,7 +3220,7 @@ 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 = desktop->getSelection(); @@ -3287,7 +3287,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,7 +3305,7 @@ 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 = desktop->getSelection(); @@ -3400,7 +3400,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,7 +3420,7 @@ 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 = desktop->getSelection(); @@ -3490,7 +3490,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,7 +3575,7 @@ 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 = desktop->getSelection(); @@ -3793,7 +3793,7 @@ 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 = desktop->getSelection(); @@ -3909,7 +3909,7 @@ 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 = desktop->getSelection(); @@ -4112,7 +4112,7 @@ 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 = desktop->getSelection(); @@ -4205,7 +4205,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 +4253,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 +4278,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 +4306,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 +4319,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 +4328,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")); } }; diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 34b27b257..5e4c0642e 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -26,7 +26,7 @@ #include "document-undo.h" #include "sp-namedview.h" #include "desktop.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "knot.h" #include "message-stack.h" @@ -473,16 +473,16 @@ void Inkscape::SelTrans::ungrab() // when trying to stretch a perfectly vertical line in horizontal direction, which will not be allowed // by the handles; this would be identified as a (zero) translation by isTranslation() if (_current_relative_affine.isTranslation()) { - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_CONTEXT_SELECT, _("Move")); } else if (_current_relative_affine.withoutTranslation().isScale()) { - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_CONTEXT_SELECT, _("Scale")); } else if (_current_relative_affine.withoutTranslation().isRotation()) { - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_CONTEXT_SELECT, _("Rotate")); } else { - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_CONTEXT_SELECT, _("Skew")); } } @@ -495,7 +495,7 @@ void Inkscape::SelTrans::ungrab() SPItem *it = SP_ITEM(l->data); it->updateRepr(); } - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_CONTEXT_SELECT, _("Set center")); } @@ -549,7 +549,7 @@ void Inkscape::SelTrans::stamp() // move to the saved position copy_repr->setPosition(pos > 0 ? pos : 0); - SPItem *copy_item = (SPItem *) sp_desktop_document(_desktop)->getObjectByRepr(copy_repr); + SPItem *copy_item = (SPItem *) _desktop->getDocument()->getObjectByRepr(copy_repr); Geom::Affine const *new_affine; if (_show == SHOW_OUTLINE) { @@ -570,7 +570,7 @@ void Inkscape::SelTrans::stamp() Inkscape::GC::release(copy_repr); l = l->next; } - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_CONTEXT_SELECT, _("Stamp")); } @@ -719,7 +719,7 @@ void Inkscape::SelTrans::handleClick(SPKnot */*knot*/, guint state, SPSelTransHa _center_is_set = false; // center has changed _updateHandles(); } - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_CONTEXT_SELECT, _("Reset center")); } break; diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp index 766026980..8d9f87037 100644 --- a/src/sp-flowtext.cpp +++ b/src/sp-flowtext.cpp @@ -14,7 +14,7 @@ #include "inkscape.h" #include "document.h" #include "selection.h" -#include "desktop-handles.h" + #include "desktop.h" #include "xml/repr.h" @@ -620,7 +620,7 @@ bool SPFlowtext::has_internal_frame() const SPItem *create_flowtext_with_internal_frame (SPDesktop *desktop, Geom::Point p0, Geom::Point p1) { - SPDocument *doc = sp_desktop_document (desktop); + SPDocument *doc = desktop->getDocument(); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::XML::Node *root_repr = xml_doc->createElement("svg:flowRoot"); diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp index d7d15bac7..3eecb2783 100644 --- a/src/sp-guide.cpp +++ b/src/sp-guide.cpp @@ -22,7 +22,7 @@ #include <algorithm> #include <cstring> #include <string> -#include "desktop-handles.h" + #include "display/sp-canvas.h" #include "display/guideline.h" #include "svg/svg.h" @@ -224,7 +224,7 @@ void sp_guide_pt_pairs_to_guides(SPDocument *doc, std::list<std::pair<Geom::Poin void sp_guide_create_guides_around_page(SPDesktop *dt) { - SPDocument *doc=sp_desktop_document(dt); + SPDocument *doc=dt->getDocument(); std::list<std::pair<Geom::Point, Geom::Point> > pts; Geom::Point A(0, 0); @@ -244,7 +244,7 @@ void sp_guide_create_guides_around_page(SPDesktop *dt) void sp_guide_delete_all_guides(SPDesktop *dt) { - SPDocument *doc=sp_desktop_document(dt); + SPDocument *doc=dt->getDocument(); const GSList *current; while ( (current = doc->getResourceList("guide")) ) { SPGuide* guide = SP_GUIDE(current->data); diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 796caa88b..026b1a11a 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -40,7 +40,7 @@ #include "box3d.h" #include "persp3d.h" #include "inkscape.h" -#include "desktop-handles.h" + #include "selection.h" #include "live_effects/effect.h" #include "live_effects/lpeobject.h" diff --git a/src/sp-item.cpp b/src/sp-item.cpp index b6dee67e4..dbb0380ea 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -25,7 +25,7 @@ #include "uri.h" #include "inkscape.h" #include "desktop.h" -#include "desktop-handles.h" + #include "style.h" #include <glibmm/i18n.h> diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp index 5b410e5c0..dc36e68b9 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -29,7 +29,7 @@ #include "document.h" #include "document-undo.h" #include "desktop-events.h" -#include "desktop-handles.h" + #include "sp-guide.h" #include "sp-item-group.h" #include "sp-namedview.h" @@ -840,7 +840,7 @@ void sp_namedview_window_from_document(SPDesktop *desktop) && nv->cx != HUGE_VAL && !IS_NAN(nv->cx) && nv->cy != HUGE_VAL && !IS_NAN(nv->cy)) { desktop->zoom_absolute(nv->cx, nv->cy, nv->zoom); - } else if (sp_desktop_document(desktop)) { // document without saved zoom, zoom to its page + } else if (desktop->getDocument()) { // document without saved zoom, zoom to its page desktop->zoom_page(); } @@ -900,8 +900,8 @@ void sp_namedview_document_from_window(SPDesktop *desktop) Geom::Rect const r = desktop->get_display_area(); // saving window geometry is not undoable - bool saved = DocumentUndo::getUndoSensitive(sp_desktop_document(desktop)); - DocumentUndo::setUndoSensitive(sp_desktop_document(desktop), false); + bool saved = DocumentUndo::getUndoSensitive(desktop->getDocument()); + DocumentUndo::setUndoSensitive(desktop->getDocument(), false); if (save_viewport_in_file) { sp_repr_set_svg_double(view, "inkscape:zoom", desktop->current_zoom()); @@ -922,7 +922,7 @@ void sp_namedview_document_from_window(SPDesktop *desktop) view->setAttribute("inkscape:current-layer", desktop->currentLayer()->getId()); // restore undoability - DocumentUndo::setUndoSensitive(sp_desktop_document(desktop), saved); + DocumentUndo::setUndoSensitive(desktop->getDocument(), saved); } void SPNamedView::hide(SPDesktop const *desktop) diff --git a/src/sp-path.cpp b/src/sp-path.cpp index 5c076b7cb..0fef57698 100644 --- a/src/sp-path.cpp +++ b/src/sp-path.cpp @@ -41,7 +41,7 @@ #include "document.h" #include "desktop.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "ui/tools/tool-base.h" #include "inkscape.h" diff --git a/src/splivarot.cpp b/src/splivarot.cpp index 70c8f37d5..8bb3e9897 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -37,7 +37,7 @@ #include "layer-model.h" #include "message-stack.h" #include "selection.h" -#include "desktop-handles.h" + #include "desktop.h" #include "display/canvas-bpath.h" #include "display/curve.h" @@ -1343,7 +1343,7 @@ sp_selected_path_outline(SPDesktop *desktop) if (res->descr_cmd.size() > 1) { // if there's 0 or 1 node left, drop this path altogether - SPDocument * doc = sp_desktop_document(desktop); + SPDocument * doc = desktop->getDocument(); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::XML::Node *repr = xml_doc->createElement("svg:path"); @@ -1482,7 +1482,7 @@ sp_selected_path_outline(SPDesktop *desktop) // restore title, description, id, transform repr->setAttribute("id", id); - SPItem *newitem = (SPItem *) sp_desktop_document(desktop)->getObjectByRepr(repr); + SPItem *newitem = (SPItem *) desktop->getDocument()->getObjectByRepr(repr); newitem->doWriteTransform(repr, transform); if (title) { newitem->setTitle(title); @@ -1512,7 +1512,7 @@ sp_selected_path_outline(SPDesktop *desktop) } if (did) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_OUTLINE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_SELECTION_OUTLINE, _("Convert stroke to path")); } else { // TRANSLATORS: "to outline" means "to convert stroke to path" @@ -1675,7 +1675,7 @@ void sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool { // pas vraiment de points sur le resultat // donc il ne reste rien - DocumentUndo::done(sp_desktop_document(desktop), + DocumentUndo::done(desktop->getDocument(), (updating ? SP_VERB_SELECTION_LINKED_OFFSET : SP_VERB_SELECTION_DYNAMIC_OFFSET), (updating ? _("Create linked offset") @@ -1723,7 +1723,7 @@ void sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool // move to the saved position repr->setPosition(pos > 0 ? pos : 0); - SPItem *nitem = reinterpret_cast<SPItem *>(sp_desktop_document(desktop)->getObjectByRepr(repr)); + SPItem *nitem = reinterpret_cast<SPItem *>(desktop->getDocument()->getObjectByRepr(repr)); if ( !updating ) { // delete original, apply the transform to the offset @@ -1740,7 +1740,7 @@ void sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool selection->set(nitem); } - DocumentUndo::done(sp_desktop_document(desktop), + DocumentUndo::done(desktop->getDocument(), (updating ? SP_VERB_SELECTION_LINKED_OFFSET : SP_VERB_SELECTION_DYNAMIC_OFFSET), (updating ? _("Create linked offset") @@ -1946,7 +1946,7 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset) // move to the saved position repr->setPosition(pos > 0 ? pos : 0); - SPItem *newitem = (SPItem *) sp_desktop_document(desktop)->getObjectByRepr(repr); + SPItem *newitem = (SPItem *) desktop->getDocument()->getObjectByRepr(repr); // reapply the transform newitem->doWriteTransform(repr, transform); @@ -1963,7 +1963,7 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset) } if (did) { - DocumentUndo::done(sp_desktop_document(desktop), + DocumentUndo::done(desktop->getDocument(), (expand ? SP_VERB_SELECTION_OFFSET : SP_VERB_SELECTION_INSET), (expand ? _("Outset path") : _("Inset path"))); } else { @@ -2089,7 +2089,7 @@ sp_selected_path_simplify_item(SPDesktop *desktop, // move to the saved position repr->setPosition(pos > 0 ? pos : 0); - SPItem *newitem = (SPItem *) sp_desktop_document(desktop)->getObjectByRepr(repr); + SPItem *newitem = (SPItem *) desktop->getDocument()->getObjectByRepr(repr); // reapply the transform newitem->doWriteTransform(repr, transform); @@ -2208,7 +2208,7 @@ sp_selected_path_simplify_selection(SPDesktop *desktop, float threshold, bool ju breakableAngles, true); if (didSomething) - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_SIMPLIFY, + DocumentUndo::done(desktop->getDocument(), SP_VERB_SELECTION_SIMPLIFY, _("Simplify")); else desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No paths</b> to simplify in the selection.")); diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp index 61ae2466b..65b59f2ad 100644 --- a/src/text-chemistry.cpp +++ b/src/text-chemistry.cpp @@ -29,7 +29,7 @@ #include "message-stack.h" #include "selection.h" #include "style.h" -#include "desktop-handles.h" + #include "text-editing.h" #include "text-chemistry.h" #include "sp-flowtext.h" @@ -122,14 +122,14 @@ text_put_on_path() Inkscape::XML::Node *parent = text->getRepr()->parent(); parent->appendChild(repr); - SPItem *new_item = (SPItem *) sp_desktop_document(desktop)->getObjectByRepr(repr); + SPItem *new_item = (SPItem *) desktop->getDocument()->getObjectByRepr(repr); new_item->doWriteTransform(repr, text->transform); new_item->updateRepr(); Inkscape::GC::release(repr); text->deleteObject(); // delete the orignal flowtext - sp_desktop_document(desktop)->ensureUpToDate(); + desktop->getDocument()->ensureUpToDate(); selection->clear(); @@ -181,7 +181,7 @@ text_put_on_path() text->getRepr()->setAttribute("x", NULL); text->getRepr()->setAttribute("y", NULL); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Put text on path")); g_slist_free(text_reprs); } @@ -217,7 +217,7 @@ text_remove_from_path() if (!did) { desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No texts-on-paths</b> in the selection.")); } else { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Remove text from path")); selection->setList(g_slist_copy((GSList *) selection->itemList())); // reselect to update statusbar description } @@ -282,7 +282,7 @@ text_remove_all_kerns() if (!did) { desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("Select <b>text(s)</b> to remove kerns from.")); } else { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Remove manual kerns")); } } @@ -294,7 +294,7 @@ text_flow_into_shape() if (!desktop) return; - SPDocument *doc = sp_desktop_document (desktop); + SPDocument *doc = desktop->getDocument(); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::Selection *selection = desktop->getSelection(); @@ -388,7 +388,7 @@ text_unflow () if (!desktop) return; - SPDocument *doc = sp_desktop_document (desktop); + SPDocument *doc = desktop->getDocument(); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::Selection *selection = desktop->getSelection(); @@ -512,7 +512,7 @@ flowtext_to_text() Inkscape::XML::Node *parent = item->getRepr()->parent(); parent->addChild(repr, item->getRepr()); - SPItem *new_item = reinterpret_cast<SPItem *>(sp_desktop_document(desktop)->getObjectByRepr(repr)); + SPItem *new_item = reinterpret_cast<SPItem *>(desktop->getDocument()->getObjectByRepr(repr)); new_item->doWriteTransform(repr, item->transform); new_item->updateRepr(); @@ -525,7 +525,7 @@ flowtext_to_text() g_slist_free(items); if (did) { - DocumentUndo::done(sp_desktop_document(desktop), + DocumentUndo::done(desktop->getDocument(), SP_VERB_OBJECT_FLOWTEXT_TO_TEXT, _("Convert flowed text to text")); selection->setReprList(reprs); diff --git a/src/trace/trace.cpp b/src/trace/trace.cpp index d856d37d8..cc3d000a3 100644 --- a/src/trace/trace.cpp +++ b/src/trace/trace.cpp @@ -16,7 +16,7 @@ #include "inkscape.h" #include "desktop.h" -#include "desktop-handles.h" + #include "document.h" #include "document-undo.h" #include "message-stack.h" diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 310df419e..c2465932b 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -37,7 +37,7 @@ #include "inkscape.h" #include "io/stringstream.h" #include "desktop.h" -#include "desktop-handles.h" + #include "desktop-style.h" // for sp_desktop_set_style, used in _pasteStyle #include "document.h" #include "document-private.h" diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index 94e524157..65bc94011 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -24,7 +24,7 @@ #include "align-and-distribute.h" #include <2geom/transforms.h> #include "ui/widget/spinbutton.h" -#include "desktop-handles.h" + #include "unclump.h" #include "document.h" #include "enums.h" @@ -123,10 +123,10 @@ void ActionAlign::do_action(SPDesktop *desktop, int index) focus = selection->smallestItem(horiz); break; case PAGE: - b = sp_desktop_document(desktop)->preferredBounds(); + b = desktop->getDocument()->preferredBounds(); break; case DRAWING: - b = sp_desktop_document(desktop)->getRoot()->desktopPreferredBounds(); + b = desktop->getDocument()->getRoot()->desktopPreferredBounds(); break; case SELECTION: b = selection->preferredBounds(); @@ -152,7 +152,7 @@ void ActionAlign::do_action(SPDesktop *desktop, int index) for (std::list<SPItem *>::iterator it(selected.begin()); it != selected.end(); ++it) { - sp_desktop_document (desktop)->ensureUpToDate(); + desktop->getDocument()->ensureUpToDate(); if (!sel_as_group) b = (*it)->desktopPreferredBounds(); if (b && (!focus || (*it) != focus)) { @@ -167,7 +167,7 @@ void ActionAlign::do_action(SPDesktop *desktop, int index) } if (changed) { - DocumentUndo::done( sp_desktop_document(desktop) , SP_VERB_DIALOG_ALIGN_DISTRIBUTE, + DocumentUndo::done( desktop->getDocument() , SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Align")); } } @@ -337,7 +337,7 @@ private : prefs->setInt("/options/clonecompensation/value", saved_compensation); if (changed) { - DocumentUndo::done( sp_desktop_document(desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, + DocumentUndo::done( desktop->getDocument(), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Distribute")); } } @@ -463,7 +463,7 @@ private : // restore compensation setting prefs->setInt("/options/clonecompensation/value", saved_compensation); - DocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, + DocumentUndo::done(_dialog.getDesktop()->getDocument(), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Remove overlaps")); } }; @@ -494,7 +494,7 @@ private : // restore compensation setting prefs->setInt("/options/clonecompensation/value", saved_compensation); - DocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, + DocumentUndo::done(_dialog.getDesktop()->getDocument(), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Arrange connector network")); } }; @@ -587,7 +587,7 @@ private : // restore compensation setting prefs->setInt("/options/clonecompensation/value", saved_compensation); - DocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, + DocumentUndo::done(_dialog.getDesktop()->getDocument(), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Exchange Positions")); } }; @@ -621,7 +621,7 @@ private : // restore compensation setting prefs->setInt("/options/clonecompensation/value", saved_compensation); - DocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, + DocumentUndo::done(_dialog.getDesktop()->getDocument(), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Unclump")); } }; @@ -676,7 +676,7 @@ private : it != selected.end(); ++it) { - sp_desktop_document (desktop)->ensureUpToDate(); + desktop->getDocument()->ensureUpToDate(); Geom::OptRect item_box = !prefs_bbox ? (*it)->desktopVisualBounds() : (*it)->desktopGeometricBounds(); if (item_box) { // find new center, staying within bbox @@ -693,7 +693,7 @@ private : // restore compensation setting prefs->setInt("/options/clonecompensation/value", saved_compensation); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Randomize positions")); } }; @@ -796,7 +796,7 @@ private : } if (changed) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Distribute text baselines")); } @@ -819,7 +819,7 @@ private : } if (changed) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Align text baselines")); } } diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index aa373e4f7..fede30b26 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -27,7 +27,7 @@ #include <gtkmm/adjustment.h> #include "desktop.h" -#include "desktop-handles.h" + #include "display/cairo-utils.h" #include "display/drawing.h" #include "display/drawing-context.h" @@ -2112,13 +2112,13 @@ void CloneTiler::clonetiler_unclump(GtkWidget */*widget*/, void *) } } - sp_desktop_document(desktop)->ensureUpToDate(); + desktop->getDocument()->ensureUpToDate(); unclump (to_unclump); g_slist_free (to_unclump); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_CLONETILER, + DocumentUndo::done(desktop->getDocument(), SP_VERB_DIALOG_CLONETILER, _("Unclump tiled clones")); } @@ -2172,7 +2172,7 @@ void CloneTiler::clonetiler_remove(GtkWidget */*widget*/, GtkWidget *dlg, bool d clonetiler_change_selection (selection, dlg); if (do_undo) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_CLONETILER, + DocumentUndo::done(desktop->getDocument(), SP_VERB_DIALOG_CLONETILER, _("Delete tiled clones")); } } @@ -2251,7 +2251,7 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg) clonetiler_remove (NULL, dlg, false); - double scale_units = Inkscape::Util::Quantity::convert(1, "px", &sp_desktop_document(desktop)->getSVGUnit()); + double scale_units = Inkscape::Util::Quantity::convert(1, "px", &desktop->getDocument()->getSVGUnit()); double shiftx_per_i = 0.01 * prefs->getDoubleLimited(prefs_path + "shiftx_per_i", 0, -10000, 10000); double shifty_per_i = 0.01 * prefs->getDoubleLimited(prefs_path + "shifty_per_i", 0, -10000, 10000); @@ -2337,7 +2337,7 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg) SPItem *item = dynamic_cast<SPItem *>(obj); if (dotrace) { - clonetiler_trace_setup (sp_desktop_document(desktop), 1.0, item); + clonetiler_trace_setup (desktop->getDocument(), 1.0, item); } Geom::Point center; @@ -2611,21 +2611,21 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg) parent->getRepr()->appendChild(clone); if (blur > 0.0) { - SPObject *clone_object = sp_desktop_document(desktop)->getObjectByRepr(clone); + SPObject *clone_object = desktop->getDocument()->getObjectByRepr(clone); double perimeter = perimeter_original * t.descrim(); double radius = blur * perimeter; // this is necessary for all newly added clones to have correct bboxes, // otherwise filters won't work: - sp_desktop_document(desktop)->ensureUpToDate(); + desktop->getDocument()->ensureUpToDate(); // it's hard to figure out exact width/height of the tile without having an object // that we can take bbox of; however here we only need a lower bound so that blur // margins are not too small, and the perimeter should work - SPFilter *constructed = new_filter_gaussian_blur(sp_desktop_document(desktop), radius, t.descrim(), t.expansionX(), t.expansionY(), perimeter, perimeter); + SPFilter *constructed = new_filter_gaussian_blur(desktop->getDocument(), radius, t.descrim(), t.expansionX(), t.expansionY(), perimeter, perimeter); sp_style_set_property_url (clone_object, "filter", constructed, false); } if (center_set) { - SPObject *clone_object = sp_desktop_document(desktop)->getObjectByRepr(clone); + SPObject *clone_object = desktop->getDocument()->getObjectByRepr(clone); SPItem *item = dynamic_cast<SPItem *>(clone_object); if (clone_object && item) { clone_object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); @@ -2647,7 +2647,7 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg) desktop->clearWaitingCursor(); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_CLONETILER, + DocumentUndo::done(desktop->getDocument(), SP_VERB_DIALOG_CLONETILER, _("Create tiled clones")); } diff --git a/src/ui/dialog/color-item.cpp b/src/ui/dialog/color-item.cpp index bab7e18e1..a49a47d5c 100644 --- a/src/ui/dialog/color-item.cpp +++ b/src/ui/dialog/color-item.cpp @@ -29,7 +29,7 @@ #include "color-item.h" #include "desktop.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "display/cairo-utils.h" #include "document.h" @@ -476,7 +476,7 @@ void ColorItem::_updatePreviews() { SPDesktop *desktop = SP_ACTIVE_DESKTOP; if ( desktop ) { - SPDocument* document = sp_desktop_document( desktop ); + SPDocument* document = desktop->getDocument(); Inkscape::XML::Node *rroot = document->getReprRoot(); if ( rroot ) { @@ -706,7 +706,7 @@ void ColorItem::buttonClicked(bool secondary) sp_desktop_set_style(desktop, css); sp_repr_css_attr_unref(css); - DocumentUndo::done( sp_desktop_document(desktop), SP_VERB_DIALOG_SWATCHES, descr.c_str() ); + DocumentUndo::done( desktop->getDocument(), SP_VERB_DIALOG_SWATCHES, descr.c_str() ); } } diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp index 6d8fe4b12..27d88bae7 100644 --- a/src/ui/dialog/dialog.cpp +++ b/src/ui/dialog/dialog.cpp @@ -25,7 +25,7 @@ #include "inkscape.h" #include "ui/tools/tool-base.h" #include "desktop.h" -#include "desktop-handles.h" + #include "shortcuts.h" #include "preferences.h" #include "ui/interface.h" diff --git a/src/ui/dialog/document-metadata.cpp b/src/ui/dialog/document-metadata.cpp index dc7f8158e..da1facc08 100644 --- a/src/ui/dialog/document-metadata.cpp +++ b/src/ui/dialog/document-metadata.cpp @@ -20,7 +20,7 @@ #include "document-metadata.h" #include "desktop.h" -#include "desktop-handles.h" + #include "inkscape.h" #include "rdf.h" #include "sp-namedview.h" diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 1d15ad32b..af7ca678a 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -26,7 +26,7 @@ #include "document-properties.h" #include "display/canvas-grid.h" #include "document.h" -#include "desktop-handles.h" + #include "desktop.h" #include "inkscape.h" #include "io/sys.h" @@ -188,7 +188,7 @@ void DocumentProperties::init() Inkscape::XML::Node *repr = getDesktop()->getNamedView()->getRepr(); repr->addListener (&_repr_events, this); - Inkscape::XML::Node *root = sp_desktop_document(getDesktop())->getRoot()->getRepr(); + Inkscape::XML::Node *root = getDesktop()->getDocument()->getRoot()->getRepr(); root->addListener (&_repr_events, this); show_all_children(); @@ -199,7 +199,7 @@ DocumentProperties::~DocumentProperties() { Inkscape::XML::Node *repr = getDesktop()->getNamedView()->getRepr(); repr->removeListenerByData (this); - Inkscape::XML::Node *root = sp_desktop_document(getDesktop())->getRoot()->getRepr(); + Inkscape::XML::Node *root = getDesktop()->getDocument()->getRoot()->getRepr(); root->removeListenerByData (this); for (RDElist::iterator it = _rdflist.begin(); it != _rdflist.end(); ++it) @@ -1484,21 +1484,21 @@ void DocumentProperties::update() _rum_deflt.setUnit (nv->display_units->abbr); } - double doc_w = sp_desktop_document(dt)->getRoot()->width.value; - Glib::ustring doc_w_unit = unit_table.getUnit(sp_desktop_document(dt)->getRoot()->width.unit)->abbr; + double doc_w = dt->getDocument()->getRoot()->width.value; + Glib::ustring doc_w_unit = unit_table.getUnit(dt->getDocument()->getRoot()->width.unit)->abbr; if (doc_w_unit == "") { doc_w_unit = "px"; - } else if (doc_w_unit == "%" && sp_desktop_document(dt)->getRoot()->viewBox_set) { + } else if (doc_w_unit == "%" && dt->getDocument()->getRoot()->viewBox_set) { doc_w_unit = "px"; - doc_w = sp_desktop_document(dt)->getRoot()->viewBox.width(); + doc_w = dt->getDocument()->getRoot()->viewBox.width(); } - double doc_h = sp_desktop_document(dt)->getRoot()->height.value; - Glib::ustring doc_h_unit = unit_table.getUnit(sp_desktop_document(dt)->getRoot()->height.unit)->abbr; + double doc_h = dt->getDocument()->getRoot()->height.value; + Glib::ustring doc_h_unit = unit_table.getUnit(dt->getDocument()->getRoot()->height.unit)->abbr; if (doc_h_unit == "") { doc_h_unit = "px"; - } else if (doc_h_unit == "%" && sp_desktop_document(dt)->getRoot()->viewBox_set) { + } else if (doc_h_unit == "%" && dt->getDocument()->getRoot()->viewBox_set) { doc_h_unit = "px"; - doc_h = sp_desktop_document(dt)->getRoot()->viewBox.height(); + doc_h = dt->getDocument()->getRoot()->viewBox.height(); } _page_sizer.setDim(Inkscape::Util::Quantity(doc_w, doc_w_unit), Inkscape::Util::Quantity(doc_h, doc_h_unit)); _page_sizer.updateFitMarginsUI(nv->getRepr()); @@ -1603,7 +1603,7 @@ void DocumentProperties::_handleActivateDesktop(SPDesktop *desktop) { Inkscape::XML::Node *repr = desktop->getNamedView()->getRepr(); repr->addListener(&_repr_events, this); - Inkscape::XML::Node *root = sp_desktop_document(desktop)->getRoot()->getRepr(); + Inkscape::XML::Node *root = desktop->getDocument()->getRoot()->getRepr(); root->addListener(&_repr_events, this); update(); } @@ -1612,7 +1612,7 @@ void DocumentProperties::_handleDeactivateDesktop(SPDesktop *desktop) { Inkscape::XML::Node *repr = desktop->getNamedView()->getRepr(); repr->removeListenerByData(this); - Inkscape::XML::Node *root = sp_desktop_document(desktop)->getRoot()->getRepr(); + Inkscape::XML::Node *root = desktop->getDocument()->getRoot()->getRepr(); root->removeListenerByData(this); } @@ -1648,7 +1648,7 @@ void DocumentProperties::onNewGrid() { SPDesktop *dt = getDesktop(); Inkscape::XML::Node *repr = dt->getNamedView()->getRepr(); - SPDocument *doc = sp_desktop_document(dt); + SPDocument *doc = dt->getDocument(); Glib::ustring typestring = _grids_combo_gridtype.get_active_text(); CanvasGrid::writeNewGridToRepr(repr, doc, CanvasGrid::getGridTypeFromName(typestring.c_str())); @@ -1679,7 +1679,7 @@ void DocumentProperties::onRemoveGrid() // delete the grid that corresponds with the selected tab // when the grid is deleted from SVG, the SPNamedview handler automatically deletes the object, so found_grid becomes an invalid pointer! found_grid->repr->parent()->removeChild(found_grid->repr); - DocumentUndo::done(sp_desktop_document(dt), SP_VERB_DIALOG_NAMEDVIEW, _("Remove grid")); + DocumentUndo::done(dt->getDocument(), SP_VERB_DIALOG_NAMEDVIEW, _("Remove grid")); } } diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 11dfa2db5..6d90c792e 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -54,7 +54,7 @@ #include "inkscape.h" #include "document.h" #include "document-undo.h" -#include "desktop-handles.h" + #include "sp-item.h" #include "selection.h" #include "file.h" @@ -101,7 +101,6 @@ #define EXPORT_COORD_PRECISION 3 -#include "../../desktop-handles.h" #include "../../document.h" #include "../../document-undo.h" #include "verbs.h" @@ -685,7 +684,7 @@ void Export::onSelectionModified ( guint /*flags*/ ) case SELECTION_DRAWING: if ( SP_ACTIVE_DESKTOP ) { SPDocument *doc; - doc = sp_desktop_document (SP_ACTIVE_DESKTOP); + doc = SP_ACTIVE_DESKTOP->getDocument(); Geom::OptRect bbox = doc->getRoot()->desktopVisualBounds(); if (bbox) { setArea ( bbox->left(), @@ -736,7 +735,7 @@ void Export::onAreaToggled () SPDocument *doc; Geom::OptRect bbox; bbox = Geom::Rect(Geom::Point(0.0, 0.0),Geom::Point(0.0, 0.0)); - doc = sp_desktop_document (SP_ACTIVE_DESKTOP); + doc = SP_ACTIVE_DESKTOP->getDocument(); /* Notice how the switch is used to 'fall through' here to get various backups. If you modify this without noticing you'll @@ -1003,7 +1002,7 @@ void Export::onExport () if (!desktop) return; SPNamedView *nv = desktop->getNamedView(); - SPDocument *doc = sp_desktop_document (desktop); + SPDocument *doc = desktop->getDocument(); bool exportSuccessful = false; @@ -1154,7 +1153,7 @@ void Export::onExport () prog_dlg->set_data("total", GINT_TO_POINTER(0)); /* Do export */ - ExportResult status = sp_export_png_file(sp_desktop_document(desktop), path.c_str(), + ExportResult status = sp_export_png_file(desktop->getDocument(), path.c_str(), Geom::Rect(Geom::Point(x0, y0), Geom::Point(x1, y1)), width, height, xdpi, ydpi, nv->pagecolor, onProgressCallback, (void*)prog_dlg, @@ -1472,7 +1471,7 @@ void Export::detectSize() { } break; case SELECTION_DRAWING: { - SPDocument *doc = sp_desktop_document (SP_ACTIVE_DESKTOP); + SPDocument *doc = SP_ACTIVE_DESKTOP->getDocument(); Geom::OptRect bbox = doc->getRoot()->desktopVisualBounds(); @@ -1485,7 +1484,7 @@ void Export::detectSize() { case SELECTION_PAGE: { SPDocument *doc; - doc = sp_desktop_document (SP_ACTIVE_DESKTOP); + doc = SP_ACTIVE_DESKTOP->getDocument(); Geom::Point x(0.0, 0.0); Geom::Point y(doc->getWidth().value("px"), diff --git a/src/ui/dialog/fill-and-stroke.cpp b/src/ui/dialog/fill-and-stroke.cpp index c55d55cda..8141f7696 100644 --- a/src/ui/dialog/fill-and-stroke.cpp +++ b/src/ui/dialog/fill-and-stroke.cpp @@ -16,7 +16,7 @@ */ #include "ui/widget/notebook-page.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "document.h" #include "fill-and-stroke.h" diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 228570c88..3da0e0043 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -33,7 +33,7 @@ #include <glibmm/stringutils.h> #include "desktop.h" -#include "desktop-handles.h" + #include "dir-util.h" #include "document.h" #include "document-undo.h" @@ -1416,7 +1416,7 @@ void FilterEffectsDialog::FilterModifier::setTargetDesktop(SPDesktop *desktop) _selectModifiedConn = desktop->selection->connectModified(sigc::hide<0>(sigc::mem_fun(*this, &FilterModifier::on_modified_selection))); } _doc_replaced = desktop->connectDocumentReplaced( sigc::mem_fun(*this, &FilterModifier::on_document_replaced)); - _resource_changed = sp_desktop_document(desktop)->connectResourcesChanged("filter",sigc::mem_fun(*this, &FilterModifier::update_filters)); + _resource_changed = desktop->getDocument()->connectResourcesChanged("filter",sigc::mem_fun(*this, &FilterModifier::update_filters)); _dialog.setDesktop(desktop); update_filters(); @@ -1537,7 +1537,7 @@ void FilterEffectsDialog::FilterModifier::on_selection_toggled(const Glib::ustri if(iter) { SPDesktop *desktop = _dialog.getDesktop(); - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); SPFilter* filter = (*iter)[_columns.filter]; Inkscape::Selection *sel = desktop->getSelection(); @@ -1571,7 +1571,7 @@ void FilterEffectsDialog::FilterModifier::on_selection_toggled(const Glib::ustri void FilterEffectsDialog::FilterModifier::update_filters() { SPDesktop* desktop = _dialog.getDesktop(); - SPDocument* document = sp_desktop_document(desktop); + SPDocument* document = desktop->getDocument(); const GSList* filters = document->getResourceList("filter"); _model->clear(); @@ -1627,7 +1627,7 @@ void FilterEffectsDialog::FilterModifier::filter_list_button_release(GdkEventBut void FilterEffectsDialog::FilterModifier::add_filter() { - SPDocument* doc = sp_desktop_document(_dialog.getDesktop()); + SPDocument* doc = _dialog.getDesktop()->getDocument(); SPFilter* filter = new_filter(doc); const int count = _model->children().size(); @@ -1937,7 +1937,7 @@ void FilterEffectsDialog::PrimitiveList::remove_selected() //XML Tree being used directly here while it shouldn't be. sp_repr_unparent(prim->getRepr()); - DocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_FILTER_EFFECTS, + DocumentUndo::done(_dialog.getDesktop()->getDocument(), SP_VERB_DIALOG_FILTER_EFFECTS, _("Remove filter primitive")); update(); diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp index be8250f88..6d8d64607 100644 --- a/src/ui/dialog/find.cpp +++ b/src/ui/dialog/find.cpp @@ -29,7 +29,7 @@ #include "document.h" #include "document-undo.h" #include "selection.h" -#include "desktop-handles.h" + #include "ui/dialog-events.h" #include "verbs.h" @@ -824,7 +824,7 @@ void Find::onAction() if (check_scope_layer.get_active()) { l = all_items (desktop->currentLayer(), l, hidden, locked); } else { - l = all_items(sp_desktop_document(desktop)->getRoot(), l, hidden, locked); + l = all_items(desktop->getDocument()->getRoot(), l, hidden, locked); } } guint all = g_slist_length (l); @@ -859,7 +859,7 @@ void Find::onAction() scroll_to_show_item(desktop, item); if (_action_replace) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Replace text or property")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Replace text or property")); } } else { diff --git a/src/ui/dialog/font-substitution.cpp b/src/ui/dialog/font-substitution.cpp index 82253417a..ae03bdf0e 100644 --- a/src/ui/dialog/font-substitution.cpp +++ b/src/ui/dialog/font-substitution.cpp @@ -28,7 +28,7 @@ #include "selection.h" #include "ui/dialog-events.h" -#include "desktop-handles.h" + #include "selection-chemistry.h" #include "preferences.h" diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp index d60778bd0..d3ccb9bde 100644 --- a/src/ui/dialog/grid-arrange-tab.cpp +++ b/src/ui/dialog/grid-arrange-tab.cpp @@ -31,7 +31,7 @@ #include "verbs.h" #include "preferences.h" #include "inkscape.h" -#include "desktop-handles.h" + #include "selection.h" #include "document.h" #include "document-undo.h" @@ -165,7 +165,7 @@ void GridArrangeTab::arrange() grid_top = 99999; SPDesktop *desktop = Parent->getDesktop(); - sp_desktop_document(desktop)->ensureUpToDate(); + desktop->getDocument()->ensureUpToDate(); Inkscape::Selection *selection = desktop->getSelection(); const GSList *items = selection ? selection->itemList() : 0; @@ -347,7 +347,7 @@ g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_h g_slist_free (current_row); } - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_ARRANGE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_SELECTION_ARRANGE, _("Arrange in a grid")); } diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index 221f9a1c0..af8e2cc31 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -24,7 +24,7 @@ #include "document-undo.h" #include "sp-guide.h" #include "sp-namedview.h" -#include "desktop-handles.h" + #include "ui/tools/tool-base.h" #include "widgets/desktop-widget.h" #include <glibmm/i18n.h> diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp index 25520ba8b..b908a90cb 100644 --- a/src/ui/dialog/icon-preview.cpp +++ b/src/ui/dialog/icon-preview.cpp @@ -35,7 +35,7 @@ #include "ui/widget/frame.h" #include "desktop.h" -#include "desktop-handles.h" + #include "display/drawing.h" #include "document.h" #include "inkscape.h" diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 31dddda7c..8d507d037 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -32,7 +32,7 @@ #include "util/units.h" #include <iostream> #include "enums.h" -#include "desktop-handles.h" + #include "extension/internal/gdkpixbuf-input.h" #include "message-stack.h" #include "style.h" diff --git a/src/ui/dialog/layer-properties.cpp b/src/ui/dialog/layer-properties.cpp index 779aa47fe..1b8fbb3f7 100644 --- a/src/ui/dialog/layer-properties.cpp +++ b/src/ui/dialog/layer-properties.cpp @@ -23,7 +23,7 @@ #include "document-undo.h" #include "layer-manager.h" #include "message-stack.h" -#include "desktop-handles.h" + #include "sp-object.h" #include "sp-item.h" #include "verbs.h" @@ -132,7 +132,7 @@ LayerPropertiesDialog::_apply() g_assert(_strategy != NULL); _strategy->perform(*this); - DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_NONE, + DocumentUndo::done(SP_ACTIVE_DESKTOP->getDocument(), SP_VERB_NONE, _("Add layer")); _close(); @@ -364,7 +364,7 @@ void LayerPropertiesDialog::Rename::perform(LayerPropertiesDialog &dialog) { (gchar *)name.c_str(), FALSE ); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE, + DocumentUndo::done(desktop->getDocument(), SP_VERB_NONE, _("Rename layer")); // TRANSLATORS: This means "The layer has been renamed" desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Renamed layer")); diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 2e96193b9..3b87597c8 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -23,7 +23,7 @@ #include <vector> #include "desktop.h" -#include "desktop-handles.h" + #include "document.h" #include "document-undo.h" #include "gtkmm/widget.h" @@ -510,7 +510,7 @@ LivePathEffectEditor::onRemove() if ( lpeitem ) { lpeitem->removeCurrentPathEffect(false); - DocumentUndo::done( sp_desktop_document(current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT, + DocumentUndo::done( current_desktop->getDocument(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Remove path effect") ); effect_list_reload(lpeitem); @@ -528,7 +528,7 @@ void LivePathEffectEditor::onUp() if ( lpeitem ) { lpeitem->upCurrentPathEffect(); - DocumentUndo::done( sp_desktop_document(current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT, + DocumentUndo::done( current_desktop->getDocument(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Move path effect up") ); effect_list_reload(lpeitem); @@ -545,7 +545,7 @@ void LivePathEffectEditor::onDown() if ( lpeitem ) { lpeitem->downCurrentPathEffect(); - DocumentUndo::done( sp_desktop_document(current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT, + DocumentUndo::done( current_desktop->getDocument(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Move path effect down") ); effect_list_reload(lpeitem); @@ -584,7 +584,7 @@ void LivePathEffectEditor::on_visibility_toggled( Glib::ustring const& str ) /* FIXME: this explicit writing to SVG is wrong. The lpe_item should have a method to disable/enable an effect within its stack. * So one can call: lpe_item->setActive(lpeobjref->lpeobject); */ lpeobjref->lpeobject->get_lpe()->getRepr()->setAttribute("is_visible", newValue ? "true" : "false"); - DocumentUndo::done( sp_desktop_document(current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT, + DocumentUndo::done( current_desktop->getDocument(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, newValue ? _("Activate path effect") : _("Deactivate path effect")); } } diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index 55a19fc51..1ca84e6b3 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -23,7 +23,7 @@ #include "document-undo.h" #include "layer-manager.h" #include "message-stack.h" -#include "desktop-handles.h" + #include "sp-object.h" #include "sp-item.h" #include "verbs.h" diff --git a/src/ui/dialog/lpe-powerstroke-properties.cpp b/src/ui/dialog/lpe-powerstroke-properties.cpp index 55f938a48..a9e57970d 100644 --- a/src/ui/dialog/lpe-powerstroke-properties.cpp +++ b/src/ui/dialog/lpe-powerstroke-properties.cpp @@ -32,7 +32,7 @@ #include "document-undo.h" #include "layer-manager.h" #include "message-stack.h" -#include "desktop-handles.h" + #include "sp-object.h" #include "sp-item.h" #include "verbs.h" diff --git a/src/ui/dialog/object-attributes.cpp b/src/ui/dialog/object-attributes.cpp index 118a66097..f43a15225 100644 --- a/src/ui/dialog/object-attributes.cpp +++ b/src/ui/dialog/object-attributes.cpp @@ -22,7 +22,7 @@ #include "ui/dialog/dialog-manager.h" #include "desktop.h" -#include "desktop-handles.h" + #include "macros.h" #include "sp-anchor.h" #include "sp-image.h" diff --git a/src/ui/dialog/object-properties.cpp b/src/ui/dialog/object-properties.cpp index ecfd057de..dfe211e94 100644 --- a/src/ui/dialog/object-properties.cpp +++ b/src/ui/dialog/object-properties.cpp @@ -28,7 +28,7 @@ #include "object-properties.h" #include "widgets/sp-attribute-widget.h" -#include "desktop-handles.h" + #include "document.h" #include "document-undo.h" #include "verbs.h" diff --git a/src/ui/dialog/polar-arrange-tab.cpp b/src/ui/dialog/polar-arrange-tab.cpp index 08cfba839..cc5decfd7 100644 --- a/src/ui/dialog/polar-arrange-tab.cpp +++ b/src/ui/dialog/polar-arrange-tab.cpp @@ -16,7 +16,7 @@ #include "verbs.h" #include "preferences.h" #include "inkscape.h" -#include "desktop-handles.h" + #include "selection.h" #include "document.h" #include "document-undo.h" @@ -399,7 +399,7 @@ void PolarArrangeTab::arrange() tmp = tmp->next; } - DocumentUndo::done(sp_desktop_document(parent->getDesktop()), SP_VERB_SELECTION_ARRANGE, + DocumentUndo::done(parent->getDesktop()->getDocument(), SP_VERB_SELECTION_ARRANGE, _("Arrange on ellipse")); } diff --git a/src/ui/dialog/spellcheck.cpp b/src/ui/dialog/spellcheck.cpp index e42b58966..6da8acb20 100644 --- a/src/ui/dialog/spellcheck.cpp +++ b/src/ui/dialog/spellcheck.cpp @@ -22,7 +22,7 @@ #include "document.h" #include "selection.h" #include "desktop.h" -#include "desktop-handles.h" + #include "ui/tools-switch.h" #include "ui/tools/text-tool.h" #include "ui/interface.h" @@ -407,7 +407,7 @@ SpellCheck::init(SPDesktop *d) } #endif /* HAVE_ASPELL */ - _root = sp_desktop_document(desktop)->getRoot(); + _root = desktop->getDocument()->getRoot(); // empty the list of objects we've checked g_slist_free (_seen_objects); @@ -792,7 +792,7 @@ void SpellCheck::onAccept () // find the end of the word anew _end_w = _begin_w; _end_w.nextEndOfWord(); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Fix spelling")); } } diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 55eed9a99..bc228633d 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -30,7 +30,7 @@ #include "xml/repr.h" #include "sp-font-face.h" #include "desktop.h" -#include "desktop-handles.h" + #include "display/nr-svgfonts.h" #include "verbs.h" #include "sp-glyph.h" @@ -182,7 +182,7 @@ void SvgFontsDialog::on_kerning_value_changed(){ return; } - SPDocument* document = sp_desktop_document(this->getDesktop()); + SPDocument* document = this->getDesktop()->getDocument(); //TODO: I am unsure whether this is the correct way of calling SPDocumentUndo::maybe_done Glib::ustring undokey = "svgfonts:hkern:k:"; @@ -265,7 +265,7 @@ void SvgFontsDialog::update_sensitiveness(){ void SvgFontsDialog::update_fonts() { SPDesktop* desktop = this->getDesktop(); - SPDocument* document = sp_desktop_document(desktop); + SPDocument* document = desktop->getDocument(); const GSList* fonts = document->getResourceList("font"); _model->clear(); @@ -482,7 +482,7 @@ void SvgFontsDialog::update_glyphs(){ void SvgFontsDialog::add_glyph(){ const int count = _GlyphsListStore->children().size(); - SPDocument* doc = sp_desktop_document(this->getDesktop()); + SPDocument* doc = this->getDesktop()->getDocument(); /* SPGlyph* glyph =*/ new_glyph(doc, get_selected_spfont(), count+1); DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Add glyph")); @@ -516,7 +516,7 @@ void SvgFontsDialog::set_glyph_description_from_selected_path(){ } Inkscape::MessageStack *msgStack = desktop->getMessageStack(); - SPDocument* doc = sp_desktop_document(desktop); + SPDocument* doc = desktop->getDocument(); Inkscape::Selection* sel = desktop->getSelection(); if (sel->isEmpty()){ char *msg = _("Select a <b>path</b> to define the curves of a glyph"); @@ -558,7 +558,7 @@ void SvgFontsDialog::missing_glyph_description_from_selected_path(){ } Inkscape::MessageStack *msgStack = desktop->getMessageStack(); - SPDocument* doc = sp_desktop_document(desktop); + SPDocument* doc = desktop->getDocument(); Inkscape::Selection* sel = desktop->getSelection(); if (sel->isEmpty()){ char *msg = _("Select a <b>path</b> to define the curves of a glyph"); @@ -598,7 +598,7 @@ void SvgFontsDialog::reset_missing_glyph_description(){ return; } - SPDocument* doc = sp_desktop_document(desktop); + SPDocument* doc = desktop->getDocument(); SPObject* obj; for (obj = get_selected_spfont()->children; obj; obj=obj->next){ if (SP_IS_MISSING_GLYPH(obj)){ @@ -619,7 +619,7 @@ void SvgFontsDialog::glyph_name_edit(const Glib::ustring&, const Glib::ustring& //XML Tree being directly used here while it shouldn't be. glyph->getRepr()->setAttribute("glyph-name", str.c_str()); - SPDocument* doc = sp_desktop_document(this->getDesktop()); + SPDocument* doc = this->getDesktop()->getDocument(); DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Edit glyph name")); update_glyphs(); @@ -633,7 +633,7 @@ void SvgFontsDialog::glyph_unicode_edit(const Glib::ustring&, const Glib::ustrin //XML Tree being directly used here while it shouldn't be. glyph->getRepr()->setAttribute("unicode", str.c_str()); - SPDocument* doc = sp_desktop_document(this->getDesktop()); + SPDocument* doc = this->getDesktop()->getDocument(); DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph unicode")); update_glyphs(); @@ -645,7 +645,7 @@ void SvgFontsDialog::remove_selected_font(){ //XML Tree being directly used here while it shouldn't be. sp_repr_unparent(font->getRepr()); - SPDocument* doc = sp_desktop_document(this->getDesktop()); + SPDocument* doc = this->getDesktop()->getDocument(); DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove font")); update_fonts(); @@ -662,7 +662,7 @@ void SvgFontsDialog::remove_selected_glyph(){ //XML Tree being directly used here while it shouldn't be. sp_repr_unparent(glyph->getRepr()); - SPDocument* doc = sp_desktop_document(this->getDesktop()); + SPDocument* doc = this->getDesktop()->getDocument(); DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove glyph")); update_glyphs(); @@ -679,7 +679,7 @@ void SvgFontsDialog::remove_selected_kerning_pair(){ //XML Tree being directly used here while it shouldn't be. sp_repr_unparent(pair->getRepr()); - SPDocument* doc = sp_desktop_document(this->getDesktop()); + SPDocument* doc = this->getDesktop()->getDocument(); DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove kerning pair")); update_glyphs(); @@ -750,7 +750,7 @@ void SvgFontsDialog::add_kerning_pair(){ if (this->kerning_pair) return; //We already have this kerning pair - SPDocument* document = sp_desktop_document(this->getDesktop()); + SPDocument* document = this->getDesktop()->getDocument(); Inkscape::XML::Document *xml_doc = document->getReprDoc(); // create a new hkern node @@ -864,7 +864,7 @@ void set_font_family(SPFont* font, char* str){ } void SvgFontsDialog::add_font(){ - SPDocument* doc = sp_desktop_document(this->getDesktop()); + SPDocument* doc = this->getDesktop()->getDocument(); SPFont* font = new_font(doc); const int count = _model->children().size(); @@ -938,7 +938,7 @@ SvgFontsDialog::SvgFontsDialog() _FontsList.signal_button_release_event().connect_notify(sigc::mem_fun(*this, &SvgFontsDialog::fonts_list_button_release)); create_fonts_popup_menu(_FontsList, sigc::mem_fun(*this, &SvgFontsDialog::remove_selected_font)); - _defs_observer.set(sp_desktop_document(this->getDesktop())->getDefs()); + _defs_observer.set(this->getDesktop()->getDocument()->getDefs()); _defs_observer.signal_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::update_fonts)); _getContents()->show_all(); diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index df20adc61..772217fcd 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -28,7 +28,7 @@ #include "color-item.h" #include "desktop.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "document.h" #include "document-private.h" @@ -1061,7 +1061,7 @@ void SwatchesPanel::_updateFromSelection() Glib::ustring fillId; Glib::ustring strokeId; - SPStyle *tmpStyle = sp_style_new( sp_desktop_document(_currentDesktop) ); + SPStyle *tmpStyle = sp_style_new(_currentDesktop->getDocument()); int result = sp_desktop_query_style( _currentDesktop, tmpStyle, QUERY_STYLE_PROPERTY_FILL ); switch (result) { case QUERY_STYLE_SINGLE: diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 0ec071d06..bdba3e154 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -52,7 +52,7 @@ #include "selection.h" #include "desktop.h" -#include "desktop-handles.h" + #include "document.h" #include "inkscape.h" #include "sp-root.h" @@ -288,7 +288,7 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : /**********************************************************/ currentDesktop = SP_ACTIVE_DESKTOP; - currentDocument = sp_desktop_document(currentDesktop); + currentDocument = currentDesktop->getDocument(); previewDocument = symbols_preview_doc(); /* Template to render symbols in */ previewDocument->ensureUpToDate(); /* Necessary? */ diff --git a/src/ui/dialog/template-widget.cpp b/src/ui/dialog/template-widget.cpp index f79d166f2..eff75b311 100644 --- a/src/ui/dialog/template-widget.cpp +++ b/src/ui/dialog/template-widget.cpp @@ -20,7 +20,7 @@ #include "template-load-tab.h" #include "desktop.h" -#include "desktop-handles.h" + #include "document.h" #include "document-undo.h" #include "file.h" @@ -68,8 +68,8 @@ void TemplateWidget::create() SPDesktop *desktop = SP_ACTIVE_DESKTOP; SPDesktop *desc = sp_file_new_default(); _current_template.tpl_effect->effect(desc); - DocumentUndo::clearUndo(sp_desktop_document(desc)); - sp_desktop_document(desc)->setModifiedSinceSave(false); + DocumentUndo::clearUndo(desc->getDocument()); + desc->getDocument()->setModifiedSinceSave(false); // Apply cx,cy etc. from document sp_namedview_window_from_document( desc ); diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index 0cbe41f78..229e82af4 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -41,7 +41,7 @@ extern "C" { #include "document.h" #include "desktop.h" #include "desktop-style.h" -#include "desktop-handles.h" + #include "document-undo.h" #include "selection.h" #include "style.h" @@ -344,7 +344,7 @@ void TextEdit::onReadSelection ( gboolean dostyle, gboolean /*docontent*/ ) Inkscape::FontLister* fontlister = Inkscape::FontLister::get_instance(); // This is normally done for us by text-toolbar but only when we are in text editing context - fontlister->update_font_list(sp_desktop_document(this->desktop)); + fontlister->update_font_list(this->desktop->getDocument()); fontlister->selection_update(); Glib::ustring fontspec = fontlister->get_fontspec(); @@ -583,7 +583,7 @@ void TextEdit::onApply() } // complete the transaction - DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT, + DocumentUndo::done(SP_ACTIVE_DESKTOP->getDocument(), SP_VERB_CONTEXT_TEXT, _("Set text style")); apply_button.set_sensitive ( false ); @@ -658,7 +658,7 @@ void TextEdit::onStartOffsetChange(GtkTextBuffer * /*text_buffer*/, TextEdit *se const gchar *sstr = gtk_combo_box_text_get_active_text(reinterpret_cast<GtkComboBoxText *>(self->startOffset)); tp->setAttribute("startOffset", sstr); - DocumentUndo::maybeDone(sp_desktop_document(SP_ACTIVE_DESKTOP), "startOffset", SP_VERB_CONTEXT_TEXT, _("Set text style")); + DocumentUndo::maybeDone(SP_ACTIVE_DESKTOP->getDocument(), "startOffset", SP_VERB_CONTEXT_TEXT, _("Set text style")); } } diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index d7cca13a8..233d99750 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -26,7 +26,7 @@ #include "document.h" #include "document-undo.h" #include "desktop.h" -#include "desktop-handles.h" + #include "transformation.h" #include "align-and-distribute.h" #include "inkscape.h" @@ -802,7 +802,7 @@ void Transformation::applyPageMove(Inkscape::Selection *selection) } } - DocumentUndo::done( sp_desktop_document(selection->desktop()) , SP_VERB_DIALOG_TRANSFORM, + DocumentUndo::done( selection->desktop()->getDocument() , SP_VERB_DIALOG_TRANSFORM, _("Move")); } @@ -864,7 +864,7 @@ void Transformation::applyPageScale(Inkscape::Selection *selection) } } - DocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM, + DocumentUndo::done(selection->desktop()->getDocument(), SP_VERB_DIALOG_TRANSFORM, _("Scale")); } @@ -889,7 +889,7 @@ void Transformation::applyPageRotate(Inkscape::Selection *selection) } } - DocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM, + DocumentUndo::done(selection->desktop()->getDocument(), SP_VERB_DIALOG_TRANSFORM, _("Rotate")); } @@ -977,7 +977,7 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) } } - DocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM, + DocumentUndo::done(selection->desktop()->getDocument(), SP_VERB_DIALOG_TRANSFORM, _("Skew")); } @@ -1007,7 +1007,7 @@ void Transformation::applyPageTransform(Inkscape::Selection *selection) sp_selection_apply_affine(selection, displayed); // post-multiply each object's transform } - DocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM, + DocumentUndo::done(selection->desktop()->getDocument(), SP_VERB_DIALOG_TRANSFORM, _("Edit transformation matrix")); } diff --git a/src/ui/dialog/undo-history.cpp b/src/ui/dialog/undo-history.cpp index 53691cd37..a50a169eb 100644 --- a/src/ui/dialog/undo-history.cpp +++ b/src/ui/dialog/undo-history.cpp @@ -24,7 +24,7 @@ #include "document-undo.h" #include "inkscape.h" #include "verbs.h" -#include "desktop-handles.h" + #include "util/signal-blocker.h" #include "desktop.h" diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp index 7105e2cda..c02520218 100644 --- a/src/ui/dialog/xml-tree.cpp +++ b/src/ui/dialog/xml-tree.cpp @@ -23,7 +23,7 @@ #include <gtkmm/stock.h> #include "desktop.h" -#include "desktop-handles.h" + #include "ui/dialog-events.h" #include "document.h" #include "document-undo.h" @@ -363,7 +363,7 @@ void XmlTree::set_tree_desktop(SPDesktop *desktop) sel_changed_connection = desktop->getSelection()->connectChanged(sigc::hide(sigc::mem_fun(this, &XmlTree::on_desktop_selection_changed))); document_replaced_connection = desktop->connectDocumentReplaced(sigc::mem_fun(this, &XmlTree::on_document_replaced)); - set_tree_document(sp_desktop_document(desktop)); + set_tree_document(desktop->getDocument()); } else { set_tree_document(NULL); } @@ -493,7 +493,7 @@ void XmlTree::set_dt_select(Inkscape::XML::Node *repr) repr = repr->parent(); } // end of while loop - object = sp_desktop_document(current_desktop)->getObjectByRepr(repr); + object = current_desktop->getDocument()->getObjectByRepr(repr); } else { object = NULL; } diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index 0649da3df..28a65e0b4 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -38,7 +38,7 @@ #include "path-prefix.h" #include "shortcuts.h" #include "document.h" -#include "desktop-handles.h" + #include "ui/interface.h" #include "desktop.h" #include "selection.h" @@ -1237,7 +1237,7 @@ sp_ui_drag_data_received(GtkWidget *widget, // move to mouse pointer { - sp_desktop_document(desktop)->ensureUpToDate(); + desktop->getDocument()->ensureUpToDate(); Geom::OptRect sel_bbox = selection->visualBounds(); if (sel_bbox) { Geom::Point m( desktop->point() - sel_bbox->midpoint() ); diff --git a/src/ui/object-edit.cpp b/src/ui/object-edit.cpp index ca550502d..fb99dfd59 100644 --- a/src/ui/object-edit.cpp +++ b/src/ui/object-edit.cpp @@ -28,7 +28,7 @@ #include "preferences.h" #include "style.h" #include "desktop.h" -#include "desktop-handles.h" + #include "sp-namedview.h" #include "live_effects/effect.h" #include "sp-pattern.h" diff --git a/src/ui/shape-editor.cpp b/src/ui/shape-editor.cpp index 0b9fc24c5..aec5cde27 100644 --- a/src/ui/shape-editor.cpp +++ b/src/ui/shape-editor.cpp @@ -14,7 +14,7 @@ #include <string.h> #include <glibmm/i18n.h> -#include "desktop-handles.h" +#include "desktop.h" #include "document.h" #include "gc-anchored.h" #include "knotholder.h" @@ -146,7 +146,7 @@ void ShapeEditor::set_item(SPItem *item, bool keep_knotholder) { void ShapeEditor::reset_item(bool keep_knotholder) { if (knotholder) { - SPObject *obj = sp_desktop_document(desktop)->getObjectByRepr(knotholder_listener_attached_for); /// note that it is not certain that this is an SPItem; it could be a LivePathEffectObject. + SPObject *obj = desktop->getDocument()->getObjectByRepr(knotholder_listener_attached_for); /// note that it is not certain that this is an SPItem; it could be a LivePathEffectObject. set_item(SP_ITEM(obj), keep_knotholder); } } diff --git a/src/ui/tool/control-point.cpp b/src/ui/tool/control-point.cpp index c1a76c715..bcf5c9fce 100644 --- a/src/ui/tool/control-point.cpp +++ b/src/ui/tool/control-point.cpp @@ -11,7 +11,7 @@ #include <gdkmm.h> #include <2geom/point.h> #include "desktop.h" -#include "desktop-handles.h" + #include "display/sp-canvas.h" #include "display/snap-indicator.h" #include "ui/tools/tool-base.h" diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp index d7b35c974..f53cef5f4 100644 --- a/src/ui/tool/multi-path-manipulator.cpp +++ b/src/ui/tool/multi-path-manipulator.cpp @@ -14,7 +14,7 @@ #include "node.h" #include <glibmm/i18n.h> #include "desktop.h" -#include "desktop-handles.h" + #include "document.h" #include "document-undo.h" #include "live_effects/lpeobject.h" @@ -820,9 +820,9 @@ void MultiPathManipulator::_commit(CommitEvent cps) _selection.signal_update.emit(); invokeForAll(&PathManipulator::writeXML); if (key) { - DocumentUndo::maybeDone(sp_desktop_document(_desktop), key, SP_VERB_CONTEXT_NODE, reason); + DocumentUndo::maybeDone(_desktop->getDocument(), key, SP_VERB_CONTEXT_NODE, reason); } else { - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_NODE, reason); + DocumentUndo::done(_desktop->getDocument(), SP_VERB_CONTEXT_NODE, reason); } signal_coords_changed.emit(); } @@ -831,7 +831,7 @@ void MultiPathManipulator::_commit(CommitEvent cps) void MultiPathManipulator::_done(gchar const *reason, bool alert_LPE) { invokeForAll(&PathManipulator::update, alert_LPE); invokeForAll(&PathManipulator::writeXML); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_NODE, reason); + DocumentUndo::done(_desktop->getDocument(), SP_VERB_CONTEXT_NODE, reason); signal_coords_changed.emit(); } diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 8c22f7c6e..eeea47e4d 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -17,7 +17,7 @@ #include "display/sp-canvas.h" #include "display/sp-canvas-util.h" #include "desktop.h" -#include "desktop-handles.h" + #include "preferences.h" #include "snap.h" #include "snap-preferences.h" diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 9108dff29..c8b986824 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -23,7 +23,7 @@ #include <glibmm/i18n.h> #include "ui/tool/path-manipulator.h" #include "desktop.h" -#include "desktop-handles.h" + #include "display/sp-canvas.h" #include "display/sp-canvas-util.h" #include "display/curve.h" @@ -1621,13 +1621,13 @@ void PathManipulator::_removeNodesFromSelection() void PathManipulator::_commit(Glib::ustring const &annotation) { writeXML(); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_NODE, annotation.data()); + DocumentUndo::done(_desktop->getDocument(), SP_VERB_CONTEXT_NODE, annotation.data()); } void PathManipulator::_commit(Glib::ustring const &annotation, gchar const *key) { writeXML(); - DocumentUndo::maybeDone(sp_desktop_document(_desktop), key, SP_VERB_CONTEXT_NODE, + DocumentUndo::maybeDone(_desktop->getDocument(), key, SP_VERB_CONTEXT_NODE, annotation.data()); } diff --git a/src/ui/tool/selector.cpp b/src/ui/tool/selector.cpp index fe541e823..e4e701785 100644 --- a/src/ui/tool/selector.cpp +++ b/src/ui/tool/selector.cpp @@ -11,7 +11,7 @@ #include "control-point.h" #include "desktop.h" -#include "desktop-handles.h" + #include "display/sodipodi-ctrlrect.h" #include "ui/tools/tool-base.h" #include "preferences.h" diff --git a/src/ui/tool/transform-handle-set.cpp b/src/ui/tool/transform-handle-set.cpp index 4b853d053..da2a54989 100644 --- a/src/ui/tool/transform-handle-set.cpp +++ b/src/ui/tool/transform-handle-set.cpp @@ -15,7 +15,7 @@ #include <glib/gi18n.h> #include <2geom/transforms.h> #include "desktop.h" -#include "desktop-handles.h" + #include "display/sodipodi-ctrlrect.h" #include "preferences.h" #include "snap.h" diff --git a/src/ui/tools-switch.cpp b/src/ui/tools-switch.cpp index 07d68471f..11313f550 100644 --- a/src/ui/tools-switch.cpp +++ b/src/ui/tools-switch.cpp @@ -18,7 +18,7 @@ #include "inkscape.h" #include "desktop.h" -#include "desktop-handles.h" + #include <glibmm/i18n.h> #include <xml/repr.h> diff --git a/src/ui/tools/arc-tool.cpp b/src/ui/tools/arc-tool.cpp index 5fe03cf8e..b9206407a 100644 --- a/src/ui/tools/arc-tool.cpp +++ b/src/ui/tools/arc-tool.cpp @@ -29,7 +29,7 @@ #include "document-undo.h" #include "sp-namedview.h" #include "selection.h" -#include "desktop-handles.h" + #include "snap.h" #include "pixmaps/cursor-ellipse.xpm" #include "xml/repr.h" @@ -444,7 +444,7 @@ void ArcTool::finishItem() { desktop->getSelection()->set(this->arc); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ARC, _("Create ellipse")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_ARC, _("Create ellipse")); this->arc = NULL; } @@ -466,7 +466,7 @@ void ArcTool::cancel() { desktop->canvas->endForcedFullRedraws(); - DocumentUndo::cancel(sp_desktop_document(desktop)); + DocumentUndo::cancel(desktop->getDocument()); } } diff --git a/src/ui/tools/box3d-tool.cpp b/src/ui/tools/box3d-tool.cpp index 20751381d..f8ae685c4 100644 --- a/src/ui/tools/box3d-tool.cpp +++ b/src/ui/tools/box3d-tool.cpp @@ -26,7 +26,7 @@ #include "sp-namedview.h" #include "selection.h" #include "selection-chemistry.h" -#include "desktop-handles.h" + #include "snap.h" #include "display/curve.h" #include "display/sp-canvas-item.h" @@ -155,7 +155,7 @@ void Box3dTool::setup() { sigc::mem_fun(this, &Box3dTool::selection_changed) ); - this->_vpdrag = new Box3D::VPDrag(sp_desktop_document(this->desktop)); + this->_vpdrag = new Box3D::VPDrag(this->desktop->getDocument()); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -195,7 +195,7 @@ bool Box3dTool::item_handler(SPItem* item, GdkEvent* event) { bool Box3dTool::root_handler(GdkEvent* event) { static bool dragging; - SPDocument *document = sp_desktop_document (desktop); + SPDocument *document = desktop->getDocument(); Inkscape::Selection *selection = desktop->getSelection(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int const snaps = prefs->getInt("/options/rotationsnapsperpi/value", 12); @@ -589,7 +589,7 @@ void Box3dTool::finishItem() { this->extruded = false; if (this->box3d != NULL) { - SPDocument *doc = sp_desktop_document(this->desktop); + SPDocument *doc = this->desktop->getDocument(); if (!doc || !doc->getCurrentPersp3D()) { return; @@ -605,7 +605,7 @@ void Box3dTool::finishItem() { desktop->canvas->endForcedFullRedraws(); desktop->getSelection()->set(this->box3d); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_3DBOX, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_3DBOX, _("Create 3D box")); this->box3d = NULL; diff --git a/src/ui/tools/calligraphic-tool.cpp b/src/ui/tools/calligraphic-tool.cpp index 36eccd93c..151ab5f89 100644 --- a/src/ui/tools/calligraphic-tool.cpp +++ b/src/ui/tools/calligraphic-tool.cpp @@ -47,7 +47,7 @@ #include "selection.h" #include "desktop.h" #include "desktop-events.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "message-context.h" #include "preferences.h" @@ -973,7 +973,7 @@ void CalligraphicTool::set_to_accumulated(bool unionize, bool subtract) { this->repr = NULL; } - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_CALLIGRAPHIC, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_CALLIGRAPHIC, _("Draw calligraphic stroke")); } diff --git a/src/ui/tools/connector-tool.cpp b/src/ui/tools/connector-tool.cpp index 3235d2356..26a4eadd5 100644 --- a/src/ui/tools/connector-tool.cpp +++ b/src/ui/tools/connector-tool.cpp @@ -79,7 +79,7 @@ #include "svg/svg.h" #include "desktop.h" #include "desktop-style.h" -#include "desktop-handles.h" + #include "document.h" #include "document-undo.h" #include "message-context.h" @@ -659,7 +659,7 @@ bool ConnectorTool::_handleButtonRelease(GdkEventButton const &revent) { bool ret = false; if ( revent.button == 1 && !this->space_panning ) { - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); SnapManager &m = desktop->namedview->snap_manager; Geom::Point const event_w(revent.x, revent.y); @@ -729,7 +729,7 @@ bool ConnectorTool::_handleKeyPress(guint const keyval) { break; case GDK_KEY_Escape: if (this->state == SP_CONNECTOR_CONTEXT_REROUTING) { - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); this->_reroutingFinish(NULL); @@ -754,7 +754,7 @@ bool ConnectorTool::_handleKeyPress(guint const keyval) { } void ConnectorTool::_reroutingFinish(Geom::Point *const p) { - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); // Clear the temporary path: this->red_curve->reset(); @@ -812,7 +812,7 @@ void ConnectorTool::_setSubsequentPoint(Geom::Point const p) { Avoid::Point dst(d[Geom::X], d[Geom::Y]); if (!this->newConnRef) { - Avoid::Router *router = sp_desktop_document(desktop)->router; + Avoid::Router *router = desktop->getDocument()->router; this->newConnRef = new Avoid::ConnRef(router); this->newConnRef->setEndpoint(Avoid::VertID::src, src); if (this->isOrthogonal) @@ -876,7 +876,7 @@ void ConnectorTool::_flushWhite(SPCurve *gc) { /* Now we have to go back to item coordinates at last */ c->transform(this->desktop->dt2doc()); - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); if ( c && !c->is_empty() ) { @@ -1309,7 +1309,7 @@ void cc_selection_set_avoid(bool const set_avoid) return; } - SPDocument *document = sp_desktop_document(desktop); + SPDocument *document = desktop->getDocument(); Inkscape::Selection *selection = desktop->getSelection(); diff --git a/src/ui/tools/dropper-tool.cpp b/src/ui/tools/dropper-tool.cpp index d9a906cb8..178e6636e 100644 --- a/src/ui/tools/dropper-tool.cpp +++ b/src/ui/tools/dropper-tool.cpp @@ -34,7 +34,7 @@ #include "sp-namedview.h" #include "sp-cursor.h" #include "desktop.h" -#include "desktop-handles.h" + #include "selection.h" #include "document.h" #include "document-undo.h" @@ -329,7 +329,7 @@ bool DropperTool::root_handler(GdkEvent* event) { } if (!(desktop->getSelection()->isEmpty())) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_DROPPER, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_DROPPER, _("Set picked color")); } diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index 2d86915c2..1b4dcfe25 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -44,7 +44,7 @@ #include "selection.h" #include "desktop.h" #include "desktop-events.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "message-context.h" #include "preferences.h" @@ -680,10 +680,10 @@ void EraserTool::set_to_accumulated() { if (selection->isEmpty()) { if ( eraserMode ) { - toWorkOn = sp_desktop_document(desktop)->getItemsPartiallyInBox(desktop->dkey, bounds); + toWorkOn = desktop->getDocument()->getItemsPartiallyInBox(desktop->dkey, bounds); } else { Inkscape::Rubberband *r = Inkscape::Rubberband::get(desktop); - toWorkOn = sp_desktop_document(desktop)->getItemsAtPoints(desktop->dkey, r->getPoints()); + toWorkOn = desktop->getDocument()->getItemsAtPoints(desktop->dkey, r->getPoints()); } toWorkOn = g_slist_remove( toWorkOn, acid ); @@ -767,9 +767,9 @@ void EraserTool::set_to_accumulated() { if ( workDone ) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ERASER, _("Draw eraser stroke")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_ERASER, _("Draw eraser stroke")); } else { - DocumentUndo::cancel(sp_desktop_document(desktop)); + DocumentUndo::cancel(desktop->getDocument()); } } diff --git a/src/ui/tools/flood-tool.cpp b/src/ui/tools/flood-tool.cpp index b6808fbc2..82057f483 100644 --- a/src/ui/tools/flood-tool.cpp +++ b/src/ui/tools/flood-tool.cpp @@ -31,7 +31,7 @@ #include "color.h" #include "context-fns.h" #include "desktop.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "display/cairo-utils.h" #include "display/drawing-context.h" @@ -360,7 +360,7 @@ inline static bool check_if_pixel_is_paintable(guchar *px, unsigned char *trace_ * @param union_with_selection If true, merge the final SVG path with the current selection. */ static void do_trace(bitmap_coords_info bci, guchar *trace_px, SPDesktop *desktop, Geom::Affine transform, unsigned int min_x, unsigned int max_x, unsigned int min_y, unsigned int max_y, bool union_with_selection) { - SPDocument *document = sp_desktop_document(desktop); + SPDocument *document = desktop->getDocument(); unsigned char *trace_t; @@ -740,7 +740,7 @@ static bool sort_fill_queue_horizontal(Geom::Point a, Geom::Point b) { */ static void sp_flood_do_flood_fill(ToolBase *event_context, GdkEvent *event, bool union_with_selection, bool is_point_fill, bool is_touch_fill) { SPDesktop *desktop = event_context->desktop; - SPDocument *document = sp_desktop_document(desktop); + SPDocument *document = desktop->getDocument(); document->ensureUpToDate(); @@ -1096,7 +1096,7 @@ bool FloodTool::item_handler(SPItem* item, GdkEvent* event) { // Set style desktop->applyCurrentOrToolStyle(item, "/tools/paintbucket", false); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_PAINTBUCKET, _("Set style on object")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_PAINTBUCKET, _("Set style on object")); ret = TRUE; } @@ -1231,7 +1231,7 @@ void FloodTool::finishItem() { desktop->getSelection()->set(this->item); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_PAINTBUCKET, _("Fill bounded area")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_PAINTBUCKET, _("Fill bounded area")); this->item = NULL; } diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index 14d9b8815..c9fe37135 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -27,7 +27,7 @@ #include <glibmm/i18n.h> #include "display/curve.h" #include "desktop.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "document.h" #include "ui/draw-anchor.h" @@ -667,7 +667,7 @@ static void spdc_flush_white(FreehandBase *dc, SPCurve *gc) : dc->desktop->dt2doc() ); SPDesktop *desktop = dc->desktop; - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); if ( c && !c->is_empty() ) { @@ -865,7 +865,7 @@ void spdc_create_single_dot(ToolBase *ec, Geom::Point const &pt, char const *too desktop->getSelection()->set(item); desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Creating single dot")); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE, _("Create single dot")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_NONE, _("Create single dot")); } } diff --git a/src/ui/tools/gradient-tool.cpp b/src/ui/tools/gradient-tool.cpp index b674b6a8a..5da30da7b 100644 --- a/src/ui/tools/gradient-tool.cpp +++ b/src/ui/tools/gradient-tool.cpp @@ -23,7 +23,7 @@ #include "document.h" #include "selection.h" #include "desktop.h" -#include "desktop-handles.h" + #include "message-context.h" #include "message-stack.h" #include "pixmaps/cursor-gradient.xpm" @@ -464,7 +464,7 @@ sp_gradient_context_add_stop_near_point (GradientTool *rc, SPItem *item, Geom:: SPStop *newstop = ec->get_drag()->addStopNearPoint (item, mouse_p, tolerance/desktop->current_zoom()); - DocumentUndo::done(sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_GRADIENT, _("Add gradient stop")); ec->get_drag()->updateDraggers(); @@ -509,13 +509,13 @@ bool GradientTool::root_handler(GdkEvent* event) { SPGradientType new_type = (SPGradientType) prefs->getInt("/tools/gradient/newgradient", SP_GRADIENT_TYPE_LINEAR); Inkscape::PaintTarget fsmode = (prefs->getInt("/tools/gradient/newfillorstroke", 1) != 0) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE; - SPGradient *vector = sp_gradient_vector_for_object(sp_desktop_document(desktop), desktop, item, fsmode); + SPGradient *vector = sp_gradient_vector_for_object(desktop->getDocument(), desktop, item, fsmode); SPGradient *priv = sp_item_set_gradient(item, vector, new_type, fsmode); sp_gradient_reset_to_userspace(priv, item); } - DocumentUndo::done(sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_GRADIENT, _("Create default gradient")); } ret = TRUE; @@ -893,7 +893,7 @@ static void sp_gradient_drag(GradientTool &rc, Geom::Point const pt, guint /*sta { SPDesktop *desktop = SP_EVENT_CONTEXT(&rc)->desktop; Inkscape::Selection *selection = desktop->getSelection(); - SPDocument *document = sp_desktop_document(desktop); + SPDocument *document = desktop->getDocument(); ToolBase *ec = SP_EVENT_CONTEXT(&rc); if (!selection->isEmpty()) { diff --git a/src/ui/tools/lpe-tool.cpp b/src/ui/tools/lpe-tool.cpp index 265c20ec8..c9b656397 100644 --- a/src/ui/tools/lpe-tool.cpp +++ b/src/ui/tools/lpe-tool.cpp @@ -30,7 +30,7 @@ #include "preferences.h" #include "ui/shape-editor.h" #include "selection.h" -#include "desktop-handles.h" + #include "document.h" #include "display/curve.h" #include "display/canvas-bpath.h" @@ -310,7 +310,7 @@ lpetool_try_construction(LpeTool *lc, Inkscape::LivePathEffect::EffectType const // TODO: should we check whether type represents a valid geometric construction? if (item && SP_IS_LPE_ITEM(item) && Inkscape::LivePathEffect::Effect::acceptsNumClicks(type) == 0) { - Inkscape::LivePathEffect::Effect::createAndApply(type, sp_desktop_document(lc->desktop), item); + Inkscape::LivePathEffect::Effect::createAndApply(type, lc->desktop->getDocument(), item); return true; } return false; @@ -360,7 +360,7 @@ lpetool_context_reset_limiting_bbox(LpeTool *lc) if (!prefs->getBool("/tools/lpetool/show_bbox", true)) return; - SPDocument *document = sp_desktop_document(lc->desktop); + SPDocument *document = lc->desktop->getDocument(); Geom::Point A, B; lpetool_get_limiting_bbox_corners(document, A, B); diff --git a/src/ui/tools/measure-tool.cpp b/src/ui/tools/measure-tool.cpp index 6fa409ada..b7e54b9c8 100644 --- a/src/ui/tools/measure-tool.cpp +++ b/src/ui/tools/measure-tool.cpp @@ -29,7 +29,7 @@ #include "pixmaps/cursor-measure.xpm" #include "preferences.h" #include "inkscape.h" -#include "desktop-handles.h" + #include "ui/tools/measure-tool.h" #include "ui/tools/freehand-base.h" #include "display/canvas-text.h" @@ -291,7 +291,7 @@ static void calculate_intersections(SPDesktop * /*desktop*/, SPItem* item, Geom: //TODO: consider only visible intersections Geom::Point intersection = lineseg[0].pointAt((*m).ta); double eps = 0.0001; - SPDocument* doc = sp_desktop_document(desktop); + SPDocument* doc = desktop->getDocument(); if (((*m).ta > eps && item == doc->getItemAtPoint(desktop->dkey, lineseg[0].pointAt((*m).ta - eps), false, NULL)) || ((*m).ta + eps < 1 && @@ -441,7 +441,7 @@ bool MeasureTool::root_handler(GdkEvent* event) { // TODO switch to a different variable name. The single letter 'l' is easy to misread. //select elements crossed by line segment: - GSList *items = sp_desktop_document(desktop)->getItemsAtPoints(desktop->dkey, points); + GSList *items = desktop->getDocument()->getItemsAtPoints(desktop->dkey, points); std::vector<double> intersection_times; for (GSList *l = items; l != NULL; l = l->next) { SPItem *item = static_cast<SPItem*>(l->data); diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index d512fadb5..d333b932e 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -27,7 +27,7 @@ // General #include "desktop.h" -#include "desktop-handles.h" + #include "document.h" #include "document-undo.h" #include "macros.h" @@ -317,7 +317,7 @@ static void sp_mesh_context_split_near_point(MeshTool *rc, SPItem *item, Geom:: ec->get_drag()->addStopNearPoint (item, mouse_p, tolerance/desktop->current_zoom()); - DocumentUndo::done(sp_desktop_document (desktop), SP_VERB_CONTEXT_MESH, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_MESH, _("Split mesh row/column")); ec->get_drag()->updateDraggers(); @@ -488,13 +488,13 @@ bool MeshTool::root_handler(GdkEvent* event) { #ifdef DEBUG_MESH std::cout << "sp_mesh_context_root_handler: creating new mesh on: " << (fsmode == Inkscape::FOR_FILL ? "Fill" : "Stroke") << std::endl; #endif - SPGradient *vector = sp_gradient_vector_for_object(sp_desktop_document(desktop), desktop, item, fsmode); + SPGradient *vector = sp_gradient_vector_for_object(desktop->getDocument(), desktop, item, fsmode); SPGradient *priv = sp_item_set_gradient(item, vector, new_type, fsmode); sp_gradient_reset_to_userspace(priv, item); } - DocumentUndo::done(sp_desktop_document (desktop), SP_VERB_CONTEXT_MESH, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_MESH, _("Create default mesh")); } @@ -934,7 +934,7 @@ bool MeshTool::root_handler(GdkEvent* event) { static void sp_mesh_drag(MeshTool &rc, Geom::Point const /*pt*/, guint /*state*/, guint32 /*etime*/) { SPDesktop *desktop = SP_EVENT_CONTEXT(&rc)->desktop; Inkscape::Selection *selection = desktop->getSelection(); - SPDocument *document = sp_desktop_document(desktop); + SPDocument *document = desktop->getDocument(); ToolBase *ec = SP_EVENT_CONTEXT(&rc); if (!selection->isEmpty()) { diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index a5d0df327..caec901a6 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -13,7 +13,7 @@ #include "ui/tool/curve-drag-point.h" #include <glib/gi18n.h> #include "desktop.h" -#include "desktop-handles.h" + #include "display/sp-canvas-group.h" #include "display/canvas-bpath.h" #include "display/curve.h" @@ -668,7 +668,7 @@ void NodeTool::select_area(Geom::Rect const &sel, GdkEventButton *event) { if (this->_multipath->empty()) { // if multipath is empty, select rubberbanded items rather than nodes Inkscape::Selection *selection = this->desktop->selection; - GSList *items = sp_desktop_document(this->desktop)->getItemsInBox(this->desktop->dkey, sel); + GSList *items = this->desktop->getDocument()->getItemsInBox(this->desktop->dkey, sel); selection->setList(items); g_slist_free(items); } else { diff --git a/src/ui/tools/node-tool.h b/src/ui/tools/node-tool.h index ab72f3632..20375e869 100644 --- a/src/ui/tools/node-tool.h +++ b/src/ui/tools/node-tool.h @@ -33,6 +33,8 @@ namespace Inkscape { } } +struct SPCanvasGroup; + #define INK_NODE_TOOL(obj) (dynamic_cast<Inkscape::UI::Tools::NodeTool*>((Inkscape::UI::Tools::ToolBase*)obj)) #define INK_IS_NODE_TOOL(obj) (dynamic_cast<const Inkscape::UI::Tools::NodeTool*>((const Inkscape::UI::Tools::ToolBase*)obj)) diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index adb5c2866..4587e88c8 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -23,7 +23,7 @@ #include "ui/tools/pen-tool.h" #include "sp-namedview.h" #include "desktop.h" -#include "desktop-handles.h" + #include "selection.h" #include "selection-chemistry.h" #include "ui/draw-anchor.h" diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp index ecb3ca12a..28fed3a8f 100644 --- a/src/ui/tools/pencil-tool.cpp +++ b/src/ui/tools/pencil-tool.cpp @@ -20,7 +20,7 @@ #include "ui/tools/pencil-tool.h" #include "desktop.h" -#include "desktop-handles.h" + #include "selection.h" #include "selection-chemistry.h" #include "ui/draw-anchor.h" diff --git a/src/ui/tools/rect-tool.cpp b/src/ui/tools/rect-tool.cpp index 69dfad025..9476ff624 100644 --- a/src/ui/tools/rect-tool.cpp +++ b/src/ui/tools/rect-tool.cpp @@ -28,7 +28,7 @@ #include "sp-namedview.h" #include "selection.h" #include "selection-chemistry.h" -#include "desktop-handles.h" + #include "snap.h" #include "desktop.h" #include "desktop-style.h" @@ -478,7 +478,7 @@ void RectTool::finishItem() { this->desktop->getSelection()->set(this->rect); - DocumentUndo::done(sp_desktop_document(this->desktop), SP_VERB_CONTEXT_RECT, _("Create rectangle")); + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_RECT, _("Create rectangle")); this->rect = NULL; } @@ -500,7 +500,7 @@ void RectTool::cancel(){ this->desktop->canvas->endForcedFullRedraws(); - DocumentUndo::cancel(sp_desktop_document(this->desktop)); + DocumentUndo::cancel(this->desktop->getDocument()); } } diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index bdde76c31..939b1a0b3 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -38,7 +38,7 @@ #include "extension/dbus/document-interface.h" #endif #include "desktop.h" -#include "desktop-handles.h" + #include "sp-root.h" #include "preferences.h" #include "ui/tools-switch.h" @@ -208,7 +208,7 @@ bool SelectTool::sp_select_context_abort() { if (this->item) { // only undo if the item is still valid if (this->item->document) { - DocumentUndo::undo(sp_desktop_document(desktop)); + DocumentUndo::undo(desktop->getDocument()); } sp_object_unref( this->item, NULL); @@ -216,7 +216,7 @@ bool SelectTool::sp_select_context_abort() { // NOTE: This is a workaround to a bug. // When the ctrl key is held, sc->item is not defined // so in this case (only), we skip the object doc check - DocumentUndo::undo(sp_desktop_document(desktop)); + DocumentUndo::undo(desktop->getDocument()); } this->item = NULL; @@ -722,9 +722,9 @@ bool SelectTool::root_handler(GdkEvent* event) { if (r->getMode() == RUBBERBAND_MODE_RECT) { Geom::OptRect const b = r->getRectangle(); - items = sp_desktop_document(desktop)->getItemsInBox(desktop->dkey, *b); + items = desktop->getDocument()->getItemsInBox(desktop->dkey, *b); } else if (r->getMode() == RUBBERBAND_MODE_TOUCHPATH) { - items = sp_desktop_document(desktop)->getItemsAtPoints(desktop->dkey, r->getPoints()); + items = desktop->getDocument()->getItemsAtPoints(desktop->dkey, r->getPoints()); } _seltrans->resetState(); diff --git a/src/ui/tools/spiral-tool.cpp b/src/ui/tools/spiral-tool.cpp index 7b11b8469..f208e1c43 100644 --- a/src/ui/tools/spiral-tool.cpp +++ b/src/ui/tools/spiral-tool.cpp @@ -27,7 +27,7 @@ #include "document-undo.h" #include "sp-namedview.h" #include "selection.h" -#include "desktop-handles.h" + #include "snap.h" #include "desktop.h" #include "desktop-style.h" @@ -418,7 +418,7 @@ void SpiralTool::finishItem() { this->desktop->canvas->endForcedFullRedraws(); this->desktop->getSelection()->set(this->spiral); - DocumentUndo::done(sp_desktop_document(this->desktop), SP_VERB_CONTEXT_SPIRAL, _("Create spiral")); + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_SPIRAL, _("Create spiral")); this->spiral = NULL; } @@ -440,7 +440,7 @@ void SpiralTool::cancel() { this->desktop->canvas->endForcedFullRedraws(); - DocumentUndo::cancel(sp_desktop_document(this->desktop)); + DocumentUndo::cancel(this->desktop->getDocument()); } } diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp index 39c146351..a01c5c55b 100644 --- a/src/ui/tools/spray-tool.cpp +++ b/src/ui/tools/spray-tool.cpp @@ -33,7 +33,7 @@ #include "selection.h" #include "desktop.h" #include "desktop-events.h" -#include "desktop-handles.h" + #include "message-context.h" #include "pixmaps/cursor-spray.xpm" #include <boost/optional.hpp> @@ -735,15 +735,15 @@ bool SprayTool::root_handler(GdkEvent* event) { this->has_dilated = false; switch (this->mode) { case SPRAY_MODE_COPY: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_SPRAY, _("Spray with copies")); break; case SPRAY_MODE_CLONE: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_SPRAY, _("Spray with clones")); break; case SPRAY_MODE_SINGLE_PATH: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_SPRAY, _("Spray in single path")); break; } diff --git a/src/ui/tools/star-tool.cpp b/src/ui/tools/star-tool.cpp index a5e46e5b7..df311f2d8 100644 --- a/src/ui/tools/star-tool.cpp +++ b/src/ui/tools/star-tool.cpp @@ -30,7 +30,7 @@ #include "document-undo.h" #include "sp-namedview.h" #include "selection.h" -#include "desktop-handles.h" + #include "snap.h" #include "desktop.h" #include "desktop-style.h" @@ -442,7 +442,7 @@ void StarTool::finishItem() { desktop->canvas->endForcedFullRedraws(); desktop->getSelection()->set(this->star); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_STAR, _("Create star")); this->star = NULL; @@ -465,7 +465,7 @@ void StarTool::cancel() { desktop->canvas->endForcedFullRedraws(); - DocumentUndo::cancel(sp_desktop_document(desktop)); + DocumentUndo::cancel(desktop->getDocument()); } } diff --git a/src/ui/tools/text-tool.cpp b/src/ui/tools/text-tool.cpp index e6dde0581..df0583d67 100644 --- a/src/ui/tools/text-tool.cpp +++ b/src/ui/tools/text-tool.cpp @@ -26,7 +26,7 @@ #include <sstream> #include "context-fns.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "desktop.h" #include "document.h" @@ -431,7 +431,7 @@ static void sp_text_context_setup_text(TextTool *tc) text_item->updateRepr(); text_item->doWriteTransform(text_item->getRepr(), text_item->transform, NULL, true); - DocumentUndo::done(sp_desktop_document(ec->desktop), SP_VERB_CONTEXT_TEXT, + DocumentUndo::done(ec->desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Create text")); } @@ -471,7 +471,7 @@ static void insert_uni_char(TextTool *const tc) tc->text_sel_start = tc->text_sel_end = sp_te_replace(tc->text, tc->text_sel_start, tc->text_sel_end, u); sp_text_context_update_cursor(tc); sp_text_context_update_text_selection(tc); - DocumentUndo::done(sp_desktop_document(tc->desktop), SP_VERB_DIALOG_TRANSFORM, + DocumentUndo::done(tc->desktop->getDocument(), SP_VERB_DIALOG_TRANSFORM, _("Insert Unicode character")); } } @@ -662,7 +662,7 @@ bool TextTool::root_handler(GdkEvent* event) { sp_desktop_apply_style_tool(desktop, ft->getRepr(), "/tools/text", true); desktop->getSelection()->set(ft); desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Flowed text is created.")); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Create flowed text")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Create flowed text")); } else { desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("The frame is <b>too small</b> for the current font size. Flowed text not created.")); } @@ -801,7 +801,7 @@ bool TextTool::root_handler(GdkEvent* event) { sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("No-break space")); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Insert no-break space")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Insert no-break space")); return TRUE; } break; @@ -837,7 +837,7 @@ bool TextTool::root_handler(GdkEvent* event) { sp_repr_css_set_property(css, "font-weight", "normal"); sp_te_apply_style(this->text, this->text_sel_start, this->text_sel_end, css); sp_repr_css_attr_unref(css); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Make bold")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Make bold")); sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); return TRUE; @@ -854,7 +854,7 @@ bool TextTool::root_handler(GdkEvent* event) { sp_repr_css_set_property(css, "font-style", "italic"); sp_te_apply_style(this->text, this->text_sel_start, this->text_sel_end, css); sp_repr_css_attr_unref(css); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Make italic")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Make italic")); sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); return TRUE; @@ -892,7 +892,7 @@ bool TextTool::root_handler(GdkEvent* event) { sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("New line")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("New line")); return TRUE; } case GDK_KEY_BackSpace: @@ -933,7 +933,7 @@ bool TextTool::root_handler(GdkEvent* event) { sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Backspace")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Backspace")); } return TRUE; case GDK_KEY_Delete: @@ -971,7 +971,7 @@ bool TextTool::root_handler(GdkEvent* event) { sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Delete")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Delete")); } return TRUE; case GDK_KEY_Left: @@ -987,7 +987,7 @@ bool TextTool::root_handler(GdkEvent* event) { sp_te_adjust_kerning_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, Geom::Point(mul*-1, 0)); sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); - DocumentUndo::maybeDone(sp_desktop_document(desktop), "kern:left", SP_VERB_CONTEXT_TEXT, _("Kern to the left")); + DocumentUndo::maybeDone(desktop->getDocument(), "kern:left", SP_VERB_CONTEXT_TEXT, _("Kern to the left")); } else { if (MOD__CTRL(event)) this->text_sel_end.cursorLeftWithControl(); @@ -1011,7 +1011,7 @@ bool TextTool::root_handler(GdkEvent* event) { sp_te_adjust_kerning_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, Geom::Point(mul*1, 0)); sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); - DocumentUndo::maybeDone(sp_desktop_document(desktop), "kern:right", SP_VERB_CONTEXT_TEXT, _("Kern to the right")); + DocumentUndo::maybeDone(desktop->getDocument(), "kern:right", SP_VERB_CONTEXT_TEXT, _("Kern to the right")); } else { if (MOD__CTRL(event)) this->text_sel_end.cursorRightWithControl(); @@ -1035,7 +1035,7 @@ bool TextTool::root_handler(GdkEvent* event) { sp_te_adjust_kerning_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, Geom::Point(0, mul*-1)); sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); - DocumentUndo::maybeDone(sp_desktop_document(desktop), "kern:up", SP_VERB_CONTEXT_TEXT, _("Kern up")); + DocumentUndo::maybeDone(desktop->getDocument(), "kern:up", SP_VERB_CONTEXT_TEXT, _("Kern up")); } else { if (MOD__CTRL(event)) this->text_sel_end.cursorUpWithControl(); @@ -1059,7 +1059,7 @@ bool TextTool::root_handler(GdkEvent* event) { sp_te_adjust_kerning_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, Geom::Point(0, mul*1)); sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); - DocumentUndo::maybeDone(sp_desktop_document(desktop), "kern:down", SP_VERB_CONTEXT_TEXT, _("Kern down")); + DocumentUndo::maybeDone(desktop->getDocument(), "kern:down", SP_VERB_CONTEXT_TEXT, _("Kern down")); } else { if (MOD__CTRL(event)) this->text_sel_end.cursorDownWithControl(); @@ -1134,7 +1134,7 @@ bool TextTool::root_handler(GdkEvent* event) { } else { sp_te_adjust_rotation(this->text, this->text_sel_start, this->text_sel_end, desktop, -90); } - DocumentUndo::maybeDone(sp_desktop_document(desktop), "textrot:ccw", SP_VERB_CONTEXT_TEXT, _("Rotate counterclockwise")); + DocumentUndo::maybeDone(desktop->getDocument(), "textrot:ccw", SP_VERB_CONTEXT_TEXT, _("Rotate counterclockwise")); sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); return TRUE; @@ -1154,7 +1154,7 @@ bool TextTool::root_handler(GdkEvent* event) { } else { sp_te_adjust_rotation(this->text, this->text_sel_start, this->text_sel_end, desktop, 90); } - DocumentUndo::maybeDone(sp_desktop_document(desktop), "textrot:cw", SP_VERB_CONTEXT_TEXT, _("Rotate clockwise")); + DocumentUndo::maybeDone(desktop->getDocument(), "textrot:cw", SP_VERB_CONTEXT_TEXT, _("Rotate clockwise")); sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); return TRUE; @@ -1170,13 +1170,13 @@ bool TextTool::root_handler(GdkEvent* event) { sp_te_adjust_linespacing_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, -10); else sp_te_adjust_linespacing_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, -1); - DocumentUndo::maybeDone(sp_desktop_document(desktop), "linespacing:dec", SP_VERB_CONTEXT_TEXT, _("Contract line spacing")); + DocumentUndo::maybeDone(desktop->getDocument(), "linespacing:dec", SP_VERB_CONTEXT_TEXT, _("Contract line spacing")); } else { if (MOD__SHIFT(event)) sp_te_adjust_tspan_letterspacing_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, -10); else sp_te_adjust_tspan_letterspacing_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, -1); - DocumentUndo::maybeDone(sp_desktop_document(desktop), "letterspacing:dec", SP_VERB_CONTEXT_TEXT, _("Contract letter spacing")); + DocumentUndo::maybeDone(desktop->getDocument(), "letterspacing:dec", SP_VERB_CONTEXT_TEXT, _("Contract letter spacing")); } sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); @@ -1193,13 +1193,13 @@ bool TextTool::root_handler(GdkEvent* event) { sp_te_adjust_linespacing_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, 10); else sp_te_adjust_linespacing_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, 1); - DocumentUndo::maybeDone(sp_desktop_document(desktop), "linespacing:inc", SP_VERB_CONTEXT_TEXT, _("Expand line spacing")); + DocumentUndo::maybeDone(desktop->getDocument(), "linespacing:inc", SP_VERB_CONTEXT_TEXT, _("Expand line spacing")); } else { if (MOD__SHIFT(event)) sp_te_adjust_tspan_letterspacing_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, 10); else sp_te_adjust_tspan_letterspacing_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, 1); - DocumentUndo::maybeDone(sp_desktop_document(desktop), "letterspacing:inc", SP_VERB_CONTEXT_TEXT, _("Expand letter spacing"));\ + DocumentUndo::maybeDone(desktop->getDocument(), "letterspacing:inc", SP_VERB_CONTEXT_TEXT, _("Expand letter spacing"));\ } sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); @@ -1328,7 +1328,7 @@ bool sp_text_paste_inline(ToolBase *ec) tc->text_sel_start = tc->text_sel_end = sp_te_insert_line(tc->text, tc->text_sel_start); begin = end + 1; } - DocumentUndo::done(sp_desktop_document(ec->desktop), SP_VERB_CONTEXT_TEXT, + DocumentUndo::done(ec->desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Paste text")); return true; @@ -1451,7 +1451,7 @@ bool TextTool::_styleSet(SPCSSAttr const *css) return false; // will get picked up by the parent and applied to the whole text object sp_te_apply_style(this->text, this->text_sel_start, this->text_sel_end, css); - DocumentUndo::done(sp_desktop_document(this->desktop), SP_VERB_CONTEXT_TEXT, + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Set text style")); sp_text_context_update_cursor(this); sp_text_context_update_text_selection(this); @@ -1661,7 +1661,7 @@ static void sp_text_context_forget_text(TextTool *tc) // the XML editor if ( text_repr && text_repr->parent() ) { sp_repr_unparent(text_repr); - SPDocumentUndo::done(sp_desktop_document(tc->desktop), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done(tc->desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Remove empty text")); } } diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index 8ce78b2d9..a07f2fb86 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -39,7 +39,7 @@ #include "xml/node-event-vector.h" #include "sp-cursor.h" #include "desktop.h" -#include "desktop-handles.h" + #include "desktop-events.h" #include "desktop-style.h" #include "sp-namedview.h" diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp index 2b77c9d7a..5e53fdb93 100644 --- a/src/ui/tools/tweak-tool.cpp +++ b/src/ui/tools/tweak-tool.cpp @@ -28,7 +28,7 @@ #include "selection.h" #include "desktop.h" #include "desktop-events.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "message-context.h" #include "pixmaps/cursor-tweak-move.xpm" @@ -1235,55 +1235,55 @@ bool TweakTool::root_handler(GdkEvent* event) { this->has_dilated = false; switch (this->mode) { case TWEAK_MODE_MOVE: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TWEAK, _("Move tweak")); break; case TWEAK_MODE_MOVE_IN_OUT: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TWEAK, _("Move in/out tweak")); break; case TWEAK_MODE_MOVE_JITTER: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TWEAK, _("Move jitter tweak")); break; case TWEAK_MODE_SCALE: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TWEAK, _("Scale tweak")); break; case TWEAK_MODE_ROTATE: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TWEAK, _("Rotate tweak")); break; case TWEAK_MODE_MORELESS: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TWEAK, _("Duplicate/delete tweak")); break; case TWEAK_MODE_PUSH: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TWEAK, _("Push path tweak")); break; case TWEAK_MODE_SHRINK_GROW: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TWEAK, _("Shrink/grow path tweak")); break; case TWEAK_MODE_ATTRACT_REPEL: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TWEAK, _("Attract/repel path tweak")); break; case TWEAK_MODE_ROUGHEN: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TWEAK, _("Roughen path tweak")); break; case TWEAK_MODE_COLORPAINT: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TWEAK, _("Color paint tweak")); break; case TWEAK_MODE_COLORJITTER: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TWEAK, _("Color jitter tweak")); break; case TWEAK_MODE_BLUR: - DocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(this)->desktop), + DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_TWEAK, _("Blur tweak")); break; } diff --git a/src/ui/widget/color-picker.cpp b/src/ui/widget/color-picker.cpp index 6b5a351f6..d4c4d394e 100644 --- a/src/ui/widget/color-picker.cpp +++ b/src/ui/widget/color-picker.cpp @@ -12,7 +12,7 @@ #include "color-picker.h" #include "inkscape.h" -#include "desktop-handles.h" +#include "desktop.h" #include "document.h" #include "document-undo.h" #include "ui/dialog-events.h" @@ -128,7 +128,7 @@ void sp_color_picker_color_mod(SPColorSelector *csel, GObject *cp) (ptr->_preview).setRgba32 (rgba); if (ptr->_undo && SP_ACTIVE_DESKTOP) - DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_NONE, + DocumentUndo::done(SP_ACTIVE_DESKTOP->getDocument(), SP_VERB_NONE, /* TODO: annotate */ "color-picker.cpp:130"); ptr->on_changed (rgba); diff --git a/src/ui/widget/filter-effect-chooser.cpp b/src/ui/widget/filter-effect-chooser.cpp index 4754b9c23..242a99073 100644 --- a/src/ui/widget/filter-effect-chooser.cpp +++ b/src/ui/widget/filter-effect-chooser.cpp @@ -13,7 +13,7 @@ #include <glibmm/i18n.h> #include "desktop.h" -#include "desktop-handles.h" + #include "document.h" #include "inkscape.h" diff --git a/src/ui/widget/layer-selector.cpp b/src/ui/widget/layer-selector.cpp index 7b1a8dbfb..dc89d233f 100644 --- a/src/ui/widget/layer-selector.cpp +++ b/src/ui/widget/layer-selector.cpp @@ -21,7 +21,7 @@ #include <glibmm/i18n.h> #include "desktop.h" -#include "desktop-handles.h" + #include "document.h" #include "document-undo.h" #include "layer-manager.h" @@ -601,7 +601,7 @@ void LayerSelector::_prepareLabelRenderer( void LayerSelector::_lockLayer(bool lock) { if ( _layer && SP_IS_ITEM(_layer) ) { SP_ITEM(_layer)->setLocked(lock); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_NONE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_NONE, lock? _("Lock layer") : _("Unlock layer")); } } @@ -609,7 +609,7 @@ void LayerSelector::_lockLayer(bool lock) { void LayerSelector::_hideLayer(bool hide) { if ( _layer && SP_IS_ITEM(_layer) ) { SP_ITEM(_layer)->setHidden(hide); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_NONE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_NONE, hide? _("Hide layer") : _("Unhide layer")); } } diff --git a/src/ui/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp index b4cfa3231..7439a402c 100644 --- a/src/ui/widget/object-composite-settings.cpp +++ b/src/ui/widget/object-composite-settings.cpp @@ -17,7 +17,7 @@ #include <glibmm/i18n.h> #include "desktop.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "document.h" #include "document-undo.h" @@ -104,7 +104,7 @@ ObjectCompositeSettings::_blendBlurValueChanged() if (!desktop) { return; } - SPDocument *document = sp_desktop_document (desktop); + SPDocument *document = desktop->getDocument(); if (_blocked) return; @@ -195,7 +195,7 @@ ObjectCompositeSettings::_opacityValueChanged() sp_repr_css_attr_unref (css); - DocumentUndo::maybeDone(sp_desktop_document (desktop), _opacity_tag.c_str(), _verb_code, + DocumentUndo::maybeDone(desktop->getDocument(), _opacity_tag.c_str(), _verb_code, _("Change opacity")); // resume interruptibility @@ -219,7 +219,7 @@ ObjectCompositeSettings::_subjectChanged() { return; _blocked = true; - SPStyle *query = sp_style_new (sp_desktop_document(desktop)); + SPStyle *query = sp_style_new (desktop->getDocument()); int result = _subject->queryStyle(query, QUERY_STYLE_PROPERTY_MASTEROPACITY); switch (result) { diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index fb7f5abd7..d36c11ace 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -32,7 +32,7 @@ #include <2geom/transforms.h> -#include "desktop-handles.h" + #include "document.h" #include "desktop.h" #include "helper/action.h" @@ -477,7 +477,7 @@ PageSizer::setDim (Inkscape::Util::Quantity w, Inkscape::Util::Quantity h, bool _unit = w.unit->abbr; if (SP_ACTIVE_DESKTOP && !_widgetRegistry->isUpdating()) { - SPDocument *doc = sp_desktop_document(SP_ACTIVE_DESKTOP); + SPDocument *doc = SP_ACTIVE_DESKTOP->getDocument(); Inkscape::Util::Quantity const old_height = doc->getHeight(); doc->setWidth (w, changeSize); doc->setHeight (h, changeSize); @@ -608,7 +608,7 @@ PageSizer::fire_fit_canvas_to_selection_or_drawing() SPNamedView *nv; Inkscape::XML::Node *nv_repr; - if ((doc = sp_desktop_document(SP_ACTIVE_DESKTOP)) + if ((doc = SP_ACTIVE_DESKTOP->getDocument()) && (nv = sp_document_namedview(doc, 0)) && (nv_repr = nv->getRepr())) { _lockMarginUpdate = true; diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index 39aa6c584..0cff25d88 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -34,7 +34,7 @@ #include "icon-size.h" #include "preferences.h" #include "desktop.h" -#include "desktop-handles.h" + #include "inkscape.h" #include "widgets/eek-preview.h" #include "ui/previewfillable.h" diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 7f3e6cd47..98028ed78 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -34,7 +34,7 @@ #include "desktop.h" #include "enums.h" #include "inkscape.h" -#include "desktop-handles.h" + #include "message-stack.h" #include "style.h" #include "selection.h" diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp index 02ab88418..bbf542987 100644 --- a/src/ui/widget/registered-widget.cpp +++ b/src/ui/widget/registered-widget.cpp @@ -37,7 +37,7 @@ #include "display/sp-canvas.h" #include "desktop.h" -#include "desktop-handles.h" + #include "sp-root.h" @@ -420,7 +420,7 @@ RegisteredColorPicker::on_changed (guint32 rgba) if (!dt) return; local_repr = dt->getNamedView()->getRepr(); - local_doc = sp_desktop_document(dt); + local_doc = dt->getDocument(); } gchar c[32]; diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index 38944250c..93b4893f2 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -20,7 +20,7 @@ #include "ui/widget/color-preview.h" #include "selection.h" -#include "desktop-handles.h" + #include "style.h" #include "desktop-style.h" #include "sp-namedview.h" @@ -541,8 +541,7 @@ void SelectedStyle::dragDataReceived( GtkWidget */*widget*/, sp_repr_css_set_property( css, (tracker->item == SS_FILL) ? "fill":"stroke", c ); sp_desktop_set_style( tracker->parent->_desktop, css ); sp_repr_css_attr_unref( css ); - DocumentUndo::done( sp_desktop_document(tracker->parent->_desktop) , SP_VERB_NONE, - _("Drop color")); + DocumentUndo::done( tracker->parent->_desktop->getDocument(), SP_VERB_NONE, _("Drop color")); } } break; @@ -554,7 +553,7 @@ void SelectedStyle::on_fill_remove() { sp_repr_css_set_property (css, "fill", "none"); sp_desktop_set_style (_desktop, css, true, true); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Remove fill")); } @@ -563,7 +562,7 @@ void SelectedStyle::on_stroke_remove() { sp_repr_css_set_property (css, "stroke", "none"); sp_desktop_set_style (_desktop, css, true, true); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Remove stroke")); } @@ -572,7 +571,7 @@ void SelectedStyle::on_fill_unset() { sp_repr_css_unset_property (css, "fill"); sp_desktop_set_style (_desktop, css, true, true); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Unset fill")); } @@ -588,7 +587,7 @@ void SelectedStyle::on_stroke_unset() { sp_repr_css_unset_property (css, "stroke-dasharray"); sp_desktop_set_style (_desktop, css, true, true); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Unset stroke")); } @@ -597,7 +596,7 @@ void SelectedStyle::on_fill_opaque() { sp_repr_css_set_property (css, "fill-opacity", "1"); sp_desktop_set_style (_desktop, css, true); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Make fill opaque")); } @@ -606,7 +605,7 @@ void SelectedStyle::on_stroke_opaque() { sp_repr_css_set_property (css, "stroke-opacity", "1"); sp_desktop_set_style (_desktop, css, true); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Make fill opaque")); } @@ -618,7 +617,7 @@ void SelectedStyle::on_fill_lastused() { sp_repr_css_set_property (css, "fill", c); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Apply last set color to fill")); } @@ -630,7 +629,7 @@ void SelectedStyle::on_stroke_lastused() { sp_repr_css_set_property (css, "stroke", c); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Apply last set color to stroke")); } @@ -641,7 +640,7 @@ void SelectedStyle::on_fill_lastselected() { sp_repr_css_set_property (css, "fill", c); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Apply last selected color to fill")); } @@ -652,7 +651,7 @@ void SelectedStyle::on_stroke_lastselected() { sp_repr_css_set_property (css, "stroke", c); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Apply last selected color to stroke")); } @@ -678,7 +677,7 @@ void SelectedStyle::on_fill_invert() { sp_repr_css_set_property (css, "fill", c); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Invert fill")); } @@ -702,7 +701,7 @@ void SelectedStyle::on_stroke_invert() { sp_repr_css_set_property (css, "stroke", c); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Invert stroke")); } @@ -714,7 +713,7 @@ void SelectedStyle::on_fill_white() { sp_repr_css_set_property (css, "fill-opacity", "1"); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("White fill")); } @@ -726,7 +725,7 @@ void SelectedStyle::on_stroke_white() { sp_repr_css_set_property (css, "stroke-opacity", "1"); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("White stroke")); } @@ -738,7 +737,7 @@ void SelectedStyle::on_fill_black() { sp_repr_css_set_property (css, "fill-opacity", "1.0"); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Black fill")); } @@ -750,7 +749,7 @@ void SelectedStyle::on_stroke_black() { sp_repr_css_set_property (css, "stroke-opacity", "1.0"); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Black stroke")); } @@ -793,7 +792,7 @@ void SelectedStyle::on_fill_paste() { sp_repr_css_set_property (css, "fill", text.c_str()); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Paste fill")); } } @@ -811,7 +810,7 @@ void SelectedStyle::on_stroke_paste() { sp_repr_css_set_property (css, "stroke", text.c_str()); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Paste stroke")); } } @@ -865,7 +864,7 @@ void SelectedStyle::on_fillstroke_swap() { sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Swap fill and stroke")); } @@ -940,7 +939,7 @@ SelectedStyle::on_opacity_click(GdkEventButton *event) sp_repr_css_set_property (css, "opacity", opacity); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Change opacity")); return true; } @@ -967,7 +966,7 @@ void SelectedStyle::on_popup_preset(int i) { // FIXME: update dash patterns! sp_desktop_set_style (_desktop, css, true); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_DIALOG_SWATCHES, + DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_SWATCHES, _("Change stroke width")); } @@ -978,7 +977,7 @@ SelectedStyle::update() return; // create temporary style - SPStyle *query = sp_style_new (sp_desktop_document(_desktop)); + SPStyle *query = sp_style_new (_desktop->getDocument()); for (int i = SS_FILL; i <= SS_STROKE; i++) { Gtk::EventBox *place = (i == SS_FILL)? &_fill_place : &_stroke_place; @@ -1244,7 +1243,7 @@ void SelectedStyle::on_opacity_changed () _desktop->getCanvas()->forceFullRedrawAfterInterruptions(0); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - DocumentUndo::maybeDone(sp_desktop_document(_desktop), "fillstroke:opacity", SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::maybeDone(_desktop->getDocument(), "fillstroke:opacity", SP_VERB_DIALOG_FILL_STROKE, _("Change opacity")); // resume interruptibility _desktop->getCanvas()->endForcedFullRedraws(); @@ -1385,25 +1384,25 @@ RotateableSwatch::do_motion(double by, guint modifier) { diff = color_adjust(hsla, by, cc, modifier); if (modifier == 3) { // alpha - DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey, + DocumentUndo::maybeDone(parent->getDesktop()->getDocument(), undokey, SP_VERB_DIALOG_FILL_STROKE, (_("Adjust alpha"))); double ch = hsla[3]; parent->getDesktop()->event_context->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Adjusting <b>alpha</b>: was %.3g, now <b>%.3g</b> (diff %.3g); with <b>Ctrl</b> to adjust lightness, with <b>Shift</b> to adjust saturation, without modifiers to adjust hue"), ch - diff, ch, diff); } else if (modifier == 2) { // saturation - DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey, + DocumentUndo::maybeDone(parent->getDesktop()->getDocument(), undokey, SP_VERB_DIALOG_FILL_STROKE, (_("Adjust saturation"))); double ch = hsla[1]; parent->getDesktop()->event_context->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Adjusting <b>saturation</b>: was %.3g, now <b>%.3g</b> (diff %.3g); with <b>Ctrl</b> to adjust lightness, with <b>Alt</b> to adjust alpha, without modifiers to adjust hue"), ch - diff, ch, diff); } else if (modifier == 1) { // lightness - DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey, + DocumentUndo::maybeDone(parent->getDesktop()->getDocument(), undokey, SP_VERB_DIALOG_FILL_STROKE, (_("Adjust lightness"))); double ch = hsla[2]; parent->getDesktop()->event_context->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Adjusting <b>lightness</b>: was %.3g, now <b>%.3g</b> (diff %.3g); with <b>Shift</b> to adjust saturation, with <b>Alt</b> to adjust alpha, without modifiers to adjust hue"), ch - diff, ch, diff); } else { // hue - DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey, + DocumentUndo::maybeDone(parent->getDesktop()->getDocument(), undokey, SP_VERB_DIALOG_FILL_STROKE, (_("Adjust hue"))); double ch = hsla[0]; parent->getDesktop()->event_context->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Adjusting <b>hue</b>: was %.3g, now <b>%.3g</b> (diff %.3g); with <b>Shift</b> to adjust saturation, with <b>Alt</b> to adjust alpha, with <b>Ctrl</b> to adjust lightness"), ch - diff, ch, diff); @@ -1440,18 +1439,18 @@ RotateableSwatch::do_release(double by, guint modifier) { } if (modifier == 3) { // alpha - DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey, + DocumentUndo::maybeDone(parent->getDesktop()->getDocument(), undokey, SP_VERB_DIALOG_FILL_STROKE, ("Adjust alpha")); } else if (modifier == 2) { // saturation - DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey, + DocumentUndo::maybeDone(parent->getDesktop()->getDocument(), undokey, SP_VERB_DIALOG_FILL_STROKE, ("Adjust saturation")); } else if (modifier == 1) { // lightness - DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey, + DocumentUndo::maybeDone(parent->getDesktop()->getDocument(), undokey, SP_VERB_DIALOG_FILL_STROKE, ("Adjust lightness")); } else { // hue - DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey, + DocumentUndo::maybeDone(parent->getDesktop()->getDocument(), undokey, SP_VERB_DIALOG_FILL_STROKE, ("Adjust hue")); } @@ -1523,7 +1522,7 @@ RotateableStrokeWidth::do_motion(double by, guint modifier) { if (modifier == 3) { // Alt, do nothing } else { double diff = value_adjust(startvalue, by, modifier, false); - DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey, + DocumentUndo::maybeDone(parent->getDesktop()->getDocument(), undokey, SP_VERB_DIALOG_FILL_STROKE, (_("Adjust stroke width"))); parent->getDesktop()->event_context->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Adjusting <b>stroke width</b>: was %.3g, now <b>%.3g</b> (diff %.3g)"), startvalue, startvalue + diff, diff); } @@ -1537,7 +1536,7 @@ RotateableStrokeWidth::do_release(double by, guint modifier) { } else { value_adjust(startvalue, by, modifier, true); startvalue_set = false; - DocumentUndo::maybeDone(sp_desktop_document(parent->getDesktop()), undokey, + DocumentUndo::maybeDone(parent->getDesktop()->getDocument(), undokey, SP_VERB_DIALOG_FILL_STROKE, (_("Adjust stroke width"))); } diff --git a/src/ui/widget/style-subject.cpp b/src/ui/widget/style-subject.cpp index 1646b0fed..a48370d9b 100644 --- a/src/ui/widget/style-subject.cpp +++ b/src/ui/widget/style-subject.cpp @@ -11,7 +11,7 @@ #include "sp-object.h" #include "xml/sp-css-attr.h" #include "desktop-style.h" -#include "desktop-handles.h" + #include "selection.h" #include "style.h" diff --git a/src/ui/widget/tolerance-slider.cpp b/src/ui/widget/tolerance-slider.cpp index e798379f2..ff525c679 100644 --- a/src/ui/widget/tolerance-slider.cpp +++ b/src/ui/widget/tolerance-slider.cpp @@ -29,7 +29,7 @@ #include "document.h" #include "document-undo.h" #include "desktop.h" -#include "desktop-handles.h" + #include "sp-namedview.h" #include "registry.h" @@ -196,7 +196,7 @@ void ToleranceSlider::update (double val) _wr->setUpdating (true); - SPDocument *doc = sp_desktop_document(dt); + SPDocument *doc = dt->getDocument(); bool saved = DocumentUndo::getUndoSensitive(doc); DocumentUndo::setUndoSensitive(doc, false); Inkscape::XML::Node *repr = dt->getNamedView()->getRepr(); diff --git a/src/vanishing-point.cpp b/src/vanishing-point.cpp index fa62b8e8c..b62aacbc5 100644 --- a/src/vanishing-point.cpp +++ b/src/vanishing-point.cpp @@ -16,7 +16,7 @@ #include <glibmm/i18n.h> #include "vanishing-point.h" -#include "desktop-handles.h" + #include "desktop.h" #include "display/sp-canvas-item.h" #include "display/sp-ctrlline.h" @@ -129,7 +129,7 @@ vp_knot_moved_handler (SPKnot *knot, Geom::Point const &ppointer, guint state, g } // FIXME: Do we need to create a new dragger as well? dragger->updateZOrders (); - DocumentUndo::done(sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_3DBOX, + DocumentUndo::done(SP_ACTIVE_DESKTOP->getDocument(), SP_VERB_CONTEXT_3DBOX, _("Split vanishing points")); return; } @@ -174,7 +174,7 @@ vp_knot_moved_handler (SPKnot *knot, Geom::Point const &ppointer, guint state, g // deleted according to changes in the svg representation, not based on any user input // as is currently the case. - DocumentUndo::done(sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_3DBOX, + DocumentUndo::done(SP_ACTIVE_DESKTOP->getDocument(), SP_VERB_CONTEXT_3DBOX, _("Merge vanishing points")); return; diff --git a/src/verbs.cpp b/src/verbs.cpp index 4d212f0fc..231e258d6 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -41,7 +41,7 @@ #include <gtkmm/stock.h> #include "desktop.h" -#include "desktop-handles.h" + #include "display/curve.h" #include "document.h" #include "ui/tools/freehand-base.h" @@ -948,10 +948,10 @@ void EditVerb::perform(SPAction *action, void *data) switch (reinterpret_cast<std::size_t>(data)) { case SP_VERB_EDIT_UNDO: - sp_undo(dt, sp_desktop_document(dt)); + sp_undo(dt, dt->getDocument()); break; case SP_VERB_EDIT_REDO: - sp_redo(dt, sp_desktop_document(dt)); + sp_redo(dt, dt->getDocument()); break; case SP_VERB_EDIT_CUT: sp_selection_cut(dt); @@ -1256,7 +1256,7 @@ void LayerVerb::perform(SPAction *action, void *data) SPObject *next=Inkscape::next_layer(dt->currentRoot(), dt->currentLayer()); if (next) { dt->setCurrentLayer(next); - DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_NEXT, + DocumentUndo::done(dt->getDocument(), SP_VERB_LAYER_NEXT, _("Switch to next layer")); dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Switched to next layer.")); } else { @@ -1268,7 +1268,7 @@ void LayerVerb::perform(SPAction *action, void *data) SPObject *prev=Inkscape::previous_layer(dt->currentRoot(), dt->currentLayer()); if (prev) { dt->setCurrentLayer(prev); - DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_PREV, + DocumentUndo::done(dt->getDocument(), SP_VERB_LAYER_PREV, _("Switch to previous layer")); dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Switched to previous layer.")); } else { @@ -1338,7 +1338,7 @@ void LayerVerb::perform(SPAction *action, void *data) description = _("Lower layer"); break; }; - DocumentUndo::done(sp_desktop_document(dt), verb, description); + DocumentUndo::done(dt->getDocument(), verb, description); if (message) { dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, message); g_free((void *) message); @@ -1384,7 +1384,7 @@ void LayerVerb::perform(SPAction *action, void *data) dt->setCurrentLayer(new_layer); } #endif - DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_DUPLICATE, + DocumentUndo::done(dt->getDocument(), SP_VERB_LAYER_DUPLICATE, _("Duplicate layer")); // TRANSLATORS: this means "The layer has been duplicated." @@ -1420,7 +1420,7 @@ void LayerVerb::perform(SPAction *action, void *data) dt->setCurrentLayer(survivor); } - DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_DELETE, + DocumentUndo::done(dt->getDocument(), SP_VERB_LAYER_DELETE, _("Delete layer")); // TRANSLATORS: this means "The layer has been deleted." @@ -1435,23 +1435,23 @@ void LayerVerb::perform(SPAction *action, void *data) dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer.")); } else { dt->toggleLayerSolo( dt->currentLayer() ); - DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_SOLO, _("Toggle layer solo")); + DocumentUndo::done(dt->getDocument(), SP_VERB_LAYER_SOLO, _("Toggle layer solo")); } break; } case SP_VERB_LAYER_SHOW_ALL: { dt->toggleHideAllLayers( false ); - DocumentUndo::maybeDone(sp_desktop_document(dt), "layer:showall", SP_VERB_LAYER_SHOW_ALL, _("Show all layers")); + DocumentUndo::maybeDone(dt->getDocument(), "layer:showall", SP_VERB_LAYER_SHOW_ALL, _("Show all layers")); break; } case SP_VERB_LAYER_HIDE_ALL: { dt->toggleHideAllLayers( true ); - DocumentUndo::maybeDone(sp_desktop_document(dt), "layer:hideall", SP_VERB_LAYER_HIDE_ALL, _("Hide all layers")); + DocumentUndo::maybeDone(dt->getDocument(), "layer:hideall", SP_VERB_LAYER_HIDE_ALL, _("Hide all layers")); break; } case SP_VERB_LAYER_LOCK_ALL: { dt->toggleLockAllLayers( true ); - DocumentUndo::maybeDone(sp_desktop_document(dt), "layer:lockall", SP_VERB_LAYER_LOCK_ALL, _("Lock all layers")); + DocumentUndo::maybeDone(dt->getDocument(), "layer:lockall", SP_VERB_LAYER_LOCK_ALL, _("Lock all layers")); break; } case SP_VERB_LAYER_LOCK_OTHERS: { @@ -1459,13 +1459,13 @@ void LayerVerb::perform(SPAction *action, void *data) dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer.")); } else { dt->toggleLockOtherLayers( dt->currentLayer() ); - DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_LOCK_OTHERS, _("Lock other layers")); + DocumentUndo::done(dt->getDocument(), SP_VERB_LAYER_LOCK_OTHERS, _("Lock other layers")); } break; } case SP_VERB_LAYER_UNLOCK_ALL: { dt->toggleLockAllLayers( false ); - DocumentUndo::maybeDone(sp_desktop_document(dt), "layer:unlockall", SP_VERB_LAYER_UNLOCK_ALL, _("Unlock all layers")); + DocumentUndo::maybeDone(dt->getDocument(), "layer:unlockall", SP_VERB_LAYER_UNLOCK_ALL, _("Unlock all layers")); break; } case SP_VERB_LAYER_TOGGLE_LOCK: @@ -1548,12 +1548,12 @@ void ObjectVerb::perform( SPAction *action, void *data) break; case SP_VERB_OBJECT_FLIP_HORIZONTAL: sp_selection_scale_relative(sel, center, Geom::Scale(-1.0, 1.0)); - DocumentUndo::done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_HORIZONTAL, + DocumentUndo::done(dt->getDocument(), SP_VERB_OBJECT_FLIP_HORIZONTAL, _("Flip horizontally")); break; case SP_VERB_OBJECT_FLIP_VERTICAL: sp_selection_scale_relative(sel, center, Geom::Scale(1.0, -1.0)); - DocumentUndo::done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_VERTICAL, + DocumentUndo::done(dt->getDocument(), SP_VERB_OBJECT_FLIP_VERTICAL, _("Flip vertically")); break; case SP_VERB_OBJECT_SET_MASK: @@ -1831,7 +1831,7 @@ void TextVerb::perform(SPAction *action, void */*data*/) g_return_if_fail(ensure_desktop_valid(action)); SPDesktop *dt = sp_action_get_desktop(action); - SPDocument *doc = sp_desktop_document(dt); + SPDocument *doc = dt->getDocument(); (void)doc; Inkscape::XML::Node *repr = dt->namedview->getRepr(); (void)repr; @@ -1846,7 +1846,7 @@ void ZoomVerb::perform(SPAction *action, void *data) SPDesktop *dt = sp_action_get_desktop(action); Inkscape::UI::Tools::ToolBase *ec = dt->event_context; - SPDocument *doc = sp_desktop_document(dt); + SPDocument *doc = dt->getDocument(); Inkscape::XML::Node *repr = dt->namedview->getRepr(); @@ -2326,7 +2326,7 @@ void FitCanvasVerb::perform(SPAction *action, void *data) { g_return_if_fail(ensure_desktop_valid(action)); SPDesktop *dt = sp_action_get_desktop(action); - SPDocument *doc = sp_desktop_document(dt); + SPDocument *doc = dt->getDocument(); if (!doc) return; switch (reinterpret_cast<std::size_t>(data)) { @@ -2392,7 +2392,7 @@ void LockAndHideVerb::perform(SPAction *action, void *data) { g_return_if_fail(ensure_desktop_valid(action)); SPDesktop *dt = sp_action_get_desktop(action); - SPDocument *doc = sp_desktop_document(dt); + SPDocument *doc = dt->getDocument(); if (!doc) return; switch (reinterpret_cast<std::size_t>(data)) { diff --git a/src/widgets/arc-toolbar.cpp b/src/widgets/arc-toolbar.cpp index 6dba44add..8a64854be 100644 --- a/src/widgets/arc-toolbar.cpp +++ b/src/widgets/arc-toolbar.cpp @@ -31,7 +31,7 @@ #include <glibmm/i18n.h> #include "arc-toolbar.h" -#include "desktop-handles.h" + #include "desktop.h" #include "document-undo.h" #include "widgets/ege-adjustment-action.h" @@ -81,7 +81,7 @@ sp_arctb_startend_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const *v { SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data( tbl, "desktop" )); - if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setDouble(Glib::ustring("/tools/shapes/arc/") + value_name, gtk_adjustment_get_value(adj)); } @@ -128,7 +128,7 @@ sp_arctb_startend_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const *v sp_arctb_sensitivize( tbl, gtk_adjustment_get_value(adj), gtk_adjustment_get_value(other) ); if (modmade) { - DocumentUndo::maybeDone(sp_desktop_document(desktop), value_name, SP_VERB_CONTEXT_ARC, + DocumentUndo::maybeDone(desktop->getDocument(), value_name, SP_VERB_CONTEXT_ARC, _("Arc: Change start/end")); } @@ -150,7 +150,7 @@ static void sp_arctb_end_value_changed(GtkAdjustment *adj, GObject *tbl) static void sp_arctb_open_state_changed( EgeSelectOneAction *act, GObject *tbl ) { SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data( tbl, "desktop" )); - if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setBool("/tools/shapes/arc/open", ege_select_one_action_get_active(act) != 0); } @@ -194,7 +194,7 @@ static void sp_arctb_open_state_changed( EgeSelectOneAction *act, GObject *tbl ) } if (modmade) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ARC, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_ARC, _("Arc: Change open/closed")); } diff --git a/src/widgets/box3d-toolbar.cpp b/src/widgets/box3d-toolbar.cpp index 3181e345b..26e914070 100644 --- a/src/widgets/box3d-toolbar.cpp +++ b/src/widgets/box3d-toolbar.cpp @@ -32,7 +32,7 @@ #include "box3d-toolbar.h" #include "box3d.h" -#include "desktop-handles.h" + #include "desktop.h" #include "document-undo.h" #include "document.h" @@ -208,7 +208,7 @@ static void box3d_toolbox_selection_changed(Inkscape::Selection *selection, GObj static void box3d_angle_value_changed(GtkAdjustment *adj, GObject *dataKludge, Proj::Axis axis) { SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data( dataKludge, "desktop" )); - SPDocument *document = sp_desktop_document(desktop); + SPDocument *document = desktop->getDocument(); // quit if run by the attr_changed or selection changed listener if (g_object_get_data( dataKludge, "freeze" )) { @@ -287,7 +287,7 @@ void box3d_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); EgeAdjustmentAction* eact = 0; - SPDocument *document = sp_desktop_document (desktop); + SPDocument *document = desktop->getDocument(); Persp3DImpl *persp_impl = document->getCurrentPersp3DImpl(); EgeAdjustmentAction* box3d_angle_x = 0; diff --git a/src/widgets/connector-toolbar.cpp b/src/widgets/connector-toolbar.cpp index 915d1e629..c906f7de4 100644 --- a/src/widgets/connector-toolbar.cpp +++ b/src/widgets/connector-toolbar.cpp @@ -32,7 +32,7 @@ #include "connector-toolbar.h" #include "conn-avoid-ref.h" -#include "desktop-handles.h" + #include "desktop.h" #include "document-undo.h" #include "widgets/ege-adjustment-action.h" @@ -77,7 +77,7 @@ static void sp_connector_orthogonal_toggled( GtkToggleAction* act, GObject *tbl { SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data( tbl, "desktop" )); Inkscape::Selection * selection = desktop->getSelection(); - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); if (!DocumentUndo::getUndoSensitive(doc)) { return; @@ -127,7 +127,7 @@ static void connector_curvature_changed(GtkAdjustment *adj, GObject* tbl) { SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data( tbl, "desktop" )); Inkscape::Selection * selection = desktop->getSelection(); - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); if (!DocumentUndo::getUndoSensitive(doc)) { return; @@ -176,7 +176,7 @@ static void connector_curvature_changed(GtkAdjustment *adj, GObject* tbl) static void connector_spacing_changed(GtkAdjustment *adj, GObject* tbl) { SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data( tbl, "desktop" )); - SPDocument *doc = sp_desktop_document(desktop); + SPDocument *doc = desktop->getDocument(); if (!DocumentUndo::getUndoSensitive(doc)) { return; @@ -237,7 +237,7 @@ static void sp_connector_graph_layout(void) prefs->setInt("/options/clonecompensation/value", saved_compensation); - DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Arrange connector network")); + DocumentUndo::done(SP_ACTIVE_DESKTOP->getDocument(), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Arrange connector network")); } static void sp_directed_graph_layout_toggled( GtkToggleAction* act, GObject * /*tbl*/ ) diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index e117e7f60..fd3756220 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -32,7 +32,7 @@ #include "conn-avoid-ref.h" #include "desktop.h" #include "desktop-events.h" -#include "desktop-handles.h" + #include "desktop-widget.h" #include "display/sp-canvas.h" #include "display/canvas-arena.h" diff --git a/src/widgets/eraser-toolbar.cpp b/src/widgets/eraser-toolbar.cpp index f547cbd8b..1f79b50f2 100644 --- a/src/widgets/eraser-toolbar.cpp +++ b/src/widgets/eraser-toolbar.cpp @@ -32,7 +32,7 @@ #include "eraser-toolbar.h" #include "calligraphy-toolbar.h" // TODO: needed for update_presets_list -#include "desktop-handles.h" + #include "desktop.h" #include "document-undo.h" #include "widgets/ege-adjustment-action.h" @@ -61,7 +61,7 @@ static void sp_erasertb_mode_changed( EgeSelectOneAction *act, GObject *tbl ) { SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data( tbl, "desktop" )); bool eraserMode = ege_select_one_action_get_active( act ) != 0; - if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setBool( "/tools/eraser/mode", eraserMode ); } diff --git a/src/widgets/fill-style.cpp b/src/widgets/fill-style.cpp index 820a20126..fcdc9a36b 100644 --- a/src/widgets/fill-style.cpp +++ b/src/widgets/fill-style.cpp @@ -35,7 +35,7 @@ #include "desktop.h" #include "selection.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "display/sp-canvas.h" #include "document-private.h" @@ -480,7 +480,7 @@ void FillNStroke::updateFromPaint() } update = true; - SPDocument *document = sp_desktop_document(desktop); + SPDocument *document = desktop->getDocument(); Inkscape::Selection *selection = desktop->getSelection(); GSList const *items = selection->itemList(); @@ -522,7 +522,7 @@ void FillNStroke::updateFromPaint() psel->setFlatColor( desktop, (kind == FILL) ? "fill" : "stroke", (kind == FILL) ? "fill-opacity" : "stroke-opacity" ); - DocumentUndo::maybeDone(sp_desktop_document(desktop), (kind == FILL) ? undo_F_label : undo_S_label, SP_VERB_DIALOG_FILL_STROKE, + DocumentUndo::maybeDone(desktop->getDocument(), (kind == FILL) ? undo_F_label : undo_S_label, SP_VERB_DIALOG_FILL_STROKE, (kind == FILL) ? _("Set fill color") : _("Set stroke color")); if (kind == FILL) { diff --git a/src/widgets/gradient-toolbar.cpp b/src/widgets/gradient-toolbar.cpp index 1968f87da..ea009c048 100644 --- a/src/widgets/gradient-toolbar.cpp +++ b/src/widgets/gradient-toolbar.cpp @@ -18,7 +18,7 @@ #include "ui/widget/color-preview.h" #include <glibmm/i18n.h> -#include "desktop-handles.h" + #include "desktop.h" #include "document-undo.h" #include "document.h" @@ -128,7 +128,7 @@ gboolean gr_vector_list(GtkWidget *combo_box, SPDesktop *desktop, bool selection return sensitive; } - SPDocument *document = sp_desktop_document(desktop); + SPDocument *document = desktop->getDocument(); GtkTreeIter iter; GtkListStore *store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(combo_box)); @@ -923,7 +923,7 @@ static void gr_gradient_combo_changed(EgeSelectOneAction *act, gpointer data) gr_apply_gradient(selection, ev? ev->get_drag() : NULL, gr); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_GRADIENT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_GRADIENT, _("Assign gradient to object")); } @@ -945,7 +945,7 @@ static void gr_spread_change(EgeSelectOneAction *act, GtkWidget *widget) gradient->setSpread(spread); gradient->updateRepr(); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_GRADIENT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_GRADIENT, _("Set gradient repeat")); } } @@ -1247,7 +1247,7 @@ static void gradient_toolbox_check_ec(SPDesktop* desktop, Inkscape::UI::Tools::T if (SP_IS_GRADIENT_CONTEXT(ec)) { Inkscape::Selection *selection = desktop->getSelection(); - SPDocument *document = sp_desktop_document(desktop); + SPDocument *document = desktop->getDocument(); // connect to selection modified and changed signals connChanged = selection->connectChanged(sigc::bind(sigc::ptr_fun(&gr_tb_selection_changed), holder)); diff --git a/src/widgets/lpe-toolbar.cpp b/src/widgets/lpe-toolbar.cpp index c3a83be70..387bf6dee 100644 --- a/src/widgets/lpe-toolbar.cpp +++ b/src/widgets/lpe-toolbar.cpp @@ -30,7 +30,7 @@ #include "live_effects/lpe-line_segment.h" #include "lpe-toolbar.h" -#include "desktop-handles.h" + #include "desktop.h" #include "document-undo.h" #include "widgets/ege-select-one-action.h" @@ -91,7 +91,7 @@ static void sp_lpetool_mode_changed(EgeSelectOneAction *act, GObject *tbl) SP_LPETOOL_CONTEXT(desktop->event_context)->mode = type; } - if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setInt( "/tools/lpetool/mode", mode ); } diff --git a/src/widgets/measure-toolbar.cpp b/src/widgets/measure-toolbar.cpp index 1a4678332..5a4785b1f 100644 --- a/src/widgets/measure-toolbar.cpp +++ b/src/widgets/measure-toolbar.cpp @@ -31,7 +31,7 @@ #include <glibmm/i18n.h> #include "measure-toolbar.h" -#include "desktop-handles.h" + #include "desktop.h" #include "document-undo.h" #include "widgets/ege-adjustment-action.h" @@ -55,7 +55,7 @@ sp_measure_fontsize_value_changed(GtkAdjustment *adj, GObject *tbl) { SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data( tbl, "desktop" )); - if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setInt(Glib::ustring("/tools/measure/fontsize"), gtk_adjustment_get_value(adj)); diff --git a/src/widgets/mesh-toolbar.cpp b/src/widgets/mesh-toolbar.cpp index 8c7ec33a8..e9e9fa344 100644 --- a/src/widgets/mesh-toolbar.cpp +++ b/src/widgets/mesh-toolbar.cpp @@ -38,7 +38,7 @@ #include "document-private.h" #include "document-undo.h" #include "desktop.h" -#include "desktop-handles.h" + #include <glibmm/i18n.h> #include "ui/tools/gradient-tool.h" @@ -335,7 +335,7 @@ static void mesh_toolbox_watch_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolB if (SP_IS_MESH_CONTEXT(ec)) { // connect to selection modified and changed signals Inkscape::Selection *selection = desktop->getSelection(); - SPDocument *document = sp_desktop_document (desktop); + SPDocument *document = desktop->getDocument(); c_selection_changed = selection->connectChanged(sigc::bind(sigc::ptr_fun(&ms_tb_selection_changed), holder)); c_selection_modified = selection->connectModified(sigc::bind(sigc::ptr_fun(&ms_tb_selection_modified), holder)); diff --git a/src/widgets/node-toolbar.cpp b/src/widgets/node-toolbar.cpp index 52be03abe..113061519 100644 --- a/src/widgets/node-toolbar.cpp +++ b/src/widgets/node-toolbar.cpp @@ -31,7 +31,7 @@ #include "ui/tool/multi-path-manipulator.h" #include <glibmm/i18n.h> #include "node-toolbar.h" -#include "desktop-handles.h" + #include "desktop.h" #include "document-undo.h" #include "widgets/ege-adjustment-action.h" @@ -264,7 +264,7 @@ static void sp_node_path_value_changed(GtkAdjustment *adj, GObject *tbl, Geom::D } Unit const *unit = tracker->getActiveUnit(); - if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { prefs->setDouble(Glib::ustring("/tools/nodes/") + (d == Geom::X ? "x" : "y"), Quantity::convert(gtk_adjustment_get_value(adj), unit, "px")); } diff --git a/src/widgets/rect-toolbar.cpp b/src/widgets/rect-toolbar.cpp index 2dc2bbb07..b78f74d94 100644 --- a/src/widgets/rect-toolbar.cpp +++ b/src/widgets/rect-toolbar.cpp @@ -31,7 +31,7 @@ #include <glibmm/i18n.h> #include "rect-toolbar.h" -#include "desktop-handles.h" + #include "desktop.h" #include "document-undo.h" #include "widgets/ege-adjustment-action.h" @@ -90,7 +90,7 @@ static void sp_rtb_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const * Unit const *unit = tracker->getActiveUnit(); g_return_if_fail(unit != NULL); - if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setDouble(Glib::ustring("/tools/shapes/rect/") + value_name, Quantity::convert(gtk_adjustment_get_value(adj), unit, "px")); @@ -120,7 +120,7 @@ static void sp_rtb_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const * sp_rtb_sensitivize( tbl ); if (modmade) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_RECT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_RECT, _("Change rectangle")); } diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp index 881de2e36..e49c4c00a 100644 --- a/src/widgets/select-toolbar.cpp +++ b/src/widgets/select-toolbar.cpp @@ -21,7 +21,7 @@ #include "ui/widget/spinbutton.h" #include <glibmm/i18n.h> #include "select-toolbar.h" -#include "desktop-handles.h" + #include "desktop.h" #include "display/sp-canvas.h" #include "document-undo.h" @@ -154,7 +154,7 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw) SPDesktop *desktop = SP_ACTIVE_DESKTOP; Inkscape::Selection *selection = desktop->getSelection(); - SPDocument *document = sp_desktop_document(desktop); + SPDocument *document = desktop->getDocument(); document->ensureUpToDate (); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); diff --git a/src/widgets/sp-xmlview-content.cpp b/src/widgets/sp-xmlview-content.cpp index 9243760bd..a1d8475ba 100644 --- a/src/widgets/sp-xmlview-content.cpp +++ b/src/widgets/sp-xmlview-content.cpp @@ -15,7 +15,7 @@ #include "xml/node-event-vector.h" #include "sp-xmlview-content.h" -#include "desktop-handles.h" +#include "desktop.h" #include "document-private.h" #include "document-undo.h" #include "inkscape.h" @@ -147,7 +147,7 @@ sp_xmlview_content_changed (GtkTextBuffer *tb, SPXMLViewContent *text) text->repr->setContent(data); g_free (data); text->blocked = FALSE; - DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_DIALOG_XML_EDITOR, + DocumentUndo::done(SP_ACTIVE_DESKTOP->getDocument(), SP_VERB_DIALOG_XML_EDITOR, _("Type text in a text node")); } } diff --git a/src/widgets/spiral-toolbar.cpp b/src/widgets/spiral-toolbar.cpp index aa9c32c1a..3fb0015c1 100644 --- a/src/widgets/spiral-toolbar.cpp +++ b/src/widgets/spiral-toolbar.cpp @@ -31,7 +31,7 @@ #include <glibmm/i18n.h> #include "spiral-toolbar.h" -#include "desktop-handles.h" + #include "desktop.h" #include "document-undo.h" #include "widgets/ege-adjustment-action.h" @@ -62,7 +62,7 @@ static void sp_spl_tb_value_changed(GtkAdjustment *adj, GObject *tbl, Glib::ustr { SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data( tbl, "desktop" )); - if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setDouble("/tools/shapes/spiral/" + value_name, gtk_adjustment_get_value(adj)); @@ -96,7 +96,7 @@ static void sp_spl_tb_value_changed(GtkAdjustment *adj, GObject *tbl, Glib::ustr g_free(namespaced_name); if (modmade) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_SPIRAL, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_SPIRAL, _("Change spiral")); } diff --git a/src/widgets/star-toolbar.cpp b/src/widgets/star-toolbar.cpp index 31c67bd6f..cf12391c1 100644 --- a/src/widgets/star-toolbar.cpp +++ b/src/widgets/star-toolbar.cpp @@ -31,7 +31,7 @@ #include <glibmm/i18n.h> #include "star-toolbar.h" -#include "desktop-handles.h" + #include "desktop.h" #include "document-undo.h" #include "widgets/ege-adjustment-action.h" @@ -64,7 +64,7 @@ static void sp_stb_magnitude_value_changed( GtkAdjustment *adj, GObject *dataKlu { SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data( dataKludge, "desktop" )); - if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { // do not remember prefs if this call is initiated by an undo change, because undoing object // creation sets bogus values to its attributes before it is deleted Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -99,7 +99,7 @@ static void sp_stb_magnitude_value_changed( GtkAdjustment *adj, GObject *dataKlu } } if (modmade) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_STAR, _("Star: Change number of corners")); } @@ -110,7 +110,7 @@ static void sp_stb_proportion_value_changed( GtkAdjustment *adj, GObject *dataKl { SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data( dataKludge, "desktop" )); - if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { if (!IS_NAN(gtk_adjustment_get_value(adj))) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setDouble("/tools/shapes/star/proportion", @@ -152,7 +152,7 @@ static void sp_stb_proportion_value_changed( GtkAdjustment *adj, GObject *dataKl } if (modmade) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_STAR, _("Star: Change spoke ratio")); } @@ -164,7 +164,7 @@ static void sp_stb_sides_flat_state_changed( EgeSelectOneAction *act, GObject *d SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data( dataKludge, "desktop" )); bool flat = ege_select_one_action_get_active( act ) == 0; - if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setBool( "/tools/shapes/star/isflatsided", flat); } @@ -197,7 +197,7 @@ static void sp_stb_sides_flat_state_changed( EgeSelectOneAction *act, GObject *d } if (modmade) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_STAR, flat ? _("Make polygon") : _("Make star")); } @@ -208,7 +208,7 @@ static void sp_stb_rounded_value_changed( GtkAdjustment *adj, GObject *dataKludg { SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data( dataKludge, "desktop" )); - if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setDouble("/tools/shapes/star/rounded", (gdouble) gtk_adjustment_get_value(adj)); } @@ -236,7 +236,7 @@ static void sp_stb_rounded_value_changed( GtkAdjustment *adj, GObject *dataKludg } } if (modmade) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_STAR, _("Star: Change rounding")); } @@ -247,7 +247,7 @@ static void sp_stb_randomized_value_changed( GtkAdjustment *adj, GObject *dataKl { SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data( dataKludge, "desktop" )); - if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setDouble("/tools/shapes/star/randomized", (gdouble) gtk_adjustment_get_value(adj)); @@ -276,7 +276,7 @@ static void sp_stb_randomized_value_changed( GtkAdjustment *adj, GObject *dataKl } } if (modmade) { - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_STAR, _("Star: Change randomization")); } diff --git a/src/widgets/stroke-marker-selector.cpp b/src/widgets/stroke-marker-selector.cpp index c62262e81..d5b43d132 100644 --- a/src/widgets/stroke-marker-selector.cpp +++ b/src/widgets/stroke-marker-selector.cpp @@ -26,7 +26,7 @@ #include "style.h" #include "ui/dialog-events.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "preferences.h" #include "path-prefix.h" @@ -65,7 +65,7 @@ MarkerComboBox::MarkerComboBox(gchar const *id, int l) : sandbox = ink_markers_preview_doc (); desktop = SP_ACTIVE_DESKTOP; - doc = sp_desktop_document(desktop); + doc = desktop->getDocument(); modified_connection = doc->getDefs()->connectModified( sigc::hide(sigc::hide(sigc::bind(sigc::ptr_fun(&MarkerComboBox::handleDefsModified), this))) ); @@ -92,7 +92,7 @@ void MarkerComboBox::setDesktop(SPDesktop *desktop) } this->desktop = desktop; - doc = sp_desktop_document(desktop); + doc = desktop->getDocument(); if (doc) { modified_connection = doc->getDefs()->connectModified( sigc::hide(sigc::hide(sigc::bind(sigc::ptr_fun(&MarkerComboBox::handleDefsModified), this))) ); diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index 830c0580d..755489e12 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -456,7 +456,7 @@ void StrokeStyle::markerSelectCB(MarkerComboBox *marker_combo, StrokeStyle *spw, spw->update = true; - SPDocument *document = sp_desktop_document(spw->desktop); + SPDocument *document = spw->desktop->getDocument(); if (!document) { return; } @@ -957,7 +957,7 @@ StrokeStyle::scaleLine() update = true; - SPDocument *document = sp_desktop_document (desktop); + SPDocument *document = desktop->getDocument(); Inkscape::Selection *selection = desktop->getSelection(); GSList const *items = selection->itemList(); @@ -1113,8 +1113,7 @@ void StrokeStyle::buttonToggledCB(StrokeStyleButton *tb, StrokeStyle *spw) sp_repr_css_attr_unref(css); css = 0; - DocumentUndo::done(sp_desktop_document(spw->desktop), SP_VERB_DIALOG_FILL_STROKE, - _("Set stroke style")); + DocumentUndo::done(spw->desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, _("Set stroke style")); } } @@ -1200,7 +1199,7 @@ StrokeStyle::updateAllMarkers(GSList const *objects) if (update) { setMarkerColor(marker, combo->get_loc(), SP_ITEM(object)); - SPDocument *document = sp_desktop_document(desktop); + SPDocument *document = desktop->getDocument(); DocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE, _("Set marker color")); } diff --git a/src/widgets/stroke-style.h b/src/widgets/stroke-style.h index 15e394097..83048cb76 100644 --- a/src/widgets/stroke-style.h +++ b/src/widgets/stroke-style.h @@ -33,7 +33,6 @@ #include <glibmm/i18n.h> #include "desktop.h" -#include "desktop-handles.h" #include "desktop-style.h" #include "ui/dialog-events.h" #include "display/canvas-bpath.h" // for SP_STROKE_LINEJOIN_* diff --git a/src/widgets/text-toolbar.cpp b/src/widgets/text-toolbar.cpp index 60ea75916..d113d5c28 100644 --- a/src/widgets/text-toolbar.cpp +++ b/src/widgets/text-toolbar.cpp @@ -31,7 +31,7 @@ #include "libnrtype/font-lister.h" #include <glibmm/i18n.h> #include "text-toolbar.h" -#include "desktop-handles.h" + #include "desktop-style.h" #include "desktop.h" #include "document-undo.h" @@ -165,7 +165,7 @@ static void sp_text_fontfamily_value_changed( Ink_ComboBoxEntry_Action *act, GOb sp_desktop_set_style (desktop, css, true, true); // Results in selection change called twice. sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Text: Change font family")); } @@ -229,7 +229,7 @@ static void sp_text_fontsize_value_changed( Ink_ComboBoxEntry_Action *act, GObje prefs->mergeStyle("/tools/text/style", css); } else { // Save for undo - DocumentUndo::maybeDone(sp_desktop_document(SP_ACTIVE_DESKTOP), "ttb:size", SP_VERB_NONE, + DocumentUndo::maybeDone(SP_ACTIVE_DESKTOP->getDocument(), "ttb:size", SP_VERB_NONE, _("Text: Change font size")); } @@ -267,7 +267,7 @@ static void sp_text_fontstyle_value_changed( Ink_ComboBoxEntry_Action *act, GObj sp_desktop_set_style (desktop, css, true, true); sp_repr_css_attr_unref (css); - DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Text: Change font style")); } @@ -345,7 +345,7 @@ static void sp_text_script_changed( InkToggleAction* act, GObject *tbl ) // Save for undo if(result_baseline != QUERY_STYLE_NOTHING) { - DocumentUndo::maybeDone(sp_desktop_document(SP_ACTIVE_DESKTOP), "ttb:script", SP_VERB_NONE, + DocumentUndo::maybeDone(SP_ACTIVE_DESKTOP->getDocument(), "ttb:script", SP_VERB_NONE, _("Text: Change superscript or subscript")); } g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) ); @@ -490,7 +490,7 @@ static void sp_text_align_mode_changed( EgeSelectOneAction *act, GObject *tbl ) sp_desktop_set_style (desktop, css, true, true); if (result_numbers != QUERY_STYLE_NOTHING) { - DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT, + DocumentUndo::done(SP_ACTIVE_DESKTOP->getDocument(), SP_VERB_CONTEXT_TEXT, _("Text: Change alignment")); } sp_repr_css_attr_unref (css); @@ -533,7 +533,7 @@ static void sp_text_lineheight_value_changed( GtkAdjustment *adj, GObject *tbl ) // Save for undo if(modmade) { - DocumentUndo::maybeDone(sp_desktop_document(SP_ACTIVE_DESKTOP), "ttb:line-height", SP_VERB_NONE, + DocumentUndo::maybeDone(SP_ACTIVE_DESKTOP->getDocument(), "ttb:line-height", SP_VERB_NONE, _("Text: Change line-height")); } @@ -582,7 +582,7 @@ static void sp_text_wordspacing_value_changed( GtkAdjustment *adj, GObject *tbl prefs->mergeStyle("/tools/text/style", css); } else { // Save for undo - DocumentUndo::maybeDone(sp_desktop_document(SP_ACTIVE_DESKTOP), "ttb:word-spacing", SP_VERB_NONE, + DocumentUndo::maybeDone(SP_ACTIVE_DESKTOP->getDocument(), "ttb:word-spacing", SP_VERB_NONE, _("Text: Change word-spacing")); } sp_style_unref(query); @@ -623,7 +623,7 @@ static void sp_text_letterspacing_value_changed( GtkAdjustment *adj, GObject *tb else { // Save for undo - DocumentUndo::maybeDone(sp_desktop_document(SP_ACTIVE_DESKTOP), "ttb:letter-spacing", SP_VERB_NONE, + DocumentUndo::maybeDone(SP_ACTIVE_DESKTOP->getDocument(), "ttb:letter-spacing", SP_VERB_NONE, _("Text: Change letter-spacing")); } @@ -663,7 +663,7 @@ static void sp_text_dx_value_changed( GtkAdjustment *adj, GObject *tbl ) if(modmade) { // Save for undo - DocumentUndo::maybeDone(sp_desktop_document(SP_ACTIVE_DESKTOP), "ttb:dx", SP_VERB_NONE, + DocumentUndo::maybeDone(SP_ACTIVE_DESKTOP->getDocument(), "ttb:dx", SP_VERB_NONE, _("Text: Change dx (kern)")); } g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) ); @@ -697,7 +697,7 @@ static void sp_text_dy_value_changed( GtkAdjustment *adj, GObject *tbl ) if(modmade) { // Save for undo - DocumentUndo::maybeDone(sp_desktop_document(SP_ACTIVE_DESKTOP), "ttb:dy", SP_VERB_NONE, + DocumentUndo::maybeDone(SP_ACTIVE_DESKTOP->getDocument(), "ttb:dy", SP_VERB_NONE, _("Text: Change dy")); } @@ -732,7 +732,7 @@ static void sp_text_rotation_value_changed( GtkAdjustment *adj, GObject *tbl ) // Save for undo if(modmade) { - DocumentUndo::maybeDone(sp_desktop_document(SP_ACTIVE_DESKTOP), "ttb:rotate", SP_VERB_NONE, + DocumentUndo::maybeDone(SP_ACTIVE_DESKTOP->getDocument(), "ttb:rotate", SP_VERB_NONE, _("Text: Change rotate")); } @@ -780,7 +780,7 @@ static void sp_text_orientation_mode_changed( EgeSelectOneAction *act, GObject * sp_desktop_set_style (SP_ACTIVE_DESKTOP, css, true, true); if(result_numbers != QUERY_STYLE_NOTHING) { - DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT, + DocumentUndo::done(SP_ACTIVE_DESKTOP->getDocument(), SP_VERB_CONTEXT_TEXT, _("Text: Change orientation")); } sp_repr_css_attr_unref (css); @@ -860,7 +860,7 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ Inkscape::FontLister* fontlister = Inkscape::FontLister::get_instance(); if (!subselection) { - fontlister->update_font_list( sp_desktop_document( SP_ACTIVE_DESKTOP )); + fontlister->update_font_list( SP_ACTIVE_DESKTOP->getDocument()); } fontlister->selection_update(); @@ -1169,7 +1169,7 @@ static void sp_text_toolbox_select_cb( GtkEntry* entry, GtkEntryIconPosition /*p GSList *selectList = NULL; SPDesktop *desktop = SP_ACTIVE_DESKTOP; - SPDocument *document = sp_desktop_document( desktop ); + SPDocument *document = desktop->getDocument(); GSList *allList = get_all_items(NULL, document->getRoot(), desktop, false, false, true, NULL); for (GSList *i = allList; i != NULL; i = i->next) { @@ -1214,7 +1214,7 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje { // Font list Inkscape::FontLister* fontlister = Inkscape::FontLister::get_instance(); - fontlister->update_font_list( sp_desktop_document( SP_ACTIVE_DESKTOP )); + fontlister->update_font_list( SP_ACTIVE_DESKTOP->getDocument()); Glib::RefPtr<Gtk::ListStore> store = fontlister->get_font_list(); GtkListStore* model = store->gobj(); diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 555bb780f..4f5682f7a 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -40,7 +40,6 @@ #include <glibmm/i18n.h> #include "../desktop.h" -#include "../desktop-handles.h" #include "../desktop-style.h" #include "document-undo.h" #include "widgets/ege-adjustment-action.h" |
