]> Pileus Git - ~andy/gtk/blob - gtk/gtkcolorswatch.c
GtkColorSwatch: Add accessible actions
[~andy/gtk] / gtk / gtkcolorswatch.c
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 2012 Red Hat, Inc.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #include "config.h"
21
22 #include "gtkcolorswatchprivate.h"
23
24 #include "gtkcolorchooserprivate.h"
25 #include "gtkroundedboxprivate.h"
26 #include "gtkthemingbackgroundprivate.h"
27 #include "gtkdnd.h"
28 #include "gtkicontheme.h"
29 #include "gtkmain.h"
30 #include "gtkmenu.h"
31 #include "gtkmenuitem.h"
32 #include "gtkmenushell.h"
33 #include "gtkprivate.h"
34 #include "gtkintl.h"
35 #include "a11y/gtkcolorswatchaccessible.h"
36
37
38 struct _GtkColorSwatchPrivate
39 {
40   GdkRGBA color;
41   gdouble radius[4];
42   gchar *icon;
43   guint    has_color        : 1;
44   guint    contains_pointer : 1;
45   guint    use_alpha        : 1;
46 };
47
48 enum
49 {
50   PROP_ZERO,
51   PROP_RGBA
52 };
53
54 enum
55 {
56   ACTIVATE,
57   CUSTOMIZE,
58   LAST_SIGNAL
59 };
60
61 static guint signals[LAST_SIGNAL];
62
63 G_DEFINE_TYPE (GtkColorSwatch, gtk_color_swatch, GTK_TYPE_DRAWING_AREA)
64
65 static void
66 gtk_color_swatch_init (GtkColorSwatch *swatch)
67 {
68   swatch->priv = G_TYPE_INSTANCE_GET_PRIVATE (swatch,
69                                               GTK_TYPE_COLOR_SWATCH,
70                                               GtkColorSwatchPrivate);
71
72   gtk_widget_set_can_focus (GTK_WIDGET (swatch), TRUE);
73   gtk_widget_set_events (GTK_WIDGET (swatch), GDK_BUTTON_PRESS_MASK
74                                               | GDK_BUTTON_RELEASE_MASK
75                                               | GDK_EXPOSURE_MASK
76                                               | GDK_ENTER_NOTIFY_MASK
77                                               | GDK_LEAVE_NOTIFY_MASK);
78   swatch->priv->use_alpha = TRUE;
79 }
80
81 #define INTENSITY(r, g, b) ((r) * 0.30 + (g) * 0.59 + (b) * 0.11)
82
83 static gboolean
84 swatch_draw (GtkWidget *widget,
85              cairo_t   *cr)
86 {
87   GtkColorSwatch *swatch = (GtkColorSwatch*)widget;
88   GtkThemingBackground background;
89   gdouble width, height;
90   GtkStyleContext *context;
91   GtkStateFlags state;
92   GtkIconTheme *theme;
93   GtkIconInfo *icon_info = NULL;
94
95   theme = gtk_icon_theme_get_default ();
96   context = gtk_widget_get_style_context (widget);
97   state = gtk_widget_get_state_flags (widget);
98   width = gtk_widget_get_allocated_width (widget);
99   height = gtk_widget_get_allocated_height (widget);
100
101   cairo_save (cr);
102
103   gtk_style_context_save (context);
104   gtk_style_context_set_state (context, state);
105
106   _gtk_theming_background_init_from_context (&background, context,
107                                              0, 0, width, height,
108                                              GTK_JUNCTION_NONE);
109
110   if (swatch->priv->has_color)
111     {
112       cairo_pattern_t *pattern;
113       cairo_matrix_t matrix;
114
115       if (swatch->priv->use_alpha)
116         {
117           cairo_save (cr);
118
119           _gtk_rounded_box_path (&background.clip_box, cr);
120           cairo_clip_preserve (cr);
121
122           cairo_set_source_rgb (cr, 0.33, 0.33, 0.33);
123           cairo_fill_preserve (cr);
124
125           pattern = _gtk_color_chooser_get_checkered_pattern ();
126           cairo_matrix_init_scale (&matrix, 0.125, 0.125);
127           cairo_pattern_set_matrix (pattern, &matrix);
128
129           cairo_set_source_rgb (cr, 0.66, 0.66, 0.66);
130           cairo_mask (cr, pattern);
131           cairo_pattern_destroy (pattern);
132
133           cairo_restore (cr);
134
135           background.bg_color = swatch->priv->color;
136         }
137       else
138         {
139           background.bg_color = swatch->priv->color;
140           background.bg_color.alpha = 1.0;
141         }
142
143       _gtk_theming_background_render (&background, cr);
144     }
145
146   gtk_render_frame (context, cr,
147                     0, 0, width, height);
148
149   if (gtk_widget_has_visible_focus (widget))
150     {
151       cairo_set_line_width (cr, 2);
152       if (swatch->priv->has_color && INTENSITY (swatch->priv->color.red, swatch->priv->color.green, swatch->priv->color.blue) < 0.5)
153         cairo_set_source_rgba (cr, 1., 1., 1., 0.4);
154       else
155         cairo_set_source_rgba (cr, 0., 0., 0., 0.4);
156       _gtk_rounded_box_shrink (&background.clip_box, 3, 3, 3, 3);
157       _gtk_rounded_box_path (&background.clip_box, cr);
158       cairo_stroke (cr);
159     }
160
161   if (swatch->priv->icon)
162     {
163       icon_info = gtk_icon_theme_lookup_icon (theme, swatch->priv->icon, 16,
164                                               GTK_ICON_LOOKUP_GENERIC_FALLBACK
165                                               | GTK_ICON_LOOKUP_USE_BUILTIN);
166     }
167   else if ((state & GTK_STATE_FLAG_SELECTED) != 0)
168     {
169       GdkRGBA bg, border;
170       GtkBorder border_width;
171       GIcon *gicon;
172
173       gtk_style_context_add_class (context, "color-active-badge");
174       gtk_style_context_get_background_color (context, state, &bg);
175       gtk_style_context_get_border_color (context, state, &border);
176       gtk_style_context_get_border (context, state, &border_width);
177
178       cairo_new_sub_path (cr);
179       cairo_arc (cr, width / 2, height / 2, 10, 0, 2 * G_PI);
180       cairo_close_path (cr);
181       gdk_cairo_set_source_rgba (cr, &bg);
182       cairo_fill_preserve (cr);
183
184       gdk_cairo_set_source_rgba (cr, &border);
185       cairo_set_line_width (cr, border_width.left);
186       cairo_stroke (cr);
187
188       gicon = g_themed_icon_new ("object-select-symbolic");
189       /* fallback for themes that don't have object-select-symbolic */
190       g_themed_icon_append_name (G_THEMED_ICON (gicon), "gtk-apply");
191
192       icon_info = gtk_icon_theme_lookup_by_gicon (theme, gicon, 16,
193                                                   GTK_ICON_LOOKUP_GENERIC_FALLBACK
194                                                   | GTK_ICON_LOOKUP_USE_BUILTIN);
195       g_object_unref (gicon);
196     }
197
198   if (icon_info != NULL)
199     {
200       GdkPixbuf *pixbuf;
201
202       pixbuf = gtk_icon_info_load_symbolic_for_context (icon_info, context,
203                                                         NULL, NULL);
204
205       if (pixbuf != NULL)
206         {
207           gtk_render_icon (context, cr, pixbuf,
208                            (width - gdk_pixbuf_get_width (pixbuf)) / 2,
209                            (height - gdk_pixbuf_get_height (pixbuf)) / 2);
210           g_object_unref (pixbuf);
211         }
212
213       gtk_icon_info_free (icon_info);
214     }
215
216   cairo_restore (cr);
217   gtk_style_context_restore (context);
218
219   return FALSE;
220 }
221
222 static void
223 drag_set_color_icon (GdkDragContext *context,
224                      const GdkRGBA  *color)
225 {
226   cairo_surface_t *surface;
227   cairo_t *cr;
228
229   surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 48, 32);
230   cr = cairo_create (surface);
231   gdk_cairo_set_source_rgba (cr, color);
232   cairo_paint (cr);
233
234   cairo_surface_set_device_offset (surface, -4, -4);
235   gtk_drag_set_icon_surface (context, surface);
236
237   cairo_destroy (cr);
238   cairo_surface_destroy (surface);
239 }
240
241 static void
242 swatch_drag_begin (GtkWidget      *widget,
243                    GdkDragContext *context)
244 {
245   GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
246   GdkRGBA color;
247
248   gtk_color_swatch_get_rgba (swatch, &color);
249   drag_set_color_icon (context, &color);
250 }
251
252 static void
253 swatch_drag_data_get (GtkWidget        *widget,
254                       GdkDragContext   *context,
255                       GtkSelectionData *selection_data,
256                       guint             info,
257                       guint             time)
258 {
259   GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
260   guint16 vals[4];
261   GdkRGBA color;
262
263   gtk_color_swatch_get_rgba (swatch, &color);
264
265   vals[0] = color.red * 0xffff;
266   vals[1] = color.green * 0xffff;
267   vals[2] = color.blue * 0xffff;
268   vals[3] = color.alpha * 0xffff;
269
270   gtk_selection_data_set (selection_data,
271                           gdk_atom_intern_static_string ("application/x-color"),
272                           16, (guchar *)vals, 8);
273 }
274
275 static void
276 swatch_drag_data_received (GtkWidget        *widget,
277                            GdkDragContext   *context,
278                            gint              x,
279                            gint              y,
280                            GtkSelectionData *selection_data,
281                            guint             info,
282                            guint             time)
283 {
284   gint length;
285   guint16 *vals;
286   GdkRGBA color;
287
288   length = gtk_selection_data_get_length (selection_data);
289
290   if (length < 0)
291     return;
292
293   /* We accept drops with the wrong format, since the KDE color
294    * chooser incorrectly drops application/x-color with format 8.
295    */
296   if (length != 8)
297     {
298       g_warning ("Received invalid color data\n");
299       return;
300     }
301
302   vals = (guint16 *) gtk_selection_data_get_data (selection_data);
303
304   color.red   = (gdouble)vals[0] / 0xffff;
305   color.green = (gdouble)vals[1] / 0xffff;
306   color.blue  = (gdouble)vals[2] / 0xffff;
307   color.alpha = (gdouble)vals[3] / 0xffff;
308
309   gtk_color_swatch_set_rgba (GTK_COLOR_SWATCH (widget), &color);
310 }
311
312 static void
313 swatch_get_preferred_width (GtkWidget *widget,
314                             gint      *min,
315                             gint      *nat)
316 {
317   *min = *nat = 48;
318 }
319
320 static void
321 swatch_get_preferred_height (GtkWidget *widget,
322                              gint      *min,
323                              gint      *nat)
324 {
325   *min = *nat = 32;
326 }
327
328 static gboolean
329 swatch_key_press (GtkWidget   *widget,
330                   GdkEventKey *event)
331 {
332   GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
333
334   if (event->keyval == GDK_KEY_space ||
335       event->keyval == GDK_KEY_Return ||
336       event->keyval == GDK_KEY_ISO_Enter||
337       event->keyval == GDK_KEY_KP_Enter ||
338       event->keyval == GDK_KEY_KP_Space)
339     {
340       if (swatch->priv->has_color && (gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_SELECTED) == 0)
341         gtk_widget_set_state_flags (widget, GTK_STATE_FLAG_SELECTED, FALSE);
342       else
343         g_signal_emit (swatch, signals[ACTIVATE], 0);
344       return TRUE;
345     }
346
347   if (GTK_WIDGET_CLASS (gtk_color_swatch_parent_class)->key_press_event (widget, event))
348     return TRUE;
349
350   return FALSE;
351 }
352
353 static gboolean
354 swatch_enter_notify (GtkWidget        *widget,
355                      GdkEventCrossing *event)
356 {
357   GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
358   swatch->priv->contains_pointer = TRUE;
359   return FALSE;
360 }
361
362 static gboolean
363 swatch_leave_notify (GtkWidget        *widget,
364                      GdkEventCrossing *event)
365 {
366   GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
367   swatch->priv->contains_pointer = FALSE;
368   return FALSE;
369 }
370
371 static void
372 emit_customize (GtkColorSwatch *swatch)
373 {
374   g_signal_emit (swatch, signals[CUSTOMIZE], 0);
375 }
376
377 static void
378 popup_position_func (GtkMenu   *menu,
379                      gint      *x,
380                      gint      *y,
381                      gboolean  *push_in,
382                      gpointer   user_data)
383 {
384   GtkWidget *widget;
385   GtkRequisition req;
386   gint root_x, root_y;
387   GdkScreen *screen;
388   GdkWindow *window;
389   GdkRectangle monitor;
390   gint monitor_num;
391
392   widget = GTK_WIDGET (user_data);
393   g_return_if_fail (gtk_widget_get_realized (widget));
394   window = gtk_widget_get_window (widget);
395
396   screen = gtk_widget_get_screen (widget);
397   monitor_num = gdk_screen_get_monitor_at_window (screen, window);
398   if (monitor_num < 0)
399     monitor_num = 0;
400   gtk_menu_set_monitor (menu, monitor_num);
401
402   gdk_window_get_origin (window, &root_x, &root_y);
403   gtk_widget_get_preferred_size (GTK_WIDGET (menu), &req, NULL);
404
405   /* Put corner of menu centered on swatch */
406   *x = root_x + gtk_widget_get_allocated_width (widget) / 2;
407   *y = root_y + gtk_widget_get_allocated_height (widget) / 2;
408
409   /* Ensure sanity */
410   gdk_screen_get_monitor_workarea (screen, monitor_num, &monitor);
411   *x = CLAMP (*x, monitor.x, MAX (monitor.x, monitor.width - req.width));
412   *y = CLAMP (*y, monitor.y, MAX (monitor.y, monitor.height - req.height));
413 }
414
415 static void
416 do_popup (GtkWidget      *swatch,
417           GdkEventButton *event)
418 {
419   GtkWidget *menu;
420   GtkWidget *item;
421
422   menu = gtk_menu_new ();
423   item = gtk_menu_item_new_with_mnemonic (_("_Customize"));
424   gtk_menu_attach_to_widget (GTK_MENU (menu), swatch, NULL);
425
426   g_signal_connect_swapped (item, "activate",
427                             G_CALLBACK (emit_customize), swatch);
428
429   gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
430
431   gtk_widget_show_all (item);
432
433   if (event)
434     gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
435                     NULL, NULL, event->button, event->time);
436   else
437     gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
438                     popup_position_func, swatch,
439                     0, gtk_get_current_event_time ());
440 }
441
442 static gboolean
443 swatch_button_press (GtkWidget      *widget,
444                      GdkEventButton *event)
445 {
446   GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
447
448   gtk_widget_grab_focus (widget);
449
450   if (gdk_event_triggers_context_menu ((GdkEvent *) event) &&
451       swatch->priv->has_color)
452     {
453       do_popup (widget, event);
454       return TRUE;
455     }
456   else if (event->type == GDK_2BUTTON_PRESS &&
457            event->button == GDK_BUTTON_PRIMARY)
458     {
459       g_signal_emit (swatch, signals[ACTIVATE], 0);
460       return TRUE;
461     }
462
463   return FALSE;
464 }
465
466 static gboolean
467 swatch_button_release (GtkWidget      *widget,
468                        GdkEventButton *event)
469 {
470   GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
471   GtkStateFlags flags;
472
473   if (event->button == GDK_BUTTON_PRIMARY &&
474       swatch->priv->contains_pointer)
475     {
476       flags = gtk_widget_get_state_flags (widget);
477       if (!swatch->priv->has_color)
478         {
479           g_signal_emit (swatch, signals[ACTIVATE], 0);
480           return TRUE;
481         }
482       else if ((flags & GTK_STATE_FLAG_SELECTED) == 0)
483         {
484           gtk_widget_set_state_flags (widget, GTK_STATE_FLAG_SELECTED, FALSE);
485           return TRUE;
486         }
487     }
488
489   return FALSE;
490 }
491
492 static gboolean
493 swatch_popup_menu (GtkWidget *swatch)
494 {
495   do_popup (swatch, NULL);
496   return TRUE;
497 }
498
499 /* GObject implementation {{{1 */
500
501 static void
502 swatch_get_property (GObject    *object,
503                      guint       prop_id,
504                      GValue     *value,
505                      GParamSpec *pspec)
506 {
507   GtkColorSwatch *swatch = GTK_COLOR_SWATCH (object);
508   GdkRGBA color;
509
510   switch (prop_id)
511     {
512     case PROP_RGBA:
513       gtk_color_swatch_get_rgba (swatch, &color);
514       g_value_set_boxed (value, &color);
515       break;
516     default:
517       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
518       break;
519     }
520 }
521
522 static void
523 swatch_set_property (GObject      *object,
524                      guint         prop_id,
525                      const GValue *value,
526                      GParamSpec   *pspec)
527 {
528   GtkColorSwatch *swatch = GTK_COLOR_SWATCH (object);
529
530   switch (prop_id)
531     {
532     case PROP_RGBA:
533       gtk_color_swatch_set_rgba (swatch, g_value_get_boxed (value));
534       break;
535     default:
536       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
537       break;
538     }
539 }
540
541 static void
542 swatch_finalize (GObject *object)
543 {
544   GtkColorSwatch *swatch = GTK_COLOR_SWATCH (object);
545
546   g_free (swatch->priv->icon);
547
548   G_OBJECT_CLASS (gtk_color_swatch_parent_class)->finalize (object);
549 }
550
551 static void
552 gtk_color_swatch_class_init (GtkColorSwatchClass *class)
553 {
554   GtkWidgetClass *widget_class = (GtkWidgetClass *)class;
555   GObjectClass *object_class = (GObjectClass *)class;
556
557   object_class->get_property = swatch_get_property;
558   object_class->set_property = swatch_set_property;
559   object_class->finalize = swatch_finalize;
560
561   widget_class->get_preferred_width = swatch_get_preferred_width;
562   widget_class->get_preferred_height = swatch_get_preferred_height;
563   widget_class->draw = swatch_draw;
564   widget_class->drag_begin = swatch_drag_begin;
565   widget_class->drag_data_get = swatch_drag_data_get;
566   widget_class->drag_data_received = swatch_drag_data_received;
567   widget_class->key_press_event = swatch_key_press;
568   widget_class->popup_menu = swatch_popup_menu;
569   widget_class->button_press_event = swatch_button_press;
570   widget_class->button_release_event = swatch_button_release;
571   widget_class->enter_notify_event = swatch_enter_notify;
572   widget_class->leave_notify_event = swatch_leave_notify;
573
574   signals[ACTIVATE] =
575     g_signal_new ("activate",
576                   GTK_TYPE_COLOR_SWATCH,
577                   G_SIGNAL_RUN_FIRST,
578                   G_STRUCT_OFFSET (GtkColorSwatchClass, activate),
579                   NULL, NULL, NULL, G_TYPE_NONE, 0);
580
581   signals[CUSTOMIZE] =
582     g_signal_new ("customize",
583                   GTK_TYPE_COLOR_SWATCH,
584                   G_SIGNAL_RUN_FIRST,
585                   G_STRUCT_OFFSET (GtkColorSwatchClass, customize),
586                   NULL, NULL, NULL, G_TYPE_NONE, 0);
587
588   g_object_class_install_property (object_class, PROP_RGBA,
589       g_param_spec_boxed ("rgba", P_("RGBA Color"), P_("Color as RGBA"),
590                           GDK_TYPE_RGBA, GTK_PARAM_READWRITE));
591
592   g_type_class_add_private (object_class, sizeof (GtkColorSwatchPrivate));
593
594   gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_COLOR_SWATCH_ACCESSIBLE);
595 }
596
597 /* Public API {{{1 */
598
599 GtkWidget *
600 gtk_color_swatch_new (void)
601 {
602   return (GtkWidget *) g_object_new (GTK_TYPE_COLOR_SWATCH, NULL);
603 }
604
605 static const GtkTargetEntry dnd_targets[] = {
606   { "application/x-color", 0 }
607 };
608
609 void
610 gtk_color_swatch_set_rgba (GtkColorSwatch *swatch,
611                            const GdkRGBA  *color)
612 {
613   GtkStyleContext *context;
614
615   context = gtk_widget_get_style_context (GTK_WIDGET (swatch));
616
617   if (!swatch->priv->has_color)
618     {
619       gtk_drag_source_set (GTK_WIDGET (swatch),
620                            GDK_BUTTON1_MASK | GDK_BUTTON3_MASK,
621                            dnd_targets, G_N_ELEMENTS (dnd_targets),
622                            GDK_ACTION_COPY | GDK_ACTION_MOVE);
623     }
624   else
625     {
626       gtk_style_context_remove_class (context, "color-light");
627       gtk_style_context_remove_class (context, "color-dark");
628     }
629
630   swatch->priv->has_color = TRUE;
631   swatch->priv->color = *color;
632
633   if (INTENSITY (swatch->priv->color.red, swatch->priv->color.green, swatch->priv->color.blue) > 0.5)
634     gtk_style_context_add_class (context, "color-light");
635   else
636     gtk_style_context_add_class (context, "color-dark");
637
638   gtk_widget_queue_draw (GTK_WIDGET (swatch));
639   g_object_notify (G_OBJECT (swatch), "rgba");
640 }
641
642 gboolean
643 gtk_color_swatch_get_rgba (GtkColorSwatch *swatch,
644                            GdkRGBA        *color)
645 {
646   if (swatch->priv->has_color)
647     {
648       color->red = swatch->priv->color.red;
649       color->green = swatch->priv->color.green;
650       color->blue = swatch->priv->color.blue;
651       color->alpha = swatch->priv->color.alpha;
652       return TRUE;
653     }
654   else
655     {
656       color->red = 1.0;
657       color->green = 1.0;
658       color->blue = 1.0;
659       color->alpha = 1.0;
660       return FALSE;
661     }
662 }
663
664 void
665 gtk_color_swatch_set_icon (GtkColorSwatch *swatch,
666                            const gchar    *icon)
667 {
668   swatch->priv->icon = g_strdup (icon);
669   gtk_widget_queue_draw (GTK_WIDGET (swatch));
670 }
671
672 void
673 gtk_color_swatch_set_can_drop (GtkColorSwatch *swatch,
674                                gboolean        can_drop)
675 {
676   if (can_drop)
677     {
678       gtk_drag_dest_set (GTK_WIDGET (swatch),
679                          GTK_DEST_DEFAULT_HIGHLIGHT |
680                          GTK_DEST_DEFAULT_MOTION |
681                          GTK_DEST_DEFAULT_DROP,
682                          dnd_targets, G_N_ELEMENTS (dnd_targets),
683                          GDK_ACTION_COPY);
684     }
685   else
686     {
687       gtk_drag_dest_unset (GTK_WIDGET (swatch));
688     }
689 }
690
691 void
692 gtk_color_swatch_set_use_alpha (GtkColorSwatch *swatch,
693                                 gboolean        use_alpha)
694 {
695   swatch->priv->use_alpha = use_alpha;
696   gtk_widget_queue_draw (GTK_WIDGET (swatch));
697 }
698
699 /* vim:set foldmethod=marker: */