Lines Matching refs:gl
45 static void sp_guideline_init(SPGuideLine *gl)
47 gl->rgba = 0x0000ff7f;
49 gl->locked = false;
50 gl->normal_to_line = Geom::Point(0,1);
51 gl->angle = 3.14159265358979323846/2;
52 gl->point_on_line = Geom::Point(0,0);
53 gl->sensitive = 0;
55 gl->origin = NULL;
56 gl->label = NULL;
64 SPGuideLine *gl = SP_GUIDELINE(object);
66 if (gl->origin) {
67 sp_canvas_item_destroy(SP_CANVAS_ITEM(gl->origin));
70 if (gl->label) {
71 g_free(gl->label);
83 SPGuideLine const *gl = SP_GUIDELINE (item);
87 ink_cairo_set_source_rgba32(buf->ct, gl->rgba);
92 Geom::Point normal_dt = /*unit_vector*/(gl->normal_to_line * gl->affine.withoutTranslation()); // note that normal_dt does not have unit length
93 Geom::Point point_on_line_dt = gl->point_on_line * gl->affine;
95 if (gl->label) {
103 cairo_show_text(buf->ct, gl->label);
126 sp_guideline_drawline (buf, buf->rect.left(), static_cast<gint>(round(y_intersect_left)), buf->rect.right(), static_cast<gint>(round(y_intersect_right)), gl->rgba);
134 sp_guideline_drawline (buf, buf->rect.right(), static_cast<gint>(round(y_intersect_right)), buf->rect.left(), static_cast<gint>(round(y_intersect_left)), gl->rgba);
143 sp_guideline_drawline (buf, static_cast<gint>(round(x_intersect_top)), buf->rect.top(), static_cast<gint>(round(x_intersect_bottom)), buf->rect.bottom(), gl->rgba);
151 sp_guideline_drawline (buf, static_cast<gint>(round(x_intersect_bottom)), buf->rect.bottom(), static_cast<gint>(round(x_intersect_top)), buf->rect.top(), gl->rgba);
161 SPGuideLine *gl = SP_GUIDELINE(item);
168 if (gl->locked) {
169 g_object_set(G_OBJECT(gl->origin), "stroke_color", 0x0000ff88,
173 g_object_set(G_OBJECT(gl->origin), "stroke_color", 0xff000088,
177 gl->origin->moveto(gl->point_on_line);
178 sp_canvas_item_request_update(SP_CANVAS_ITEM(gl->origin));
181 gl->affine = affine;
182 Geom::Point pol_transformed = gl->point_on_line * affine;
183 if (gl->is_horizontal()) {
185 } else if (gl->is_vertical()) {
196 SPGuideLine *gl = SP_GUIDELINE (item);
198 if (!gl->sensitive) {
204 Geom::Point vec = gl->normal_to_line * gl->affine.withoutTranslation();
205 double distance = Geom::dot((p - gl->point_on_line * gl->affine), unit_vector(vec));
212 SPGuideLine *gl = SP_GUIDELINE(item);
215 gl->label = label;
216 gl->locked = false;
217 gl->normal_to_line = normal;
218 gl->angle = tan( -gl->normal_to_line[Geom::X] / gl->normal_to_line[Geom::Y]);
219 sp_guideline_set_position(gl, point_on_line);
221 gl->origin = (SPCtrl *) sp_canvas_item_new(parent, SP_TYPE_CTRL,
227 gl->origin->pickable = false;
232 void sp_guideline_set_label(SPGuideLine *gl, const char* label)
234 if (gl->label) {
235 g_free(gl->label);
237 gl->label = g_strdup(label);
239 sp_canvas_item_request_update(SP_CANVAS_ITEM (gl));
242 void sp_guideline_set_locked(SPGuideLine *gl, const bool locked)
244 gl->locked = locked;
245 sp_canvas_item_request_update(SP_CANVAS_ITEM (gl));
248 void sp_guideline_set_position(SPGuideLine *gl, Geom::Point point_on_line)
250 gl->point_on_line = point_on_line;
251 sp_canvas_item_request_update(SP_CANVAS_ITEM (gl));
254 void sp_guideline_set_normal(SPGuideLine *gl, Geom::Point normal_to_line)
256 gl->normal_to_line = normal_to_line;
257 gl->angle = tan( -normal_to_line[Geom::X] / normal_to_line[Geom::Y]);
259 sp_canvas_item_request_update(SP_CANVAS_ITEM (gl));
262 void sp_guideline_set_color(SPGuideLine *gl, unsigned int rgba)
264 gl->rgba = rgba;
265 g_object_set(G_OBJECT(gl->origin), "stroke_color", rgba, NULL);
266 sp_canvas_item_request_update(SP_CANVAS_ITEM(gl));
269 void sp_guideline_set_sensitive(SPGuideLine *gl, int sensitive)
271 gl->sensitive = sensitive;
274 void sp_guideline_delete(SPGuideLine *gl)
276 sp_canvas_item_destroy(SP_CANVAS_ITEM(gl));