diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2007-12-16 22:01:05 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2007-12-16 22:01:05 +0000 |
| commit | bd59d3f05937aa2ab65671d7885fbb6cd90f00e6 (patch) | |
| tree | 7eaec80d752fe5deaffb971209904e06f81b073f /src/display/guideline.cpp | |
| parent | * [INTL: it] Updated Italian translation (diff) | |
| download | inkscape-bd59d3f05937aa2ab65671d7885fbb6cd90f00e6.tar.gz inkscape-bd59d3f05937aa2ab65671d7885fbb6cd90f00e6.zip | |
start of getting angled guidelines.
define guide's normal instead of vertical/horizontal.
rendering is not implemented for angled guides yet.
(bzr r4243)
Diffstat (limited to 'src/display/guideline.cpp')
| -rw-r--r-- | src/display/guideline.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/display/guideline.cpp b/src/display/guideline.cpp index 36f51d3c6..b029be7a0 100644 --- a/src/display/guideline.cpp +++ b/src/display/guideline.cpp @@ -67,7 +67,7 @@ static void sp_guideline_init(SPGuideLine *gl) { gl->rgba = 0x0000ff7f; - gl->vertical = 0; + gl->normal = Geom::Point(0,1); gl->sensitive = 0; } @@ -90,7 +90,7 @@ static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf) int p0, p1, step; unsigned char *d; - if (gl->vertical) { + if (gl->normal[Geom::Y] == 0.) { if (gl->position < buf->rect.x0 || gl->position >= buf->rect.x1) { return; @@ -129,7 +129,7 @@ static void sp_guideline_update(SPCanvasItem *item, NR::Matrix const &affine, un ((SPCanvasItemClass *) parent_class)->update(item, affine, flags); } - if (gl->vertical) { + if (gl->normal[Geom::Y] == 0.) { gl->position = (int) (affine[4] + 0.5); sp_canvas_update_bbox (item, gl->position, -1000000, gl->position + 1, 1000000); } else { @@ -148,20 +148,21 @@ static double sp_guideline_point(SPCanvasItem *item, NR::Point p, SPCanvasItem * *actual_item = item; - if (gl->vertical) { + if (gl->normal[Geom::Y] == 0.) { return MAX(fabs(gl->position - p[NR::X])-1, 0); } else { return MAX(fabs(gl->position - p[NR::Y])-1, 0); } } -SPCanvasItem *sp_guideline_new(SPCanvasGroup *parent, double position, unsigned int vertical) +SPCanvasItem *sp_guideline_new(SPCanvasGroup *parent, double position, Geom::Point normal) { SPCanvasItem *item = sp_canvas_item_new(parent, SP_TYPE_GUIDELINE, NULL); SPGuideLine *gl = SP_GUIDELINE(item); - gl->vertical = vertical; + normal.normalize(); + gl->normal = normal; sp_guideline_set_position(gl, position); return item; |
