diff options
Diffstat (limited to 'src/display')
| -rw-r--r-- | src/display/canvas-arena.cpp | 16 | ||||
| -rw-r--r-- | src/display/canvas-axonomgrid.cpp | 56 | ||||
| -rw-r--r-- | src/display/canvas-axonomgrid.h | 7 | ||||
| -rw-r--r-- | src/display/canvas-bpath.cpp | 46 | ||||
| -rw-r--r-- | src/display/canvas-bpath.h | 8 | ||||
| -rw-r--r-- | src/display/canvas-grid.cpp | 86 | ||||
| -rw-r--r-- | src/display/canvas-grid.h | 12 | ||||
| -rw-r--r-- | src/display/gnome-canvas-acetate.cpp | 8 | ||||
| -rw-r--r-- | src/display/guideline.cpp | 11 | ||||
| -rw-r--r-- | src/display/nr-arena-shape.cpp | 2 | ||||
| -rw-r--r-- | src/display/sodipodi-ctrl.cpp | 17 | ||||
| -rw-r--r-- | src/display/sodipodi-ctrl.h | 2 | ||||
| -rw-r--r-- | src/display/sodipodi-ctrlrect.cpp | 20 | ||||
| -rw-r--r-- | src/display/sodipodi-ctrlrect.h | 6 | ||||
| -rw-r--r-- | src/display/sp-canvas-util.cpp | 6 | ||||
| -rw-r--r-- | src/display/sp-canvas-util.h | 6 | ||||
| -rw-r--r-- | src/display/sp-canvas.cpp | 60 | ||||
| -rw-r--r-- | src/display/sp-canvas.h | 15 | ||||
| -rw-r--r-- | src/display/sp-ctrlline.cpp | 38 | ||||
| -rw-r--r-- | src/display/sp-ctrlline.h | 6 | ||||
| -rw-r--r-- | src/display/sp-ctrlquadr.cpp | 56 | ||||
| -rw-r--r-- | src/display/sp-ctrlquadr.h | 2 |
22 files changed, 243 insertions, 243 deletions
diff --git a/src/display/canvas-arena.cpp b/src/display/canvas-arena.cpp index e06c2a3b0..e01958c9f 100644 --- a/src/display/canvas-arena.cpp +++ b/src/display/canvas-arena.cpp @@ -32,9 +32,9 @@ static void sp_canvas_arena_class_init(SPCanvasArenaClass *klass); static void sp_canvas_arena_init(SPCanvasArena *group); static void sp_canvas_arena_destroy(GtkObject *object); -static void sp_canvas_arena_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags); +static void sp_canvas_arena_update (SPCanvasItem *item, Geom::Matrix const &affine, unsigned int flags); static void sp_canvas_arena_render (SPCanvasItem *item, SPCanvasBuf *buf); -static double sp_canvas_arena_point (SPCanvasItem *item, NR::Point p, SPCanvasItem **actual_item); +static double sp_canvas_arena_point (SPCanvasItem *item, Geom::Point p, SPCanvasItem **actual_item); static gint sp_canvas_arena_event (SPCanvasItem *item, GdkEvent *event); static gint sp_canvas_arena_send_event (SPCanvasArena *arena, GdkEvent *event); @@ -137,7 +137,7 @@ sp_canvas_arena_destroy (GtkObject *object) } static void -sp_canvas_arena_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags) +sp_canvas_arena_update (SPCanvasItem *item, Geom::Matrix const &affine, unsigned int flags) { SPCanvasArena *arena = SP_CANVAS_ARENA (item); @@ -165,8 +165,8 @@ sp_canvas_arena_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned i ec.send_event = TRUE; ec.subwindow = ec.window; ec.time = GDK_CURRENT_TIME; - ec.x = arena->c[NR::X]; - ec.y = arena->c[NR::Y]; + ec.x = arena->c[Geom::X]; + ec.y = arena->c[Geom::Y]; /* fixme: */ if (arena->active) { ec.type = GDK_LEAVE_NOTIFY; @@ -227,7 +227,7 @@ sp_canvas_arena_render (SPCanvasItem *item, SPCanvasBuf *buf) } static double -sp_canvas_arena_point (SPCanvasItem *item, NR::Point p, SPCanvasItem **actual_item) +sp_canvas_arena_point (SPCanvasItem *item, Geom::Point p, SPCanvasItem **actual_item) { SPCanvasArena *arena = SP_CANVAS_ARENA (item); @@ -267,7 +267,7 @@ sp_canvas_arena_event (SPCanvasItem *item, GdkEvent *event) arena->cursor = TRUE; /* TODO ... event -> arena transform? */ - arena->c = NR::Point(event->crossing.x, event->crossing.y); + arena->c = Geom::Point(event->crossing.x, event->crossing.y); /* fixme: Not sure abut this, but seems the right thing (Lauris) */ nr_arena_item_invoke_update (arena->root, NULL, &arena->gc, NR_ARENA_ITEM_STATE_PICK, NR_ARENA_ITEM_STATE_NONE); @@ -288,7 +288,7 @@ sp_canvas_arena_event (SPCanvasItem *item, GdkEvent *event) case GDK_MOTION_NOTIFY: /* TODO ... event -> arena transform? */ - arena->c = NR::Point(event->motion.x, event->motion.y); + arena->c = Geom::Point(event->motion.x, event->motion.y); /* fixme: Not sure abut this, but seems the right thing (Lauris) */ nr_arena_item_invoke_update (arena->root, NULL, &arena->gc, NR_ARENA_ITEM_STATE_PICK, NR_ARENA_ITEM_STATE_NONE); diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp index df402831e..0f5045c4d 100644 --- a/src/display/canvas-axonomgrid.cpp +++ b/src/display/canvas-axonomgrid.cpp @@ -197,8 +197,8 @@ CanvasAxonomGrid::CanvasAxonomGrid (SPNamedView * nv, Inkscape::XML::Node * in_r gridunit = sp_unit_get_by_abbreviation( prefs->getString("options.grids.axonom", "units").data() ); if (!gridunit) gridunit = &sp_unit_get_by_id(SP_UNIT_PX); - origin[NR::X] = sp_units_get_pixels( prefs->getDouble("options.grids.axonom", "origin_x", 0.0), *gridunit ); - origin[NR::Y] = sp_units_get_pixels( prefs->getDouble("options.grids.axonom", "origin_y", 0.0), *gridunit ); + origin[Geom::X] = sp_units_get_pixels( prefs->getDouble("options.grids.axonom", "origin_x", 0.0), *gridunit ); + origin[Geom::Y] = sp_units_get_pixels( prefs->getDouble("options.grids.axonom", "origin_y", 0.0), *gridunit ); color = prefs->getInt("options.grids.axonom", "color", 0x0000ff20); empcolor = prefs->getInt("options.grids.axonom", "empcolor", 0x0000ff40); empspacing = prefs->getInt("options.grids.axonom", "empspacing", 5); @@ -301,12 +301,12 @@ CanvasAxonomGrid::readRepr() /// @todo Replace direct XML preference node manipulation with calls to public prefs API gchar const *value; if ( (value = repr->attribute("originx")) ) { - sp_nv_read_length(value, SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE, &origin[NR::X], &gridunit); - origin[NR::X] = sp_units_get_pixels(origin[NR::X], *(gridunit)); + sp_nv_read_length(value, SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE, &origin[Geom::X], &gridunit); + origin[Geom::X] = sp_units_get_pixels(origin[Geom::X], *(gridunit)); } if ( (value = repr->attribute("originy")) ) { - sp_nv_read_length(value, SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE, &origin[NR::Y], &gridunit); - origin[NR::Y] = sp_units_get_pixels(origin[NR::Y], *(gridunit)); + sp_nv_read_length(value, SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE, &origin[Geom::Y], &gridunit); + origin[Geom::Y] = sp_units_get_pixels(origin[Geom::Y], *(gridunit)); } if ( (value = repr->attribute("spacingy")) ) { @@ -445,10 +445,10 @@ _wr.setUpdating (false); _rumg->setUnit (gridunit); gdouble val; - val = origin[NR::X]; + val = origin[Geom::X]; val = sp_pixels_get_units (val, *(gridunit)); _rsu_ox->setValue (val); - val = origin[NR::Y]; + val = origin[Geom::Y]; val = sp_pixels_get_units (val, *(gridunit)); _rsu_oy->setValue (val); val = lengthy; @@ -484,10 +484,10 @@ CanvasAxonomGrid::updateWidgets() _rumg.setUnit (gridunit); gdouble val; - val = origin[NR::X]; + val = origin[Geom::X]; val = sp_pixels_get_units (val, *(gridunit)); _rsu_ox.setValue (val); - val = origin[NR::Y]; + val = origin[Geom::Y]; val = sp_pixels_get_units (val, *(gridunit)); _rsu_oy.setValue (val); val = lengthy; @@ -510,10 +510,10 @@ CanvasAxonomGrid::updateWidgets() void -CanvasAxonomGrid::Update (NR::Matrix const &affine, unsigned int /*flags*/) +CanvasAxonomGrid::Update (Geom::Matrix const &affine, unsigned int /*flags*/) { ow = origin * affine; - sw = NR::Point(fabs(affine[0]),fabs(affine[3])); + sw = Geom::Point(fabs(affine[0]),fabs(affine[3])); for(int dim = 0; dim < 2; dim++) { gint scaling_factor = empspacing; @@ -534,10 +534,10 @@ CanvasAxonomGrid::Update (NR::Matrix const &affine, unsigned int /*flags*/) } - spacing_ylines = sw[NR::X] * lengthy /(tan_angle[X] + tan_angle[Z]); - lyw = sw[NR::Y] * lengthy; - lxw_x = (lengthy / tan_angle[X]) * sw[NR::X]; - lxw_z = (lengthy / tan_angle[Z]) * sw[NR::X]; + spacing_ylines = sw[Geom::X] * lengthy /(tan_angle[X] + tan_angle[Z]); + lyw = sw[Geom::Y] * lengthy; + lxw_x = (lengthy / tan_angle[X]) * sw[Geom::X]; + lxw_z = (lengthy / tan_angle[Z]) * sw[Geom::X]; if (empspacing == 0) { scaled = TRUE; @@ -563,12 +563,12 @@ CanvasAxonomGrid::Render (SPCanvasBuf *buf) // bc = buffer patch coordinates // tl = topleft ; br = bottomright - NR::Point buf_tl_gc; - NR::Point buf_br_gc; - buf_tl_gc[NR::X] = buf->rect.x0 - ow[NR::X]; - buf_tl_gc[NR::Y] = buf->rect.y0 - ow[NR::Y]; - buf_br_gc[NR::X] = buf->rect.x1 - ow[NR::X]; - buf_br_gc[NR::Y] = buf->rect.y1 - ow[NR::Y]; + Geom::Point buf_tl_gc; + Geom::Point buf_br_gc; + buf_tl_gc[Geom::X] = buf->rect.x0 - ow[Geom::X]; + buf_tl_gc[Geom::Y] = buf->rect.y0 - ow[Geom::Y]; + buf_br_gc[Geom::X] = buf->rect.x1 - ow[Geom::X]; + buf_br_gc[Geom::Y] = buf->rect.y1 - ow[Geom::Y]; gdouble x; gdouble y; @@ -576,9 +576,9 @@ CanvasAxonomGrid::Render (SPCanvasBuf *buf) // render the three separate line groups representing the main-axes // x-axis always goes from topleft to bottomright. (0,0) - (1,1) - gdouble const xintercept_y_bc = (buf_tl_gc[NR::X] * tan_angle[X]) - buf_tl_gc[NR::Y] ; + gdouble const xintercept_y_bc = (buf_tl_gc[Geom::X] * tan_angle[X]) - buf_tl_gc[Geom::Y] ; gdouble const xstart_y_sc = ( xintercept_y_bc - floor(xintercept_y_bc/lyw)*lyw ) + buf->rect.y0; - gint const xlinestart = (gint) Inkscape::round( (xstart_y_sc - buf->rect.x0*tan_angle[X] -ow[NR::Y]) / lyw ); + gint const xlinestart = (gint) Inkscape::round( (xstart_y_sc - buf->rect.x0*tan_angle[X] -ow[Geom::Y]) / lyw ); gint xlinenum = xlinestart; // lines starting on left side. for (y = xstart_y_sc; y < buf->rect.y1; y += lyw, xlinenum++) { @@ -610,8 +610,8 @@ CanvasAxonomGrid::Render (SPCanvasBuf *buf) } // y-axis lines (vertical) - gdouble const ystart_x_sc = floor (buf_tl_gc[NR::X] / spacing_ylines) * spacing_ylines + ow[NR::X]; - gint const ylinestart = (gint) Inkscape::round((ystart_x_sc - ow[NR::X]) / spacing_ylines); + gdouble const ystart_x_sc = floor (buf_tl_gc[Geom::X] / spacing_ylines) * spacing_ylines + ow[Geom::X]; + gint const ylinestart = (gint) Inkscape::round((ystart_x_sc - ow[Geom::X]) / spacing_ylines); gint ylinenum = ylinestart; for (x = ystart_x_sc; x < buf->rect.x1; x += spacing_ylines, ylinenum++) { gint const x0 = (gint) Inkscape::round(x); @@ -624,9 +624,9 @@ CanvasAxonomGrid::Render (SPCanvasBuf *buf) } // z-axis always goes from bottomleft to topright. (0,1) - (1,0) - gdouble const zintercept_y_bc = (buf_tl_gc[NR::X] * -tan_angle[Z]) - buf_tl_gc[NR::Y] ; + gdouble const zintercept_y_bc = (buf_tl_gc[Geom::X] * -tan_angle[Z]) - buf_tl_gc[Geom::Y] ; gdouble const zstart_y_sc = ( zintercept_y_bc - floor(zintercept_y_bc/lyw)*lyw ) + buf->rect.y0; - gint const zlinestart = (gint) Inkscape::round( (zstart_y_sc + buf->rect.x0*tan_angle[Z] - ow[NR::Y]) / lyw ); + gint const zlinestart = (gint) Inkscape::round( (zstart_y_sc + buf->rect.x0*tan_angle[Z] - ow[Geom::Y]) / lyw ); gint zlinenum = zlinestart; // lines starting from left side for (y = zstart_y_sc; y < buf->rect.y1; y += lyw, zlinenum++) { diff --git a/src/display/canvas-axonomgrid.h b/src/display/canvas-axonomgrid.h index f8dc8e25a..1d255d798 100644 --- a/src/display/canvas-axonomgrid.h +++ b/src/display/canvas-axonomgrid.h @@ -7,7 +7,6 @@ */ #include <display/sp-canvas.h> -#include <libnr/nr-coord.h> #include "xml/repr.h" #include <gtkmm/box.h> @@ -35,7 +34,7 @@ public: CanvasAxonomGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument * in_doc); virtual ~CanvasAxonomGrid(); - void Update (NR::Matrix const &affine, unsigned int flags); + void Update (Geom::Matrix const &affine, unsigned int flags); void Render (SPCanvasBuf *buf); void readRepr(); @@ -48,13 +47,13 @@ public: bool scaled; /**< Whether the grid is in scaled mode */ - NR::Point ow; /**< Transformed origin by the affine for the zoom */ + Geom::Point ow; /**< Transformed origin by the affine for the zoom */ double lyw; /**< Transformed length y by the affine for the zoom */ double lxw_x; double lxw_z; double spacing_ylines; - NR::Point sw; /**< the scaling factors of the affine transform */ + Geom::Point sw; /**< the scaling factors of the affine transform */ protected: virtual Gtk::Widget * newSpecificWidget(); diff --git a/src/display/canvas-bpath.cpp b/src/display/canvas-bpath.cpp index 74b69b9c0..8342ff7ff 100644 --- a/src/display/canvas-bpath.cpp +++ b/src/display/canvas-bpath.cpp @@ -59,9 +59,9 @@ static void sp_canvas_bpath_class_init (SPCanvasBPathClass *klass); static void sp_canvas_bpath_init (SPCanvasBPath *path); static void sp_canvas_bpath_destroy (GtkObject *object); -static void sp_canvas_bpath_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags); +static void sp_canvas_bpath_update (SPCanvasItem *item, Geom::Matrix const &affine, unsigned int flags); static void sp_canvas_bpath_render (SPCanvasItem *item, SPCanvasBuf *buf); -static double sp_canvas_bpath_point (SPCanvasItem *item, NR::Point p, SPCanvasItem **actual_item); +static double sp_canvas_bpath_point (SPCanvasItem *item, Geom::Point p, SPCanvasItem **actual_item); static SPCanvasItemClass *parent_class; @@ -128,7 +128,7 @@ sp_canvas_bpath_destroy (GtkObject *object) } static void -sp_canvas_bpath_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags) +sp_canvas_bpath_update (SPCanvasItem *item, Geom::Matrix const &affine, unsigned int flags) { SPCanvasBPath *cbp = SP_CANVAS_BPATH (item); @@ -204,7 +204,7 @@ sp_canvas_bpath_render (SPCanvasItem *item, SPCanvasBuf *buf) } static double -sp_canvas_bpath_point (SPCanvasItem *item, NR::Point p, SPCanvasItem **actual_item) +sp_canvas_bpath_point (SPCanvasItem *item, Geom::Point p, SPCanvasItem **actual_item) { SPCanvasBPath *cbp = SP_CANVAS_BPATH (item); @@ -214,7 +214,7 @@ sp_canvas_bpath_point (SPCanvasItem *item, NR::Point p, SPCanvasItem **actual_it return NR_HUGE; double width = 0.5; - Geom::Rect viewbox = to_2geom(item->canvas->getViewbox()); + Geom::Rect viewbox = item->canvas->getViewbox(); viewbox.expandBy (width); double dist = NR_HUGE; pathv_matrix_point_bbox_wind_distance(cbp->curve->get_pathvector(), cbp->affine, p, NULL, NULL, &dist, 0.5, &viewbox); @@ -295,7 +295,7 @@ static void sp_canvastext_class_init (SPCanvasTextClass *klass); static void sp_canvastext_init (SPCanvasText *canvastext); static void sp_canvastext_destroy (GtkObject *object); -static void sp_canvastext_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags); +static void sp_canvastext_update (SPCanvasItem *item, Geom::Matrix const &affine, unsigned int flags); static void sp_canvastext_render (SPCanvasItem *item, SPCanvasBuf *buf); static SPCanvasItemClass *parent_class_ct; @@ -337,8 +337,8 @@ static void sp_canvastext_init (SPCanvasText *canvastext) { canvastext->rgba = 0x0000ff7f; - canvastext->s[NR::X] = canvastext->s[NR::Y] = 0.0; - canvastext->affine = NR::identity(); + canvastext->s[Geom::X] = canvastext->s[Geom::Y] = 0.0; + canvastext->affine = Geom::identity(); canvastext->fontsize = 10.0; canvastext->item = NULL; canvastext->desktop = NULL; @@ -377,9 +377,9 @@ sp_canvastext_render (SPCanvasItem *item, SPCanvasBuf *buf) guint32 rgba = cl->rgba; cairo_set_source_rgba(buf->ct, SP_RGBA32_B_F(rgba), SP_RGBA32_G_F(rgba), SP_RGBA32_R_F(rgba), SP_RGBA32_A_F(rgba)); - NR::Point s = cl->s * cl->affine; - double offsetx = s[NR::X] - buf->rect.x0; - double offsety = s[NR::Y] - buf->rect.y0; + Geom::Point s = cl->s * cl->affine; + double offsetx = s[Geom::X] - buf->rect.x0; + double offsety = s[Geom::Y] - buf->rect.y0; offsetx -= anchor_offset_x; offsety += anchor_offset_y; @@ -392,7 +392,7 @@ sp_canvastext_render (SPCanvasItem *item, SPCanvasBuf *buf) } static void -sp_canvastext_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags) +sp_canvastext_update (SPCanvasItem *item, Geom::Matrix const &affine, unsigned int flags) { SPCanvasText *cl = SP_CANVASTEXT (item); @@ -405,7 +405,7 @@ sp_canvastext_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int cl->affine = affine; - NR::Point s = cl->s * affine; + Geom::Point s = cl->s * affine; // set up a temporary cairo_t to measure the text extents; it would be better to compute this in the render() // method but update() seems to be called before so we don't have the information available when we need it @@ -414,10 +414,10 @@ sp_canvastext_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int cairo_text_extents_t bbox; cairo_text_extents(&tmp_buf, cl->text, &bbox); **/ - item->x1 = s[NR::X] + 0; - item->y1 = s[NR::Y] - cl->fontsize; - item->x2 = s[NR::X] + cl->fontsize * strlen(cl->text); - item->y2 = s[NR::Y] + cl->fontsize * 0.5; // for letters below the baseline + item->x1 = s[Geom::X] + 0; + item->y1 = s[Geom::Y] - cl->fontsize; + item->x2 = s[Geom::X] + cl->fontsize * strlen(cl->text); + item->y2 = s[Geom::Y] + cl->fontsize * 0.5; // for letters below the baseline // adjust update region according to anchor shift // FIXME: use the correct text extent @@ -471,20 +471,20 @@ sp_canvastext_set_rgba32 (SPCanvasText *ct, guint32 rgba) void sp_canvastext_set_coords (SPCanvasText *ct, gdouble x0, gdouble y0) { - sp_canvastext_set_coords(ct, NR::Point(x0, y0)); + sp_canvastext_set_coords(ct, Geom::Point(x0, y0)); } void -sp_canvastext_set_coords (SPCanvasText *ct, const NR::Point start) +sp_canvastext_set_coords (SPCanvasText *ct, const Geom::Point start) { - NR::Point pos = ct->desktop->doc2dt(start); + Geom::Point pos = ct->desktop->doc2dt(start); g_return_if_fail (ct != NULL); g_return_if_fail (SP_IS_CANVASTEXT (ct)); - if (DIFFER (pos[0], ct->s[NR::X]) || DIFFER (pos[1], ct->s[NR::Y])) { - ct->s[NR::X] = pos[0]; - ct->s[NR::Y] = pos[1]; + if (DIFFER (pos[0], ct->s[Geom::X]) || DIFFER (pos[1], ct->s[Geom::Y])) { + ct->s[Geom::X] = pos[0]; + ct->s[Geom::Y] = pos[1]; sp_canvas_item_request_update (SP_CANVAS_ITEM (ct)); } sp_canvas_item_request_update (SP_CANVAS_ITEM (ct)); diff --git a/src/display/canvas-bpath.h b/src/display/canvas-bpath.h index d6382b651..2001bfa7d 100644 --- a/src/display/canvas-bpath.h +++ b/src/display/canvas-bpath.h @@ -64,7 +64,7 @@ struct SPCanvasBPath { /* Line def */ SPCurve *curve; - NR::Matrix affine; + Geom::Matrix affine; /* Fill attributes */ guint32 fill_rgba; @@ -114,8 +114,8 @@ struct SPCanvasText : public SPCanvasItem{ SPDesktop *desktop; // the desktop to which this text is attached; needed for coordinate transforms (TODO: these should be eliminated) gchar* text; - NR::Point s; - NR::Matrix affine; + Geom::Point s; + Geom::Matrix affine; double fontsize; double anchor_x; double anchor_y; @@ -128,7 +128,7 @@ SPCanvasItem *sp_canvastext_new(SPCanvasGroup *parent, SPDesktop *desktop, Geom: void sp_canvastext_set_rgba32 (SPCanvasText *ct, guint32 rgba); void sp_canvastext_set_coords (SPCanvasText *ct, gdouble x0, gdouble y0); -void sp_canvastext_set_coords (SPCanvasText *ct, const NR::Point start); +void sp_canvastext_set_coords (SPCanvasText *ct, const Geom::Point start); void sp_canvastext_set_text (SPCanvasText *ct, gchar const* new_text); void sp_canvastext_set_number_as_text (SPCanvasText *ct, int num); void sp_canvastext_set_fontsize (SPCanvasText *ct, double size); diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp index 948b89e6a..9b6b512b0 100644 --- a/src/display/canvas-grid.cpp +++ b/src/display/canvas-grid.cpp @@ -52,7 +52,7 @@ static void grid_canvasitem_class_init (GridCanvasItemClass *klass); static void grid_canvasitem_init (GridCanvasItem *grid); static void grid_canvasitem_destroy (GtkObject *object); -static void grid_canvasitem_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags); +static void grid_canvasitem_update (SPCanvasItem *item, Geom::Matrix const &affine, unsigned int flags); static void grid_canvasitem_render (SPCanvasItem *item, SPCanvasBuf *buf); static SPCanvasItemClass * parent_class; @@ -124,7 +124,7 @@ grid_canvasitem_render (SPCanvasItem * item, SPCanvasBuf * buf) } static void -grid_canvasitem_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags) +grid_canvasitem_update (SPCanvasItem *item, Geom::Matrix const &affine, unsigned int flags) { GridCanvasItem *gridcanvasitem = INKSCAPE_GRID_CANVASITEM (item); @@ -419,13 +419,13 @@ CanvasXYGrid::CanvasXYGrid (SPNamedView * nv, Inkscape::XML::Node * in_repr, SPD gridunit = sp_unit_get_by_abbreviation( prefs->getString("options.grids.xy", "units").data() ); if (!gridunit) gridunit = &sp_unit_get_by_id(SP_UNIT_PX); - origin[NR::X] = sp_units_get_pixels(prefs->getDouble("options.grids.xy", "origin_x", 0.0), *gridunit); - origin[NR::Y] = sp_units_get_pixels(prefs->getDouble("options.grids.xy", "origin_y", 0.0), *gridunit); + origin[Geom::X] = sp_units_get_pixels(prefs->getDouble("options.grids.xy", "origin_x", 0.0), *gridunit); + origin[Geom::Y] = sp_units_get_pixels(prefs->getDouble("options.grids.xy", "origin_y", 0.0), *gridunit); color = prefs->getInt("options.grids.xy", "color", 0x0000ff20); empcolor = prefs->getInt("options.grids.xy", "empcolor", 0x0000ff40); empspacing = prefs->getInt("options.grids.xy", "empspacing", 5); - spacing[NR::X] = sp_units_get_pixels(prefs->getDouble("options.grids.xy", "spacing_x", 0.0), *gridunit); - spacing[NR::Y] = sp_units_get_pixels(prefs->getDouble("options.grids.xy", "spacing_y", 0.0), *gridunit); + spacing[Geom::X] = sp_units_get_pixels(prefs->getDouble("options.grids.xy", "spacing_x", 0.0), *gridunit); + spacing[Geom::Y] = sp_units_get_pixels(prefs->getDouble("options.grids.xy", "spacing_y", 0.0), *gridunit); render_dotted = prefs->getBool("options.grids.xy", "dotted", false); snapper = new CanvasXYGridSnapper(this, &namedview->snap_manager, 0); @@ -568,27 +568,27 @@ CanvasXYGrid::readRepr() { gchar const *value; if ( (value = repr->attribute("originx")) ) { - sp_nv_read_length(value, SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE, &origin[NR::X], &gridunit); - origin[NR::X] = sp_units_get_pixels(origin[NR::X], *(gridunit)); + sp_nv_read_length(value, SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE, &origin[Geom::X], &gridunit); + origin[Geom::X] = sp_units_get_pixels(origin[Geom::X], *(gridunit)); } if ( (value = repr->attribute("originy")) ) { - sp_nv_read_length(value, SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE, &origin[NR::Y], &gridunit); - origin[NR::Y] = sp_units_get_pixels(origin[NR::Y], *(gridunit)); + sp_nv_read_length(value, SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE, &origin[Geom::Y], &gridunit); + origin[Geom::Y] = sp_units_get_pixels(origin[Geom::Y], *(gridunit)); } if ( (value = repr->attribute("spacingx")) ) { - double oldVal = spacing[NR::X]; - sp_nv_read_length(value, SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE, &spacing[NR::X], &gridunit); - validateScalar( oldVal, &spacing[NR::X]); - spacing[NR::X] = sp_units_get_pixels(spacing[NR::X], *(gridunit)); + double oldVal = spacing[Geom::X]; + sp_nv_read_length(value, SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE, &spacing[Geom::X], &gridunit); + validateScalar( oldVal, &spacing[Geom::X]); + spacing[Geom::X] = sp_units_get_pixels(spacing[Geom::X], *(gridunit)); } if ( (value = repr->attribute("spacingy")) ) { - double oldVal = spacing[NR::Y]; - sp_nv_read_length(value, SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE, &spacing[NR::Y], &gridunit); - validateScalar( oldVal, &spacing[NR::Y]); - spacing[NR::Y] = sp_units_get_pixels(spacing[NR::Y], *(gridunit)); + double oldVal = spacing[Geom::Y]; + sp_nv_read_length(value, SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE, &spacing[Geom::Y], &gridunit); + validateScalar( oldVal, &spacing[Geom::Y]); + spacing[Geom::Y] = sp_units_get_pixels(spacing[Geom::Y], *(gridunit)); } @@ -719,16 +719,16 @@ _wr.setUpdating (false); _rumg->setUnit (gridunit); gdouble val; - val = origin[NR::X]; + val = origin[Geom::X]; val = sp_pixels_get_units (val, *(gridunit)); _rsu_ox->setValue (val); - val = origin[NR::Y]; + val = origin[Geom::Y]; val = sp_pixels_get_units (val, *(gridunit)); _rsu_oy->setValue (val); - val = spacing[NR::X]; + val = spacing[Geom::X]; double gridx = sp_pixels_get_units (val, *(gridunit)); _rsu_sx->setValue (gridx); - val = spacing[NR::Y]; + val = spacing[Geom::Y]; double gridy = sp_pixels_get_units (val, *(gridunit)); _rsu_sy->setValue (gridy); @@ -761,16 +761,16 @@ CanvasXYGrid::updateWidgets() _rumg.setUnit (gridunit); gdouble val; - val = origin[NR::X]; + val = origin[Geom::X]; val = sp_pixels_get_units (val, *(gridunit)); _rsu_ox.setValue (val); - val = origin[NR::Y]; + val = origin[Geom::Y]; val = sp_pixels_get_units (val, *(gridunit)); _rsu_oy.setValue (val); - val = spacing[NR::X]; + val = spacing[Geom::X]; double gridx = sp_pixels_get_units (val, *(gridunit)); _rsu_sx.setValue (gridx); - val = spacing[NR::Y]; + val = spacing[Geom::Y]; double gridy = sp_pixels_get_units (val, *(gridunit)); _rsu_sy.setValue (gridy); @@ -789,11 +789,11 @@ CanvasXYGrid::updateWidgets() void -CanvasXYGrid::Update (NR::Matrix const &affine, unsigned int /*flags*/) +CanvasXYGrid::Update (Geom::Matrix const &affine, unsigned int /*flags*/) { ow = origin * affine; sw = spacing * affine; - sw -= NR::Point(affine[4], affine[5]); + sw -= Geom::Point(affine[4], affine[5]); for(int dim = 0; dim < 2; dim++) { gint scaling_factor = empspacing; @@ -881,16 +881,16 @@ grid_dot (SPCanvasBuf *buf, gint x, gint y, guint32 rgba) void CanvasXYGrid::Render (SPCanvasBuf *buf) { - gdouble const sxg = floor ((buf->rect.x0 - ow[NR::X]) / sw[NR::X]) * sw[NR::X] + ow[NR::X]; - gint const xlinestart = (gint) Inkscape::round((sxg - ow[NR::X]) / sw[NR::X]); - gdouble const syg = floor ((buf->rect.y0 - ow[NR::Y]) / sw[NR::Y]) * sw[NR::Y] + ow[NR::Y]; - gint const ylinestart = (gint) Inkscape::round((syg - ow[NR::Y]) / sw[NR::Y]); + gdouble const sxg = floor ((buf->rect.x0 - ow[Geom::X]) / sw[Geom::X]) * sw[Geom::X] + ow[Geom::X]; + gint const xlinestart = (gint) Inkscape::round((sxg - ow[Geom::X]) / sw[Geom::X]); + gdouble const syg = floor ((buf->rect.y0 - ow[Geom::Y]) / sw[Geom::Y]) * sw[Geom::Y] + ow[Geom::Y]; + gint const ylinestart = (gint) Inkscape::round((syg - ow[Geom::Y]) / sw[Geom::Y]); //set correct coloring, depending preference (when zoomed out, always major coloring or minor coloring) Inkscape::Preferences *prefs = Inkscape::Preferences::get(); guint32 _empcolor; bool no_emp_when_zoomed_out = prefs->getBool("options.grids", "no_emphasize_when_zoomedout", false); - if( (scaled[NR::X] || scaled[NR::Y]) && no_emp_when_zoomed_out ) { + if( (scaled[Geom::X] || scaled[Geom::Y]) && no_emp_when_zoomed_out ) { _empcolor = color; } else { _empcolor = empcolor; @@ -899,9 +899,9 @@ CanvasXYGrid::Render (SPCanvasBuf *buf) if (!render_dotted) { gint ylinenum; gdouble y; - for (y = syg, ylinenum = ylinestart; y < buf->rect.y1; y += sw[NR::Y], ylinenum++) { + for (y = syg, ylinenum = ylinestart; y < buf->rect.y1; y += sw[Geom::Y], ylinenum++) { gint const y0 = (gint) Inkscape::round(y); - if (!scaled[NR::Y] && (ylinenum % empspacing) != 0) { + if (!scaled[Geom::Y] && (ylinenum % empspacing) != 0) { grid_hline (buf, y0, buf->rect.x0, buf->rect.x1 - 1, color); } else { grid_hline (buf, y0, buf->rect.x0, buf->rect.x1 - 1, _empcolor); @@ -910,9 +910,9 @@ CanvasXYGrid::Render (SPCanvasBuf *buf) gint xlinenum; gdouble x; - for (x = sxg, xlinenum = xlinestart; x < buf->rect.x1; x += sw[NR::X], xlinenum++) { + for (x = sxg, xlinenum = xlinestart; x < buf->rect.x1; x += sw[Geom::X], xlinenum++) { gint const ix = (gint) Inkscape::round(x); - if (!scaled[NR::X] && (xlinenum % empspacing) != 0) { + if (!scaled[Geom::X] && (xlinenum % empspacing) != 0) { grid_vline (buf, ix, buf->rect.y0, buf->rect.y1, color); } else { grid_vline (buf, ix, buf->rect.y0, buf->rect.y1, _empcolor); @@ -921,16 +921,16 @@ CanvasXYGrid::Render (SPCanvasBuf *buf) } else { gint ylinenum; gdouble y; - for (y = syg, ylinenum = ylinestart; y < buf->rect.y1; y += sw[NR::Y], ylinenum++) { + for (y = syg, ylinenum = ylinestart; y < buf->rect.y1; y += sw[Geom::Y], ylinenum++) { gint const iy = (gint) Inkscape::round(y); gint xlinenum; gdouble x; - for (x = sxg, xlinenum = xlinestart; x < buf->rect.x1; x += sw[NR::X], xlinenum++) { + for (x = sxg, xlinenum = xlinestart; x < buf->rect.x1; x += sw[Geom::X], xlinenum++) { gint const ix = (gint) Inkscape::round(x); - if ( (!scaled[NR::X] && (xlinenum % empspacing) != 0) - || (!scaled[NR::Y] && (ylinenum % empspacing) != 0) - || ((scaled[NR::X] || scaled[NR::Y]) && no_emp_when_zoomed_out) ) + if ( (!scaled[Geom::X] && (xlinenum % empspacing) != 0) + || (!scaled[Geom::Y] && (ylinenum % empspacing) != 0) + || ((scaled[Geom::X] || scaled[Geom::Y]) && no_emp_when_zoomed_out) ) { grid_dot (buf, ix, iy, color | (guint32)0x000000FF); // put alpha to max value } else { @@ -949,7 +949,7 @@ CanvasXYGrid::Render (SPCanvasBuf *buf) } } -CanvasXYGridSnapper::CanvasXYGridSnapper(CanvasXYGrid *grid, SnapManager const *sm, NR::Coord const d) : LineSnapper(sm, d) +CanvasXYGridSnapper::CanvasXYGridSnapper(CanvasXYGrid *grid, SnapManager const *sm, Geom::Coord const d) : LineSnapper(sm, d) { this->grid = grid; } diff --git a/src/display/canvas-grid.h b/src/display/canvas-grid.h index 20cb31473..66f3bc43c 100644 --- a/src/display/canvas-grid.h +++ b/src/display/canvas-grid.h @@ -81,7 +81,7 @@ public: GridCanvasItem * createCanvasItem(SPDesktop * desktop); - virtual void Update (NR::Matrix const &affine, unsigned int flags) = 0; + virtual void Update (Geom::Matrix const &affine, unsigned int flags) = 0; virtual void Render (SPCanvasBuf *buf) = 0; virtual void readRepr() = 0; @@ -89,7 +89,7 @@ public: Gtk::Widget * newWidget(); - NR::Point origin; /**< Origin of the grid */ + Geom::Point origin; /**< Origin of the grid */ guint32 color; /**< Color for normal lines */ guint32 empcolor; /**< Color for emphasis lines */ gint empspacing; /**< Spacing between emphasis lines */ @@ -131,18 +131,18 @@ public: CanvasXYGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument * in_doc); virtual ~CanvasXYGrid(); - void Update (NR::Matrix const &affine, unsigned int flags); + void Update (Geom::Matrix const &affine, unsigned int flags); void Render (SPCanvasBuf *buf); void readRepr(); void onReprAttrChanged (Inkscape::XML::Node * repr, const gchar *key, const gchar *oldval, const gchar *newval, bool is_interactive); - NR::Point spacing; /**< Spacing between elements of the grid */ + Geom::Point spacing; /**< Spacing between elements of the grid */ bool scaled[2]; /**< Whether the grid is in scaled mode, which can be different in the X or Y direction, hense two variables */ - NR::Point ow; /**< Transformed origin by the affine for the zoom */ - NR::Point sw; /**< Transformed spacing by the affine for the zoom */ + Geom::Point ow; /**< Transformed origin by the affine for the zoom */ + Geom::Point sw; /**< Transformed spacing by the affine for the zoom */ protected: virtual Gtk::Widget * newSpecificWidget(); diff --git a/src/display/gnome-canvas-acetate.cpp b/src/display/gnome-canvas-acetate.cpp index ee6834075..fdb137e27 100644 --- a/src/display/gnome-canvas-acetate.cpp +++ b/src/display/gnome-canvas-acetate.cpp @@ -21,8 +21,8 @@ static void sp_canvas_acetate_class_init (SPCanvasAcetateClass *klass); static void sp_canvas_acetate_init (SPCanvasAcetate *acetate); static void sp_canvas_acetate_destroy (GtkObject *object); -static void sp_canvas_acetate_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags); -static double sp_canvas_acetate_point (SPCanvasItem *item, NR::Point p, SPCanvasItem **actual_item); +static void sp_canvas_acetate_update (SPCanvasItem *item, Geom::Matrix const &affine, unsigned int flags); +static double sp_canvas_acetate_point (SPCanvasItem *item, Geom::Point p, SPCanvasItem **actual_item); static SPCanvasItemClass *parent_class; @@ -82,7 +82,7 @@ sp_canvas_acetate_destroy (GtkObject *object) } static void -sp_canvas_acetate_update( SPCanvasItem *item, NR::Matrix const &/*affine*/, unsigned int /*flags*/ ) +sp_canvas_acetate_update( SPCanvasItem *item, Geom::Matrix const &/*affine*/, unsigned int /*flags*/ ) { item->x1 = -G_MAXINT; item->y1 = -G_MAXINT; @@ -91,7 +91,7 @@ sp_canvas_acetate_update( SPCanvasItem *item, NR::Matrix const &/*affine*/, unsi } static double -sp_canvas_acetate_point( SPCanvasItem *item, NR::Point /*p*/, SPCanvasItem **actual_item ) +sp_canvas_acetate_point( SPCanvasItem *item, Geom::Point /*p*/, SPCanvasItem **actual_item ) { *actual_item = item; diff --git a/src/display/guideline.cpp b/src/display/guideline.cpp index e2e014eff..cd1a12213 100644 --- a/src/display/guideline.cpp +++ b/src/display/guideline.cpp @@ -15,6 +15,7 @@ #include <libnr/nr-pixops.h> +#include <2geom/transforms.h> #include "display-forward.h" #include "sp-canvas-util.h" #include "guideline.h" @@ -23,10 +24,10 @@ static void sp_guideline_class_init(SPGuideLineClass *c); static void sp_guideline_init(SPGuideLine *guideline); static void sp_guideline_destroy(GtkObject *object); -static void sp_guideline_update(SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags); +static void sp_guideline_update(SPCanvasItem *item, Geom::Matrix const &affine, unsigned int flags); static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf); -static double sp_guideline_point(SPCanvasItem *item, NR::Point p, SPCanvasItem **actual_item); +static double sp_guideline_point(SPCanvasItem *item, Geom::Point p, SPCanvasItem **actual_item); static void sp_guideline_drawline (SPCanvasBuf *buf, gint x0, gint y0, gint x1, gint y1, guint32 rgba); @@ -168,7 +169,7 @@ static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf) } } -static void sp_guideline_update(SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags) +static void sp_guideline_update(SPCanvasItem *item, Geom::Matrix const &affine, unsigned int flags) { SPGuideLine *gl = SP_GUIDELINE(item); @@ -189,7 +190,7 @@ static void sp_guideline_update(SPCanvasItem *item, NR::Matrix const &affine, un } // Returns 0.0 if point is on the guideline -static double sp_guideline_point(SPCanvasItem *item, NR::Point p, SPCanvasItem **actual_item) +static double sp_guideline_point(SPCanvasItem *item, Geom::Point p, SPCanvasItem **actual_item) { SPGuideLine *gl = SP_GUIDELINE (item); @@ -221,7 +222,7 @@ SPCanvasItem *sp_guideline_new(SPCanvasGroup *parent, Geom::Point point_on_line, void sp_guideline_set_position(SPGuideLine *gl, Geom::Point point_on_line) { sp_canvas_item_affine_absolute(SP_CANVAS_ITEM (gl), - NR::Matrix(NR::translate(point_on_line))); + Geom::Matrix(Geom::Translate(point_on_line))); } void sp_guideline_set_normal(SPGuideLine *gl, Geom::Point normal_to_line) diff --git a/src/display/nr-arena-shape.cpp b/src/display/nr-arena-shape.cpp index 554ea2dc9..751801c7e 100644 --- a/src/display/nr-arena-shape.cpp +++ b/src/display/nr-arena-shape.cpp @@ -1094,7 +1094,7 @@ nr_arena_shape_pick(NRArenaItem *item, NR::Point p, double delta, unsigned int / && shape->_fill.opacity > 1e-3 && !outline); if (item->arena->canvasarena) { - Geom::Rect viewbox = to_2geom(item->arena->canvasarena->item.canvas->getViewbox()); + Geom::Rect viewbox = item->arena->canvasarena->item.canvas->getViewbox(); viewbox.expandBy (width); pathv_matrix_point_bbox_wind_distance(shape->curve->get_pathvector(), shape->ctm, p, NULL, needfill? &wind : NULL, &dist, 0.5, &viewbox); } else { diff --git a/src/display/sodipodi-ctrl.cpp b/src/display/sodipodi-ctrl.cpp index db199d3a5..1bed9355d 100644 --- a/src/display/sodipodi-ctrl.cpp +++ b/src/display/sodipodi-ctrl.cpp @@ -8,6 +8,7 @@ * */ +#include <2geom/transforms.h> #include "sp-canvas-util.h" #include "display-forward.h" #include "sodipodi-ctrl.h" @@ -31,10 +32,10 @@ static void sp_ctrl_init (SPCtrl *ctrl); static void sp_ctrl_destroy (GtkObject *object); static void sp_ctrl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void sp_ctrl_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags); +static void sp_ctrl_update (SPCanvasItem *item, Geom::Matrix const &affine, unsigned int flags); static void sp_ctrl_render (SPCanvasItem *item, SPCanvasBuf *buf); -static double sp_ctrl_point (SPCanvasItem *item, NR::Point p, SPCanvasItem **actual_item); +static double sp_ctrl_point (SPCanvasItem *item, Geom::Point p, SPCanvasItem **actual_item); static SPCanvasItemClass *parent_class; @@ -202,7 +203,7 @@ sp_ctrl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) } static void -sp_ctrl_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags) +sp_ctrl_update (SPCanvasItem *item, Geom::Matrix const &affine, unsigned int flags) { SPCtrl *ctrl; gint x, y; @@ -272,14 +273,14 @@ sp_ctrl_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags } static double -sp_ctrl_point (SPCanvasItem *item, NR::Point p, SPCanvasItem **actual_item) +sp_ctrl_point (SPCanvasItem *item, Geom::Point p, SPCanvasItem **actual_item) { SPCtrl *ctrl = SP_CTRL (item); *actual_item = item; - double const x = p[NR::X]; - double const y = p[NR::Y]; + double const x = p[Geom::X]; + double const y = p[Geom::Y]; if ((x >= ctrl->box.x0) && (x <= ctrl->box.x1) && (y >= ctrl->box.y0) && (y <= ctrl->box.y1)) return 0.0; @@ -540,8 +541,8 @@ sp_ctrl_render (SPCanvasItem *item, SPCanvasBuf *buf) ctrl->shown = TRUE; } -void SPCtrl::moveto (NR::Point const p) { - sp_canvas_item_affine_absolute (SP_CANVAS_ITEM (this), NR::Matrix(NR::translate (p))); +void SPCtrl::moveto (Geom::Point const p) { + sp_canvas_item_affine_absolute (SP_CANVAS_ITEM (this), Geom::Matrix(Geom::Translate (p))); _moved = true; } diff --git a/src/display/sodipodi-ctrl.h b/src/display/sodipodi-ctrl.h index 2a68d1943..634e9ff3e 100644 --- a/src/display/sodipodi-ctrl.h +++ b/src/display/sodipodi-ctrl.h @@ -53,7 +53,7 @@ struct SPCtrl : public SPCanvasItem{ guchar *cache; GdkPixbuf * pixbuf; - void moveto(NR::Point const p); + void moveto(Geom::Point const p); }; struct SPCtrlClass : public SPCanvasItemClass{ diff --git a/src/display/sodipodi-ctrlrect.cpp b/src/display/sodipodi-ctrlrect.cpp index 28c76e704..682488efc 100644 --- a/src/display/sodipodi-ctrlrect.cpp +++ b/src/display/sodipodi-ctrlrect.cpp @@ -31,7 +31,7 @@ static void sp_ctrlrect_class_init(SPCtrlRectClass *c); static void sp_ctrlrect_init(CtrlRect *ctrlrect); static void sp_ctrlrect_destroy(GtkObject *object); -static void sp_ctrlrect_update(SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags); +static void sp_ctrlrect_update(SPCanvasItem *item, Geom::Matrix const &affine, unsigned int flags); static void sp_ctrlrect_render(SPCanvasItem *item, SPCanvasBuf *buf); static SPCanvasItemClass *parent_class; @@ -161,7 +161,7 @@ static void sp_ctrlrect_render(SPCanvasItem *item, SPCanvasBuf *buf) } -static void sp_ctrlrect_update(SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags) +static void sp_ctrlrect_update(SPCanvasItem *item, Geom::Matrix const &affine, unsigned int flags) { SP_CTRLRECT(item)->update(affine, flags); } @@ -177,7 +177,7 @@ void CtrlRect::init() _area.x0 = _area.y0 = 0; _area.x1 = _area.y1 = 0; - _rect = NR::Rect(NR::Point(0,0),NR::Point(0,0)); + _rect = Geom::Rect(Geom::Point(0,0),Geom::Point(0,0)); _shadow_size = 0; @@ -221,7 +221,7 @@ void CtrlRect::render(SPCanvasBuf *buf) } -void CtrlRect::update(NR::Matrix const &affine, unsigned int flags) +void CtrlRect::update(Geom::Matrix const &affine, unsigned int flags) { if (((SPCanvasItemClass *) parent_class)->update) { ((SPCanvasItemClass *) parent_class)->update(this, affine, flags); @@ -255,12 +255,12 @@ void CtrlRect::update(NR::Matrix const &affine, unsigned int flags) } } - NR::Rect bbox(_rect.min() * affine, _rect.max() * affine); + Geom::Rect bbox(_rect.min() * affine, _rect.max() * affine); - _area.x0 = (int) floor(bbox.min()[NR::X] + 0.5); - _area.y0 = (int) floor(bbox.min()[NR::Y] + 0.5); - _area.x1 = (int) floor(bbox.max()[NR::X] + 0.5); - _area.y1 = (int) floor(bbox.max()[NR::Y] + 0.5); + _area.x0 = (int) floor(bbox.min()[Geom::X] + 0.5); + _area.y0 = (int) floor(bbox.min()[Geom::Y] + 0.5); + _area.x1 = (int) floor(bbox.max()[Geom::X] + 0.5); + _area.y1 = (int) floor(bbox.max()[Geom::Y] + 0.5); _shadow_size = _shadow; @@ -312,7 +312,7 @@ void CtrlRect::setShadow(int s, guint c) _requestUpdate(); } -void CtrlRect::setRectangle(NR::Rect const &r) +void CtrlRect::setRectangle(Geom::Rect const &r) { _rect = r; _requestUpdate(); diff --git a/src/display/sodipodi-ctrlrect.h b/src/display/sodipodi-ctrlrect.h index dc931b7dc..7e5f5157e 100644 --- a/src/display/sodipodi-ctrlrect.h +++ b/src/display/sodipodi-ctrlrect.h @@ -32,16 +32,16 @@ public: void init(); void setColor(guint32 b, bool h, guint f); void setShadow(int s, guint c); - void setRectangle(NR::Rect const &r); + void setRectangle(Geom::Rect const &r); void setDashed(bool d); void render(SPCanvasBuf *buf); - void update(NR::Matrix const &affine, unsigned int flags); + void update(Geom::Matrix const &affine, unsigned int flags); private: void _requestUpdate(); - NR::Rect _rect; + Geom::Rect _rect; bool _has_fill; bool _dashed; NRRectL _area; diff --git a/src/display/sp-canvas-util.cpp b/src/display/sp-canvas-util.cpp index 9be8d5844..4badb6c3e 100644 --- a/src/display/sp-canvas-util.cpp +++ b/src/display/sp-canvas-util.cpp @@ -76,7 +76,7 @@ sp_canvas_clear_buffer (SPCanvasBuf *buf) } } -NR::Matrix sp_canvas_item_i2p_affine (SPCanvasItem * item) +Geom::Matrix sp_canvas_item_i2p_affine (SPCanvasItem * item) { g_assert (item != NULL); /* this may be overly zealous - it is * plausible that this gets called @@ -85,7 +85,7 @@ NR::Matrix sp_canvas_item_i2p_affine (SPCanvasItem * item) return item->xform; } -NR::Matrix sp_canvas_item_i2i_affine (SPCanvasItem * from, SPCanvasItem * to) +Geom::Matrix sp_canvas_item_i2i_affine (SPCanvasItem * from, SPCanvasItem * to) { g_assert (from != NULL); g_assert (to != NULL); @@ -93,7 +93,7 @@ NR::Matrix sp_canvas_item_i2i_affine (SPCanvasItem * from, SPCanvasItem * to) return sp_canvas_item_i2w_affine(from) * sp_canvas_item_i2w_affine(to).inverse(); } -void sp_canvas_item_set_i2w_affine (SPCanvasItem * item, NR::Matrix const &i2w) +void sp_canvas_item_set_i2w_affine (SPCanvasItem * item, Geom::Matrix const &i2w) { g_assert (item != NULL); diff --git a/src/display/sp-canvas-util.h b/src/display/sp-canvas-util.h index 0b2ec40d7..4708126e5 100644 --- a/src/display/sp-canvas-util.h +++ b/src/display/sp-canvas-util.h @@ -28,15 +28,15 @@ sp_canvas_clear_buffer (SPCanvasBuf * buf); /* get i2p (item to parent) affine transformation as general 6-element array */ -NR::Matrix sp_canvas_item_i2p_affine (SPCanvasItem * item); +Geom::Matrix sp_canvas_item_i2p_affine (SPCanvasItem * item); /* get i2i (item to item) affine transformation as general 6-element array */ -NR::Matrix sp_canvas_item_i2i_affine (SPCanvasItem * from, SPCanvasItem * to); +Geom::Matrix sp_canvas_item_i2i_affine (SPCanvasItem * from, SPCanvasItem * to); /* set item affine matrix to achieve given i2w matrix */ -void sp_canvas_item_set_i2w_affine (SPCanvasItem * item, NR::Matrix const & aff); +void sp_canvas_item_set_i2w_affine (SPCanvasItem * item, Geom::Matrix const & aff); void sp_canvas_item_move_to_z (SPCanvasItem * item, gint z); diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index 3beb26b72..fd124aa1e 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -171,7 +171,7 @@ static void sp_canvas_item_init (SPCanvasItem *item) { item->flags |= SP_CANVAS_ITEM_VISIBLE; - item->xform = NR::Matrix(NR::identity()); + item->xform = Geom::Matrix(Geom::identity()); } /** @@ -246,7 +246,7 @@ sp_canvas_item_dispose (GObject *object) // this redraws only the stroke of the rect to be deleted, // avoiding redraw of the entire area if (SP_IS_CTRLRECT(item)) { - SP_CTRLRECT(object)->setRectangle(NR::Rect(NR::Point(0,0),NR::Point(0,0))); + SP_CTRLRECT(object)->setRectangle(Geom::Rect(Geom::Point(0,0),Geom::Point(0,0))); SP_CTRLRECT(object)->update(item->xform, 0); } else { redraw_if_visible (item); @@ -284,10 +284,10 @@ sp_canvas_item_dispose (GObject *object) * NB! affine is parent2canvas. */ static void -sp_canvas_item_invoke_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags) +sp_canvas_item_invoke_update (SPCanvasItem *item, Geom::Matrix const &affine, unsigned int flags) { /* Apply the child item's transform */ - NR::Matrix child_affine = item->xform * affine; + Geom::Matrix child_affine = item->xform * affine; /* apply object flags to child flags */ int child_flags = flags & ~SP_CANVAS_UPDATE_REQUESTED; @@ -331,7 +331,7 @@ sp_canvas_item_invoke_point (SPCanvasItem *item, Geom::Point p, SPCanvasItem **a * @affine: An affine transformation matrix. */ void -sp_canvas_item_affine_absolute (SPCanvasItem *item, NR::Matrix const &affine) +sp_canvas_item_affine_absolute (SPCanvasItem *item, Geom::Matrix const &affine) { item->xform = affine; @@ -586,11 +586,11 @@ sp_canvas_item_ungrab (SPCanvasItem *item, guint32 etime) * Returns the product of all transformation matrices from the root item down * to the item. */ -NR::Matrix sp_canvas_item_i2w_affine(SPCanvasItem const *item) +Geom::Matrix sp_canvas_item_i2w_affine(SPCanvasItem const *item) { g_assert (SP_IS_CANVAS_ITEM (item)); // should we get this? - NR::Matrix affine = NR::identity(); + Geom::Matrix affine = Geom::identity(); while (item) { affine *= item->xform; @@ -685,8 +685,8 @@ static void sp_canvas_group_class_init (SPCanvasGroupClass *klass); static void sp_canvas_group_init (SPCanvasGroup *group); static void sp_canvas_group_destroy (GtkObject *object); -static void sp_canvas_group_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags); -static double sp_canvas_group_point (SPCanvasItem *item, NR::Point p, SPCanvasItem **actual_item); +static void sp_canvas_group_update (SPCanvasItem *item, Geom::Matrix const &affine, unsigned int flags); +static double sp_canvas_group_point (SPCanvasItem *item, Geom::Point p, SPCanvasItem **actual_item); static void sp_canvas_group_render (SPCanvasItem *item, SPCanvasBuf *buf); static SPCanvasItemClass *group_parent_class; @@ -770,10 +770,10 @@ sp_canvas_group_destroy (GtkObject *object) * Update handler for canvas groups */ static void -sp_canvas_group_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags) +sp_canvas_group_update (SPCanvasItem *item, Geom::Matrix const &affine, unsigned int flags) { SPCanvasGroup const *group = SP_CANVAS_GROUP (item); - NR::ConvexHull corners(NR::Point(0, 0)); + NR::ConvexHull corners(Geom::Point(0, 0)); bool empty=true; for (GList *list = group->items; list; list = list->next) { @@ -783,12 +783,12 @@ sp_canvas_group_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned i if ( i->x2 > i->x1 && i->y2 > i->y1 ) { if (empty) { - corners = NR::ConvexHull(NR::Point(i->x1, i->y1)); + corners = NR::ConvexHull(Geom::Point(i->x1, i->y1)); empty = false; } else { - corners.add(NR::Point(i->x1, i->y1)); + corners.add(Geom::Point(i->x1, i->y1)); } - corners.add(NR::Point(i->x2, i->y2)); + corners.add(Geom::Point(i->x2, i->y2)); } } @@ -808,11 +808,11 @@ sp_canvas_group_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned i * Point handler for canvas groups. */ static double -sp_canvas_group_point (SPCanvasItem *item, NR::Point p, SPCanvasItem **actual_item) +sp_canvas_group_point (SPCanvasItem *item, Geom::Point p, SPCanvasItem **actual_item) { SPCanvasGroup const *group = SP_CANVAS_GROUP (item); - double const x = p[NR::X]; - double const y = p[NR::Y]; + double const x = p[Geom::X]; + double const y = p[Geom::Y]; int x1 = (int)(x - item->canvas->close_enough); int y1 = (int)(y - item->canvas->close_enough); int x2 = (int)(x + item->canvas->close_enough); @@ -1821,7 +1821,7 @@ The default for now is the strips mode. lo.x1 = mid; hi.x0 = mid; - if (setup->mouse_loc[NR::X] < mid) { + if (setup->mouse_loc[Geom::X] < mid) { // Always paint towards the mouse first return sp_canvas_paint_rect_internal(setup, lo) && sp_canvas_paint_rect_internal(setup, hi); @@ -1838,7 +1838,7 @@ The default for now is the strips mode. lo.y1 = mid; hi.y0 = mid; - if (setup->mouse_loc[NR::Y] < mid) { + if (setup->mouse_loc[Geom::Y] < mid) { // Always paint towards the mouse first return sp_canvas_paint_rect_internal(setup, lo) && sp_canvas_paint_rect_internal(setup, hi); @@ -2029,7 +2029,7 @@ static int paint (SPCanvas *canvas) { if (canvas->need_update) { - sp_canvas_item_invoke_update (canvas->root, NR::identity(), 0); + sp_canvas_item_invoke_update (canvas->root, Geom::identity(), 0); canvas->need_update = FALSE; } @@ -2086,7 +2086,7 @@ do_update (SPCanvas *canvas) /* Cause the update if necessary */ if (canvas->need_update) { - sp_canvas_item_invoke_update (canvas->root, NR::identity(), 0); + sp_canvas_item_invoke_update (canvas->root, Geom::identity(), 0); canvas->need_update = FALSE; } @@ -2296,23 +2296,21 @@ bool sp_canvas_world_pt_inside_window(SPCanvas const *canvas, Geom::Point const g_assert( canvas != NULL ); g_assert(SP_IS_CANVAS(canvas)); - using NR::X; - using NR::Y; GtkWidget const &w = *GTK_WIDGET(canvas); - return ( ( canvas->x0 <= world[X] ) && - ( canvas->y0 <= world[Y] ) && - ( world[X] < canvas->x0 + w.allocation.width ) && - ( world[Y] < canvas->y0 + w.allocation.height ) ); + return ( ( canvas->x0 <= world[Geom::X] ) && + ( canvas->y0 <= world[Geom::Y] ) && + ( world[Geom::X] < canvas->x0 + w.allocation.width ) && + ( world[Geom::Y] < canvas->y0 + w.allocation.height ) ); } /** - * Return canvas window coordinates as NR::Rect. + * Return canvas window coordinates as Geom::Rect. */ -NR::Rect SPCanvas::getViewbox() const +Geom::Rect SPCanvas::getViewbox() const { GtkWidget const *w = GTK_WIDGET(this); - return NR::Rect(Geom::Point(dx0, dy0), - Geom::Point(dx0 + w->allocation.width, dy0 + w->allocation.height)); + return Geom::Rect(Geom::Point(dx0, dy0), + Geom::Point(dx0 + w->allocation.width, dy0 + w->allocation.height)); } /** diff --git a/src/display/sp-canvas.h b/src/display/sp-canvas.h index 8f743436f..60bda5818 100644 --- a/src/display/sp-canvas.h +++ b/src/display/sp-canvas.h @@ -36,9 +36,10 @@ #include <glibmm/ustring.h> #include <libnr/nr-matrix.h> -#include <libnr/nr-rect.h> #include <libnr/nr-rect-l.h> +#include <2geom/rect.h> + G_BEGIN_DECLS struct SPCanvas; @@ -75,17 +76,17 @@ struct SPCanvasItem : public GtkObject { double x1, y1, x2, y2; NR::Rect bounds; - NR::Matrix xform; + Geom::Matrix xform; }; /** * The vtable of an SPCanvasItem. */ struct _SPCanvasItemClass : public GtkObjectClass { - void (* update) (SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags); + void (* update) (SPCanvasItem *item, Geom::Matrix const &affine, unsigned int flags); void (* render) (SPCanvasItem *item, SPCanvasBuf *buf); - double (* point) (SPCanvasItem *item, NR::Point p, SPCanvasItem **actual_item); + double (* point) (SPCanvasItem *item, Geom::Point p, SPCanvasItem **actual_item); int (* event) (SPCanvasItem *item, GdkEvent *event); }; @@ -96,7 +97,7 @@ G_END_DECLS #define sp_canvas_item_set gtk_object_set -void sp_canvas_item_affine_absolute(SPCanvasItem *item, NR::Matrix const &aff); +void sp_canvas_item_affine_absolute(SPCanvasItem *item, Geom::Matrix const &aff); void sp_canvas_item_raise(SPCanvasItem *item, int positions); void sp_canvas_item_lower(SPCanvasItem *item, int positions); @@ -105,7 +106,7 @@ void sp_canvas_item_hide(SPCanvasItem *item); int sp_canvas_item_grab(SPCanvasItem *item, unsigned int event_mask, GdkCursor *cursor, guint32 etime); void sp_canvas_item_ungrab(SPCanvasItem *item, guint32 etime); -NR::Matrix sp_canvas_item_i2w_affine(SPCanvasItem const *item); +Geom::Matrix sp_canvas_item_i2w_affine(SPCanvasItem const *item); void sp_canvas_item_grab_focus(SPCanvasItem *item); @@ -190,7 +191,7 @@ struct SPCanvas { bool is_scrolling; - NR::Rect getViewbox() const; + Geom::Rect getViewbox() const; NR::IRect getViewboxIntegers() const; }; diff --git a/src/display/sp-ctrlline.cpp b/src/display/sp-ctrlline.cpp index 8f71a0cc0..be0b8d1c6 100644 --- a/src/display/sp-ctrlline.cpp +++ b/src/display/sp-ctrlline.cpp @@ -34,7 +34,7 @@ static void sp_ctrlline_class_init (SPCtrlLineClass *klass); static void sp_ctrlline_init (SPCtrlLine *ctrlline); static void sp_ctrlline_destroy (GtkObject *object); -static void sp_ctrlline_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags); +static void sp_ctrlline_update (SPCanvasItem *item, Geom::Matrix const &affine, unsigned int flags); static void sp_ctrlline_render (SPCanvasItem *item, SPCanvasBuf *buf); static SPCanvasItemClass *parent_class; @@ -77,7 +77,7 @@ static void sp_ctrlline_init (SPCtrlLine *ctrlline) { ctrlline->rgba = 0x0000ff7f; - ctrlline->s[NR::X] = ctrlline->s[NR::Y] = ctrlline->e[NR::X] = ctrlline->e[NR::Y] = 0.0; + ctrlline->s[Geom::X] = ctrlline->s[Geom::Y] = ctrlline->e[Geom::X] = ctrlline->e[Geom::Y] = 0.0; ctrlline->item=NULL; } @@ -111,17 +111,17 @@ sp_ctrlline_render (SPCanvasItem *item, SPCanvasBuf *buf) cairo_set_line_width(buf->ct, 1); cairo_new_path(buf->ct); - NR::Point s = cl->s * cl->affine; - NR::Point e = cl->e * cl->affine; + Geom::Point s = cl->s * cl->affine; + Geom::Point e = cl->e * cl->affine; - cairo_move_to (buf->ct, s[NR::X] - buf->rect.x0, s[NR::Y] - buf->rect.y0); - cairo_line_to (buf->ct, e[NR::X] - buf->rect.x0, e[NR::Y] - buf->rect.y0); + cairo_move_to (buf->ct, s[Geom::X] - buf->rect.x0, s[Geom::Y] - buf->rect.y0); + cairo_line_to (buf->ct, e[Geom::X] - buf->rect.x0, e[Geom::Y] - buf->rect.y0); cairo_stroke(buf->ct); } static void -sp_ctrlline_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags) +sp_ctrlline_update (SPCanvasItem *item, Geom::Matrix const &affine, unsigned int flags) { SPCtrlLine *cl = SP_CTRLLINE (item); @@ -134,13 +134,13 @@ sp_ctrlline_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int f cl->affine = affine; - NR::Point s = cl->s * affine; - NR::Point e = cl->e * affine; + Geom::Point s = cl->s * affine; + Geom::Point e = cl->e * affine; - item->x1 = round(MIN(s[NR::X], e[NR::X]) - 1); - item->y1 = round(MIN(s[NR::Y], e[NR::Y]) - 1); - item->x2 = round(MAX(s[NR::X], e[NR::X]) + 1); - item->y2 = round(MAX(s[NR::Y], e[NR::Y]) + 1); + item->x1 = round(MIN(s[Geom::X], e[Geom::X]) - 1); + item->y1 = round(MIN(s[Geom::Y], e[Geom::Y]) - 1); + item->x2 = round(MAX(s[Geom::X], e[Geom::X]) + 1); + item->y2 = round(MAX(s[Geom::Y], e[Geom::Y]) + 1); sp_canvas_request_redraw (item->canvas, (int)item->x1, (int)item->y1, (int)item->x2, (int)item->y2); } @@ -168,17 +168,17 @@ sp_ctrlline_set_coords (SPCtrlLine *cl, gdouble x0, gdouble y0, gdouble x1, gdou g_return_if_fail (cl != NULL); g_return_if_fail (SP_IS_CTRLLINE (cl)); - if (DIFFER (x0, cl->s[NR::X]) || DIFFER (y0, cl->s[NR::Y]) || DIFFER (x1, cl->e[NR::X]) || DIFFER (y1, cl->e[NR::Y])) { - cl->s[NR::X] = x0; - cl->s[NR::Y] = y0; - cl->e[NR::X] = x1; - cl->e[NR::Y] = y1; + if (DIFFER (x0, cl->s[Geom::X]) || DIFFER (y0, cl->s[Geom::Y]) || DIFFER (x1, cl->e[Geom::X]) || DIFFER (y1, cl->e[Geom::Y])) { + cl->s[Geom::X] = x0; + cl->s[Geom::Y] = y0; + cl->e[Geom::X] = x1; + cl->e[Geom::Y] = y1; sp_canvas_item_request_update (SP_CANVAS_ITEM (cl)); } } void -sp_ctrlline_set_coords (SPCtrlLine *cl, const NR::Point start, const NR::Point end) +sp_ctrlline_set_coords (SPCtrlLine *cl, const Geom::Point start, const Geom::Point end) { sp_ctrlline_set_coords(cl, start[0], start[1], end[0], end[1]); } diff --git a/src/display/sp-ctrlline.h b/src/display/sp-ctrlline.h index 88bebe601..696fb52ee 100644 --- a/src/display/sp-ctrlline.h +++ b/src/display/sp-ctrlline.h @@ -25,8 +25,8 @@ struct SPItem; struct SPCtrlLine : public SPCanvasItem{ SPItem *item; // the item to which this line belongs in some sense; may be NULL for some users guint32 rgba; - NR::Point s, e; - NR::Matrix affine; + Geom::Point s, e; + Geom::Matrix affine; }; struct SPCtrlLineClass : public SPCanvasItemClass{}; @@ -34,7 +34,7 @@ GType sp_ctrlline_get_type (void); void sp_ctrlline_set_rgba32 (SPCtrlLine *cl, guint32 rgba); void sp_ctrlline_set_coords (SPCtrlLine *cl, gdouble x0, gdouble y0, gdouble x1, gdouble y1); -void sp_ctrlline_set_coords (SPCtrlLine *cl, const NR::Point start, const NR::Point end); +void sp_ctrlline_set_coords (SPCtrlLine *cl, const Geom::Point start, const Geom::Point end); diff --git a/src/display/sp-ctrlquadr.cpp b/src/display/sp-ctrlquadr.cpp index c8a71512d..31766c3c2 100644 --- a/src/display/sp-ctrlquadr.cpp +++ b/src/display/sp-ctrlquadr.cpp @@ -23,8 +23,8 @@ struct SPCtrlQuadr : public SPCanvasItem{ guint32 rgba; - NR::Point p1, p2, p3, p4; - NR::Matrix affine; + Geom::Point p1, p2, p3, p4; + Geom::Matrix affine; }; struct SPCtrlQuadrClass : public SPCanvasItemClass{}; @@ -33,7 +33,7 @@ static void sp_ctrlquadr_class_init (SPCtrlQuadrClass *klass); static void sp_ctrlquadr_init (SPCtrlQuadr *ctrlquadr); static void sp_ctrlquadr_destroy (GtkObject *object); -static void sp_ctrlquadr_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags); +static void sp_ctrlquadr_update (SPCanvasItem *item, Geom::Matrix const &affine, unsigned int flags); static void sp_ctrlquadr_render (SPCanvasItem *item, SPCanvasBuf *buf); static SPCanvasItemClass *parent_class; @@ -76,10 +76,10 @@ static void sp_ctrlquadr_init (SPCtrlQuadr *ctrlquadr) { ctrlquadr->rgba = 0x000000ff; - ctrlquadr->p1 = NR::Point(0, 0); - ctrlquadr->p2 = NR::Point(0, 0); - ctrlquadr->p3 = NR::Point(0, 0); - ctrlquadr->p4 = NR::Point(0, 0); + ctrlquadr->p1 = Geom::Point(0, 0); + ctrlquadr->p2 = Geom::Point(0, 0); + ctrlquadr->p3 = Geom::Point(0, 0); + ctrlquadr->p4 = Geom::Point(0, 0); } static void @@ -97,7 +97,7 @@ sp_ctrlquadr_render (SPCanvasItem *item, SPCanvasBuf *buf) { SPCtrlQuadr *cq = SP_CTRLQUADR (item); - NR::Rect area (NR::Point(buf->rect.x0, buf->rect.y0), NR::Point(buf->rect.x1, buf->rect.y1)); + //NR::Rect area (NR::Point(buf->rect.x0, buf->rect.y0), NR::Point(buf->rect.x1, buf->rect.y1)); if (!buf->ct) return; @@ -105,18 +105,18 @@ sp_ctrlquadr_render (SPCanvasItem *item, SPCanvasBuf *buf) // RGB / BGR cairo_new_path(buf->ct); - NR::Point min = NR::Point(buf->rect.x0, buf->rect.y0); + Geom::Point min = Geom::Point(buf->rect.x0, buf->rect.y0); - NR::Point p1 = (cq->p1 * cq->affine) - min; - NR::Point p2 = (cq->p2 * cq->affine) - min; - NR::Point p3 = (cq->p3 * cq->affine) - min; - NR::Point p4 = (cq->p4 * cq->affine) - min; + Geom::Point p1 = (cq->p1 * cq->affine) - min; + Geom::Point p2 = (cq->p2 * cq->affine) - min; + Geom::Point p3 = (cq->p3 * cq->affine) - min; + Geom::Point p4 = (cq->p4 * cq->affine) - min; - cairo_move_to(buf->ct, p1[NR::X], p1[NR::Y]); - cairo_line_to(buf->ct, p2[NR::X], p2[NR::Y]); - cairo_line_to(buf->ct, p3[NR::X], p3[NR::Y]); - cairo_line_to(buf->ct, p4[NR::X], p4[NR::Y]); - cairo_line_to(buf->ct, p1[NR::X], p1[NR::Y]); + cairo_move_to(buf->ct, p1[Geom::X], p1[Geom::Y]); + cairo_line_to(buf->ct, p2[Geom::X], p2[Geom::Y]); + cairo_line_to(buf->ct, p3[Geom::X], p3[Geom::Y]); + cairo_line_to(buf->ct, p4[Geom::X], p4[Geom::Y]); + cairo_line_to(buf->ct, p1[Geom::X], p1[Geom::Y]); // FIXME: this is supposed to draw inverse but cairo apparently is unable of this trick :( //cairo_set_operator (buf->ct, CAIRO_OPERATOR_XOR); @@ -139,7 +139,7 @@ sp_ctrlquadr_render (SPCanvasItem *item, SPCanvasBuf *buf) static void -sp_ctrlquadr_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags) +sp_ctrlquadr_update (SPCanvasItem *item, Geom::Matrix const &affine, unsigned int flags) { SPCtrlQuadr *cq = SP_CTRLQUADR (item); @@ -152,15 +152,15 @@ sp_ctrlquadr_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int cq->affine = affine; - NR::Point p1(cq->p1 * affine); - NR::Point p2(cq->p2 * affine); - NR::Point p3(cq->p3 * affine); - NR::Point p4(cq->p4 * affine); + Geom::Point p1(cq->p1 * affine); + Geom::Point p2(cq->p2 * affine); + Geom::Point p3(cq->p3 * affine); + Geom::Point p4(cq->p4 * affine); - item->x1 = (int)(MIN4(p1[NR::X], p2[NR::X], p3[NR::X], p4[NR::X])); - item->y1 = (int)(MIN4(p1[NR::Y], p2[NR::Y], p3[NR::Y], p4[NR::Y])); - item->x2 = (int)(MAX4(p1[NR::X], p2[NR::X], p3[NR::X], p4[NR::X])); - item->y2 = (int)(MAX4(p1[NR::Y], p2[NR::Y], p3[NR::Y], p4[NR::Y])); + item->x1 = (int)(MIN4(p1[Geom::X], p2[Geom::X], p3[Geom::X], p4[Geom::X])); + item->y1 = (int)(MIN4(p1[Geom::Y], p2[Geom::Y], p3[Geom::Y], p4[Geom::Y])); + item->x2 = (int)(MAX4(p1[Geom::X], p2[Geom::X], p3[Geom::X], p4[Geom::X])); + item->y2 = (int)(MAX4(p1[Geom::Y], p2[Geom::Y], p3[Geom::Y], p4[Geom::Y])); sp_canvas_request_redraw (item->canvas, (int)item->x1, (int)item->y1, (int)item->x2, (int)item->y2); } @@ -180,7 +180,7 @@ sp_ctrlquadr_set_rgba32 (SPCtrlQuadr *cl, guint32 rgba) } void -sp_ctrlquadr_set_coords (SPCtrlQuadr *cl, NR::Point p1, NR::Point p2, NR::Point p3, NR::Point p4) +sp_ctrlquadr_set_coords (SPCtrlQuadr *cl, Geom::Point p1, Geom::Point p2, Geom::Point p3, Geom::Point p4) { g_return_if_fail (cl != NULL); g_return_if_fail (SP_IS_CTRLQUADR (cl)); diff --git a/src/display/sp-ctrlquadr.h b/src/display/sp-ctrlquadr.h index c32d2c376..996c02295 100644 --- a/src/display/sp-ctrlquadr.h +++ b/src/display/sp-ctrlquadr.h @@ -26,7 +26,7 @@ struct SPCtrlQuadrClass; GType sp_ctrlquadr_get_type (void); void sp_ctrlquadr_set_rgba32 (SPCtrlQuadr *cl, guint32 rgba); -void sp_ctrlquadr_set_coords (SPCtrlQuadr *cl, const NR::Point p1, const NR::Point p2, const NR::Point p3, const NR::Point p4); +void sp_ctrlquadr_set_coords (SPCtrlQuadr *cl, const Geom::Point p1, const Geom::Point p2, const Geom::Point p3, const Geom::Point p4); #endif |
