From a6cc5d4dc103a0a48cffd4b29d9e8f49fd6609a8 Mon Sep 17 00:00:00 2001 From: speleo3 Date: Fri, 13 Mar 2009 17:13:24 +0000 Subject: [PATCH] remove desktop-affine.h and refactor sp_desktop_dt2doc_* calls --- src/Makefile_insert | 1 - src/connector-context.cpp | 3 +-- src/context-fns.cpp | 5 ++--- src/desktop-affine.h | 32 -------------------------------- src/doxygen-main.cpp | 2 +- src/draw-context.cpp | 3 +-- src/dyna-draw-context.cpp | 3 +-- src/eraser-context.cpp | 3 +-- src/object-edit.cpp | 1 - src/sp-flowtext.cpp | 5 ++--- src/spiral-context.cpp | 5 ++--- src/star-context.cpp | 5 ++--- src/text-context.cpp | 3 +-- src/tweak-context.cpp | 1 - src/ui/view/CMakeLists.txt | 1 - 15 files changed, 14 insertions(+), 59 deletions(-) delete mode 100644 src/desktop-affine.h diff --git a/src/Makefile_insert b/src/Makefile_insert index a3babf265..de986ca16 100644 --- a/src/Makefile_insert +++ b/src/Makefile_insert @@ -26,7 +26,6 @@ ink_common_sources += \ console-output-undo-observer.h console-output-undo-observer.cpp \ context-fns.cpp context-fns.h \ decimal-round.h \ - desktop-affine.h \ desktop.cpp desktop.h \ desktop-events.cpp desktop-events.h \ desktop-handles.cpp desktop-handles.h \ diff --git a/src/connector-context.cpp b/src/connector-context.cpp index a3bb19de6..e364336c4 100644 --- a/src/connector-context.cpp +++ b/src/connector-context.cpp @@ -52,7 +52,6 @@ #include "svg/svg.h" #include "desktop.h" #include "desktop-style.h" -#include "desktop-affine.h" #include "desktop-handles.h" #include "document.h" #include "message-context.h" @@ -913,7 +912,7 @@ spcc_flush_white(SPConnectorContext *cc, SPCurve *gc) } /* Now we have to go back to item coordinates at last */ - c->transform(sp_desktop_dt2doc_affine(SP_EVENT_CONTEXT_DESKTOP(cc))); + c->transform(SP_EVENT_CONTEXT_DESKTOP(cc)->dt2doc()); SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc); SPDocument *doc = sp_desktop_document(desktop); diff --git a/src/context-fns.cpp b/src/context-fns.cpp index 30062504c..50942b80a 100644 --- a/src/context-fns.cpp +++ b/src/context-fns.cpp @@ -9,7 +9,6 @@ #include "message-stack.h" #include "context-fns.h" #include "snap.h" -#include "desktop-affine.h" #include "event-context.h" #include "sp-namedview.h" #include "display/snap-indicator.h" @@ -207,8 +206,8 @@ Geom::Rect Inkscape::snap_rectangular_box(SPDesktop const *desktop, SPItem *item desktop->snapindicator->set_new_snaptarget(snappoint); } - p[0] = sp_desktop_dt2doc_xy_point(desktop, p[0]); - p[1] = sp_desktop_dt2doc_xy_point(desktop, p[1]); + p[0] *= desktop->dt2doc(); + p[1] *= desktop->dt2doc(); return Geom::Rect(Geom::Point(MIN(p[0][Geom::X], p[1][Geom::X]), MIN(p[0][Geom::Y], p[1][Geom::Y])), Geom::Point(MAX(p[0][Geom::X], p[1][Geom::X]), MAX(p[0][Geom::Y], p[1][Geom::Y]))); diff --git a/src/desktop-affine.h b/src/desktop-affine.h deleted file mode 100644 index dda4e90ee..000000000 --- a/src/desktop-affine.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef __SP_DESKTOP_AFFINE_H__ -#define __SP_DESKTOP_AFFINE_H__ - -/* - * Desktop transformations - * - * Authors: - * Lauris Kaplinski - * - * Copyright (C) 1999-2002 Lauris Kaplinski - * Copyright (C) 2000-2001 Ximian, Inc. - * - * Released under GNU GPL, read the file 'COPYING' for more information - */ - -#include "desktop.h" - -#define sp_desktop_dt2doc_affine(desktop) desktop->dt2doc() -#define sp_desktop_dt2doc_xy_point(desktop,point) desktop->dt2doc(point) - -#endif - -/* - 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:encoding=utf-8:textwidth=99 : diff --git a/src/doxygen-main.cpp b/src/doxygen-main.cpp index bfca9b21a..fd8f4bb1a 100644 --- a/src/doxygen-main.cpp +++ b/src/doxygen-main.cpp @@ -284,7 +284,7 @@ namespace XML {} * * - Inkscape::UI::View::View [\ref ui/view/view.cpp, \ref ui/view/view.h] * - Inkscape::UI::View::Edit [\ref ui/view/edit.cpp, \ref ui/view/edit.h] - * - SPDesktop [\ref desktop.cpp, \ref desktop-affine.cpp, \ref desktop-events.cpp, \ref desktop-handles.cpp, \ref desktop-style.cpp, \ref desktop.h, \ref desktop-affine.h, \ref desktop-events.h, \ref desktop-handles.h, \ref desktop-style.h] + * - SPDesktop [\ref desktop.cpp, \ref desktop-events.cpp, \ref desktop-handles.cpp, \ref desktop-style.cpp, \ref desktop.h, \ref desktop-events.h, \ref desktop-handles.h, \ref desktop-style.h] * - SPSVGView [\ref svg-view.cpp, \ref svg-view.h] * * SPDesktopWidget [\ref desktop-widget.h] SPSVGSPViewWidget [\ref svg-view.cpp] diff --git a/src/draw-context.cpp b/src/draw-context.cpp index c86e2cc69..3891ce331 100644 --- a/src/draw-context.cpp +++ b/src/draw-context.cpp @@ -26,7 +26,6 @@ #include #include "display/curve.h" #include "desktop.h" -#include "desktop-affine.h" #include "desktop-handles.h" #include "desktop-style.h" #include "document.h" @@ -662,7 +661,7 @@ spdc_flush_white(SPDrawContext *dc, SPCurve *gc) /* Now we have to go back to item coordinates at last */ c->transform( dc->white_item ? sp_item_dt2i_affine(dc->white_item) - : to_2geom(sp_desktop_dt2doc_affine(SP_EVENT_CONTEXT_DESKTOP(dc))) ); + : SP_EVENT_CONTEXT_DESKTOP(dc)->dt2doc() ); SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(dc); SPDocument *doc = sp_desktop_document(desktop); diff --git a/src/dyna-draw-context.cpp b/src/dyna-draw-context.cpp index 23a264c80..bb8e69092 100644 --- a/src/dyna-draw-context.cpp +++ b/src/dyna-draw-context.cpp @@ -45,7 +45,6 @@ #include "desktop.h" #include "desktop-events.h" #include "desktop-handles.h" -#include "desktop-affine.h" #include "desktop-style.h" #include "message-context.h" #include "preferences.h" @@ -1016,7 +1015,7 @@ set_to_accumulated(SPDynaDrawContext *dc, bool unionize, bool subtract) item->transform = sp_item_i2doc_affine(SP_ITEM(desktop->currentLayer())).inverse(); item->updateRepr(); } - Geom::PathVector pathv = dc->accumulated->get_pathvector() * sp_desktop_dt2doc_affine(desktop); + Geom::PathVector pathv = dc->accumulated->get_pathvector() * desktop->dt2doc(); gchar *str = sp_svg_write_path(pathv); g_assert( str != NULL ); dc->repr->setAttribute("d", str); diff --git a/src/eraser-context.cpp b/src/eraser-context.cpp index 8854dbcec..022de4090 100644 --- a/src/eraser-context.cpp +++ b/src/eraser-context.cpp @@ -43,7 +43,6 @@ #include "desktop.h" #include "desktop-events.h" #include "desktop-handles.h" -#include "desktop-affine.h" #include "desktop-style.h" #include "message-context.h" #include "preferences.h" @@ -727,7 +726,7 @@ set_to_accumulated(SPEraserContext *dc) item->transform = sp_item_i2doc_affine(SP_ITEM(desktop->currentLayer())).inverse(); item->updateRepr(); } - Geom::PathVector pathv = dc->accumulated->get_pathvector() * sp_desktop_dt2doc_affine(desktop); + Geom::PathVector pathv = dc->accumulated->get_pathvector() * desktop->dt2doc(); gchar *str = sp_svg_write_path(pathv); g_assert( str != NULL ); dc->repr->setAttribute("d", str); diff --git a/src/object-edit.cpp b/src/object-edit.cpp index edb1a0134..a9cf20298 100644 --- a/src/object-edit.cpp +++ b/src/object-edit.cpp @@ -26,7 +26,6 @@ #include "sp-offset.h" #include "sp-flowtext.h" #include "preferences.h" -#include "desktop-affine.h" #include "style.h" #include "desktop.h" #include "desktop-handles.h" diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp index c6c095014..6af2f7169 100644 --- a/src/sp-flowtext.cpp +++ b/src/sp-flowtext.cpp @@ -16,7 +16,6 @@ #include "selection.h" #include "desktop-handles.h" #include "desktop.h" -#include "desktop-affine.h" #include "xml/repr.h" @@ -697,8 +696,8 @@ SPItem *create_flowtext_with_internal_frame (SPDesktop *desktop, Geom::Point p0, SPObject *rect = doc->getObjectByRepr(rect_repr); - p0 = sp_desktop_dt2doc_xy_point(desktop, p0); - p1 = sp_desktop_dt2doc_xy_point(desktop, p1); + p0 *= desktop->dt2doc(); + p1 *= desktop->dt2doc(); using Geom::X; using Geom::Y; Geom::Coord const x0 = MIN(p0[X], p1[X]); diff --git a/src/spiral-context.cpp b/src/spiral-context.cpp index 3689ae4af..e91f550dc 100644 --- a/src/spiral-context.cpp +++ b/src/spiral-context.cpp @@ -27,7 +27,6 @@ #include "sp-namedview.h" #include "selection.h" #include "desktop-handles.h" -#include "desktop-affine.h" #include "snap.h" #include "desktop.h" #include "desktop-style.h" @@ -406,8 +405,8 @@ sp_spiral_drag(SPSpiralContext *sc, Geom::Point p, guint state) Geom::Point pt2g = to_2geom(p); m.freeSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, pt2g, Inkscape::SNAPSOURCE_HANDLE); - Geom::Point const p0 = to_2geom(sp_desktop_dt2doc_xy_point(desktop, sc->center)); - Geom::Point const p1 = to_2geom(sp_desktop_dt2doc_xy_point(desktop, from_2geom(pt2g))); + Geom::Point const p0 = desktop->dt2doc(sc->center); + Geom::Point const p1 = desktop->dt2doc(pt2g); SPSpiral *spiral = SP_SPIRAL(sc->item); diff --git a/src/star-context.cpp b/src/star-context.cpp index 54c431e2c..b2c56cc7f 100644 --- a/src/star-context.cpp +++ b/src/star-context.cpp @@ -30,7 +30,6 @@ #include "sp-namedview.h" #include "selection.h" #include "desktop-handles.h" -#include "desktop-affine.h" #include "snap.h" #include "desktop.h" #include "desktop-style.h" @@ -418,8 +417,8 @@ static void sp_star_drag(SPStarContext *sc, Geom::Point p, guint state) Geom::Point pt2g = to_2geom(p); m.freeSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, pt2g, Inkscape::SNAPSOURCE_HANDLE); - Geom::Point const p0 = to_2geom(sp_desktop_dt2doc_xy_point(desktop, sc->center)); - Geom::Point const p1 = to_2geom(sp_desktop_dt2doc_xy_point(desktop, from_2geom(pt2g))); + Geom::Point const p0 = desktop->dt2doc(sc->center); + Geom::Point const p1 = desktop->dt2doc(pt2g); SPStar *star = SP_STAR(sc->item); diff --git a/src/text-context.cpp b/src/text-context.cpp index b2efd0cc2..d743d45c2 100644 --- a/src/text-context.cpp +++ b/src/text-context.cpp @@ -35,7 +35,6 @@ #include "desktop.h" #include "desktop-style.h" #include "desktop-handles.h" -#include "desktop-affine.h" #include "message-stack.h" #include "message-context.h" #include "pixmaps/cursor-text.xpm" @@ -670,7 +669,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons /* Button 1, set X & Y & new item */ sp_desktop_selection(desktop)->clear(); Geom::Point dtp = desktop->w2d(Geom::Point(event->button.x, event->button.y)); - tc->pdoc = sp_desktop_dt2doc_xy_point(desktop, dtp); + tc->pdoc = desktop->dt2doc(dtp); tc->show = TRUE; tc->phase = 1; diff --git a/src/tweak-context.cpp b/src/tweak-context.cpp index fd8f098fe..7d797915e 100644 --- a/src/tweak-context.cpp +++ b/src/tweak-context.cpp @@ -29,7 +29,6 @@ #include "desktop.h" #include "desktop-events.h" #include "desktop-handles.h" -#include "desktop-affine.h" #include "desktop-style.h" #include "message-context.h" #include "pixmaps/cursor-tweak-move.xpm" diff --git a/src/ui/view/CMakeLists.txt b/src/ui/view/CMakeLists.txt index df2b422ca..5c96bc40e 100644 --- a/src/ui/view/CMakeLists.txt +++ b/src/ui/view/CMakeLists.txt @@ -1,6 +1,5 @@ SET(ui_view_SRC desktop.cpp -desktop-affine.cpp desktop-events.cpp desktop-handles.cpp desktop-style.cpp -- 2.30.2