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
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)
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
45 #include "console_interface.h"
46 #include "console_menus.h"
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
),
64 gnome_app_fill_menu(GTK_MENU_SHELL(menu_gpiv_popup
),
70 gtk_widget_ref(menubar_gpiv_popup
[0].widget
);
71 gtk_object_set_data_full(GTK_OBJECT(console
),
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
),
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
),
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
),
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
),
101 gtk_widget_ref(file_menu_gpiv_popup
[0].widget
);
102 gtk_object_set_data(GTK_OBJECT(file_menu_gpiv_popup
[0].widget
),
106 gtk_widget_ref(file_menu_gpiv_popup
[1].widget
);
107 gtk_object_set_data(GTK_OBJECT(file_menu_gpiv_popup
[1].widget
),
111 gtk_widget_ref(settings_menu_gpiv_popup
[0].widget
);
112 gtk_object_set_data_full(GTK_OBJECT(console
),
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
),
119 if (gpiv_par
.view_gpivbuttons
) {
120 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
121 (settings_menu_gpiv_popup
[0].widget
),
124 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
125 (settings_menu_gpiv_popup
[0].widget
),
131 gtk_widget_ref(settings_menu_gpiv_popup
[1].widget
);
132 gtk_object_set_data_full(GTK_OBJECT(console
),
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
),
139 if (gpiv_par
.view_tabulator
) {
140 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
141 (settings_menu_gpiv_popup
[1].widget
),
144 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
145 (settings_menu_gpiv_popup
[1].widget
),
150 if (gpiv_par
.show_tooltips
) {
151 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
152 (help_menu_gpiv_popup
[0].widget
),
155 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
156 (help_menu_gpiv_popup
[0].widget
),
162 return menu_gpiv_popup
;
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
;
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
),
220 gpiv
->console
= gnome_app_new("Gpiv-gui-gtk",
222 gtk_window_set_policy(GTK_WINDOW(gpiv
->console
),
226 gtk_object_set_data(GTK_OBJECT(gpiv
->console
),
230 gpiv
->dock1
= GNOME_APP(gpiv
->console
)->dock
;
231 gtk_widget_ref(gpiv
->dock1
);
232 gtk_object_set_data_full(GTK_OBJECT(gpiv
->console
),
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
),
248 gtk_widget_ref(menubar_gpiv
[0].widget
);
249 gtk_object_set_data_full(GTK_OBJECT(gpiv
->console
),
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
),
258 file_menu_gpiv
[0].widget
,
259 (GtkDestroyNotify
) gtk_widget_unref
);
260 gtk_object_set_data(GTK_OBJECT(file_menu_gpiv
[0].widget
),
265 gtk_widget_ref(file_menu_gpiv
[1].widget
);
266 gtk_object_set_data_full(GTK_OBJECT(gpiv
->console
),
268 file_menu_gpiv
[1].widget
,
269 (GtkDestroyNotify
) gtk_widget_unref
);
270 gtk_object_set_data(GTK_OBJECT(file_menu_gpiv
[1].widget
),
274 gtk_widget_ref(file_menu_gpiv
[2].widget
);
275 gtk_object_set_data_full(GTK_OBJECT(gpiv
->console
),
277 file_menu_gpiv
[2].widget
,
278 (GtkDestroyNotify
) gtk_widget_unref
);
279 gtk_object_set_data(GTK_OBJECT(file_menu_gpiv
[2].widget
),
284 gtk_widget_ref(file_menu_gpiv
[3].widget
);
285 gtk_object_set_data_full(GTK_OBJECT(gpiv
->console
),
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
),
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
),
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
),
308 settings_menu_gpiv
[0].widget
,
309 (GtkDestroyNotify
) gtk_widget_unref
);
310 gtk_object_set_data(GTK_OBJECT(settings_menu_gpiv
[0].widget
),
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
),
321 settings_menu_gpiv
[1].widget
,
322 (GtkDestroyNotify
) gtk_widget_unref
);
323 gtk_object_set_data(GTK_OBJECT(settings_menu_gpiv
[1].widget
),
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
),
334 settings_menu_gpiv
[3].widget
,
335 (GtkDestroyNotify
) gtk_widget_unref
);
336 gtk_object_set_data(GTK_OBJECT(settings_menu_gpiv
[3].widget
),
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
),
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
),
354 help_menu_gpiv
[0].widget
,
355 (GtkDestroyNotify
) gtk_widget_unref
);
356 gtk_object_set_data(GTK_OBJECT(help_menu_gpiv
[0].widget
),
361 gtk_widget_ref(help_menu_gpiv
[1].widget
);
362 gtk_object_set_data_full(GTK_OBJECT(gpiv
->console
),
364 help_menu_gpiv
[1].widget
,
365 (GtkDestroyNotify
) gtk_widget_unref
);
366 gtk_object_set_data(GTK_OBJECT(help_menu_gpiv
[1].widget
),
371 gtk_widget_ref(help_menu_gpiv
[2].widget
);
372 gtk_object_set_data_full(GTK_OBJECT(gpiv
->console
),
374 help_menu_gpiv
[2].widget
,
375 (GtkDestroyNotify
) gtk_widget_unref
);
376 gtk_object_set_data(GTK_OBJECT(help_menu_gpiv
[2].widget
),
384 gnome_app_create_toolbar(GNOME_APP (gpiv
->console
),
388 gtk_widget_ref(toolbar_gpiv
[0].widget
);
389 gtk_object_set_data_full(GTK_OBJECT(gpiv
->console
),
391 toolbar_gpiv
[0].widget
,
392 (GtkDestroyNotify
) gtk_widget_unref
);
394 gtk_object_set_data(GTK_OBJECT(toolbar_gpiv
[0].widget
),
397 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv
[0].widget
),
399 GTK_SIGNAL_FUNC(on_button_open_enter
),
401 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv
[0].widget
),
403 GTK_SIGNAL_FUNC(on_widget_leave
),
408 gtk_widget_ref(toolbar_gpiv
[1].widget
);
409 gtk_object_set_data_full(GTK_OBJECT(gpiv
->console
),
411 toolbar_gpiv
[1].widget
,
412 (GtkDestroyNotify
) gtk_widget_unref
);
414 gtk_object_set_data(GTK_OBJECT(toolbar_gpiv
[1].widget
),
417 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv
[1].widget
),
419 GTK_SIGNAL_FUNC(on_button_save_enter
),
421 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv
[1].widget
),
423 GTK_SIGNAL_FUNC(on_widget_leave
),
428 gtk_widget_ref(toolbar_gpiv
[2].widget
);
429 gtk_object_set_data_full(GTK_OBJECT(gpiv
->console
),
431 toolbar_gpiv
[2].widget
,
432 (GtkDestroyNotify
) gtk_widget_unref
);
434 gtk_object_set_data(GTK_OBJECT(toolbar_gpiv
[2].widget
),
437 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv
[2].widget
),
439 GTK_SIGNAL_FUNC(on_button_execute_enter
),
441 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv
[2].widget
),
443 GTK_SIGNAL_FUNC(on_widget_leave
),
449 gtk_widget_ref(toolbar_gpiv
[3].widget
);
450 gtk_object_set_data_full(GTK_OBJECT(gpiv
->console
),
452 toolbar_gpiv
[3].widget
,
453 (GtkDestroyNotify
) gtk_widget_unref
);
455 gtk_object_set_data(GTK_OBJECT(toolbar_gpiv
[3].widget
),
458 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv
[3].widget
),
459 "button_press_event",
460 GTK_SIGNAL_FUNC(on_button_stop_press
),
462 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv
[3].widget
),
463 "button_release_event",
464 GTK_SIGNAL_FUNC(on_button_stop_release
),
466 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv
[3].widget
),
468 GTK_SIGNAL_FUNC(on_button_stop_enter
),
470 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv
[3].widget
),
472 GTK_SIGNAL_FUNC(on_widget_leave
),
478 gtk_widget_ref(toolbar_gpiv
[4].widget
);
479 gtk_object_set_data_full(GTK_OBJECT(gpiv
->console
),
481 toolbar_gpiv
[4].widget
,
482 (GtkDestroyNotify
) gtk_widget_unref
);
483 gtk_object_set_data(GTK_OBJECT(toolbar_gpiv
[4].widget
),
486 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv
[4].widget
),
488 GTK_SIGNAL_FUNC(on_button_close_enter
),
490 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv
[4].widget
),
492 GTK_SIGNAL_FUNC(on_widget_leave
),
496 * toolbar_gpiv[5].widget: Separator
499 gtk_widget_ref(toolbar_gpiv
[6].widget
);
500 gtk_object_set_data_full(GTK_OBJECT(gpiv
->console
),
502 toolbar_gpiv
[6].widget
,
503 (GtkDestroyNotify
) gtk_widget_unref
);
504 gtk_object_set_data(GTK_OBJECT(toolbar_gpiv
[6].widget
),
507 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv
[6].widget
),
509 GTK_SIGNAL_FUNC(on_button_exit_enter
),
511 gtk_signal_connect(GTK_OBJECT(toolbar_gpiv
[6].widget
),
513 GTK_SIGNAL_FUNC(on_widget_leave
),
518 * vbox_main contains handleboxes for toolbar, gpiv toolbar, tabulator
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
),
527 (GtkDestroyNotify
) gtk_widget_unref
);
528 gtk_widget_show(gpiv
->vbox_main
);
529 gnome_app_set_contents (GNOME_APP (gpiv
->console
),
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
),
542 (GtkDestroyNotify
) gtk_widget_unref
);
543 gtk_box_pack_start(GTK_BOX(gpiv
->vbox_main
),
553 gpiv
->scrolledwindow_handbox1
= gtk_scrolled_window_new(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
,
569 gpiv
->viewport_handbox1
=
570 gtk_viewport_new(NULL
,
572 gtk_widget_ref(gpiv
->viewport_handbox1
);
573 gtk_object_set_data_full(GTK_OBJECT(gpiv
->console
),
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
),
590 gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL
,
592 gtk_widget_ref(gpiv
->toolbar2
);
593 gtk_object_set_data_full(GTK_OBJECT(gpiv
->console
),
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
),
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
),
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
,
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"),
638 gtk_object_set_data(GTK_OBJECT(gpiv
->button_toolbar_piv
),
641 gtk_signal_connect(GTK_OBJECT(gpiv
->button_toolbar_piv
),
643 GTK_SIGNAL_FUNC(on_button_piv_enter
),
645 gtk_signal_connect(GTK_OBJECT(gpiv
->button_toolbar_piv
),
647 GTK_SIGNAL_FUNC(on_widget_leave
),
649 gtk_signal_connect(GTK_OBJECT(gpiv
->button_toolbar_piv
),
651 GTK_SIGNAL_FUNC(on_toolbar_checkbutton_piv
),
653 if (gpiv_par
.process_piv
== 1) {
654 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
655 (gpiv
->button_toolbar_piv
),
658 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
659 (gpiv
->button_toolbar_piv
),
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
,
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"),
685 gtk_object_set_data(GTK_OBJECT(gpiv
->button_toolbar_gradient
),
688 gtk_signal_connect(GTK_OBJECT(gpiv
->button_toolbar_gradient
),
690 GTK_SIGNAL_FUNC(on_button_valid_gradient_enter
),
692 gtk_signal_connect(GTK_OBJECT(gpiv
->button_toolbar_gradient
),
694 GTK_SIGNAL_FUNC(on_widget_leave
),
696 gtk_signal_connect(GTK_OBJECT(gpiv
->button_toolbar_gradient
),
698 GTK_SIGNAL_FUNC(on_toolbar_checkbutton_gradient
),
700 if (gpiv_par
.process_gradient
== 1) {
701 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
702 (gpiv
->button_toolbar_gradient
),
705 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
706 (gpiv
->button_toolbar_gradient
),
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
,
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"),
732 gtk_object_set_data(GTK_OBJECT(gpiv
->button_toolbar_resstats
),
735 gtk_signal_connect(GTK_OBJECT(gpiv
->button_toolbar_resstats
),
737 GTK_SIGNAL_FUNC(on_button_valid_errvec_resstats_enter
),
739 gtk_signal_connect(GTK_OBJECT(gpiv
->button_toolbar_resstats
),
741 GTK_SIGNAL_FUNC(on_widget_leave
),
743 gtk_signal_connect(GTK_OBJECT(gpiv
->button_toolbar_resstats
),
745 GTK_SIGNAL_FUNC(on_toolbar_checkbutton_resstats
),
747 if (gpiv_par
.process_resstats
== 1) {
748 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
749 (gpiv
->button_toolbar_resstats
),
752 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
753 (gpiv
->button_toolbar_resstats
),
759 gpiv
->button_toolbar_errvec
= gtk_check_button_new_with_label
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
,
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"),
780 gtk_object_set_data(GTK_OBJECT(gpiv
->button_toolbar_errvec
),
783 gtk_signal_connect(GTK_OBJECT(gpiv
->button_toolbar_errvec
),
785 GTK_SIGNAL_FUNC(on_button_valid_errvec_enter
),
787 gtk_signal_connect(GTK_OBJECT(gpiv
->button_toolbar_errvec
),
789 GTK_SIGNAL_FUNC(on_widget_leave
), NULL
);
790 gtk_signal_connect(GTK_OBJECT(gpiv
->button_toolbar_errvec
),
792 GTK_SIGNAL_FUNC(on_toolbar_checkbutton_errvec
),
794 if (gpiv_par
.process_errvec
== 1) {
795 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
796 (gpiv
->button_toolbar_errvec
),
799 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
800 (gpiv
->button_toolbar_errvec
),
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
,
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"),
827 gtk_object_set_data(GTK_OBJECT(gpiv
->button_toolbar_peaklock
),
830 gtk_signal_connect(GTK_OBJECT(gpiv
->button_toolbar_peaklock
),
832 GTK_SIGNAL_FUNC(on_button_valid_peaklck_enter
),
834 gtk_signal_connect(GTK_OBJECT(gpiv
->button_toolbar_peaklock
),
836 GTK_SIGNAL_FUNC(on_widget_leave
),
838 gtk_signal_connect(GTK_OBJECT(gpiv
->button_toolbar_peaklock
),
840 GTK_SIGNAL_FUNC(on_toolbar_checkbutton_peaklck
),
842 if (gpiv_par
.process_peaklock
== 1) {
843 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
844 (gpiv
->button_toolbar_peaklock
),
847 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
848 (gpiv
->button_toolbar_peaklock
),
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
,
865 gtk_tooltips_set_tip(gpiv
->tooltips
,
866 gpiv
->button_toolbar_scale
,
867 _("Enables scaling for chain processing: scales spatial displacements \
869 \nThe process will be executed by clicking the \"Execute\" button"),
872 gtk_object_set_data(GTK_OBJECT(gpiv
->button_toolbar_scale
),
875 gtk_signal_connect(GTK_OBJECT(gpiv
->button_toolbar_scale
),
877 GTK_SIGNAL_FUNC(on_button_post_scale_enter
),
879 gtk_signal_connect(GTK_OBJECT(gpiv
->button_toolbar_scale
),
881 GTK_SIGNAL_FUNC(on_widget_leave
),
883 gtk_signal_connect(GTK_OBJECT(gpiv
->button_toolbar_scale
),
885 GTK_SIGNAL_FUNC(on_toolbar_checkbutton_scale
),
887 if (gpiv_par
.process_scale
== 1) {
888 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
889 (gpiv
->button_toolbar_scale
),
892 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
893 (gpiv
->button_toolbar_scale
),
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
,
910 gtk_tooltips_set_tip(gpiv
->tooltips
,
911 gpiv
->button_toolbar_average
,
912 _("Enables average for chain processing: Calculates spatial average displacements \
914 \nThe process will be executed by clicking the \"Execute\" button"),
917 gtk_object_set_data(GTK_OBJECT(gpiv
->button_toolbar_average
),
920 gtk_signal_connect(GTK_OBJECT(gpiv
->button_toolbar_average
),
922 GTK_SIGNAL_FUNC(on_button_post_savg_enter
),
924 gtk_signal_connect(GTK_OBJECT(gpiv
->button_toolbar_average
),
926 GTK_SIGNAL_FUNC(on_widget_leave
),
928 gtk_signal_connect(GTK_OBJECT(gpiv
->button_toolbar_average
),
930 GTK_SIGNAL_FUNC(on_toolbar_checkbutton_average
),
932 if (gpiv_par
.process_average
== 1) {
933 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
934 (gpiv
->button_toolbar_average
),
937 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
938 (gpiv
->button_toolbar_average
),
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
,
956 gtk_tooltips_set_tip(gpiv
->tooltips
,
957 gpiv
->button_toolbar_subavg
,
958 _("Enables substract for chain processing: substracts spatial average displacements \
960 \nThe process will be executed by clicking the \"Execute\" button"),
963 gtk_object_set_data(GTK_OBJECT(gpiv
->button_toolbar_subavg
),
966 gtk_signal_connect(GTK_OBJECT(gpiv
->button_toolbar_subavg
),
968 GTK_SIGNAL_FUNC(on_button_post_subavg_enter
),
970 gtk_signal_connect(GTK_OBJECT(gpiv
->button_toolbar_subavg
),
972 GTK_SIGNAL_FUNC(on_widget_leave
),
974 gtk_signal_connect(GTK_OBJECT(gpiv
->button_toolbar_subavg
),
976 GTK_SIGNAL_FUNC(on_toolbar_checkbutton_subavg
),
978 if (gpiv_par
.process_substract
== 1) {
979 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
980 (gpiv
->button_toolbar_subavg
),
983 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
984 (gpiv
->button_toolbar_subavg
),
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
,
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"),
1009 gtk_object_set_data(GTK_OBJECT(gpiv
->button_toolbar_vorstra
),
1012 gtk_signal_connect(GTK_OBJECT(gpiv
->button_toolbar_vorstra
),
1014 GTK_SIGNAL_FUNC(on_button_post_vorstra_enter
),
1016 gtk_signal_connect(GTK_OBJECT(gpiv
->button_toolbar_vorstra
),
1018 GTK_SIGNAL_FUNC(on_widget_leave
),
1020 gtk_signal_connect(GTK_OBJECT(gpiv
->button_toolbar_vorstra
),
1022 GTK_SIGNAL_FUNC(on_toolbar_checkbutton_vorstra
),
1024 if (gpiv_par
.process_vorstra
== 1) {
1025 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
1026 (gpiv
->button_toolbar_vorstra
),
1029 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
1030 (gpiv
->button_toolbar_vorstra
),
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
),
1043 (GtkDestroyNotify
) gtk_widget_unref
);
1044 gtk_widget_show(gpiv
->hbox_main
);
1045 gtk_box_pack_start(GTK_BOX(gpiv
->vbox_main
),
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
),
1060 (GtkDestroyNotify
) gtk_widget_unref
);
1061 gtk_widget_show(gpiv
->notebook
);
1062 gtk_box_pack_start(GTK_BOX(gpiv
->hbox_main
),
1070 gpiv
->imgh
= create_imgh(gpiv
->console
,
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
),
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
1084 gpiv
->tablabel_imgh
);
1088 gpiv
->piveval
= create_piveval(gpiv
->console
,
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
),
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
1102 gpiv
->tablabel_piveval
);
1106 gtk_object_set_data(GTK_OBJECT(gpiv
->piveval
->radiobutton_mouse_1
),
1109 gtk_object_set_data(GTK_OBJECT(gpiv
->piveval
->radiobutton_mouse_2
),
1112 gtk_object_set_data(GTK_OBJECT(gpiv
->piveval
->radiobutton_mouse_3
),
1115 gtk_object_set_data(GTK_OBJECT(gpiv
->piveval
->radiobutton_mouse_4
),
1118 gtk_object_set_data(GTK_OBJECT(gpiv
->piveval
->radiobutton_mouse_5
),
1121 gtk_object_set_data(GTK_OBJECT(gpiv
->piveval
->radiobutton_mouse_6
),
1124 gtk_object_set_data(GTK_OBJECT(gpiv
->piveval
->radiobutton_mouse_7
),
1127 gtk_object_set_data(GTK_OBJECT(gpiv
->piveval
->checkbutton_disprocess
),
1130 gtk_object_set_data(GTK_OBJECT(gpiv
->piveval
->checkbutton_disprocess
),
1133 gtk_object_set_data(GTK_OBJECT(gpiv
->piveval
->button
),
1138 gpiv
->pivvalid
= create_pivvalid(gpiv
->console
,
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
1152 gpiv
->tablabel_pivvalid
);
1156 gtk_object_set_data(GTK_OBJECT(gpiv
->pivvalid
->button_gradient
),
1159 gtk_object_set_data(GTK_OBJECT(gpiv
->pivvalid
->radiobutton_disable_0
),
1162 gtk_object_set_data(GTK_OBJECT(gpiv
->pivvalid
->radiobutton_disable_1
),
1165 gtk_object_set_data(GTK_OBJECT(gpiv
->pivvalid
->radiobutton_disable_2
),
1168 gtk_object_set_data(GTK_OBJECT(gpiv
->pivvalid
->radiobutton_disable_3
),
1171 gtk_object_set_data(GTK_OBJECT(gpiv
->pivvalid
->radiobutton_disable_4
),
1174 gtk_object_set_data(GTK_OBJECT(gpiv
->pivvalid
->button_gradient
),
1177 gtk_object_set_data(GTK_OBJECT(gpiv
->pivvalid
->button_errvec_resstats
),
1180 gtk_object_set_data(GTK_OBJECT(gpiv
->pivvalid
->button_peaklck
),
1183 gtk_object_set_data(GTK_OBJECT
1184 (gpiv
->pivvalid
->radiobutton_errvec_residu_1
),
1187 gtk_object_set_data(GTK_OBJECT
1188 (gpiv
->pivvalid
->radiobutton_errvec_residu_2
),
1191 gtk_object_set_data(GTK_OBJECT
1192 (gpiv
->pivvalid
->checkbutton_errvec_disres
),
1195 gtk_object_set_data(GTK_OBJECT
1196 (gpiv
->pivvalid
->radiobutton_errvec_subst_1
),
1199 gtk_object_set_data(GTK_OBJECT
1200 (gpiv
->pivvalid
->radiobutton_errvec_subst_2
),
1203 gtk_object_set_data(GTK_OBJECT
1204 (gpiv
->pivvalid
->radiobutton_errvec_subst_3
),
1207 gtk_object_set_data(GTK_OBJECT
1208 (gpiv
->pivvalid
->button_errvec
),
1215 /* pivpost->checkbutton_scale */
1216 gpiv
->pivpost
= create_pivpost(gpiv
->console
,
1218 /* gtk_object_set_data(GTK_OBJECT(gpiv->console), */
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
),
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
1233 gpiv
->tablabel_pivpost
);
1237 gtk_object_set_data(GTK_OBJECT(gpiv
->pivpost
->button_scale
),
1240 gtk_object_set_data(GTK_OBJECT(gpiv
->pivpost
->button_savg
),
1243 gtk_object_set_data(GTK_OBJECT(gpiv
->pivpost
->button_subavg
),
1246 gtk_object_set_data(GTK_OBJECT(gpiv
->pivpost
->
1247 radiobutton_vorstra_output_1
),
1250 gtk_object_set_data(GTK_OBJECT(gpiv
->pivpost
->
1251 radiobutton_vorstra_output_2
),
1254 gtk_object_set_data(GTK_OBJECT(gpiv
->pivpost
->
1255 radiobutton_vorstra_output_3
),
1258 gtk_object_set_data(GTK_OBJECT(gpiv
->pivpost
->
1259 radiobutton_vorstra_diffscheme_1
),
1262 gtk_object_set_data(GTK_OBJECT(gpiv
->pivpost
->
1263 radiobutton_vorstra_diffscheme_2
),
1266 gtk_object_set_data(GTK_OBJECT(gpiv
->pivpost
->
1267 radiobutton_vorstra_diffscheme_3
),
1270 gtk_object_set_data(GTK_OBJECT(gpiv
->pivpost
->
1271 radiobutton_vorstra_diffscheme_4
),
1274 gtk_object_set_data(GTK_OBJECT(gpiv
->pivpost
->button_vorstra
),
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
),
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
,
1295 gtk_handle_box_set_handle_position(GTK_HANDLE_BOX(gpiv
->handlebox_buf
),
1297 gtk_tooltips_set_tip(gpiv
->tooltips
,
1298 gpiv
->handlebox_buf
,
1299 _("buffer names and numbers"),
1303 gpiv
->alignment_buf
= gtk_alignment_new(0.0,
1307 gtk_widget_ref(gpiv
->alignment_buf
);
1308 gtk_object_set_data_full(GTK_OBJECT(gpiv
->console
),
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",
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
,
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
,
1353 gtk_widget_ref(gpiv
->viewport_buf
);
1354 gtk_object_set_data_full(GTK_OBJECT(gpiv
->console
),
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
,
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
),
1372 (GtkDestroyNotify
) gtk_widget_unref
);
1373 gtk_widget_show(gpiv
->clist_buf
);
1374 gtk_container_add(GTK_CONTAINER(gpiv
->viewport_buf
/* scrolledwindow_buf */ ),
1376 gtk_tooltips_set_tip(gpiv
->tooltips
, gpiv
->clist_buf
,
1379 gtk_clist_set_column_width(GTK_CLIST(gpiv
->clist_buf
),
1382 gtk_clist_set_column_width(GTK_CLIST(gpiv
->clist_buf
),
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
),
1392 gtk_signal_connect(GTK_OBJECT(gpiv
->clist_buf
),
1394 GTK_SIGNAL_FUNC(on_clist_buf_rowselect
),
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
),
1403 (GtkDestroyNotify
) gtk_widget_unref
);
1404 gtk_widget_show(gpiv
->label_buf_1
);
1405 gtk_clist_set_column_widget(GTK_CLIST(gpiv
->clist_buf
),
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
),
1415 (GtkDestroyNotify
) gtk_widget_unref
);
1416 gtk_widget_show(gpiv
->label_buf_2
);
1417 gtk_clist_set_column_widget(GTK_CLIST(gpiv
->clist_buf
),
1420 gtk_misc_set_alignment(GTK_MISC(gpiv
->label_buf_2
),
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
),
1433 gpiv
->scrolledwindow_buf_adj
=
1434 gtk_adjustment_new(0.0,
1439 250.0 /* 2500.0 */);
1440 gtk_scrolled_window_set_hadjustment(GTK_SCROLLED_WINDOW
1441 (gpiv
->scrolledwindow_buf
),
1443 (gpiv
->scrolledwindow_buf_adj
));
1446 gtk_drag_dest_set (/* GTK_CLIST */ GTK_WIDGET (gpiv
->clist_buf
),
1447 GTK_DEST_DEFAULT_ALL
,
1451 gtk_signal_connect (GTK_OBJECT (gpiv
->clist_buf
),
1452 "drag_data_received",
1453 GTK_SIGNAL_FUNC (on_clist_buf_drag_data_received
),
1457 * Application bar buttons
1459 gpiv
->appbar
= gnome_appbar_new(TRUE
,
1461 GNOME_PREFERENCES_ALWAYS
);
1462 gtk_widget_ref(gpiv
->appbar
);
1463 gtk_object_set_data_full(GTK_OBJECT(gpiv
->console
),
1466 (GtkDestroyNotify
) gtk_widget_unref
);
1467 gtk_widget_show(gpiv
->appbar
);
1468 gnome_app_set_statusbar(GNOME_APP(gpiv
->console
),
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
),
1484 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
1485 (settings_menu_gpiv
[0].widget
),
1490 if (gpiv_par
.view_tabulator
) {
1491 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
1492 (settings_menu_gpiv
[1].widget
),
1495 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
1496 (settings_menu_gpiv
[1].widget
),
1501 if (gpiv_par
.show_tooltips
) {
1502 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
1503 (help_menu_gpiv
[0].widget
),
1506 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
1507 (help_menu_gpiv
[0].widget
),
1512 gnome_app_install_menu_hints (GNOME_APP (gpiv
->console
),
1521 GtkWidget
*create_about(void)
1523 const gchar
*authors
[] = {
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."),
1538 gtk_object_set_data(GTK_OBJECT(about
),
1541 gtk_window_set_modal(GTK_WINDOW(about
), TRUE
);
1542 gtk_window_set_wmclass(GTK_WINDOW(about
),
1546 gtk_signal_connect(GTK_OBJECT(about
),
1548 GTK_SIGNAL_FUNC(gtk_widget_destroy
),
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
,
1569 gtk_object_set_data(GTK_OBJECT(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
),
1582 dialog_vbox1
= GNOME_DIALOG(exit
)->vbox
;
1583 gtk_object_set_data(GTK_OBJECT(exit
),
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",
1598 (GtkDestroyNotify
) gtk_widget_unref
);
1599 gtk_widget_show(exit_message_label
);
1600 gtk_box_pack_start(GTK_BOX(dialog_vbox1
),
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
),
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
);
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
),
1628 (GtkDestroyNotify
) gtk_widget_unref
);
1629 gtk_widget_show(button_yes
);
1630 GTK_WIDGET_SET_FLAGS(GTK_OBJECT(button_yes
),
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
),
1642 (GtkDestroyNotify
) gtk_widget_unref
);
1643 gtk_widget_show(button_no
);
1644 GTK_WIDGET_SET_FLAGS(GTK_OBJECT(button_no
),
1649 gtk_signal_connect(GTK_OBJECT(button_yes
),
1651 GTK_SIGNAL_FUNC(on_button_quit_gpiv_yes_clicked
),
1654 gtk_signal_connect(GTK_OBJECT(button_no
),
1656 GTK_SIGNAL_FUNC(on_button_quit_no_clicked
),
1665 *create_messagebox(gchar
* message
)
1667 GtkWidget
*messagebox
;
1668 GtkWidget
*dialog_vbox
;
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
,
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
),
1685 gtk_window_set_title(GTK_WINDOW(messagebox
),
1687 gtk_window_set_position(GTK_WINDOW(messagebox
),
1689 gtk_window_set_policy(GTK_WINDOW(messagebox
),
1696 dialog_vbox
= GNOME_DIALOG(messagebox
)->vbox
;
1697 gtk_object_set_data(GTK_OBJECT(messagebox
),
1700 gtk_widget_show(dialog_vbox
);
1704 gnome_dialog_append_button(GNOME_DIALOG(messagebox
),
1705 GNOME_STOCK_BUTTON_OK
);
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
),
1712 (GtkDestroyNotify
) gtk_widget_unref
);
1713 gtk_widget_show(button
);
1714 GTK_WIDGET_SET_FLAGS(GTK_OBJECT(button
),
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
),
1728 GTK_SIGNAL_FUNC(on_button_message_clicked
),
1739 GtkWidget
*create_errorbox(gchar
* message
)
1741 GtkWidget
*errorbox
;
1742 GtkWidget
*dialog_vbox
;
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
,
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
),
1759 gtk_window_set_title(GTK_WINDOW(errorbox
),
1761 gtk_window_set_policy(GTK_WINDOW(errorbox
),
1768 dialog_vbox
= GNOME_DIALOG(errorbox
)->vbox
;
1769 gtk_object_set_data(GTK_OBJECT(errorbox
),
1772 gtk_widget_show(dialog_vbox
);
1774 gnome_dialog_append_button(GNOME_DIALOG(errorbox
),
1775 GNOME_STOCK_BUTTON_CLOSE
);
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
),
1782 (GtkDestroyNotify
) gtk_widget_unref
);
1783 gtk_widget_show(button
);
1784 GTK_WIDGET_SET_FLAGS(GTK_OBJECT(button
),
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
),
1798 GTK_SIGNAL_FUNC(on_button_error_clicked
),
1807 close_buffer_yes_no (GpivConsole
* gpiv
,
1810 GtkWidget
*dialog
, *label
;
1813 dialog
= gnome_dialog_new (
1815 GNOME_STOCK_BUTTON_YES
,
1816 GNOME_STOCK_BUTTON_NO
,
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
),
1826 (GtkDestroyNotify
) gtk_widget_unref
);
1827 gtk_widget_show(label
);
1828 gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog
)->vbox
),
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
));