display ruler, line/point evaluation
[gpiv.git] / src / console_interface.c
blobf763eddfc67abff75b58e60b529d6b6fd403060b
1 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 c-style: "K&R" -*- */
4 /*----------------------------------------------------------------------
6 gpiv - Graphic program for Particle Image Velocimetry, based on gtk/gnome
7 libraries.
9 Copyright (C) 2002 Gerber van der Graaf
11 This file is part of gpiv.
13 Gpiv is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2, or (at your option)
16 any later version.
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software Foundation,
25 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 ----------------------------------------------------------------------*/
30 * $Log: console_interface.c,v $
31 * Revision 1.2 2003-06-27 13:47:26 gerber
32 * display ruler, line/point evaluation
34 * Revision 1.1.1.1 2003/06/17 17:10:52 gerber
35 * Imported gpiv
38 #ifdef HAVE_CONFIG_H
39 # include <config.h>
40 #endif
41 #include "support.h"
43 #include "gpiv_gtk.h"
44 #include "console.h"
45 #include "console_interface.h"
46 #include "console_menus.h"
47 #include "piveval.h"
48 #include "pivvalid.h"
49 #include "pivpost.h"
54 GtkWidget *
55 create_menu_gpiv_popup(GpivConsole * gpiv)
57 GtkWidget * console = gpiv->console;
58 GtkWidget * menu_gpiv_popup = NULL;
60 menu_gpiv_popup = gtk_menu_new();
61 gtk_object_set_data(GTK_OBJECT(console),
62 "menu_gpiv_popup",
63 menu_gpiv_popup);
64 gnome_app_fill_menu(GTK_MENU_SHELL(menu_gpiv_popup),
65 menubar_gpiv_popup,
66 NULL,
67 FALSE,
68 0);
70 gtk_widget_ref(menubar_gpiv_popup[0].widget);
71 gtk_object_set_data_full(GTK_OBJECT(console),
72 "file",
73 menubar_gpiv_popup[0].widget,
74 (GtkDestroyNotify) gtk_widget_unref);
77 gtk_widget_ref(menubar_gpiv_popup[1].widget);
78 gtk_object_set_data_full(GTK_OBJECT(console),
79 "settings",
80 menubar_gpiv_popup[1].widget,
81 (GtkDestroyNotify) gtk_widget_unref);
84 gtk_widget_ref(menubar_gpiv_popup[2].widget);
85 gtk_object_set_data_full(GTK_OBJECT(console),
86 "help",
87 menubar_gpiv_popup[2].widget,
88 (GtkDestroyNotify) gtk_widget_unref);
90 gtk_widget_ref(help_menu_gpiv_popup[0].widget);
91 gtk_object_set_data_full(GTK_OBJECT(console),
92 "tooltip",
93 help_menu_gpiv_popup[0].widget,
94 (GtkDestroyNotify) gtk_widget_unref);
95 gtk_object_set_data(GTK_OBJECT(help_menu_gpiv_popup[0].widget),
96 "gpiv",
97 gpiv);
101 gtk_widget_ref(file_menu_gpiv_popup[0].widget);
102 gtk_object_set_data(GTK_OBJECT(file_menu_gpiv_popup[0].widget),
103 "gpiv",
104 gpiv);
106 gtk_widget_ref(file_menu_gpiv_popup[1].widget);
107 gtk_object_set_data(GTK_OBJECT(file_menu_gpiv_popup[1].widget),
108 "gpiv",
109 gpiv);
111 gtk_widget_ref(settings_menu_gpiv_popup[0].widget);
112 gtk_object_set_data_full(GTK_OBJECT(console),
113 "gpiv_buttons",
114 settings_menu_gpiv_popup[0].widget,
115 (GtkDestroyNotify) gtk_widget_unref);
116 gtk_object_set_data(GTK_OBJECT(settings_menu_gpiv_popup[0].widget),
117 "gpiv",
118 gpiv);
119 if (gpiv_par.view_gpivbuttons) {
120 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
121 (settings_menu_gpiv_popup[0].widget),
122 TRUE);
123 } else {
124 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
125 (settings_menu_gpiv_popup[0].widget),
126 FALSE);
131 gtk_widget_ref(settings_menu_gpiv_popup[1].widget);
132 gtk_object_set_data_full(GTK_OBJECT(console),
133 "tabulator",
134 settings_menu_gpiv_popup[1].widget,
135 (GtkDestroyNotify) gtk_widget_unref);
136 gtk_object_set_data(GTK_OBJECT(settings_menu_gpiv_popup[1].widget),
137 "gpiv",
138 gpiv);
139 if (gpiv_par.view_tabulator) {
140 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
141 (settings_menu_gpiv_popup[1].widget),
142 TRUE);
143 } else {
144 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
145 (settings_menu_gpiv_popup[1].widget),
146 FALSE);
150 if (gpiv_par.show_tooltips) {
151 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
152 (help_menu_gpiv_popup[0].widget),
153 TRUE);
154 } else {
155 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
156 (help_menu_gpiv_popup[0].widget),
157 FALSE);
162 return menu_gpiv_popup;
167 GpivConsole *
168 create_gpiv(void)
170 GpivConsole *gpiv = g_new0(GpivConsole, 1);
171 /* GdkColormap *cmap = gdk_colormap_get_system( ); */
173 GdkColor red = { 0, 0xFFFF, 0x0000, 0x0000 };
174 GdkColor yellow = { 0, 0xFFFF, 0xFFFF, 0x0000 };
175 GdkColor *bg = &yellow;
176 GdkColor *fg = &red;
179 /* gdouble color[3]; */
180 /* g_warning("::0"); */
181 /* fg->red = (gushort) (color[0]*65535.0); */
182 /* g_warning("::1"); */
183 /* fg->green = (gushort) (color[1]*0.0); */
184 /* fg->blue = (gushort) (color[2]*0.0); */
186 /* bg->red = (gushort) (color[0]*0.0); */
187 /* bg->green = (gushort) (color[1]*0.0); */
188 /* bg->blue = (gushort) (color[2]*0.0); */
191 /* g_warning("::0"); */
192 /* fg->red = (gushort) 10000; */
193 /* g_warning("::1"); */
194 /* fg->green = (gushort) 0; */
195 /* fg->blue = (gushort) 0; */
197 /* g_warning("::0"); */
198 /* bg->red = (gushort) 0; */
199 /* g_warning("::1"); */
200 /* bg->green = (gushort) 0; */
201 /* bg->blue = (gushort) 10000; */
202 /* g_warning("::3"); */
207 gpiv->tooltips = gtk_tooltips_new();
209 /* if (gdk_parse_color("yellow", &bg) && */
210 /* gdk_colormap_alloc_color(cmap, &bg, FALSE, TRUE)) { */
211 /* if (gdk_parse_color("red", &fg) && */
212 /* gdk_colormap_alloc_color(cmap, &fg, FALSE, TRUE)) { */
213 gtk_tooltips_set_colors (GTK_TOOLTIPS (gpiv->tooltips),
214 bg,
215 fg);
216 /* } */
217 /* } */
220 gpiv->console = gnome_app_new("Gpiv-gui-gtk",
221 "gpiv");
222 gtk_window_set_policy(GTK_WINDOW(gpiv->console),
223 FALSE,
224 TRUE,
225 TRUE);
226 gtk_object_set_data(GTK_OBJECT(gpiv->console),
227 "gpiv",
228 gpiv);
230 gpiv->dock1 = GNOME_APP(gpiv->console)->dock;
231 gtk_widget_ref(gpiv->dock1);
232 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
233 "dock1",
234 gpiv->dock1,
235 (GtkDestroyNotify) gtk_widget_unref);
236 gtk_widget_show(gpiv->dock1);
241 * Menu bar with gnome_app_create_menus
244 gnome_app_create_menus(GNOME_APP (gpiv->console),
245 menubar_gpiv);
248 gtk_widget_ref(menubar_gpiv[0].widget);
249 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
250 "file",
251 menubar_gpiv[0].widget,
252 (GtkDestroyNotify) gtk_widget_unref);
255 gtk_widget_ref(file_menu_gpiv[0].widget);
256 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
257 "open",
258 file_menu_gpiv[0].widget,
259 (GtkDestroyNotify) gtk_widget_unref);
260 gtk_object_set_data(GTK_OBJECT(file_menu_gpiv[0].widget),
261 "gpiv",
262 gpiv);
265 gtk_widget_ref(file_menu_gpiv[1].widget);
266 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
267 "save",
268 file_menu_gpiv[1].widget,
269 (GtkDestroyNotify) gtk_widget_unref);
270 gtk_object_set_data(GTK_OBJECT(file_menu_gpiv[1].widget),
271 "gpiv",
272 gpiv);
274 gtk_widget_ref(file_menu_gpiv[2].widget);
275 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
276 "save_as",
277 file_menu_gpiv[2].widget,
278 (GtkDestroyNotify) gtk_widget_unref);
279 gtk_object_set_data(GTK_OBJECT(file_menu_gpiv[2].widget),
280 "gpiv",
281 gpiv);
284 gtk_widget_ref(file_menu_gpiv[3].widget);
285 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
286 "separator",
287 file_menu_gpiv[3].widget,
288 (GtkDestroyNotify) gtk_widget_unref);
291 gtk_widget_ref(file_menu_gpiv[4].widget);
292 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
293 "exit",
294 file_menu_gpiv[4].widget,
295 (GtkDestroyNotify) gtk_widget_unref);
298 gtk_widget_ref(menubar_gpiv[1].widget);
299 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
300 "settings",
301 menubar_gpiv[1].widget,
302 (GtkDestroyNotify) gtk_widget_unref);
305 gtk_widget_ref(settings_menu_gpiv[0].widget);
306 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
307 "gpiv_buttons",
308 settings_menu_gpiv[0].widget,
309 (GtkDestroyNotify) gtk_widget_unref);
310 gtk_object_set_data(GTK_OBJECT(settings_menu_gpiv[0].widget),
311 "gpiv",
312 gpiv);
313 gtk_object_set_data(GTK_OBJECT(gpiv->console),
314 "settings_menu_gpiv0",
315 settings_menu_gpiv[0].widget);
318 gtk_widget_ref(settings_menu_gpiv[1].widget);
319 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
320 "tabulator",
321 settings_menu_gpiv[1].widget,
322 (GtkDestroyNotify) gtk_widget_unref);
323 gtk_object_set_data(GTK_OBJECT(settings_menu_gpiv[1].widget),
324 "gpiv",
325 gpiv);
326 gtk_object_set_data(GTK_OBJECT(gpiv->console),
327 "settings_menu_gpiv1",
328 settings_menu_gpiv[1].widget);
331 gtk_widget_ref(settings_menu_gpiv[3].widget);
332 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
333 "preferences",
334 settings_menu_gpiv[3].widget,
335 (GtkDestroyNotify) gtk_widget_unref);
336 gtk_object_set_data(GTK_OBJECT(settings_menu_gpiv[3].widget),
337 "gpiv",
338 gpiv);
339 gtk_object_set_data(GTK_OBJECT(gpiv->console),
340 "settings_menu_gpiv3",
341 settings_menu_gpiv[3].widget);
344 gtk_widget_ref(menubar_gpiv[2].widget);
345 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
346 "help",
347 menubar_gpiv[2].widget,
348 (GtkDestroyNotify) gtk_widget_unref);
351 gtk_widget_ref(help_menu_gpiv[0].widget);
352 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
353 "tooltip",
354 help_menu_gpiv[0].widget,
355 (GtkDestroyNotify) gtk_widget_unref);
356 gtk_object_set_data(GTK_OBJECT(help_menu_gpiv[0].widget),
357 "gpiv",
358 gpiv);
361 gtk_widget_ref(help_menu_gpiv[1].widget);
362 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
363 "manual",
364 help_menu_gpiv[1].widget,
365 (GtkDestroyNotify) gtk_widget_unref);
366 gtk_object_set_data(GTK_OBJECT(help_menu_gpiv[1].widget),
367 "gpiv",
368 gpiv);
371 gtk_widget_ref(help_menu_gpiv[2].widget);
372 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
373 "about",
374 help_menu_gpiv[2].widget,
375 (GtkDestroyNotify) gtk_widget_unref);
376 gtk_object_set_data(GTK_OBJECT(help_menu_gpiv[2].widget),
377 "gpiv",
378 gpiv);
382 * toolbar
384 gnome_app_create_toolbar(GNOME_APP (gpiv->console),
385 toolbar_gpiv);
388 gtk_widget_ref(toolbar_gpiv[0].widget);
389 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
390 "button_open",
391 toolbar_gpiv[0].widget,
392 (GtkDestroyNotify) gtk_widget_unref);
394 gtk_object_set_data(GTK_OBJECT(toolbar_gpiv[0].widget),
395 "gpiv",
396 gpiv);
397 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv[0].widget),
398 "enter",
399 GTK_SIGNAL_FUNC(on_button_open_enter),
400 NULL);
401 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv[0].widget),
402 "leave",
403 GTK_SIGNAL_FUNC(on_widget_leave),
404 NULL);
408 gtk_widget_ref(toolbar_gpiv[1].widget);
409 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
410 "button_save",
411 toolbar_gpiv[1].widget,
412 (GtkDestroyNotify) gtk_widget_unref);
414 gtk_object_set_data(GTK_OBJECT(toolbar_gpiv[1].widget),
415 "gpiv",
416 gpiv);
417 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv[1].widget),
418 "enter",
419 GTK_SIGNAL_FUNC(on_button_save_enter),
420 NULL);
421 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv[1].widget),
422 "leave",
423 GTK_SIGNAL_FUNC(on_widget_leave),
424 NULL);
428 gtk_widget_ref(toolbar_gpiv[2].widget);
429 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
430 "button_exec",
431 toolbar_gpiv[2].widget,
432 (GtkDestroyNotify) gtk_widget_unref);
434 gtk_object_set_data(GTK_OBJECT(toolbar_gpiv[2].widget),
435 "gpiv",
436 gpiv);
437 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv[2].widget),
438 "enter",
439 GTK_SIGNAL_FUNC(on_button_execute_enter),
440 NULL);
441 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv[2].widget),
442 "leave",
443 GTK_SIGNAL_FUNC(on_widget_leave),
444 NULL);
449 gtk_widget_ref(toolbar_gpiv[3].widget);
450 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
451 "button_stop",
452 toolbar_gpiv[3].widget,
453 (GtkDestroyNotify) gtk_widget_unref);
455 gtk_object_set_data(GTK_OBJECT(toolbar_gpiv[3].widget),
456 "gpiv",
457 gpiv);
458 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv[3].widget),
459 "button_press_event",
460 GTK_SIGNAL_FUNC(on_button_stop_press),
461 NULL);
462 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv[3].widget),
463 "button_release_event",
464 GTK_SIGNAL_FUNC(on_button_stop_release),
465 NULL);
466 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv[3].widget),
467 "enter",
468 GTK_SIGNAL_FUNC(on_button_stop_enter),
469 NULL);
470 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv[3].widget),
471 "leave",
472 GTK_SIGNAL_FUNC(on_widget_leave),
473 NULL);
478 gtk_widget_ref(toolbar_gpiv[4].widget);
479 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
480 "button_close",
481 toolbar_gpiv[4].widget,
482 (GtkDestroyNotify) gtk_widget_unref);
483 gtk_object_set_data(GTK_OBJECT(toolbar_gpiv[4].widget),
484 "gpiv",
485 gpiv);
486 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv[4].widget),
487 "enter",
488 GTK_SIGNAL_FUNC(on_button_close_enter),
489 NULL);
490 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv[4].widget),
491 "leave",
492 GTK_SIGNAL_FUNC(on_widget_leave),
493 NULL);
496 * toolbar_gpiv[5].widget: Separator
499 gtk_widget_ref(toolbar_gpiv[6].widget);
500 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
501 "button_exit",
502 toolbar_gpiv[6].widget,
503 (GtkDestroyNotify) gtk_widget_unref);
504 gtk_object_set_data(GTK_OBJECT(toolbar_gpiv[6].widget),
505 "gpiv",
506 gpiv);
507 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv[6].widget),
508 "enter",
509 GTK_SIGNAL_FUNC(on_button_exit_enter),
510 NULL);
511 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv[6].widget),
512 "leave",
513 GTK_SIGNAL_FUNC(on_widget_leave),
514 NULL);
518 * vbox_main contains handleboxes for toolbar, gpiv toolbar, tabulator
519 * and bufferlist
521 gpiv->vbox_main = gtk_vbox_new(FALSE,
523 gtk_widget_ref(gpiv->vbox_main);
524 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
525 "vbox_main",
526 gpiv->vbox_main,
527 (GtkDestroyNotify) gtk_widget_unref);
528 gtk_widget_show(gpiv->vbox_main);
529 gnome_app_set_contents (GNOME_APP (gpiv->console),
530 gpiv->vbox_main);
535 * handlebox and toolbar for gpiv chain processes buttons
537 gpiv->handlebox1 = gtk_handle_box_new();
538 gtk_widget_ref(gpiv->handlebox1);
539 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
540 "handlebox1",
541 gpiv->handlebox1,
542 (GtkDestroyNotify) gtk_widget_unref);
543 gtk_box_pack_start(GTK_BOX(gpiv->vbox_main),
544 gpiv->handlebox1,
545 FALSE,
546 TRUE,
551 * Scrolled window
553 gpiv->scrolledwindow_handbox1 = gtk_scrolled_window_new(NULL,
554 NULL);
555 gtk_widget_ref(gpiv->scrolledwindow_handbox1);
556 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
557 "scrolledwindow_handbox1",
558 gpiv->scrolledwindow_handbox1,
559 (GtkDestroyNotify) gtk_widget_unref);
560 gtk_widget_show(gpiv->scrolledwindow_handbox1);
561 gtk_container_add (GTK_CONTAINER (gpiv->handlebox1),
562 gpiv->scrolledwindow_handbox1);
563 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW
564 (gpiv->scrolledwindow_handbox1),
565 GTK_POLICY_AUTOMATIC,
566 GTK_POLICY_NEVER);
569 gpiv->viewport_handbox1 =
570 gtk_viewport_new(NULL,
571 NULL);
572 gtk_widget_ref(gpiv->viewport_handbox1);
573 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
574 "viewport_handbox1",
575 gpiv->viewport_handbox1,
576 (GtkDestroyNotify) gtk_widget_unref);
577 gtk_widget_show(gpiv->viewport_handbox1);
578 gtk_container_add(GTK_CONTAINER(gpiv->scrolledwindow_handbox1),
579 gpiv->viewport_handbox1);
580 gtk_widget_set_usize(GTK_WIDGET(gpiv->viewport_handbox1),
581 410,
582 50);
586 * toolbar
589 gpiv->toolbar2 =
590 gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL,
591 GTK_TOOLBAR_TEXT);
592 gtk_widget_ref(gpiv->toolbar2);
593 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
594 "gpiv->toolbar2",
595 gpiv->toolbar2,
596 (GtkDestroyNotify) gtk_widget_unref);
597 gtk_toolbar_set_space_style (GTK_TOOLBAR(gpiv->toolbar2),
598 GTK_TOOLBAR_SPACE_LINE);
599 gtk_widget_show(gpiv->toolbar2);
600 gtk_container_add (GTK_CONTAINER (gpiv->viewport_handbox1),
601 gpiv->toolbar2);
605 gpiv->hbox_toolbar2 = gtk_hbox_new (FALSE,
607 gtk_widget_ref (gpiv->vbox_main);
608 gtk_object_set_data_full (GTK_OBJECT (gpiv->console),
609 "hbox_toolbar2",
610 gpiv->hbox_toolbar2,
611 (GtkDestroyNotify) gtk_widget_unref);
612 gtk_widget_show (gpiv->hbox_toolbar2);
613 gtk_container_add(GTK_CONTAINER(gpiv->toolbar2),
614 gpiv->hbox_toolbar2);
618 gpiv->button_toolbar_piv = gtk_check_button_new_with_label(_("piv"));
619 gtk_widget_ref(gpiv->button_toolbar_piv);
620 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
621 "button_toolbar_piv",
622 gpiv->button_toolbar_piv,
623 (GtkDestroyNotify) gtk_widget_unref);
624 gtk_widget_show(gpiv->button_toolbar_piv);
625 gtk_box_pack_start(GTK_BOX(gpiv->hbox_toolbar2),
626 gpiv->button_toolbar_piv,
627 FALSE,
628 FALSE,
630 gtk_tooltips_set_tip(gpiv->tooltips,
631 gpiv->button_toolbar_piv,
632 _("Enables PIV for chain processing: analysing of a PIV image \
633 (pair), resulting into the mean displacements of the particle images within \
634 each interrogation area. \n\
635 The process will be executed by clicking the Execute button"),
636 NULL);
638 gtk_object_set_data(GTK_OBJECT(gpiv->button_toolbar_piv),
639 "gpiv",
640 gpiv);
641 gtk_signal_connect(GTK_OBJECT(gpiv->button_toolbar_piv),
642 "enter",
643 GTK_SIGNAL_FUNC(on_button_piv_enter),
644 NULL);
645 gtk_signal_connect(GTK_OBJECT(gpiv->button_toolbar_piv),
646 "leave",
647 GTK_SIGNAL_FUNC(on_widget_leave),
648 NULL);
649 gtk_signal_connect(GTK_OBJECT(gpiv->button_toolbar_piv),
650 "clicked",
651 GTK_SIGNAL_FUNC(on_toolbar_checkbutton_piv),
652 NULL);
653 if (gpiv_par.process_piv == 1) {
654 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
655 (gpiv->button_toolbar_piv),
656 TRUE);
657 } else {
658 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
659 (gpiv->button_toolbar_piv),
660 FALSE);
665 gpiv->button_toolbar_gradient =
666 gtk_check_button_new_with_label(_("gradient"));
667 gtk_widget_ref(gpiv->button_toolbar_gradient);
668 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
669 "button_toolbar_gradient",
670 gpiv->button_toolbar_gradient,
671 (GtkDestroyNotify) gtk_widget_unref);
672 gtk_widget_show(gpiv->button_toolbar_gradient);
673 gtk_box_pack_start(GTK_BOX(gpiv->hbox_toolbar2),
674 gpiv->button_toolbar_gradient,
675 FALSE,
676 FALSE,
678 gtk_tooltips_set_tip(gpiv->tooltips,
679 gpiv->button_toolbar_gradient,
680 _("Enables gradient for chain processing: Disables velocities with gradients larger than \
681 0.05 over the interrogation area. \
682 \nThe process will be executed by clicking the \"Execute\" button"),
683 NULL);
685 gtk_object_set_data(GTK_OBJECT(gpiv->button_toolbar_gradient),
686 "gpiv",
687 gpiv);
688 gtk_signal_connect(GTK_OBJECT(gpiv->button_toolbar_gradient),
689 "enter",
690 GTK_SIGNAL_FUNC(on_button_valid_gradient_enter),
691 NULL);
692 gtk_signal_connect(GTK_OBJECT(gpiv->button_toolbar_gradient),
693 "leave",
694 GTK_SIGNAL_FUNC(on_widget_leave),
695 NULL);
696 gtk_signal_connect(GTK_OBJECT(gpiv->button_toolbar_gradient),
697 "clicked",
698 GTK_SIGNAL_FUNC(on_toolbar_checkbutton_gradient),
699 NULL);
700 if (gpiv_par.process_gradient == 1) {
701 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
702 (gpiv->button_toolbar_gradient),
703 TRUE);
704 } else {
705 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
706 (gpiv->button_toolbar_gradient),
707 FALSE);
712 gpiv->button_toolbar_resstats = gtk_check_button_new_with_label(_("residu stats"));
713 gtk_widget_ref(gpiv->button_toolbar_resstats);
714 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
715 "button_toolbar_resstats",
716 gpiv->button_toolbar_resstats,
717 (GtkDestroyNotify) gtk_widget_unref);
718 gtk_widget_show(gpiv->button_toolbar_resstats);
719 gtk_box_pack_start(GTK_BOX(gpiv->hbox_toolbar2),
720 gpiv->button_toolbar_resstats,
721 FALSE,
722 FALSE,
724 gtk_tooltips_set_tip(gpiv->tooltips,
725 gpiv->button_toolbar_resstats,
726 _("Enables residu statistics for chain processing: calculates \
727 the residus of displacements for detection of outliers and shows an histogram \
728 of them. The histogram will be displayed in the Piv Validation tab. \n\
729 The process will be executed by clicking the Execute button"),
730 NULL);
732 gtk_object_set_data(GTK_OBJECT(gpiv->button_toolbar_resstats),
733 "gpiv",
734 gpiv);
735 gtk_signal_connect(GTK_OBJECT(gpiv->button_toolbar_resstats),
736 "enter",
737 GTK_SIGNAL_FUNC(on_button_valid_errvec_resstats_enter),
738 NULL);
739 gtk_signal_connect(GTK_OBJECT(gpiv->button_toolbar_resstats),
740 "leave",
741 GTK_SIGNAL_FUNC(on_widget_leave),
742 NULL);
743 gtk_signal_connect(GTK_OBJECT(gpiv->button_toolbar_resstats),
744 "clicked",
745 GTK_SIGNAL_FUNC(on_toolbar_checkbutton_resstats),
746 NULL);
747 if (gpiv_par.process_resstats == 1) {
748 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
749 (gpiv->button_toolbar_resstats),
750 TRUE);
751 } else {
752 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
753 (gpiv->button_toolbar_resstats),
754 FALSE);
759 gpiv->button_toolbar_errvec = gtk_check_button_new_with_label
760 (_("validate"));
761 gtk_widget_ref(gpiv->button_toolbar_errvec);
762 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
763 "button_toolbar_errvec",
764 gpiv->button_toolbar_errvec,
765 (GtkDestroyNotify) gtk_widget_unref);
766 gtk_widget_show(gpiv->button_toolbar_errvec);
767 gtk_box_pack_start(GTK_BOX(gpiv->hbox_toolbar2),
768 gpiv->button_toolbar_errvec,
769 FALSE,
770 FALSE,
772 gtk_tooltips_set_tip(gpiv->tooltips,
773 gpiv->button_toolbar_errvec,
774 _("Enables validation for chain processing: detects \
775 outliers of PIV data by testing on median residu or by Signal to Noise \
776 Ratio magnitudes and, eventually, substitutes. \n\
777 The process will be executed by clicking the Execute button"),
778 NULL);
780 gtk_object_set_data(GTK_OBJECT(gpiv->button_toolbar_errvec),
781 "gpiv",
782 gpiv);
783 gtk_signal_connect(GTK_OBJECT(gpiv->button_toolbar_errvec),
784 "enter",
785 GTK_SIGNAL_FUNC(on_button_valid_errvec_enter),
786 NULL);
787 gtk_signal_connect(GTK_OBJECT(gpiv->button_toolbar_errvec),
788 "leave",
789 GTK_SIGNAL_FUNC(on_widget_leave), NULL);
790 gtk_signal_connect(GTK_OBJECT(gpiv->button_toolbar_errvec),
791 "clicked",
792 GTK_SIGNAL_FUNC(on_toolbar_checkbutton_errvec),
793 NULL);
794 if (gpiv_par.process_errvec == 1) {
795 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
796 (gpiv->button_toolbar_errvec),
797 TRUE);
798 } else {
799 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
800 (gpiv->button_toolbar_errvec),
801 FALSE);
806 gpiv->button_toolbar_peaklock =
807 gtk_check_button_new_with_label(_("peaklock"));
808 gtk_widget_ref(gpiv->button_toolbar_peaklock);
809 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
810 "button_toolbar_peaklock",
811 gpiv->button_toolbar_peaklock,
812 (GtkDestroyNotify) gtk_widget_unref);
813 gtk_widget_show(gpiv->button_toolbar_peaklock);
814 gtk_box_pack_start(GTK_BOX(gpiv->hbox_toolbar2),
815 gpiv->button_toolbar_peaklock,
816 FALSE,
817 FALSE,
819 gtk_tooltips_set_tip(gpiv->tooltips,
820 gpiv->button_toolbar_peaklock,
821 _("Enables peak-lock for chain processing: shows an histogram \
822 of sub-pixel displacements in order to check on peak-locking effects. \
823 The histogram will be displayed in the Piv Validation tab. \n\
824 The process will be executed by clicking the \"Execute\" button"),
825 NULL);
827 gtk_object_set_data(GTK_OBJECT(gpiv->button_toolbar_peaklock),
828 "gpiv",
829 gpiv);
830 gtk_signal_connect(GTK_OBJECT(gpiv->button_toolbar_peaklock),
831 "enter",
832 GTK_SIGNAL_FUNC(on_button_valid_peaklck_enter),
833 NULL);
834 gtk_signal_connect(GTK_OBJECT(gpiv->button_toolbar_peaklock),
835 "leave",
836 GTK_SIGNAL_FUNC(on_widget_leave),
837 NULL);
838 gtk_signal_connect(GTK_OBJECT(gpiv->button_toolbar_peaklock),
839 "clicked",
840 GTK_SIGNAL_FUNC(on_toolbar_checkbutton_peaklck),
841 NULL);
842 if (gpiv_par.process_peaklock == 1) {
843 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
844 (gpiv->button_toolbar_peaklock),
845 TRUE);
846 } else {
847 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
848 (gpiv->button_toolbar_peaklock),
849 FALSE);
853 gpiv->button_toolbar_scale =
854 gtk_check_button_new_with_label(_("scale"));
855 gtk_widget_ref(gpiv->button_toolbar_scale);
856 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
857 "button_toolbar_scale",
858 gpiv->button_toolbar_scale,
859 (GtkDestroyNotify) gtk_widget_unref);
860 gtk_widget_show(gpiv->button_toolbar_scale);
861 gtk_box_pack_start(GTK_BOX(gpiv->hbox_toolbar2),
862 gpiv->button_toolbar_scale, FALSE,
863 FALSE,
865 gtk_tooltips_set_tip(gpiv->tooltips,
866 gpiv->button_toolbar_scale,
867 _("Enables scaling for chain processing: scales spatial displacements \
868 over all data. \
869 \nThe process will be executed by clicking the \"Execute\" button"),
870 NULL);
872 gtk_object_set_data(GTK_OBJECT(gpiv->button_toolbar_scale),
873 "gpiv",
874 gpiv);
875 gtk_signal_connect(GTK_OBJECT(gpiv->button_toolbar_scale),
876 "enter",
877 GTK_SIGNAL_FUNC(on_button_post_scale_enter),
878 NULL);
879 gtk_signal_connect(GTK_OBJECT(gpiv->button_toolbar_scale),
880 "leave",
881 GTK_SIGNAL_FUNC(on_widget_leave),
882 NULL);
883 gtk_signal_connect(GTK_OBJECT(gpiv->button_toolbar_scale),
884 "clicked",
885 GTK_SIGNAL_FUNC(on_toolbar_checkbutton_scale),
886 NULL);
887 if (gpiv_par.process_scale == 1) {
888 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
889 (gpiv->button_toolbar_scale),
890 TRUE);
891 } else {
892 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
893 (gpiv->button_toolbar_scale),
894 FALSE);
898 gpiv->button_toolbar_average =
899 gtk_check_button_new_with_label(_("average"));
900 gtk_widget_ref(gpiv->button_toolbar_average);
901 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
902 "button_toolbar_average",
903 gpiv->button_toolbar_average,
904 (GtkDestroyNotify) gtk_widget_unref);
905 gtk_widget_show(gpiv->button_toolbar_average);
906 gtk_box_pack_start(GTK_BOX(gpiv->hbox_toolbar2),
907 gpiv->button_toolbar_average, FALSE,
908 FALSE,
910 gtk_tooltips_set_tip(gpiv->tooltips,
911 gpiv->button_toolbar_average,
912 _("Enables average for chain processing: Calculates spatial average displacements \
913 over all data. \
914 \nThe process will be executed by clicking the \"Execute\" button"),
915 NULL);
917 gtk_object_set_data(GTK_OBJECT(gpiv->button_toolbar_average),
918 "gpiv",
919 gpiv);
920 gtk_signal_connect(GTK_OBJECT(gpiv->button_toolbar_average),
921 "enter",
922 GTK_SIGNAL_FUNC(on_button_post_savg_enter),
923 NULL);
924 gtk_signal_connect(GTK_OBJECT(gpiv->button_toolbar_average),
925 "leave",
926 GTK_SIGNAL_FUNC(on_widget_leave),
927 NULL);
928 gtk_signal_connect(GTK_OBJECT(gpiv->button_toolbar_average),
929 "clicked",
930 GTK_SIGNAL_FUNC(on_toolbar_checkbutton_average),
931 NULL);
932 if (gpiv_par.process_average == 1) {
933 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
934 (gpiv->button_toolbar_average),
935 TRUE);
936 } else {
937 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
938 (gpiv->button_toolbar_average),
939 FALSE);
943 gpiv->button_toolbar_subavg =
944 gtk_check_button_new_with_label(_("substract"));
945 gtk_widget_ref(gpiv->button_toolbar_subavg);
946 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
947 "button_toolbar_subavg",
948 gpiv->button_toolbar_subavg,
949 (GtkDestroyNotify) gtk_widget_unref);
950 gtk_widget_show(gpiv->button_toolbar_subavg);
951 gtk_box_pack_start(GTK_BOX(gpiv->hbox_toolbar2),
952 gpiv->button_toolbar_subavg,
953 FALSE,
954 FALSE,
956 gtk_tooltips_set_tip(gpiv->tooltips,
957 gpiv->button_toolbar_subavg,
958 _("Enables substract for chain processing: substracts spatial average displacements \
959 from all data. \
960 \nThe process will be executed by clicking the \"Execute\" button"),
961 NULL);
963 gtk_object_set_data(GTK_OBJECT(gpiv->button_toolbar_subavg),
964 "gpiv",
965 gpiv);
966 gtk_signal_connect(GTK_OBJECT(gpiv->button_toolbar_subavg),
967 "enter",
968 GTK_SIGNAL_FUNC(on_button_post_subavg_enter),
969 NULL);
970 gtk_signal_connect(GTK_OBJECT(gpiv->button_toolbar_subavg),
971 "leave",
972 GTK_SIGNAL_FUNC(on_widget_leave),
973 NULL);
974 gtk_signal_connect(GTK_OBJECT(gpiv->button_toolbar_subavg),
975 "clicked",
976 GTK_SIGNAL_FUNC(on_toolbar_checkbutton_subavg),
977 NULL);
978 if (gpiv_par.process_substract == 1) {
979 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
980 (gpiv->button_toolbar_subavg),
981 TRUE);
982 } else {
983 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
984 (gpiv->button_toolbar_subavg),
985 FALSE);
989 gpiv->button_toolbar_vorstra =
990 gtk_check_button_new_with_label(_("vorticity"));
991 gtk_widget_ref(gpiv->button_toolbar_vorstra);
992 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
993 "button_toolbar_vorstra",
994 gpiv->button_toolbar_vorstra,
995 (GtkDestroyNotify) gtk_widget_unref);
996 gtk_widget_show(gpiv->button_toolbar_vorstra);
997 gtk_box_pack_start(GTK_BOX(gpiv->hbox_toolbar2),
998 gpiv->button_toolbar_vorstra,
999 FALSE,
1000 FALSE,
1002 gtk_tooltips_set_tip(gpiv->tooltips,
1003 gpiv->button_toolbar_vorstra,
1004 _("Enables vorticity for chain processing: calculates \
1005 vorticity or strain magnitudes from a velocity field.\n\
1006 The process will be executed by clicking the Execute button"),
1007 NULL);
1009 gtk_object_set_data(GTK_OBJECT(gpiv->button_toolbar_vorstra),
1010 "gpiv",
1011 gpiv);
1012 gtk_signal_connect(GTK_OBJECT(gpiv->button_toolbar_vorstra),
1013 "enter",
1014 GTK_SIGNAL_FUNC(on_button_post_vorstra_enter),
1015 NULL);
1016 gtk_signal_connect(GTK_OBJECT(gpiv->button_toolbar_vorstra),
1017 "leave",
1018 GTK_SIGNAL_FUNC(on_widget_leave),
1019 NULL);
1020 gtk_signal_connect(GTK_OBJECT(gpiv->button_toolbar_vorstra),
1021 "clicked",
1022 GTK_SIGNAL_FUNC(on_toolbar_checkbutton_vorstra),
1023 NULL);
1024 if (gpiv_par.process_vorstra == 1) {
1025 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
1026 (gpiv->button_toolbar_vorstra),
1027 TRUE);
1028 } else {
1029 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
1030 (gpiv->button_toolbar_vorstra),
1031 FALSE);
1036 /* gpiv->hbox_main contains a handlebox with buffer list */
1037 gpiv->hbox_main = gtk_hbox_new(FALSE,
1039 gtk_widget_ref(gpiv->hbox_main);
1040 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
1041 "hbox_main",
1042 gpiv->hbox_main,
1043 (GtkDestroyNotify) gtk_widget_unref);
1044 gtk_widget_show(gpiv->hbox_main);
1045 gtk_box_pack_start(GTK_BOX(gpiv->vbox_main),
1046 gpiv->hbox_main,
1047 FALSE,
1048 FALSE,
1053 * Notebook (tabulator)
1055 gpiv->notebook = gtk_notebook_new();
1056 gtk_widget_ref(gpiv->notebook);
1057 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
1058 "notebook",
1059 gpiv->notebook,
1060 (GtkDestroyNotify) gtk_widget_unref);
1061 gtk_widget_show(gpiv->notebook);
1062 gtk_box_pack_start(GTK_BOX(gpiv->hbox_main),
1063 gpiv->notebook,
1064 TRUE,
1065 TRUE,
1070 gpiv->imgh = create_imgh(gpiv->console,
1071 gpiv->notebook);
1073 gpiv->tablabel_imgh = gtk_label_new(_("Image Info"));
1074 gtk_widget_ref(gpiv->tablabel_imgh);
1075 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
1076 "tablabel_imgh",
1077 gpiv->tablabel_imgh,
1078 (GtkDestroyNotify) gtk_widget_unref);
1079 gtk_widget_show(gpiv->tablabel_imgh);
1080 gtk_notebook_set_tab_label(GTK_NOTEBOOK(gpiv->notebook),
1081 gtk_notebook_get_nth_page(GTK_NOTEBOOK
1082 (gpiv->notebook),
1084 gpiv->tablabel_imgh);
1088 gpiv->piveval = create_piveval(gpiv->console,
1089 gpiv->notebook);
1091 gpiv->tablabel_piveval = gtk_label_new(_("Evaluation"));
1092 gtk_widget_ref(gpiv->tablabel_piveval);
1093 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
1094 "tablabel_piveval",
1095 gpiv->tablabel_piveval,
1096 (GtkDestroyNotify) gtk_widget_unref);
1097 gtk_widget_show(gpiv->tablabel_piveval);
1098 gtk_notebook_set_tab_label(GTK_NOTEBOOK(gpiv->notebook),
1099 gtk_notebook_get_nth_page(GTK_NOTEBOOK
1100 (gpiv->notebook),
1102 gpiv->tablabel_piveval);
1106 gtk_object_set_data(GTK_OBJECT(gpiv->piveval->radiobutton_mouse_1),
1107 "gpiv",
1108 gpiv);
1109 gtk_object_set_data(GTK_OBJECT(gpiv->piveval->radiobutton_mouse_2),
1110 "gpiv",
1111 gpiv);
1112 gtk_object_set_data(GTK_OBJECT(gpiv->piveval->radiobutton_mouse_3),
1113 "gpiv",
1114 gpiv);
1115 gtk_object_set_data(GTK_OBJECT(gpiv->piveval->radiobutton_mouse_4),
1116 "gpiv",
1117 gpiv);
1118 gtk_object_set_data(GTK_OBJECT(gpiv->piveval->radiobutton_mouse_5),
1119 "gpiv",
1120 gpiv);
1121 gtk_object_set_data(GTK_OBJECT(gpiv->piveval->radiobutton_mouse_6),
1122 "gpiv",
1123 gpiv);
1124 gtk_object_set_data(GTK_OBJECT(gpiv->piveval->radiobutton_mouse_7),
1125 "gpiv",
1126 gpiv);
1127 gtk_object_set_data(GTK_OBJECT(gpiv->piveval->checkbutton_disprocess),
1128 "gpiv",
1129 gpiv);
1130 gtk_object_set_data(GTK_OBJECT(gpiv->piveval->checkbutton_disprocess),
1131 "gpiv",
1132 gpiv);
1133 gtk_object_set_data(GTK_OBJECT(gpiv->piveval->button),
1134 "gpiv",
1135 gpiv);
1138 gpiv->pivvalid = create_pivvalid(gpiv->console,
1139 gpiv->notebook);
1141 gpiv->tablabel_pivvalid = gtk_label_new(_("Validation"));
1142 gtk_widget_ref(gpiv->tablabel_pivvalid);
1143 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
1144 "tablabel_pivvalid",
1145 gpiv->tablabel_pivvalid,
1146 (GtkDestroyNotify) gtk_widget_unref);
1147 gtk_widget_show(gpiv->tablabel_pivvalid);
1148 gtk_notebook_set_tab_label(GTK_NOTEBOOK(gpiv->notebook),
1149 gtk_notebook_get_nth_page(GTK_NOTEBOOK
1150 (gpiv->notebook),
1152 gpiv->tablabel_pivvalid);
1156 gtk_object_set_data(GTK_OBJECT(gpiv->pivvalid->button_gradient),
1157 "gpiv",
1158 gpiv);
1159 gtk_object_set_data(GTK_OBJECT(gpiv->pivvalid->radiobutton_disable_0),
1160 "gpiv",
1161 gpiv);
1162 gtk_object_set_data(GTK_OBJECT(gpiv->pivvalid->radiobutton_disable_1),
1163 "gpiv",
1164 gpiv);
1165 gtk_object_set_data(GTK_OBJECT(gpiv->pivvalid->radiobutton_disable_2),
1166 "gpiv",
1167 gpiv);
1168 gtk_object_set_data(GTK_OBJECT(gpiv->pivvalid->radiobutton_disable_3),
1169 "gpiv",
1170 gpiv);
1171 gtk_object_set_data(GTK_OBJECT(gpiv->pivvalid->radiobutton_disable_4),
1172 "gpiv",
1173 gpiv);
1174 gtk_object_set_data(GTK_OBJECT(gpiv->pivvalid->button_gradient),
1175 "gpiv",
1176 gpiv);
1177 gtk_object_set_data(GTK_OBJECT(gpiv->pivvalid->button_errvec_resstats),
1178 "gpiv",
1179 gpiv);
1180 gtk_object_set_data(GTK_OBJECT(gpiv->pivvalid->button_peaklck),
1181 "gpiv",
1182 gpiv);
1183 gtk_object_set_data(GTK_OBJECT
1184 (gpiv->pivvalid->radiobutton_errvec_residu_1),
1185 "gpiv",
1186 gpiv);
1187 gtk_object_set_data(GTK_OBJECT
1188 (gpiv->pivvalid->radiobutton_errvec_residu_2),
1189 "gpiv",
1190 gpiv);
1191 gtk_object_set_data(GTK_OBJECT
1192 (gpiv->pivvalid->checkbutton_errvec_disres),
1193 "gpiv",
1194 gpiv);
1195 gtk_object_set_data(GTK_OBJECT
1196 (gpiv->pivvalid->radiobutton_errvec_subst_1),
1197 "gpiv",
1198 gpiv);
1199 gtk_object_set_data(GTK_OBJECT
1200 (gpiv->pivvalid->radiobutton_errvec_subst_2),
1201 "gpiv",
1202 gpiv);
1203 gtk_object_set_data(GTK_OBJECT
1204 (gpiv->pivvalid->radiobutton_errvec_subst_3),
1205 "gpiv",
1206 gpiv);
1207 gtk_object_set_data(GTK_OBJECT
1208 (gpiv->pivvalid->button_errvec),
1209 "gpiv",
1210 gpiv);
1215 /* pivpost->checkbutton_scale */
1216 gpiv->pivpost = create_pivpost(gpiv->console,
1217 gpiv->notebook);
1218 /* gtk_object_set_data(GTK_OBJECT(gpiv->console), */
1219 /* "gpiv", */
1220 /* gpiv); */
1222 gpiv->tablabel_pivpost = gtk_label_new(_("Post processing"));
1223 gtk_widget_ref(gpiv->tablabel_pivpost);
1224 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
1225 "tablabel_pivpost",
1226 gpiv->tablabel_pivpost,
1227 (GtkDestroyNotify) gtk_widget_unref);
1228 gtk_widget_show(gpiv->tablabel_pivpost);
1229 gtk_notebook_set_tab_label(GTK_NOTEBOOK(gpiv->notebook),
1230 gtk_notebook_get_nth_page(GTK_NOTEBOOK
1231 (gpiv->notebook),
1233 gpiv->tablabel_pivpost);
1237 gtk_object_set_data(GTK_OBJECT(gpiv->pivpost->button_scale),
1238 "gpiv",
1239 gpiv);
1240 gtk_object_set_data(GTK_OBJECT(gpiv->pivpost->button_savg),
1241 "gpiv",
1242 gpiv);
1243 gtk_object_set_data(GTK_OBJECT(gpiv->pivpost->button_subavg),
1244 "gpiv",
1245 gpiv);
1246 gtk_object_set_data(GTK_OBJECT(gpiv->pivpost->
1247 radiobutton_vorstra_output_1),
1248 "gpiv",
1249 gpiv);
1250 gtk_object_set_data(GTK_OBJECT(gpiv->pivpost->
1251 radiobutton_vorstra_output_2),
1252 "gpiv",
1253 gpiv);
1254 gtk_object_set_data(GTK_OBJECT(gpiv->pivpost->
1255 radiobutton_vorstra_output_3),
1256 "gpiv",
1257 gpiv);
1258 gtk_object_set_data(GTK_OBJECT(gpiv->pivpost->
1259 radiobutton_vorstra_diffscheme_1),
1260 "gpiv",
1261 gpiv);
1262 gtk_object_set_data(GTK_OBJECT(gpiv->pivpost->
1263 radiobutton_vorstra_diffscheme_2),
1264 "gpiv",
1265 gpiv);
1266 gtk_object_set_data(GTK_OBJECT(gpiv->pivpost->
1267 radiobutton_vorstra_diffscheme_3),
1268 "gpiv",
1269 gpiv);
1270 gtk_object_set_data(GTK_OBJECT(gpiv->pivpost->
1271 radiobutton_vorstra_diffscheme_4),
1272 "gpiv",
1273 gpiv);
1274 gtk_object_set_data(GTK_OBJECT(gpiv->pivpost->button_vorstra),
1275 "gpiv",
1276 gpiv);
1281 * handlebox of buffer list
1283 gpiv->handlebox_buf = gtk_handle_box_new();
1284 gtk_widget_ref(gpiv->handlebox_buf);
1285 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
1286 "handlebox_buf",
1287 gpiv->handlebox_buf,
1288 (GtkDestroyNotify) gtk_widget_unref);
1289 gtk_widget_show(gpiv->handlebox_buf);
1290 gtk_box_pack_start(GTK_BOX(gpiv->hbox_main),
1291 gpiv->handlebox_buf,
1292 TRUE,
1293 TRUE,
1295 gtk_handle_box_set_handle_position(GTK_HANDLE_BOX(gpiv->handlebox_buf),
1296 GTK_POS_TOP);
1297 gtk_tooltips_set_tip(gpiv->tooltips,
1298 gpiv->handlebox_buf,
1299 _("buffer names and numbers"),
1300 NULL);
1303 gpiv->alignment_buf = gtk_alignment_new(0.0,
1304 0.0,
1305 0.0,
1306 1.0);
1307 gtk_widget_ref(gpiv->alignment_buf);
1308 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
1309 "alignment_buf",
1310 gpiv->alignment_buf,
1311 (GtkDestroyNotify) gtk_widget_unref);
1312 gtk_widget_show(gpiv->alignment_buf);
1313 gtk_container_add(GTK_CONTAINER(gpiv->handlebox_buf),
1314 gpiv->alignment_buf);
1317 gpiv->eventbox_buf = gtk_event_box_new();
1318 gtk_widget_ref(gpiv->eventbox_buf);
1319 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
1320 "gpiv->eventbox_buf",
1321 gpiv->eventbox_buf,
1322 (GtkDestroyNotify) gtk_widget_unref);
1323 gtk_widget_show(gpiv->eventbox_buf);
1324 gtk_container_add(GTK_CONTAINER(gpiv->alignment_buf),
1325 gpiv->eventbox_buf);
1328 gpiv->scrolledwindow_buf = gtk_scrolled_window_new(NULL,
1329 NULL);
1330 gtk_widget_ref(gpiv->scrolledwindow_buf);
1331 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
1332 "scrolledwindow_buf",
1333 gpiv->scrolledwindow_buf,
1334 (GtkDestroyNotify) gtk_widget_unref);
1335 gtk_widget_show(gpiv->scrolledwindow_buf);
1336 gtk_container_add(GTK_CONTAINER(gpiv->eventbox_buf),
1337 gpiv->scrolledwindow_buf);
1338 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW
1339 (gpiv->scrolledwindow_buf),
1340 /* GTK_POLICY_NEVER */
1341 GTK_POLICY_AUTOMATIC,
1342 GTK_POLICY_AUTOMATIC);
1343 /* gpiv->scrolledwindow_buf_adj = gtk_adjustment_new (0.0, 500.0, 100.0, 5.0, 50.0, 2500.0); */
1344 /* gtk_scrolled_window_set_hadjustment (GTK_SCROLLED_WINDOW(gpiv->scrolledwindow_buf), */
1345 /* GTK_ADJUSTMENT (gpiv->scrolledwindow_buf_adj)); */
1346 /* gnome_canvas_set_scroll_region( GNOME_CANVAS(canvas_display()->display_act->gpd.display), */
1347 /* 0.0, 0.0, IMAGE_WIDTH, IMAGE_HEIGHT); */
1350 gpiv->viewport_buf =
1351 gtk_viewport_new(NULL,
1352 NULL);
1353 gtk_widget_ref(gpiv->viewport_buf);
1354 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
1355 "viewport_buf",
1356 gpiv->viewport_buf,
1357 (GtkDestroyNotify) gtk_widget_unref);
1358 gtk_widget_show(gpiv->viewport_buf);
1359 gtk_container_add(GTK_CONTAINER(gpiv->scrolledwindow_buf),
1360 gpiv->viewport_buf);
1361 gtk_widget_set_usize(gpiv->viewport_buf,
1362 120,
1363 400);
1367 gpiv->clist_buf = gtk_clist_new(2);
1368 gtk_widget_ref(gpiv->clist_buf);
1369 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
1370 "clist_buf",
1371 gpiv->clist_buf,
1372 (GtkDestroyNotify) gtk_widget_unref);
1373 gtk_widget_show(gpiv->clist_buf);
1374 gtk_container_add(GTK_CONTAINER(gpiv->viewport_buf/* scrolledwindow_buf */ ),
1375 gpiv->clist_buf);
1376 gtk_tooltips_set_tip(gpiv->tooltips, gpiv->clist_buf,
1377 _("buffer list"),
1378 NULL);
1379 gtk_clist_set_column_width(GTK_CLIST(gpiv->clist_buf),
1381 10);
1382 gtk_clist_set_column_width(GTK_CLIST(gpiv->clist_buf),
1384 80);
1385 gtk_clist_set_selection_mode(GTK_CLIST (gpiv->clist_buf),
1386 GTK_SELECTION_EXTENDED /* MULTIPLE */);
1387 gtk_clist_column_titles_show(GTK_CLIST(gpiv->clist_buf));
1389 gtk_object_set_data(GTK_OBJECT(gpiv->clist_buf),
1390 "gpiv",
1391 gpiv);
1392 gtk_signal_connect(GTK_OBJECT(gpiv->clist_buf),
1393 "select_row",
1394 GTK_SIGNAL_FUNC(on_clist_buf_rowselect),
1395 NULL);
1398 gpiv->label_buf_1 = gtk_label_new(_("#"));
1399 gtk_widget_ref(gpiv->label_buf_1);
1400 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
1401 "label_buf_1",
1402 gpiv->label_buf_1,
1403 (GtkDestroyNotify) gtk_widget_unref);
1404 gtk_widget_show(gpiv->label_buf_1);
1405 gtk_clist_set_column_widget(GTK_CLIST(gpiv->clist_buf),
1407 gpiv->label_buf_1);
1410 gpiv->label_buf_2 = gtk_label_new(_("buffer name"));
1411 gtk_widget_ref(gpiv->label_buf_2);
1412 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
1413 "label_buf_2",
1414 gpiv->label_buf_2,
1415 (GtkDestroyNotify) gtk_widget_unref);
1416 gtk_widget_show(gpiv->label_buf_2);
1417 gtk_clist_set_column_widget(GTK_CLIST(gpiv->clist_buf),
1419 gpiv->label_buf_2);
1420 gtk_misc_set_alignment(GTK_MISC(gpiv->label_buf_2),
1421 0.0,
1422 0.5);
1423 gtk_clist_column_titles_passive(GTK_CLIST(gpiv->clist_buf));
1424 /* gtk_clist_set_policy (GTK_CLIST (gpiv->clist_buf), */
1425 /* GTK_POLICY_ALWAYS, */
1426 /* GTK_POLICY_ALWAYS); */
1429 gtk_clist_set_column_auto_resize(GTK_CLIST(gpiv->clist_buf),
1431 TRUE);
1433 gpiv->scrolledwindow_buf_adj =
1434 gtk_adjustment_new(0.0,
1435 500.0,
1436 100.0,
1437 5.0,
1438 50.0,
1439 250.0 /* 2500.0 */);
1440 gtk_scrolled_window_set_hadjustment(GTK_SCROLLED_WINDOW
1441 (gpiv->scrolledwindow_buf),
1442 GTK_ADJUSTMENT
1443 (gpiv->scrolledwindow_buf_adj));
1446 gtk_drag_dest_set (/* GTK_CLIST */ GTK_WIDGET (gpiv->clist_buf),
1447 GTK_DEST_DEFAULT_ALL,
1448 target_table, 1,
1449 GDK_ACTION_COPY);
1451 gtk_signal_connect (GTK_OBJECT (gpiv->clist_buf),
1452 "drag_data_received",
1453 GTK_SIGNAL_FUNC (on_clist_buf_drag_data_received),
1454 NULL);
1457 * Application bar buttons
1459 gpiv->appbar = gnome_appbar_new(TRUE,
1460 TRUE,
1461 GNOME_PREFERENCES_ALWAYS);
1462 gtk_widget_ref(gpiv->appbar);
1463 gtk_object_set_data_full(GTK_OBJECT(gpiv->console),
1464 "appbar",
1465 gpiv->appbar,
1466 (GtkDestroyNotify) gtk_widget_unref);
1467 gtk_widget_show(gpiv->appbar);
1468 gnome_app_set_statusbar(GNOME_APP(gpiv->console),
1469 gpiv->appbar);
1470 /* gtk_widget_set_sensitive (gpiv->appbar, FALSE); */
1477 * set gpiv->menubars after definition of all console widgets
1479 if (gpiv_par.view_gpivbuttons) {
1480 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
1481 (settings_menu_gpiv[0].widget),
1482 TRUE);
1483 } else {
1484 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
1485 (settings_menu_gpiv[0].widget),
1486 FALSE);
1490 if (gpiv_par.view_tabulator) {
1491 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
1492 (settings_menu_gpiv[1].widget),
1493 TRUE);
1494 } else {
1495 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
1496 (settings_menu_gpiv[1].widget),
1497 FALSE);
1501 if (gpiv_par.show_tooltips) {
1502 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
1503 (help_menu_gpiv[0].widget),
1504 TRUE);
1505 } else {
1506 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
1507 (help_menu_gpiv[0].widget),
1508 FALSE);
1512 gnome_app_install_menu_hints (GNOME_APP (gpiv->console),
1513 menubar_gpiv);
1515 return gpiv;
1521 GtkWidget *create_about(void)
1523 const gchar *authors[] = {
1524 "G. van der Graaf",
1525 NULL
1527 /* GtkWidget *about; */
1528 about = gnome_about_new( /* Title: */ "gpiv",
1529 /* VersioN: */ VERSION,
1530 /* Copyright */ _("Copyright G. Van der Graaf"),
1531 /* Author(s): */ authors,
1532 /* Comments: */ _("GPIV is a program for "
1533 "(Digital) Particle Image Velocimetry. It evaluates images (pairs), "
1534 "resulting into a velocity field of a fluid flow. The program includes "
1535 "validation of the velocities and allows to post-proces the data resulting "
1536 "into derivatives of the flow."),
1537 NULL);
1538 gtk_object_set_data(GTK_OBJECT(about),
1539 "about",
1540 about);
1541 gtk_window_set_modal(GTK_WINDOW(about), TRUE);
1542 gtk_window_set_wmclass(GTK_WINDOW(about),
1543 "gpiv about",
1544 "");
1546 gtk_signal_connect(GTK_OBJECT(about),
1547 "clicked",
1548 GTK_SIGNAL_FUNC(gtk_widget_destroy),
1549 NULL);
1551 return about;
1555 GtkWidget
1556 *create_exit(void)
1558 GtkWidget *exit;
1559 GtkWidget *dialog_vbox1;
1560 GtkWidget *exit_message_label;
1561 GtkWidget *dialog_action_area1;
1562 GtkWidget *button_yes;
1563 GtkWidget *button_no;
1567 exit = gnome_dialog_new(NULL,
1568 NULL);
1569 gtk_object_set_data(GTK_OBJECT(exit),
1570 "exit",
1571 exit);
1572 GTK_WINDOW(exit)->type = GTK_WINDOW_DIALOG;
1573 gtk_window_set_position(GTK_WINDOW(exit),
1574 GTK_WIN_POS_CENTER);
1575 gtk_window_set_policy(GTK_WINDOW(exit),
1576 FALSE,
1577 FALSE,
1578 FALSE);
1582 dialog_vbox1 = GNOME_DIALOG(exit)->vbox;
1583 gtk_object_set_data(GTK_OBJECT(exit),
1584 "dialog_vbox1",
1585 dialog_vbox1);
1586 gtk_widget_show(dialog_vbox1);
1590 exit_message_label =
1591 gtk_label_new(_("There are unsaved data that will be lost.\n\
1592 Are you sure you want to quit?"));
1594 gtk_widget_ref(exit_message_label);
1595 gtk_object_set_data_full(GTK_OBJECT(exit),
1596 "exit_message_label",
1597 exit_message_label,
1598 (GtkDestroyNotify) gtk_widget_unref);
1599 gtk_widget_show(exit_message_label);
1600 gtk_box_pack_start(GTK_BOX(dialog_vbox1),
1601 exit_message_label,
1602 FALSE,
1603 FALSE,
1608 dialog_action_area1 = GNOME_DIALOG(exit)->action_area;
1609 gtk_object_set_data(GTK_OBJECT(exit),
1610 "dialog_action_area1",
1611 dialog_action_area1);
1612 gtk_widget_show(dialog_action_area1);
1613 gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area1),
1614 GTK_BUTTONBOX_END);
1615 gtk_button_box_set_spacing(GTK_BUTTON_BOX(dialog_action_area1),
1620 gnome_dialog_append_button(GNOME_DIALOG(exit),
1621 GNOME_STOCK_BUTTON_YES);
1622 button_yes =
1623 GTK_WIDGET(g_list_last(GNOME_DIALOG(exit)->buttons)->data);
1624 gtk_widget_ref(button_yes);
1625 gtk_object_set_data_full(GTK_OBJECT(exit),
1626 "button_yes",
1627 button_yes,
1628 (GtkDestroyNotify) gtk_widget_unref);
1629 gtk_widget_show(button_yes);
1630 GTK_WIDGET_SET_FLAGS(GTK_OBJECT(button_yes),
1631 GTK_CAN_DEFAULT);
1635 gnome_dialog_append_button(GNOME_DIALOG(exit),
1636 GNOME_STOCK_BUTTON_NO);
1637 button_no = GTK_WIDGET(g_list_last(GNOME_DIALOG(exit)->buttons)->data);
1638 gtk_widget_ref(button_no);
1639 gtk_object_set_data_full(GTK_OBJECT(exit),
1640 "button_no",
1641 button_no,
1642 (GtkDestroyNotify) gtk_widget_unref);
1643 gtk_widget_show(button_no);
1644 GTK_WIDGET_SET_FLAGS(GTK_OBJECT(button_no),
1645 GTK_CAN_DEFAULT);
1649 gtk_signal_connect(GTK_OBJECT(button_yes),
1650 "clicked",
1651 GTK_SIGNAL_FUNC(on_button_quit_gpiv_yes_clicked),
1652 NULL);
1654 gtk_signal_connect(GTK_OBJECT(button_no),
1655 "clicked",
1656 GTK_SIGNAL_FUNC(on_button_quit_no_clicked),
1657 NULL);
1659 return exit;
1664 GtkWidget
1665 *create_messagebox(gchar * message)
1667 GtkWidget *messagebox;
1668 GtkWidget *dialog_vbox;
1669 GtkWidget *button;
1670 GtkWidget *dialog_action_area2;
1672 /* We create it with an OK button, and then remove the button, to work
1673 around a bug in gnome-libs. */
1674 messagebox = gnome_message_box_new(message,
1675 GNOME_MESSAGE_BOX_WARNING,
1676 GNOME_STOCK_BUTTON_OK,
1677 NULL);
1678 gtk_container_remove(GTK_CONTAINER
1679 (GNOME_DIALOG(messagebox)->action_area),
1680 GNOME_DIALOG(messagebox)->buttons->data);
1681 GNOME_DIALOG(messagebox)->buttons = NULL;
1682 gtk_object_set_data(GTK_OBJECT(messagebox),
1683 "messagebox",
1684 messagebox);
1685 gtk_window_set_title(GTK_WINDOW(messagebox),
1686 _("GPIV message"));
1687 gtk_window_set_position(GTK_WINDOW(messagebox),
1688 GTK_WIN_POS_MOUSE);
1689 gtk_window_set_policy(GTK_WINDOW(messagebox),
1690 FALSE,
1691 FALSE,
1692 FALSE);
1696 dialog_vbox = GNOME_DIALOG(messagebox)->vbox;
1697 gtk_object_set_data(GTK_OBJECT(messagebox),
1698 "dialog_vbox",
1699 dialog_vbox);
1700 gtk_widget_show(dialog_vbox);
1704 gnome_dialog_append_button(GNOME_DIALOG(messagebox),
1705 GNOME_STOCK_BUTTON_OK);
1706 button =
1707 GTK_WIDGET(g_list_last(GNOME_DIALOG(messagebox)->buttons)->data);
1708 gtk_widget_ref(button);
1709 gtk_object_set_data_full(GTK_OBJECT(messagebox),
1710 "button",
1711 button,
1712 (GtkDestroyNotify) gtk_widget_unref);
1713 gtk_widget_show(button);
1714 GTK_WIDGET_SET_FLAGS(GTK_OBJECT(button),
1715 GTK_CAN_DEFAULT);
1719 dialog_action_area2 = GNOME_DIALOG(messagebox)->action_area;
1720 gtk_widget_ref(dialog_action_area2);
1721 gtk_object_set_data_full(GTK_OBJECT(messagebox),
1722 "dialog_action_area2",
1723 dialog_action_area2,
1724 (GtkDestroyNotify) gtk_widget_unref);
1726 gtk_signal_connect(GTK_OBJECT(button),
1727 "clicked",
1728 GTK_SIGNAL_FUNC(on_button_message_clicked),
1729 NULL);
1733 return messagebox;
1739 GtkWidget *create_errorbox(gchar * message)
1741 GtkWidget *errorbox;
1742 GtkWidget *dialog_vbox;
1743 GtkWidget *button;
1744 GtkWidget *dialog_action_area3;
1746 /* We create it with an OK button, and then remove the button, to work
1747 around a bug in gnome-libs. */
1748 errorbox = gnome_message_box_new(message,
1749 GNOME_MESSAGE_BOX_ERROR,
1750 GNOME_STOCK_BUTTON_OK,
1751 NULL);
1752 gtk_container_remove(GTK_CONTAINER
1753 (GNOME_DIALOG(errorbox)->action_area),
1754 GNOME_DIALOG(errorbox)->buttons->data);
1755 GNOME_DIALOG(errorbox)->buttons = NULL;
1756 gtk_object_set_data(GTK_OBJECT(errorbox),
1757 "errorbox",
1758 errorbox);
1759 gtk_window_set_title(GTK_WINDOW(errorbox),
1760 _("GPIV error"));
1761 gtk_window_set_policy(GTK_WINDOW(errorbox),
1762 FALSE,
1763 FALSE,
1764 FALSE);
1768 dialog_vbox = GNOME_DIALOG(errorbox)->vbox;
1769 gtk_object_set_data(GTK_OBJECT(errorbox),
1770 "dialog_vbox",
1771 dialog_vbox);
1772 gtk_widget_show(dialog_vbox);
1774 gnome_dialog_append_button(GNOME_DIALOG(errorbox),
1775 GNOME_STOCK_BUTTON_CLOSE);
1776 button =
1777 GTK_WIDGET(g_list_last(GNOME_DIALOG(errorbox)->buttons)->data);
1778 gtk_widget_ref(button);
1779 gtk_object_set_data_full(GTK_OBJECT(errorbox),
1780 "button",
1781 button,
1782 (GtkDestroyNotify) gtk_widget_unref);
1783 gtk_widget_show(button);
1784 GTK_WIDGET_SET_FLAGS(GTK_OBJECT(button),
1785 GTK_CAN_DEFAULT);
1789 dialog_action_area3 = GNOME_DIALOG(errorbox)->action_area;
1790 gtk_widget_ref(dialog_action_area3);
1791 gtk_object_set_data_full(GTK_OBJECT(errorbox),
1792 "dialog_action_area3",
1793 dialog_action_area3,
1794 (GtkDestroyNotify) gtk_widget_unref);
1796 gtk_signal_connect(GTK_OBJECT(button),
1797 "clicked",
1798 GTK_SIGNAL_FUNC(on_button_error_clicked),
1799 NULL);
1801 return errorbox;
1806 gint
1807 close_buffer_yes_no (GpivConsole * gpiv,
1808 char *message)
1810 GtkWidget *dialog, *label;
1811 int button;
1813 dialog = gnome_dialog_new (
1814 "gpiv dialog",
1815 GNOME_STOCK_BUTTON_YES,
1816 GNOME_STOCK_BUTTON_NO,
1817 NULL);
1819 gnome_dialog_set_parent (GNOME_DIALOG (dialog),
1820 GTK_WINDOW(gpiv->console));
1822 label = gtk_label_new (message);
1823 gtk_object_set_data_full(GTK_OBJECT(dialog),
1824 "label",
1825 label,
1826 (GtkDestroyNotify) gtk_widget_unref);
1827 gtk_widget_show(label);
1828 gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox),
1829 label,
1830 TRUE,
1831 TRUE,
1835 * Run the dialog and wait for the user to select yes or no.
1836 * If the user closes the window with the window manager, we
1837 * will get a -1 return value
1839 button = gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
1841 return button;