Code

Esc and Ctrl+Z in pencil tool should also cancel when we're drawing straight line...
[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 "context-fns.h"
38 #include "sp-namedview.h"
39 #include "xml/repr.h"
40 #include "document.h"
41 #include "desktop-style.h"
42 #include "macros.h"
43 #include "display/curve.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;
64 static NR::Point pencil_drag_origin_w(0, 0);
65 static bool pencil_within_tolerance = false;
67 /**
68  * Register SPPencilContext class with Gdk and return its type number.
69  */
70 GType
71 sp_pencil_context_get_type()
72 {
73     static GType type = 0;
74     if (!type) {
75         GTypeInfo info = {
76             sizeof(SPPencilContextClass),
77             NULL, NULL,
78             (GClassInitFunc) sp_pencil_context_class_init,
79             NULL, NULL,
80             sizeof(SPPencilContext),
81             4,
82             (GInstanceInitFunc) sp_pencil_context_init,
83             NULL,   /* value_table */
84         };
85         type = g_type_register_static(SP_TYPE_DRAW_CONTEXT, "SPPencilContext", &info, (GTypeFlags)0);
86     }
87     return type;
88 }
90 /**
91  * Initialize SPPencilContext vtable.
92  */
93 static void
94 sp_pencil_context_class_init(SPPencilContextClass *klass)
95 {
96     GObjectClass *object_class;
97     SPEventContextClass *event_context_class;
99     object_class = (GObjectClass *) klass;
100     event_context_class = (SPEventContextClass *) klass;
102     pencil_parent_class = (SPDrawContextClass*)g_type_class_peek_parent(klass);
104     object_class->dispose = sp_pencil_context_dispose;
106     event_context_class->setup = sp_pencil_context_setup;
107     event_context_class->root_handler = sp_pencil_context_root_handler;
110 /**
111  * Callback to initialize SPPencilContext object.
112  */
113 static void
114 sp_pencil_context_init(SPPencilContext *pc)
116     SPEventContext *event_context = SP_EVENT_CONTEXT(pc);
118     event_context->cursor_shape = cursor_pencil_xpm;
119     event_context->hot_x = 4;
120     event_context->hot_y = 4;
122     pc->npoints = 0;
123     pc->state = SP_PENCIL_CONTEXT_IDLE;
124     pc->req_tangent = NR::Point(0, 0);
127 /**
128  * Callback to setup SPPencilContext object.
129  */
130 static void
131 sp_pencil_context_setup(SPEventContext *ec)
133     if (prefs_get_int_attribute("tools.freehand.pencil", "selcue", 0) != 0) {
134         ec->enableSelectionCue();
135     }
137     if (((SPEventContextClass *) pencil_parent_class)->setup) {
138         ((SPEventContextClass *) pencil_parent_class)->setup(ec);
139     }
141     SPPencilContext *const pc = SP_PENCIL_CONTEXT(ec);
142     pc->is_drawing = false;
144     pc->anchor_statusbar = false;
147 static void
148 sp_pencil_context_dispose(GObject *object)
150     G_OBJECT_CLASS(pencil_parent_class)->dispose(object);
153 /** Snaps new node relative to the previous node. */
154 static void
155 spdc_endpoint_snap(SPPencilContext const *pc, NR::Point &p, guint const state)
157     if ((state & GDK_CONTROL_MASK)) { //CTRL enables constrained snapping
158         spdc_endpoint_snap_rotation(pc, p, pc->p[0], state);
159     } else {
160         if (!(state & GDK_SHIFT_MASK)) { //SHIFT disables all snapping, except the angular snapping above
161                                          //After all, the user explicitely asked for angular snapping by
162                                          //pressing CTRL
163             spdc_endpoint_snap_free(pc, p, state);
164         }
165     }
168 /**
169  * Callback for handling all pencil context events.
170  */
171 gint
172 sp_pencil_context_root_handler(SPEventContext *const ec, GdkEvent *event)
174     SPPencilContext *const pc = SP_PENCIL_CONTEXT(ec);
176     gint ret = FALSE;
178     switch (event->type) {
179         case GDK_BUTTON_PRESS:
180             ret = pencil_handle_button_press(pc, event->button);
181             break;
183         case GDK_MOTION_NOTIFY:
184             ret = pencil_handle_motion_notify(pc, event->motion);
185             break;
187         case GDK_BUTTON_RELEASE:
188             ret = pencil_handle_button_release(pc, event->button);
189             break;
191         case GDK_KEY_PRESS:
192             ret = pencil_handle_key_press(pc, get_group0_keyval (&event->key), event->key.state);
193             break;
195         default:
196             break;
197     }
199     if (!ret) {
200         gint (*const parent_root_handler)(SPEventContext *, GdkEvent *)
201             = ((SPEventContextClass *) pencil_parent_class)->root_handler;
202         if (parent_root_handler) {
203             ret = parent_root_handler(ec, event);
204         }
205     }
207     return ret;
210 static gint
211 pencil_handle_button_press(SPPencilContext *const pc, GdkEventButton const &bevent)
213     gint ret = FALSE;
214     SPEventContext *event_context = SP_EVENT_CONTEXT(pc);
215     if ( bevent.button == 1  && !event_context->space_panning) {
217         SPDrawContext *dc = SP_DRAW_CONTEXT (pc);
218         SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(dc);
219         Inkscape::Selection *selection = sp_desktop_selection(desktop);
221         if (Inkscape::have_viable_layer(desktop, dc->_message_context) == false) {
222             return TRUE;
223         }
225         NR::Point const button_w(bevent.x, bevent.y);
227         /* Find desktop coordinates */
228         NR::Point p = pc->desktop->w2d(button_w);
230         /* Test whether we hit any anchor. */
231         SPDrawAnchor *anchor = spdc_test_inside(pc, button_w);
233         pencil_drag_origin_w = NR::Point(bevent.x,bevent.y);
234         pencil_within_tolerance = true;
236         switch (pc->state) {
237             case SP_PENCIL_CONTEXT_ADDLINE:
238                 /* Current segment will be finished with release */
239                 ret = TRUE;
240                 break;
241             default:
242                 /* Set first point of sequence */
243                 if (bevent.state & GDK_CONTROL_MASK) {
244                     freehand_create_single_dot(event_context, p, "tools.freehand.pencil", bevent.state);
245                     ret = true;
246                     break;
247                 }
248                 if (anchor) {
249                     p = anchor->dp;
250                     desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Continuing selected path"));
251                 } else {
253                     if (!(bevent.state & GDK_SHIFT_MASK)) {
255                         // This is the first click of a new curve; deselect item so that
256                         // this curve is not combined with it (unless it is drawn from its
257                         // anchor, which is handled by the sibling branch above)
258                         selection->clear();
259                         desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Creating new path"));
260                         SnapManager &m = desktop->namedview->snap_manager;
261                         m.setup(desktop);
262                         m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, p);
263                     } else if (selection->singleItem() && SP_IS_PATH(selection->singleItem())) {
264                         desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Appending to selected path"));
265                     }
266                 }
267                 pc->sa = anchor;
268                 spdc_set_startpoint(pc, p);
269                 ret = TRUE;
270                 break;
271         }
273         pc->is_drawing = true;
274     }
275     return ret;
278 static gint
279 pencil_handle_motion_notify(SPPencilContext *const pc, GdkEventMotion const &mevent)
281     if ((mevent.state & GDK_CONTROL_MASK) && (mevent.state & GDK_BUTTON1_MASK)) {
282         // mouse was accidentally moved during Ctrl+click;
283         // ignore the motion and create a single point
284         pc->is_drawing = false;
285         return TRUE;
286     }
287     gint ret = FALSE;
288     SPDesktop *const dt = pc->desktop;
290     SPEventContext *event_context = SP_EVENT_CONTEXT(pc);
291     if (event_context->space_panning || mevent.state & GDK_BUTTON2_MASK || mevent.state & GDK_BUTTON3_MASK) {
292         // allow scrolling
293         return FALSE;
294     }
296     if ( ( mevent.state & GDK_BUTTON1_MASK ) && !pc->grab && pc->is_drawing) {
297         /* Grab mouse, so release will not pass unnoticed */
298         pc->grab = SP_CANVAS_ITEM(dt->acetate);
299         sp_canvas_item_grab(pc->grab, ( GDK_KEY_PRESS_MASK | GDK_BUTTON_PRESS_MASK   |
300                                         GDK_BUTTON_RELEASE_MASK |
301                                         GDK_POINTER_MOTION_MASK  ),
302                             NULL, mevent.time);
303     }
305     /* Find desktop coordinates */
306     NR::Point p = dt->w2d(NR::Point(mevent.x, mevent.y));
308     /* Test whether we hit any anchor. */
309     SPDrawAnchor *anchor = spdc_test_inside(pc, NR::Point(mevent.x, mevent.y));
311     if (pencil_within_tolerance) {
312         gint const tolerance = prefs_get_int_attribute_limited("options.dragtolerance",
313                                                                "value", 0, 0, 100);
314         if ( NR::LInfty( NR::Point(mevent.x,mevent.y) - pencil_drag_origin_w ) < tolerance ) {
315             return FALSE;   // Do not drag if we're within tolerance from origin.
316         }
317     }
319     // Once the user has moved farther than tolerance from the original location
320     // (indicating they intend to move the object, not click), then always process the
321     // motion notify coordinates as given (no snapping back to origin)
322     pencil_within_tolerance = false;
324     switch (pc->state) {
325         case SP_PENCIL_CONTEXT_ADDLINE:
326             /* Set red endpoint */
327             if (anchor) {
328                 p = anchor->dp;
329             } else {
330                 spdc_endpoint_snap(pc, p, mevent.state);
331             }
332             spdc_set_endpoint(pc, p);
333             ret = TRUE;
334             break;
335         default:
336             /* We may be idle or already freehand */
337             if ( mevent.state & GDK_BUTTON1_MASK && pc->is_drawing ) {
338                 pc->state = SP_PENCIL_CONTEXT_FREEHAND;
339                 if ( !pc->sa && !pc->green_anchor ) {
340                     /* Create green anchor */
341                     pc->green_anchor = sp_draw_anchor_new(pc, pc->green_curve, TRUE, pc->p[0]);
342                 }
343                 /** \todo
344                  * fixme: I am not sure whether we want to snap to anchors
345                  * in middle of freehand (Lauris)
346                  */
347                 if (anchor) {
348                     p = anchor->dp;
349                 } else if ((mevent.state & GDK_SHIFT_MASK) == 0) {
350                     SnapManager &m = dt->namedview->snap_manager;
351                     m.setup(dt, NULL);
352                     m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, p);
353                 }
354                 if ( pc->npoints != 0 ) { // buttonpress may have happened before we entered draw context!
355                     spdc_add_freehand_point(pc, p, mevent.state);
356                     ret = TRUE;
357                 }
359                 if (anchor && !pc->anchor_statusbar) {
360                     pc->_message_context->set(Inkscape::NORMAL_MESSAGE, _("<b>Release</b> here to close and finish the path."));
361                     pc->anchor_statusbar = true;
362                 } else if (!anchor && pc->anchor_statusbar) {
363                     pc->_message_context->clear();
364                     pc->anchor_statusbar = false;
365                 } else if (!anchor) {
366                     pc->_message_context->set(Inkscape::NORMAL_MESSAGE, _("Drawing a freehand path"));
367                 }
369             } else {
370                 if (anchor && !pc->anchor_statusbar) {
371                     pc->_message_context->set(Inkscape::NORMAL_MESSAGE, _("<b>Drag</b> to continue the path from this point."));
372                     pc->anchor_statusbar = true;
373                 } else if (!anchor && pc->anchor_statusbar) {
374                     pc->_message_context->clear();
375                     pc->anchor_statusbar = false;
376                 }
377             }
378             break;
379     }
380     return ret;
383 static gint
384 pencil_handle_button_release(SPPencilContext *const pc, GdkEventButton const &revent)
386     gint ret = FALSE;
388     SPEventContext *event_context = SP_EVENT_CONTEXT(pc);
389     if ( revent.button == 1 && pc->is_drawing && !event_context->space_panning) {
390         SPDesktop *const dt = pc->desktop;
392         pc->is_drawing = false;
394         /* Find desktop coordinates */
395         NR::Point p = dt->w2d(NR::Point(revent.x, revent.y));
397         /* Test whether we hit any anchor. */
398         SPDrawAnchor *anchor = spdc_test_inside(pc, NR::Point(revent.x,
399                                                               revent.y));
401         switch (pc->state) {
402             case SP_PENCIL_CONTEXT_IDLE:
403                 /* Releasing button in idle mode means single click */
404                 /* We have already set up start point/anchor in button_press */
405                 if (!(revent.state & GDK_CONTROL_MASK)) {
406                     // Ctrl+click creates a single point so only set context in ADDLINE mode when Ctrl isn't pressed
407                     pc->state = SP_PENCIL_CONTEXT_ADDLINE;
408                 }
409                 ret = TRUE;
410                 break;
411             case SP_PENCIL_CONTEXT_ADDLINE:
412                 /* Finish segment now */
413                 if (anchor) {
414                     p = anchor->dp;
415                 } else {
416                     spdc_endpoint_snap(pc, p, revent.state);
417                 }
418                 pc->ea = anchor;
419                 spdc_set_endpoint(pc, p);
420                 spdc_finish_endpoint(pc);
421                 pc->state = SP_PENCIL_CONTEXT_IDLE;
422                 ret = TRUE;
423                 break;
424             case SP_PENCIL_CONTEXT_FREEHAND:
425                 /* Finish segment now */
426                 /// \todo fixme: Clean up what follows (Lauris)
427                 if (anchor) {
428                     p = anchor->dp;
429                 }
430                 pc->ea = anchor;
431                 /* Write curves to object */
433                 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Finishing freehand"));
435                 spdc_concat_colors_and_flush(pc, FALSE);
436                 pc->sa = NULL;
437                 pc->ea = NULL;
438                 if (pc->green_anchor) {
439                     pc->green_anchor = sp_draw_anchor_destroy(pc->green_anchor);
440                 }
441                 pc->state = SP_PENCIL_CONTEXT_IDLE;
442                 ret = TRUE;
443                 break;
444             default:
445                 break;
446         }
448         if (pc->grab) {
449             /* Release grab now */
450             sp_canvas_item_ungrab(pc->grab, revent.time);
451             pc->grab = NULL;
452         }
454         ret = TRUE;
455     }
456     return ret;
459 static void
460 pencil_cancel (SPPencilContext *const pc) 
462     if (pc->grab) {
463         /* Release grab now */
464         sp_canvas_item_ungrab(pc->grab, 0);
465         pc->grab = NULL;
466     }
468     pc->is_drawing = false;
470     pc->state = SP_PENCIL_CONTEXT_IDLE;
472     pc->red_curve->reset();
473     sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), NULL);
474     while (pc->green_bpaths) {
475         gtk_object_destroy(GTK_OBJECT(pc->green_bpaths->data));
476         pc->green_bpaths = g_slist_remove(pc->green_bpaths, pc->green_bpaths->data);
477     }
478     pc->green_curve->reset();
479     if (pc->green_anchor) {
480         pc->green_anchor = sp_draw_anchor_destroy(pc->green_anchor);
481     }
483     pc->_message_context->clear();
484     pc->_message_context->flash(Inkscape::NORMAL_MESSAGE, _("Drawing cancelled"));
486     sp_canvas_end_forced_full_redraws(pc->desktop->canvas);
490 static gint
491 pencil_handle_key_press(SPPencilContext *const pc, guint const keyval, guint const state)
493     gint ret = FALSE;
494     switch (keyval) {
495         case GDK_Up:
496         case GDK_Down:
497         case GDK_KP_Up:
498         case GDK_KP_Down:
499             // Prevent the zoom field from activation.
500             if (!mod_ctrl_only(state)) {
501                 ret = TRUE;
502             }
503             break;
504         case GDK_Escape:
505             if (pc->npoints != 0) {
506                 pencil_cancel (pc);
507                 ret = TRUE;
508             }
509             break;
510         case GDK_z:
511         case GDK_Z:
512             if (mod_ctrl_only(state) && pc->npoints != 0) {
513                 // if drawing, cancel, otherwise pass it up for undo
514                 pencil_cancel (pc);
515                 ret = TRUE;
516             }
517             break;
518         case GDK_g:
519         case GDK_G:
520             if (mod_shift_only(state)) {
521                 sp_selection_to_guides();
522                 ret = true;
523             }
524             break;
525         default:
526             break;
527     }
528     return ret;
531 /**
532  * Reset points and set new starting point.
533  */
534 static void
535 spdc_set_startpoint(SPPencilContext *const pc, NR::Point const p)
537     pc->npoints = 0;
538     pc->red_curve_is_valid = false;
539     if (in_svg_plane(p)) {
540         pc->p[pc->npoints++] = p;
541     }
544 /**
545  * Change moving endpoint position.
546  * <ul>
547  * <li>Ctrl constrains to moving to H/V direction, snapping in given direction.
548  * <li>Otherwise we snap freely to whatever attractors are available.
549  * </ul>
550  *
551  * Number of points is (re)set to 2 always, 2nd point is modified.
552  * We change RED curve.
553  */
554 static void
555 spdc_set_endpoint(SPPencilContext *const pc, NR::Point const p)
557     if (pc->npoints == 0) {
558         return;
559         /* May occur if first point wasn't in SVG plane (e.g. weird w2d transform, perhaps from bad
560          * zoom setting).
561          */
562     }
563     g_return_if_fail( pc->npoints > 0 );
565     pc->red_curve->reset();
566     if ( ( p == pc->p[0] )
567          || !in_svg_plane(p) )
568     {
569         pc->npoints = 1;
570     } else {
571         pc->p[1] = p;
572         pc->npoints = 2;
574         pc->red_curve->moveto(pc->p[0]);
575         pc->red_curve->lineto(pc->p[1]);
576         pc->red_curve_is_valid = true;
578         sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), pc->red_curve);
579     }
582 /**
583  * Finalize addline.
584  *
585  * \todo
586  * fixme: I'd like remove red reset from concat colors (lauris).
587  * Still not sure, how it will make most sense.
588  */
589 static void
590 spdc_finish_endpoint(SPPencilContext *const pc)
592     if ( ( pc->red_curve->is_empty() )
593          || ( pc->red_curve->first_point() == pc->red_curve->second_point()   ) )
594     {
595         pc->red_curve->reset();
596         sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), NULL);
597     } else {
598         /* Write curves to object. */
599         spdc_concat_colors_and_flush(pc, FALSE);
600         pc->sa = NULL;
601         pc->ea = NULL;
602     }
605 static void
606 spdc_add_freehand_point(SPPencilContext *pc, NR::Point p, guint /*state*/)
608     g_assert( pc->npoints > 0 );
609     g_return_if_fail(unsigned(pc->npoints) < G_N_ELEMENTS(pc->p));
611     if ( ( p != pc->p[ pc->npoints - 1 ] )
612          && in_svg_plane(p) )
613     {
614         pc->p[pc->npoints++] = p;
615         fit_and_split(pc);
616     }
619 static inline double
620 square(double const x)
622     return x * x;
625 static void
626 fit_and_split(SPPencilContext *pc)
628     g_assert( pc->npoints > 1 );
630     double const tol = prefs_get_double_attribute_limited("tools.freehand.pencil",                                                                             "tolerance", 10.0, 1.0, 100.0);
631     double const tolerance_sq = 0.02 * square( NR::expansion(pc->desktop->w2d()) * tol) 
632         * exp(0.2*tol - 2);
634     NR::Point b[4];
635     g_assert(is_zero(pc->req_tangent)
636              || is_unit_vector(pc->req_tangent));
637     NR::Point const tHatEnd(0, 0);
638     int const n_segs = sp_bezier_fit_cubic_full(b, NULL, pc->p, pc->npoints,
639                                                 pc->req_tangent, tHatEnd, tolerance_sq, 1);
640     if ( n_segs > 0
641          && unsigned(pc->npoints) < G_N_ELEMENTS(pc->p) )
642     {
643         /* Fit and draw and reset state */
644         pc->red_curve->reset();
645         pc->red_curve->moveto(b[0]);
646         pc->red_curve->curveto(b[1], b[2], b[3]);
647         sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), pc->red_curve);
648         pc->red_curve_is_valid = true;
649     } else {
650         /* Fit and draw and copy last point */
652         g_assert(!pc->red_curve->is_empty());
654         /* Set up direction of next curve. */
655         {
656             Geom::CubicBezier const * last_seg = dynamic_cast<Geom::CubicBezier const *>(pc->red_curve->last_segment());
657             g_assert( last_seg );      // Relevance: validity of (*last_seg)[2]
658             pc->p[0] = last_seg->finalPoint();
659             pc->npoints = 1;
660             NR::Point const req_vec( pc->p[0] - (*last_seg)[2] );
661             pc->req_tangent = ( ( NR::is_zero(req_vec) || !in_svg_plane(req_vec) )
662                                 ? NR::Point(0, 0)
663                                 : NR::unit_vector(req_vec) );
664         }
666         pc->green_curve->append_continuous(pc->red_curve, 0.0625);
667         SPCurve *curve = pc->red_curve->copy();
669         /// \todo fixme:
670         SPCanvasItem *cshape = sp_canvas_bpath_new(sp_desktop_sketch(pc->desktop), curve);
671         curve->unref();
672         sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(cshape), pc->green_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
674         pc->green_bpaths = g_slist_prepend(pc->green_bpaths, cshape);
676         pc->red_curve_is_valid = false;
677     }
681 /*
682   Local Variables:
683   mode:c++
684   c-file-style:"stroustrup"
685   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
686   indent-tabs-mode:nil
687   fill-column:99
688   End:
689 */
690 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :