Code

Make path segments convertable to guides, too
[inkscape.git] / src / pencil-context.cpp
1 /** \file
2  * Pencil event context implementation.
3  */
5 /*
6  * Authors:
7  *   Lauris Kaplinski <lauris@kaplinski.com>
8  *   bulia byak <buliabyak@users.sf.net>
9  *
10  * Copyright (C) 2000 Lauris Kaplinski
11  * Copyright (C) 2000-2001 Ximian, Inc.
12  * Copyright (C) 2002 Lauris Kaplinski
13  * Copyright (C) 2004 Monash University
14  *
15  * Released under GNU GPL, read the file 'COPYING' for more information
16  */
18 #include <gdk/gdkkeysyms.h>
20 #include "pencil-context.h"
21 #include "desktop.h"
22 #include "desktop-handles.h"
23 #include "selection.h"
24 #include "selection-chemistry.h"
25 #include "draw-anchor.h"
26 #include "message-stack.h"
27 #include "message-context.h"
28 #include "modifier-fns.h"
29 #include "sp-path.h"
30 #include "prefs-utils.h"
31 #include "snap.h"
32 #include "pixmaps/cursor-pencil.xpm"
33 #include "display/bezier-utils.h"
34 #include "display/canvas-bpath.h"
35 #include <glibmm/i18n.h>
36 #include "libnr/in-svg-plane.h"
37 #include "libnr/n-art-bpath.h"
38 #include "context-fns.h"
39 #include "sp-namedview.h"
40 #include "xml/repr.h"
41 #include "document.h"
42 #include "desktop-style.h"
43 #include "macros.h"
45 static void sp_pencil_context_class_init(SPPencilContextClass *klass);
46 static void sp_pencil_context_init(SPPencilContext *pc);
47 static void sp_pencil_context_setup(SPEventContext *ec);
48 static void sp_pencil_context_dispose(GObject *object);
50 static gint sp_pencil_context_root_handler(SPEventContext *event_context, GdkEvent *event);
51 static gint pencil_handle_button_press(SPPencilContext *const pc, GdkEventButton const &bevent);
52 static gint pencil_handle_motion_notify(SPPencilContext *const pc, GdkEventMotion const &mevent);
53 static gint pencil_handle_button_release(SPPencilContext *const pc, GdkEventButton const &revent);
54 static gint pencil_handle_key_press(SPPencilContext *const pc, guint const keyval, guint const state);
56 static void spdc_set_startpoint(SPPencilContext *pc, NR::Point const p);
57 static void spdc_set_endpoint(SPPencilContext *pc, NR::Point const p);
58 static void spdc_finish_endpoint(SPPencilContext *pc);
59 static void spdc_add_freehand_point(SPPencilContext *pc, NR::Point p, guint state);
60 static void fit_and_split(SPPencilContext *pc);
63 static SPDrawContextClass *pencil_parent_class;
65 /**
66  * Register SPPencilContext class with Gdk and return its type number.
67  */
68 GType
69 sp_pencil_context_get_type()
70 {
71     static GType type = 0;
72     if (!type) {
73         GTypeInfo info = {
74             sizeof(SPPencilContextClass),
75             NULL, NULL,
76             (GClassInitFunc) sp_pencil_context_class_init,
77             NULL, NULL,
78             sizeof(SPPencilContext),
79             4,
80             (GInstanceInitFunc) sp_pencil_context_init,
81             NULL,   /* value_table */
82         };
83         type = g_type_register_static(SP_TYPE_DRAW_CONTEXT, "SPPencilContext", &info, (GTypeFlags)0);
84     }
85     return type;
86 }
88 /**
89  * Initialize SPPencilContext vtable.
90  */
91 static void
92 sp_pencil_context_class_init(SPPencilContextClass *klass)
93 {
94     GObjectClass *object_class;
95     SPEventContextClass *event_context_class;
97     object_class = (GObjectClass *) klass;
98     event_context_class = (SPEventContextClass *) klass;
100     pencil_parent_class = (SPDrawContextClass*)g_type_class_peek_parent(klass);
102     object_class->dispose = sp_pencil_context_dispose;
104     event_context_class->setup = sp_pencil_context_setup;
105     event_context_class->root_handler = sp_pencil_context_root_handler;
108 /**
109  * Callback to initialize SPPencilContext object.
110  */
111 static void
112 sp_pencil_context_init(SPPencilContext *pc)
114     SPEventContext *event_context = SP_EVENT_CONTEXT(pc);
116     event_context->cursor_shape = cursor_pencil_xpm;
117     event_context->hot_x = 4;
118     event_context->hot_y = 4;
120     pc->npoints = 0;
121     pc->state = SP_PENCIL_CONTEXT_IDLE;
122     pc->req_tangent = NR::Point(0, 0);
125 /**
126  * Callback to setup SPPencilContext object.
127  */
128 static void
129 sp_pencil_context_setup(SPEventContext *ec)
131     if (prefs_get_int_attribute("tools.freehand.pencil", "selcue", 0) != 0) {
132         ec->enableSelectionCue();
133     }
135     if (((SPEventContextClass *) pencil_parent_class)->setup) {
136         ((SPEventContextClass *) pencil_parent_class)->setup(ec);
137     }
139     SPPencilContext *const pc = SP_PENCIL_CONTEXT(ec);
140     pc->is_drawing = false;
142     pc->anchor_statusbar = false;
145 static void
146 sp_pencil_context_dispose(GObject *object)
148     G_OBJECT_CLASS(pencil_parent_class)->dispose(object);
151 /** Snaps new node relative to the previous node. */
152 static void
153 spdc_endpoint_snap(SPPencilContext const *pc, NR::Point &p, guint const state)
155     spdc_endpoint_snap_rotation(pc, p, pc->p[0], state);
156     spdc_endpoint_snap_free(pc, p, state);
159 /**
160  * Callback for handling all pencil context events.
161  */
162 gint
163 sp_pencil_context_root_handler(SPEventContext *const ec, GdkEvent *event)
165     SPPencilContext *const pc = SP_PENCIL_CONTEXT(ec);
167     gint ret = FALSE;
169     switch (event->type) {
170         case GDK_BUTTON_PRESS:
171             ret = pencil_handle_button_press(pc, event->button);
172             break;
174         case GDK_MOTION_NOTIFY:
175             ret = pencil_handle_motion_notify(pc, event->motion);
176             break;
178         case GDK_BUTTON_RELEASE:
179             ret = pencil_handle_button_release(pc, event->button);
180             break;
182         case GDK_KEY_PRESS:
183             ret = pencil_handle_key_press(pc, get_group0_keyval (&event->key), event->key.state);
184             break;
186         default:
187             break;
188     }
190     if (!ret) {
191         gint (*const parent_root_handler)(SPEventContext *, GdkEvent *)
192             = ((SPEventContextClass *) pencil_parent_class)->root_handler;
193         if (parent_root_handler) {
194             ret = parent_root_handler(ec, event);
195         }
196     }
198     return ret;
201 static gint
202 pencil_handle_button_press(SPPencilContext *const pc, GdkEventButton const &bevent)
204     gint ret = FALSE;
205     SPEventContext *event_context = SP_EVENT_CONTEXT(pc);
206     if ( bevent.button == 1  && !event_context->space_panning) {
208         SPDrawContext *dc = SP_DRAW_CONTEXT (pc);
209         SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(dc);
210         Inkscape::Selection *selection = sp_desktop_selection(desktop);
212         if (Inkscape::have_viable_layer(desktop, dc->_message_context) == false) {
213             return TRUE;
214         }
216         NR::Point const button_w(bevent.x, bevent.y);
218         /* Find desktop coordinates */
219         NR::Point p = pc->desktop->w2d(button_w);
221         /* Test whether we hit any anchor. */
222         SPDrawAnchor *anchor = spdc_test_inside(pc, button_w);
224         switch (pc->state) {
225             case SP_PENCIL_CONTEXT_ADDLINE:
226                 /* Current segment will be finished with release */
227                 ret = TRUE;
228                 break;
229             default:
230                 /* Set first point of sequence */
231                 if (bevent.state & GDK_CONTROL_MASK) {
232                     /* Create object */
233                     Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
234                     Inkscape::XML::Node *repr = xml_doc->createElement("svg:path");
235                     repr->setAttribute("sodipodi:type", "arc");
236                     SPItem *item = SP_ITEM(desktop->currentLayer()->appendChildRepr(repr));
237                     Inkscape::GC::release(repr);
238                     NR::Matrix const i2d (sp_item_i2d_affine (item));
239                     NR::Point pp = p * i2d;
240                     sp_repr_set_svg_double (repr, "sodipodi:cx", pp[NR::X]);
241                     sp_repr_set_svg_double (repr, "sodipodi:cy", pp[NR::Y]);
242                     sp_repr_set_int (repr, "sodipodi:rx", 10);
243                     sp_repr_set_int (repr, "sodipodi:ry", 10);
245                     /* Set style */
246                     sp_desktop_apply_style_tool(desktop, repr, "tools.shapes.arc", false);
248                     item->updateRepr();
249                     desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Creating single point"));
250                     sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_PENCIL, _("Create single point"));
251                     ret = true;
252                     break;
253                     
254                 }
255                 if (anchor) {
256                     p = anchor->dp;
257                     desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Continuing selected path"));
258                 } else {
260                     if (!(bevent.state & GDK_SHIFT_MASK)) {
262                         // This is the first click of a new curve; deselect item so that
263                         // this curve is not combined with it (unless it is drawn from its
264                         // anchor, which is handled by the sibling branch above)
265                         selection->clear();
266                         desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Creating new path"));
267                         SnapManager const &m = desktop->namedview->snap_manager;
268                         p = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, p, NULL).getPoint();
269                     } else if (selection->singleItem() && SP_IS_PATH(selection->singleItem())) {
270                         desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Appending to selected path"));
271                     }
272                 }
273                 pc->sa = anchor;
274                 spdc_set_startpoint(pc, p);
275                 ret = TRUE;
276                 break;
277         }
279         pc->is_drawing = true;
280     }
281     return ret;
284 static gint
285 pencil_handle_motion_notify(SPPencilContext *const pc, GdkEventMotion const &mevent)
287     if (mevent.state & GDK_CONTROL_MASK) {
288         // mouse was accidentally moved during Ctrl+click;
289         // ignore the motion and create a single point
290         return TRUE;
291     }
292     gint ret = FALSE;
293     SPDesktop *const dt = pc->desktop;
295     SPEventContext *event_context = SP_EVENT_CONTEXT(pc);
296     if (event_context->space_panning || mevent.state & GDK_BUTTON2_MASK || mevent.state & GDK_BUTTON3_MASK) {
297         // allow scrolling
298         return FALSE;
299     }
301     if ( ( mevent.state & GDK_BUTTON1_MASK ) && !pc->grab && pc->is_drawing) {
302         /* Grab mouse, so release will not pass unnoticed */
303         pc->grab = SP_CANVAS_ITEM(dt->acetate);
304         sp_canvas_item_grab(pc->grab, ( GDK_KEY_PRESS_MASK | GDK_BUTTON_PRESS_MASK   |
305                                         GDK_BUTTON_RELEASE_MASK |
306                                         GDK_POINTER_MOTION_MASK  ),
307                             NULL, mevent.time);
308     }
310     /* Find desktop coordinates */
311     NR::Point p = dt->w2d(NR::Point(mevent.x, mevent.y));
313     /* Test whether we hit any anchor. */
314     SPDrawAnchor *anchor = spdc_test_inside(pc, NR::Point(mevent.x, mevent.y));
316     switch (pc->state) {
317         case SP_PENCIL_CONTEXT_ADDLINE:
318             /* Set red endpoint */
319             if (anchor) {
320                 p = anchor->dp;
321             } else {
322                 spdc_endpoint_snap(pc, p, mevent.state);
323             }
324             spdc_set_endpoint(pc, p);
325             ret = TRUE;
326             break;
327         default:
328             /* We may be idle or already freehand */
329             if ( mevent.state & GDK_BUTTON1_MASK && pc->is_drawing ) {
330                 pc->state = SP_PENCIL_CONTEXT_FREEHAND;
331                 if ( !pc->sa && !pc->green_anchor ) {
332                     /* Create green anchor */
333                     pc->green_anchor = sp_draw_anchor_new(pc, pc->green_curve, TRUE, pc->p[0]);
334                 }
335                 /** \todo
336                  * fixme: I am not sure whether we want to snap to anchors
337                  * in middle of freehand (Lauris)
338                  */
339                 if (anchor) {
340                     p = anchor->dp;
341                 } else if ((mevent.state & GDK_SHIFT_MASK) == 0) {
342                     SnapManager const &m = dt->namedview->snap_manager;
343                     p = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, p, NULL).getPoint();
344                 }
345                 if ( pc->npoints != 0 ) { // buttonpress may have happened before we entered draw context!
346                     spdc_add_freehand_point(pc, p, mevent.state);
347                     ret = TRUE;
348                 }
350                 if (anchor && !pc->anchor_statusbar) {
351                     pc->_message_context->set(Inkscape::NORMAL_MESSAGE, _("<b>Release</b> here to close and finish the path."));
352                     pc->anchor_statusbar = true;
353                 } else if (!anchor && pc->anchor_statusbar) {
354                     pc->_message_context->clear();
355                     pc->anchor_statusbar = false;
356                 } else if (!anchor) {
357                     pc->_message_context->set(Inkscape::NORMAL_MESSAGE, _("Drawing a freehand path"));
358                 }
360             } else {
361                 if (anchor && !pc->anchor_statusbar) {
362                     pc->_message_context->set(Inkscape::NORMAL_MESSAGE, _("<b>Drag</b> to continue the path from this point."));
363                     pc->anchor_statusbar = true;
364                 } else if (!anchor && pc->anchor_statusbar) {
365                     pc->_message_context->clear();
366                     pc->anchor_statusbar = false;
367                 }
368             }
369             break;
370     }
371     return ret;
374 static gint
375 pencil_handle_button_release(SPPencilContext *const pc, GdkEventButton const &revent)
377     gint ret = FALSE;
379     SPEventContext *event_context = SP_EVENT_CONTEXT(pc);
380     if ( revent.button == 1 && pc->is_drawing && !event_context->space_panning) {
381         SPDesktop *const dt = pc->desktop;
383         pc->is_drawing = false;
385         /* Find desktop coordinates */
386         NR::Point p = dt->w2d(NR::Point(revent.x, revent.y));
388         /* Test whether we hit any anchor. */
389         SPDrawAnchor *anchor = spdc_test_inside(pc, NR::Point(revent.x,
390                                                               revent.y));
392         switch (pc->state) {
393             case SP_PENCIL_CONTEXT_IDLE:
394                 /* Releasing button in idle mode means single click */
395                 /* We have already set up start point/anchor in button_press */
396                 if (!(revent.state & GDK_CONTROL_MASK)) {
397                     // Ctrl+click creates a single point so only set context in ADDLINE mode when Ctrl isn't pressed
398                     pc->state = SP_PENCIL_CONTEXT_ADDLINE;
399                 }
400                 ret = TRUE;
401                 break;
402             case SP_PENCIL_CONTEXT_ADDLINE:
403                 /* Finish segment now */
404                 if (anchor) {
405                     p = anchor->dp;
406                 } else {
407                     spdc_endpoint_snap(pc, p, revent.state);
408                 }
409                 pc->ea = anchor;
410                 spdc_set_endpoint(pc, p);
411                 spdc_finish_endpoint(pc);
412                 pc->state = SP_PENCIL_CONTEXT_IDLE;
413                 ret = TRUE;
414                 break;
415             case SP_PENCIL_CONTEXT_FREEHAND:
416                 /* Finish segment now */
417                 /// \todo fixme: Clean up what follows (Lauris)
418                 if (anchor) {
419                     p = anchor->dp;
420                 }
421                 pc->ea = anchor;
422                 /* Write curves to object */
424                 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Finishing freehand"));
426                 spdc_concat_colors_and_flush(pc, FALSE);
427                 pc->sa = NULL;
428                 pc->ea = NULL;
429                 if (pc->green_anchor) {
430                     pc->green_anchor = sp_draw_anchor_destroy(pc->green_anchor);
431                 }
432                 pc->state = SP_PENCIL_CONTEXT_IDLE;
433                 ret = TRUE;
434                 break;
435             default:
436                 break;
437         }
439         if (pc->grab) {
440             /* Release grab now */
441             sp_canvas_item_ungrab(pc->grab, revent.time);
442             pc->grab = NULL;
443         }
445         ret = TRUE;
446     }
447     return ret;
450 static void
451 pencil_cancel (SPPencilContext *const pc) 
453     if (pc->grab) {
454         /* Release grab now */
455         sp_canvas_item_ungrab(pc->grab, 0);
456         pc->grab = NULL;
457     }
459     pc->is_drawing = false;
461     pc->state = SP_PENCIL_CONTEXT_IDLE;
463     sp_curve_reset(pc->red_curve);
464     sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), NULL);
465     while (pc->green_bpaths) {
466         gtk_object_destroy(GTK_OBJECT(pc->green_bpaths->data));
467         pc->green_bpaths = g_slist_remove(pc->green_bpaths, pc->green_bpaths->data);
468     }
469     sp_curve_reset(pc->green_curve);
470     if (pc->green_anchor) {
471         pc->green_anchor = sp_draw_anchor_destroy(pc->green_anchor);
472     }
474     pc->_message_context->clear();
475     pc->_message_context->flash(Inkscape::NORMAL_MESSAGE, _("Drawing cancelled"));
477     sp_canvas_end_forced_full_redraws(pc->desktop->canvas);
481 static gint
482 pencil_handle_key_press(SPPencilContext *const pc, guint const keyval, guint const state)
484     gint ret = FALSE;
485     switch (keyval) {
486         case GDK_Up:
487         case GDK_Down:
488         case GDK_KP_Up:
489         case GDK_KP_Down:
490             // Prevent the zoom field from activation.
491             if (!mod_ctrl_only(state)) {
492                 ret = TRUE;
493             }
494             break;
495         case GDK_Escape:
496             if (pc->npoints != 0) {
497                 // if drawing, cancel, otherwise pass it up for deselecting
498                 if (pc->is_drawing) {
499                     pencil_cancel (pc);
500                     ret = TRUE;
501                 }
502             }
503             break;
504         case GDK_z:
505         case GDK_Z:
506             if (mod_ctrl_only(state) && pc->npoints != 0) {
507                 // if drawing, cancel, otherwise pass it up for undo
508                 if (pc->is_drawing) {
509                     pencil_cancel (pc);
510                     ret = TRUE;
511                 }
512             }
513             break;
514         case GDK_g:
515         case GDK_G:
516             if (mod_shift_only(state)) {
517                 sp_selection_to_guides();
518                 ret = true;
519             }
520             break;
521         default:
522             break;
523     }
524     return ret;
527 /**
528  * Reset points and set new starting point.
529  */
530 static void
531 spdc_set_startpoint(SPPencilContext *const pc, NR::Point const p)
533     pc->npoints = 0;
534     pc->red_curve_is_valid = false;
535     if (in_svg_plane(p)) {
536         pc->p[pc->npoints++] = p;
537     }
540 /**
541  * Change moving endpoint position.
542  * <ul>
543  * <li>Ctrl constrains to moving to H/V direction, snapping in given direction.
544  * <li>Otherwise we snap freely to whatever attractors are available.
545  * </ul>
546  *
547  * Number of points is (re)set to 2 always, 2nd point is modified.
548  * We change RED curve.
549  */
550 static void
551 spdc_set_endpoint(SPPencilContext *const pc, NR::Point const p)
553     if (pc->npoints == 0) {
554         return;
555         /* May occur if first point wasn't in SVG plane (e.g. weird w2d transform, perhaps from bad
556          * zoom setting).
557          */
558     }
559     g_return_if_fail( pc->npoints > 0 );
561     sp_curve_reset(pc->red_curve);
562     if ( ( p == pc->p[0] )
563          || !in_svg_plane(p) )
564     {
565         pc->npoints = 1;
566     } else {
567         pc->p[1] = p;
568         pc->npoints = 2;
570         sp_curve_moveto(pc->red_curve, pc->p[0]);
571         sp_curve_lineto(pc->red_curve, pc->p[1]);
572         pc->red_curve_is_valid = true;
574         sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), pc->red_curve);
575     }
578 /**
579  * Finalize addline.
580  *
581  * \todo
582  * fixme: I'd like remove red reset from concat colors (lauris).
583  * Still not sure, how it will make most sense.
584  */
585 static void
586 spdc_finish_endpoint(SPPencilContext *const pc)
588     if ( ( SP_CURVE_LENGTH(pc->red_curve) != 2 )
589          || ( SP_CURVE_SEGMENT(pc->red_curve, 0)->c(3) ==
590               SP_CURVE_SEGMENT(pc->red_curve, 1)->c(3)   ) )
591     {
592         sp_curve_reset(pc->red_curve);
593         sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), NULL);
594     } else {
595         /* Write curves to object. */
596         spdc_concat_colors_and_flush(pc, FALSE);
597         pc->sa = NULL;
598         pc->ea = NULL;
599     }
602 static void
603 spdc_add_freehand_point(SPPencilContext *pc, NR::Point p, guint /*state*/)
605     g_assert( pc->npoints > 0 );
606     g_return_if_fail(unsigned(pc->npoints) < G_N_ELEMENTS(pc->p));
608     if ( ( p != pc->p[ pc->npoints - 1 ] )
609          && in_svg_plane(p) )
610     {
611         pc->p[pc->npoints++] = p;
612         fit_and_split(pc);
613     }
616 static inline double
617 square(double const x)
619     return x * x;
622 static void
623 fit_and_split(SPPencilContext *pc)
625     g_assert( pc->npoints > 1 );
627     double const tolerance_sq = square( NR::expansion(pc->desktop->w2d())
628                                         * prefs_get_double_attribute_limited("tools.freehand.pencil",
629                                                                              "tolerance", 10.0, 1.0, 100.0) );
631     NR::Point b[4];
632     g_assert(is_zero(pc->req_tangent)
633              || is_unit_vector(pc->req_tangent));
634     NR::Point const tHatEnd(0, 0);
635     int const n_segs = sp_bezier_fit_cubic_full(b, NULL, pc->p, pc->npoints,
636                                                 pc->req_tangent, tHatEnd, tolerance_sq, 1);
637     if ( n_segs > 0
638          && unsigned(pc->npoints) < G_N_ELEMENTS(pc->p) )
639     {
640         /* Fit and draw and reset state */
641         sp_curve_reset(pc->red_curve);
642         sp_curve_moveto(pc->red_curve, b[0]);
643         sp_curve_curveto(pc->red_curve, b[1], b[2], b[3]);
644         sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), pc->red_curve);
645         pc->red_curve_is_valid = true;
646     } else {
647         /* Fit and draw and copy last point */
649         g_assert(!sp_curve_empty(pc->red_curve));
651         /* Set up direction of next curve. */
652         {
653             NArtBpath const &last_seg = *sp_curve_last_bpath(pc->red_curve);
654             pc->p[0] = last_seg.c(3);
655             pc->npoints = 1;
656             g_assert( last_seg.code == NR_CURVETO );
657             /* Relevance: validity of last_seg.c(2). */
658             NR::Point const req_vec( pc->p[0] - last_seg.c(2) );
659             pc->req_tangent = ( ( NR::is_zero(req_vec) || !in_svg_plane(req_vec) )
660                                 ? NR::Point(0, 0)
661                                 : NR::unit_vector(req_vec) );
662         }
664         sp_curve_append_continuous(pc->green_curve, pc->red_curve, 0.0625);
665         SPCurve *curve = sp_curve_copy(pc->red_curve);
667         /// \todo fixme:
668         SPCanvasItem *cshape = sp_canvas_bpath_new(sp_desktop_sketch(pc->desktop), curve);
669         sp_curve_unref(curve);
670         sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(cshape), pc->green_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
672         pc->green_bpaths = g_slist_prepend(pc->green_bpaths, cshape);
674         pc->red_curve_is_valid = false;
675     }
679 /*
680   Local Variables:
681   mode:c++
682   c-file-style:"stroustrup"
683   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
684   indent-tabs-mode:nil
685   fill-column:99
686   End:
687 */
688 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :