~centralelyon2010/inkscape/imagelinks2

« back to all changes in this revision

Viewing changes to src/display/sp-ctrlline.cpp

  • Committer: cilix42
  • Date: 2008-09-18 17:48:42 UTC
  • Revision ID: cilix42@users.sourceforge.net-20080918174842-1ad33a7d7gqhv2hq
Next roud of NR ==> Geom conversion

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
static void sp_ctrlline_init (SPCtrlLine *ctrlline);
35
35
static void sp_ctrlline_destroy (GtkObject *object);
36
36
 
37
 
static void sp_ctrlline_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags);
 
37
static void sp_ctrlline_update (SPCanvasItem *item, Geom::Matrix const &affine, unsigned int flags);
38
38
static void sp_ctrlline_render (SPCanvasItem *item, SPCanvasBuf *buf);
39
39
 
40
40
static SPCanvasItemClass *parent_class;
77
77
sp_ctrlline_init (SPCtrlLine *ctrlline)
78
78
{
79
79
    ctrlline->rgba = 0x0000ff7f;
80
 
    ctrlline->s[NR::X] = ctrlline->s[NR::Y] = ctrlline->e[NR::X] = ctrlline->e[NR::Y] = 0.0;
 
80
    ctrlline->s[Geom::X] = ctrlline->s[Geom::Y] = ctrlline->e[Geom::X] = ctrlline->e[Geom::Y] = 0.0;
81
81
    ctrlline->item=NULL;
82
82
}
83
83
 
111
111
    cairo_set_line_width(buf->ct, 1);
112
112
    cairo_new_path(buf->ct);
113
113
 
114
 
    NR::Point s = cl->s * cl->affine;
115
 
    NR::Point e = cl->e * cl->affine;
 
114
    Geom::Point s = cl->s * cl->affine;
 
115
    Geom::Point e = cl->e * cl->affine;
116
116
 
117
 
    cairo_move_to (buf->ct, s[NR::X] - buf->rect.x0, s[NR::Y] - buf->rect.y0);
118
 
    cairo_line_to (buf->ct, e[NR::X] - buf->rect.x0, e[NR::Y] - buf->rect.y0);
 
117
    cairo_move_to (buf->ct, s[Geom::X] - buf->rect.x0, s[Geom::Y] - buf->rect.y0);
 
118
    cairo_line_to (buf->ct, e[Geom::X] - buf->rect.x0, e[Geom::Y] - buf->rect.y0);
119
119
 
120
120
    cairo_stroke(buf->ct);
121
121
}
122
122
 
123
123
static void
124
 
sp_ctrlline_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags)
 
124
sp_ctrlline_update (SPCanvasItem *item, Geom::Matrix const &affine, unsigned int flags)
125
125
{
126
126
    SPCtrlLine *cl = SP_CTRLLINE (item);
127
127
 
134
134
 
135
135
    cl->affine = affine;
136
136
 
137
 
    NR::Point s = cl->s * affine;
138
 
    NR::Point e = cl->e * affine;
 
137
    Geom::Point s = cl->s * affine;
 
138
    Geom::Point e = cl->e * affine;
139
139
 
140
 
    item->x1 = round(MIN(s[NR::X], e[NR::X]) - 1);
141
 
    item->y1 = round(MIN(s[NR::Y], e[NR::Y]) - 1);
142
 
    item->x2 = round(MAX(s[NR::X], e[NR::X]) + 1);
143
 
    item->y2 = round(MAX(s[NR::Y], e[NR::Y]) + 1);
 
140
    item->x1 = round(MIN(s[Geom::X], e[Geom::X]) - 1);
 
141
    item->y1 = round(MIN(s[Geom::Y], e[Geom::Y]) - 1);
 
142
    item->x2 = round(MAX(s[Geom::X], e[Geom::X]) + 1);
 
143
    item->y2 = round(MAX(s[Geom::Y], e[Geom::Y]) + 1);
144
144
 
145
145
    sp_canvas_request_redraw (item->canvas, (int)item->x1, (int)item->y1, (int)item->x2, (int)item->y2);
146
146
}
168
168
    g_return_if_fail (cl != NULL);
169
169
    g_return_if_fail (SP_IS_CTRLLINE (cl));
170
170
 
171
 
    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])) {
172
 
        cl->s[NR::X] = x0;
173
 
        cl->s[NR::Y] = y0;
174
 
        cl->e[NR::X] = x1;
175
 
        cl->e[NR::Y] = y1;
 
171
    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])) {
 
172
        cl->s[Geom::X] = x0;
 
173
        cl->s[Geom::Y] = y0;
 
174
        cl->e[Geom::X] = x1;
 
175
        cl->e[Geom::Y] = y1;
176
176
        sp_canvas_item_request_update (SP_CANVAS_ITEM (cl));
177
177
    }
178
178
}
179
179
 
180
180
void
181
 
sp_ctrlline_set_coords (SPCtrlLine *cl, const NR::Point start, const NR::Point end)
 
181
sp_ctrlline_set_coords (SPCtrlLine *cl, const Geom::Point start, const Geom::Point end)
182
182
{
183
183
    sp_ctrlline_set_coords(cl, start[0], start[1], end[0], end[1]);
184
184
}