Documentation: Use G_SOURCE_CONTINUE and G_SOURCE_REMOVE
[geeqie.git] / src / ui-tree-edit.cc
1 /*
2  * Copyright (C) 2004 John Ellis
3  * Copyright (C) 2008 - 2016 The Geeqie Team
4  *
5  * Author: John Ellis
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21
22 #include <string.h>
23
24 #include "main.h"
25 #include "ui-tree-edit.h"
26
27 /*
28  *-------------------------------------------------------------------
29  * cell popup editor
30  *-------------------------------------------------------------------
31  */
32
33 static void tree_edit_close(TreeEditData *ted)
34 {
35         gtk_grab_remove(ted->window);
36         gdk_keyboard_ungrab(GDK_CURRENT_TIME);
37         gdk_pointer_ungrab(GDK_CURRENT_TIME);
38
39         gtk_widget_destroy(ted->window);
40
41         g_free(ted->old_name);
42         g_free(ted->new_name);
43         gtk_tree_path_free(ted->path);
44
45         g_free(ted);
46 }
47
48 static void tree_edit_do(TreeEditData *ted)
49 {
50         ted->new_name = g_strdup(gtk_entry_get_text(GTK_ENTRY(ted->entry)));
51
52         if (strcmp(ted->new_name, ted->old_name) != 0)
53                 {
54                 if (ted->edit_func)
55                         {
56                         if (ted->edit_func(ted, ted->old_name, ted->new_name, ted->edit_data))
57                                 {
58                                 /* hmm, should the caller be required to set text instead ? */
59                                 }
60                         }
61                 }
62 }
63
64 static gboolean tree_edit_click_end_cb(GtkWidget *UNUSED(widget), GdkEventButton *UNUSED(event), gpointer data)
65 {
66         TreeEditData *ted = static_cast<TreeEditData *>(data);
67
68         tree_edit_do(ted);
69         tree_edit_close(ted);
70
71         return TRUE;
72 }
73
74 static gboolean tree_edit_click_cb(GtkWidget *UNUSED(widget), GdkEventButton *event, gpointer data)
75 {
76         TreeEditData *ted = static_cast<TreeEditData *>(data);
77         GdkWindow *window = gtk_widget_get_window(ted->window);
78
79         gint x, y;
80         gint w, h;
81
82         gint xr, yr;
83
84         xr = (gint)event->x_root;
85         yr = (gint)event->y_root;
86
87         gdk_window_get_origin(window, &x, &y);
88         w = gdk_window_get_width(window);
89         h = gdk_window_get_height(window);
90
91         if (xr < x || yr < y || xr > x + w || yr > y + h)
92                 {
93                 /* gobble the release event, so it does not propgate to an underlying widget */
94                 g_signal_connect(G_OBJECT(ted->window), "button_release_event",
95                                  G_CALLBACK(tree_edit_click_end_cb), ted);
96                 return TRUE;
97                 }
98         return FALSE;
99 }
100
101 static gboolean tree_edit_key_press_cb(GtkWidget *UNUSED(widget), GdkEventKey *event, gpointer data)
102 {
103         TreeEditData *ted = static_cast<TreeEditData *>(data);
104
105         switch (event->keyval)
106                 {
107                 case GDK_KEY_Return:
108                 case GDK_KEY_KP_Enter:
109                 case GDK_KEY_Tab:               /* ok, we are going to intercept the focus change
110                                            from keyboard and act like return was hit */
111                 case GDK_KEY_ISO_Left_Tab:
112                 case GDK_KEY_Up:
113                 case GDK_KEY_Down:
114                 case GDK_KEY_KP_Up:
115                 case GDK_KEY_KP_Down:
116                 case GDK_KEY_KP_Left:
117                 case GDK_KEY_KP_Right:
118                         tree_edit_do(ted);
119                         tree_edit_close(ted);
120                         break;
121                 case GDK_KEY_Escape:
122                         tree_edit_close(ted);
123                         break;
124                 default:
125                         break;
126                 }
127
128         return FALSE;
129 }
130
131 static gboolean tree_edit_by_path_idle_cb(gpointer data)
132 {
133         TreeEditData *ted = static_cast<TreeEditData *>(data);
134         GdkRectangle rect;
135         gint x, y, w, h;        /* geometry of cell within tree */
136         gint wx, wy;            /* geometry of tree from root window */
137         gint sx, sw;
138
139         gtk_tree_view_get_cell_area(ted->tree, ted->path, ted->column, &rect);
140
141         x = rect.x;
142         y = rect.y;
143         w = rect.width + 4;
144         h = rect.height + 4;
145
146         if (gtk_tree_view_column_cell_get_position(ted->column, ted->cell, &sx, &sw))
147                 {
148                 x += sx;
149                 w = MAX(w - sx, sw);
150                 }
151
152         gdk_window_get_origin(gtk_widget_get_window(gtk_widget_get_parent(GTK_WIDGET(ted->tree))), &wx, &wy);
153
154         x += wx - 2; /* the -val is to 'fix' alignment of entry position */
155         y += wy - 2;
156
157         /* now show it */
158         gtk_widget_set_size_request(ted->window, w, h);
159         gtk_widget_realize(ted->window);
160         gtk_window_move(GTK_WINDOW(ted->window), x, y);
161         gtk_window_resize(GTK_WINDOW(ted->window), w, h);
162         gtk_widget_show(ted->window);
163
164         /* grab it */
165         gtk_widget_grab_focus(ted->entry);
166         /* explicitly set the focus flag for the entry, for some reason on popup windows this
167          * is not set, and causes no edit cursor to appear ( popups not allowed focus? )
168          */
169         gtk_widget_grab_focus(ted->entry);
170         gtk_grab_add(ted->window);
171         gdk_pointer_grab(gtk_widget_get_window(ted->window), TRUE,
172                          static_cast<GdkEventMask>(GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_MOTION_MASK),
173                          NULL, NULL, GDK_CURRENT_TIME);
174         gdk_keyboard_grab(gtk_widget_get_window(ted->window), TRUE, GDK_CURRENT_TIME);
175
176         return G_SOURCE_REMOVE;
177 }
178
179 gboolean tree_edit_by_path(GtkTreeView *tree, GtkTreePath *tpath, gint column, const gchar *text,
180                            gboolean (*edit_func)(TreeEditData *, const gchar *, const gchar *, gpointer), gpointer data)
181 {
182         TreeEditData *ted;
183         GtkTreeViewColumn *tcolumn;
184         GtkCellRenderer *cell = NULL;
185         GList *list;
186         GList *work;
187
188         if (!edit_func) return FALSE;
189         if (!gtk_widget_get_visible(GTK_WIDGET(tree))) return FALSE;
190
191         tcolumn = gtk_tree_view_get_column(tree, column);
192         if (!tcolumn) return FALSE;
193
194         list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(tcolumn));
195         work = list;
196         while (work && !cell)
197                 {
198                 cell = static_cast<GtkCellRenderer *>(work->data);
199                 if (!GTK_IS_CELL_RENDERER_TEXT(cell))
200                         {
201                         cell = NULL;
202                         }
203                 work = work->next;
204                 }
205
206         g_list_free(list);
207         if (!cell) return FALSE;
208
209         if (!text) text = "";
210
211         ted = g_new0(TreeEditData, 1);
212
213         ted->old_name = g_strdup(text);
214
215         ted->edit_func = edit_func;
216         ted->edit_data = data;
217
218         ted->tree = tree;
219         ted->path = gtk_tree_path_copy(tpath);
220         ted->column = tcolumn;
221         ted->cell = cell;
222
223         gtk_tree_view_scroll_to_cell(ted->tree, ted->path, ted->column, TRUE, 0.5, 0.0);
224
225         /* create the window */
226
227         ted->window = gtk_window_new(GTK_WINDOW_POPUP);
228         gtk_window_set_resizable(GTK_WINDOW(ted->window), FALSE);
229         g_signal_connect(G_OBJECT(ted->window), "button_press_event",
230                          G_CALLBACK(tree_edit_click_cb), ted);
231         g_signal_connect(G_OBJECT(ted->window), "key_press_event",
232                          G_CALLBACK(tree_edit_key_press_cb), ted);
233
234         ted->entry = gtk_entry_new();
235         gtk_entry_set_text(GTK_ENTRY(ted->entry), ted->old_name);
236         gtk_editable_select_region(GTK_EDITABLE(ted->entry), 0, strlen(ted->old_name));
237         gtk_container_add(GTK_CONTAINER(ted->window), ted->entry);
238         gtk_widget_show(ted->entry);
239
240         /* due to the fact that gtktreeview scrolls in an idle loop, we cannot
241          * reliably get the cell position until those scroll priority signals are processed
242          */
243         g_idle_add_full(G_PRIORITY_DEFAULT_IDLE - 2, tree_edit_by_path_idle_cb, ted, NULL);
244
245         return TRUE;
246 }
247
248 /*
249  *-------------------------------------------------------------------
250  * tree cell position retrieval
251  *-------------------------------------------------------------------
252  */
253
254 gboolean tree_view_get_cell_origin(GtkTreeView *widget, GtkTreePath *tpath, gint column, gboolean text_cell_only,
255                                    gint *x, gint *y, gint *width, gint *height)
256 {
257         gint x_origin, y_origin;
258         gint x_offset, y_offset;
259         gint header_size;
260         GtkTreeViewColumn *tv_column;
261         GdkRectangle rect;
262
263         tv_column = gtk_tree_view_get_column(widget, column);
264         if (!tv_column || !tpath) return FALSE;
265
266         /* hmm, appears the rect will not account for X scroll, but does for Y scroll
267          * use x_offset instead for X scroll (sigh)
268          */
269         gtk_tree_view_get_cell_area(widget, tpath, tv_column, &rect);
270         gtk_tree_view_convert_tree_to_widget_coords(widget, 0, 0, &x_offset, &y_offset);
271         gdk_window_get_origin(gtk_widget_get_window(GTK_WIDGET(widget)), &x_origin, &y_origin);
272
273         if (gtk_tree_view_get_headers_visible(widget))
274                 {
275                 GtkAllocation allocation;
276                 gtk_widget_get_allocation(gtk_tree_view_column_get_button(tv_column), &allocation);
277                 header_size = allocation.height;
278                 }
279         else
280                 {
281                 header_size = 0;
282                 }
283
284         if (text_cell_only)
285                 {
286                 GtkCellRenderer *cell = NULL;
287                 GList *renderers;
288                 GList *work;
289                 gint cell_x;
290                 gint cell_width;
291
292                 renderers = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(tv_column));
293                 work = renderers;
294                 while (work && !cell)
295                         {
296                         cell = static_cast<GtkCellRenderer *>(work->data);
297                         work = work->next;
298                         if (!GTK_IS_CELL_RENDERER_TEXT(cell)) cell = NULL;
299                         }
300                 g_list_free(renderers);
301
302                 if (!cell) return FALSE;
303
304                 if (!gtk_tree_view_column_cell_get_position(tv_column, cell, &cell_x, &cell_width))
305                         {
306                         cell_x = 0;
307                         cell_width = rect.width;
308                         }
309                 *x = x_origin + x_offset + rect.x + cell_x;
310                 *width = cell_width;
311                 }
312         else
313                 {
314                 *x = x_origin + x_offset + rect.x;
315                 *width = rect.width;
316                 }
317         *y = y_origin + rect.y + header_size;
318         *height = rect.height;
319         return TRUE;
320 }
321
322 void tree_view_get_cell_clamped(GtkTreeView *widget, GtkTreePath *tpath, gint column, gboolean text_cell_only,
323                                 gint *x, gint *y, gint *width, gint *height)
324 {
325         gint wx, wy, ww, wh;
326         GdkWindow *window;
327
328         window = gtk_widget_get_window(GTK_WIDGET(widget));
329         gdk_window_get_origin(window, &wx, &wy);
330
331         ww = gdk_window_get_width(window);
332         wh = gdk_window_get_height(window);
333
334         if (!tree_view_get_cell_origin(widget, tpath, column, text_cell_only, x,  y, width, height))
335                 {
336                 *x = wx;
337                 *y = wy;
338                 *width = ww;
339                 *height = wh;
340                 return;
341                 }
342
343         *width = MIN(*width, ww);
344         *x = CLAMP(*x, wx, wx + ww - (*width));
345         *y = CLAMP(*y, wy, wy + wh);
346         *height = MIN(*height, wy + wh - (*y));
347 }
348
349 /* an implementation that uses gtk_tree_view_get_visible_range */
350 gint tree_view_row_get_visibility(GtkTreeView *widget, GtkTreeIter *iter, gboolean fully_visible)
351 {
352         GtkTreeModel *store;
353         GtkTreePath *tpath, *start_path, *end_path;
354         gint ret = 0;
355
356         if (!gtk_tree_view_get_visible_range(widget, &start_path, &end_path)) return -1; /* we will most probably scroll down, needed for tree_view_row_make_visible */
357
358         store = gtk_tree_view_get_model(widget);
359         tpath = gtk_tree_model_get_path(store, iter);
360
361         if (fully_visible)
362                 {
363                 if (gtk_tree_path_compare(tpath, start_path) <= 0)
364                         {
365                         ret = -1;
366                         }
367                 else if (gtk_tree_path_compare(tpath, end_path) >= 0)
368                         {
369                         ret = 1;
370                         }
371                 }
372         else
373                 {
374                 if (gtk_tree_path_compare(tpath, start_path) < 0)
375                         {
376                         ret = -1;
377                         }
378                 else if (gtk_tree_path_compare(tpath, end_path) > 0)
379                         {
380                         ret = 1;
381                         }
382                 }
383
384         gtk_tree_path_free(tpath);
385         gtk_tree_path_free(start_path);
386         gtk_tree_path_free(end_path);
387         return ret;
388 }
389
390 gint tree_view_row_make_visible(GtkTreeView *widget, GtkTreeIter *iter, gboolean center)
391 {
392         GtkTreePath *tpath;
393         gint vis;
394
395         vis = tree_view_row_get_visibility(widget, iter, TRUE);
396
397         tpath = gtk_tree_model_get_path(gtk_tree_view_get_model(widget), iter);
398         if (center && vis != 0)
399                 {
400                 gtk_tree_view_scroll_to_cell(widget, tpath, NULL, TRUE, 0.5, 0.0);
401                 }
402         else if (vis < 0)
403                 {
404                 gtk_tree_view_scroll_to_cell(widget, tpath, NULL, TRUE, 0.0, 0.0);
405                 }
406         else if (vis > 0)
407                 {
408                 gtk_tree_view_scroll_to_cell(widget, tpath, NULL, TRUE, 1.0, 0.0);
409                 }
410         gtk_tree_path_free(tpath);
411
412         return vis;
413 }
414
415 gboolean tree_view_move_cursor_away(GtkTreeView *widget, GtkTreeIter *iter, gboolean only_selected)
416 {
417         GtkTreeModel *store;
418         GtkTreePath *tpath;
419         GtkTreePath *fpath;
420         gboolean move = FALSE;
421
422         if (!iter) return FALSE;
423
424         store = gtk_tree_view_get_model(widget);
425         tpath = gtk_tree_model_get_path(store, iter);
426         gtk_tree_view_get_cursor(widget, &fpath, NULL);
427
428         if (fpath && gtk_tree_path_compare(tpath, fpath) == 0)
429                 {
430                 GtkTreeSelection *selection;
431
432                 selection = gtk_tree_view_get_selection(widget);
433
434                 if (!only_selected ||
435                     gtk_tree_selection_path_is_selected(selection, tpath))
436                         {
437                         GtkTreeIter current;
438
439                         current = *iter;
440                         if (gtk_tree_model_iter_next(store, &current))
441                                 {
442                                 gtk_tree_path_next(tpath);
443                                 move = TRUE;
444                                 }
445                         else if (gtk_tree_path_prev(tpath) &&
446                                  gtk_tree_model_get_iter(store, &current, tpath))
447                                 {
448                                 move = TRUE;
449                                 }
450
451                         if (move)
452                                 {
453                                 gtk_tree_view_set_cursor(widget, tpath, NULL, FALSE);
454                                 }
455                         }
456                 }
457
458         gtk_tree_path_free(tpath);
459         if (fpath) gtk_tree_path_free(fpath);
460
461         return move;
462 }
463
464 //gint tree_path_to_row(GtkTreePath *tpath)
465 //{
466         //gint *indices;
467
468         //indices = gtk_tree_path_get_indices(tpath);
469         //if (indices) return indices[0];
470
471         //return -1;
472 //}
473
474
475 /*
476  *-------------------------------------------------------------------
477  * color utilities
478  *-------------------------------------------------------------------
479  */
480
481 void shift_color(GdkColor *src, gshort val, gint direction)
482 {
483         gshort cs;
484
485         if (val == -1)
486                 {
487                 val = STYLE_SHIFT_STANDARD;
488                 }
489         else
490                 {
491                 val = CLAMP(val, 1, 100);
492                 }
493         cs = 0xffff / 100 * val;
494
495         /* up or down ? */
496         if (direction < 0 ||
497             (direction == 0 &&((gint)src->red + (gint)src->green + (gint)src->blue) / 3 > 0xffff / 2))
498                 {
499                 src->red = MAX(0 , src->red - cs);
500                 src->green = MAX(0 , src->green - cs);
501                 src->blue = MAX(0 , src->blue - cs);
502                 }
503         else
504                 {
505                 src->red = MIN(0xffff, src->red + cs);
506                 src->green = MIN(0xffff, src->green + cs);
507                 src->blue = MIN(0xffff, src->blue + cs);
508                 }
509 }
510
511 /* darkens or lightens a style's color for given state
512  * esp. useful for alternating dark/light in (c)lists
513  */
514 //void style_shift_color(GtkStyle *style, GtkStateType type, gshort shift_value, gint direction)
515 //{
516         //if (!style) return;
517
518         //shift_color(&style->base[type], shift_value, direction);
519         //shift_color(&style->bg[type], shift_value, direction);
520 //}
521
522 /*
523  *-------------------------------------------------------------------
524  * auto scroll by mouse position
525  *-------------------------------------------------------------------
526  */
527
528 #define AUTO_SCROLL_DEFAULT_SPEED 100
529 #define AUTO_SCROLL_DEFAULT_REGION 20
530
531 typedef struct _AutoScrollData AutoScrollData;
532 struct _AutoScrollData
533 {
534         guint timer_id; /* event source id */
535         gint region_size;
536         GtkWidget *widget;
537         GtkAdjustment *adj;
538         gint max_step;
539
540         gint (*notify_func)(GtkWidget *, gint, gint, gpointer);
541         gpointer notify_data;
542 };
543
544 void widget_auto_scroll_stop(GtkWidget *widget)
545 {
546         AutoScrollData *sd;
547
548         sd = static_cast<AutoScrollData *>(g_object_get_data(G_OBJECT(widget), "autoscroll"));
549         if (!sd) return;
550         g_object_set_data(G_OBJECT(widget), "autoscroll", NULL);
551
552         if (sd->timer_id) g_source_remove(sd->timer_id);
553         g_free(sd);
554 }
555
556 static gboolean widget_auto_scroll_cb(gpointer data)
557 {
558         AutoScrollData *sd = static_cast<AutoScrollData *>(data);
559         GdkWindow *window;
560         gint x, y;
561         gint w, h;
562         gint amt = 0;
563         GdkSeat *seat;
564         GdkDevice *device;
565
566         if (sd->max_step < sd->region_size)
567                 {
568                 sd->max_step = MIN(sd->region_size, sd->max_step + 2);
569                 }
570
571         window = gtk_widget_get_window(sd->widget);
572         seat = gdk_display_get_default_seat(gdk_window_get_display(window));
573         device = gdk_seat_get_pointer(seat);
574         gdk_window_get_device_position(window, device, &x, &y, NULL);
575
576         w = gdk_window_get_width(window);
577         h = gdk_window_get_height(window);
578
579         if (x < 0 || x >= w || y < 0 || y >= h)
580                 {
581                 sd->timer_id = 0;
582                 widget_auto_scroll_stop(sd->widget);
583                 return FALSE;
584                 }
585
586         if (h < sd->region_size * 3)
587                 {
588                 /* height is cramped, nicely divide into three equal regions */
589                 if (y < h / 3 || y > h / 3 * 2)
590                         {
591                         amt = (y < h / 2) ? 0 - ((h / 2) - y) : y - (h / 2);
592                         }
593                 }
594         else if (y < sd->region_size)
595                 {
596                 amt = 0 - (sd->region_size - y);
597                 }
598         else if (y >= h - sd->region_size)
599                 {
600                 amt = y - (h - sd->region_size);
601                 }
602
603         if (amt != 0)
604                 {
605                 amt = CLAMP(amt, 0 - sd->max_step, sd->max_step);
606
607                 if (gtk_adjustment_get_value(sd->adj) != CLAMP(gtk_adjustment_get_value(sd->adj) + amt, gtk_adjustment_get_lower(sd->adj), gtk_adjustment_get_upper(sd->adj) - gtk_adjustment_get_page_size(sd->adj)))
608                         {
609                         /* only notify when scrolling is needed */
610                         if (sd->notify_func && !sd->notify_func(sd->widget, x, y, sd->notify_data))
611                                 {
612                                 sd->timer_id = 0;
613                                 widget_auto_scroll_stop(sd->widget);
614                                 return FALSE;
615                                 }
616
617                         gtk_adjustment_set_value(sd->adj,
618                                 CLAMP(gtk_adjustment_get_value(sd->adj) + amt, gtk_adjustment_get_lower(sd->adj), gtk_adjustment_get_upper(sd->adj) - gtk_adjustment_get_page_size(sd->adj)));
619                         }
620                 }
621
622         return TRUE;
623 }
624
625 gint widget_auto_scroll_start(GtkWidget *widget, GtkAdjustment *v_adj, gint scroll_speed, gint region_size,
626                               gint (*notify_func)(GtkWidget *widget, gint x, gint y, gpointer data), gpointer notify_data)
627 {
628         AutoScrollData *sd;
629
630         if (!widget || !v_adj) return 0;
631         if (g_object_get_data(G_OBJECT(widget), "autoscroll")) return 0;
632         if (scroll_speed < 1) scroll_speed = AUTO_SCROLL_DEFAULT_SPEED;
633         if (region_size < 1) region_size = AUTO_SCROLL_DEFAULT_REGION;
634
635         sd = g_new0(AutoScrollData, 1);
636         sd->widget = widget;
637         sd->adj = v_adj;
638         sd->region_size = region_size;
639         sd->max_step = 1;
640         sd->timer_id = g_timeout_add(scroll_speed, widget_auto_scroll_cb, sd);
641
642         sd->notify_func = notify_func;
643         sd->notify_data = notify_data;
644
645         g_object_set_data(G_OBJECT(widget), "autoscroll", sd);
646
647         return scroll_speed;
648 }
649
650
651 /*
652  *-------------------------------------------------------------------
653  * GList utils
654  *-------------------------------------------------------------------
655  */
656
657 GList *uig_list_insert_link(GList *list, GList *link, gpointer data)
658 {
659         GList *new_list;
660
661         if (!list || link == list) return g_list_prepend(list, data);
662         if (!link) return g_list_append(list, data);
663
664         new_list = g_list_alloc();
665         new_list->data = data;
666
667         if (link->prev)
668                 {
669                 link->prev->next = new_list;
670                 new_list->prev = link->prev;
671                 }
672         else
673                 {
674                 list = new_list;
675                 }
676         link->prev = new_list;
677         new_list->next = link;
678
679         return list;
680 }
681
682 GList *uig_list_insert_list(GList *parent, GList *insert_link, GList *list)
683 {
684         GList *end;
685
686         if (!insert_link) return g_list_concat(parent, list);
687         if (insert_link == parent) return g_list_concat(list, parent);
688         if (!parent) return list;
689         if (!list) return parent;
690
691         end  = g_list_last(list);
692
693         if (insert_link->prev) insert_link->prev->next = list;
694         list->prev = insert_link->prev;
695         insert_link->prev = end;
696         end->next = insert_link;
697
698         return parent;
699 }
700 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */