bugrepair: drag and drop
[gpiv.git] / src / display_interface.c
blob7df9b8b18f879c27f1681e7155e7eb1818bacda0
1 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 c-style: "K&R" -*- */
3 /*----------------------------------------------------------------------
5 gpiv - Graphic program for Particle Image Velocimetry, based on gtk/gnome
6 libraries.
8 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008
9 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 * interface for create_display
31 * $Log: display_interface.c,v $
32 * Revision 1.19 2008-04-28 12:00:57 gerber
33 * hdf-formatted files are now with .hdf extension (previously: .gpi)
35 * Revision 1.18 2007-12-19 08:42:35 gerber
36 * debugged
38 * Revision 1.17 2007-11-23 16:24:07 gerber
39 * release 0.5.0: Kafka
41 * Revision 1.16 2007-06-06 17:00:48 gerber
42 * Retreives images/data from URI using Gnome Virtual File System.
44 * Revision 1.15 2007-03-22 16:00:32 gerber
45 * Added image processing tabulator
47 * Revision 1.14 2007-02-16 17:09:48 gerber
48 * added Gauss weighting on I.A. and SPOF filtering (on correlation function)
50 * Revision 1.13 2007/02/05 15:17:09 gerber
51 * auto stretching, broadcast display settings to buffers from preferences
53 * Revision 1.12 2007-01-29 11:27:43 gerber
54 * added image formats png, gif, tif png, bmp, improved buffer display
56 * Revision 1.11 2006-09-18 07:27:05 gerber
57 * *** empty log message ***
59 * Revision 1.10 2006/01/31 14:28:12 gerber
60 * version 0.3.0
62 * Revision 1.9 2005/06/15 15:03:54 gerber
63 * Optional Anti Aliased canvas for viewer
65 * Revision 1.8 2005/06/15 09:40:40 gerber
66 * debugged, optimized
68 * Revision 1.7 2005/01/19 15:53:41 gerber
69 * Initiation of Data Acquisition (DAC); trigerring of lasers and camera
70 * by using RTAI and Realtime Linux, recording images from IEEE1394
71 * (Firewire) IIDC compliant camera's
73 * Revision 1.6 2004/10/15 19:24:05 gerber
74 * GPIV_ and Gpiv prefix to defines and structure names of libgpiv
76 * Revision 1.5 2004/06/14 21:19:23 gerber
77 * Image depth up to 16 bits.
78 * Improvement "single int" and "drag int" in Eval tab.
79 * Viewer's pop-up menu.
80 * Adaption for gpiv_matrix_* and gpiv_vector_*.
81 * Resizing console.
82 * See Changelog for further info.
84 * Revision 1.4 2003/09/01 11:17:14 gerber
85 * improved monitoring of interrogation process
87 * Revision 1.3 2003/07/04 10:47:01 gerber
88 * cleaning up
90 * Revision 1.2 2003/06/27 13:47:26 gerber
91 * display ruler, line/point evaluation
93 * Revision 1.1.1.1 2003/06/17 17:10:52 gerber
94 * Imported gpiv
98 #include "gpiv_gui.h"
99 #include "utils.h"
100 #include "display_interface.h"
101 #include "display_menus.h"
102 #include "display.h"
104 #define EVENT_METHOD(i, x) GTK_WIDGET_GET_CLASS(i)->x
107 Display *
108 create_display (gchar *fname,
109 GpivImage *image,
110 guint display_id,
111 GpivConsole *gpiv
113 /*-----------------------------------------------------------------------------
115 * Layout:
117 * main_vbox
119 * +-- menubar
121 * +-- vbox
123 * +-- table
124 * | |
125 * | +-- origin
126 * | +-- hruler
127 * | +-- vruler
128 * | +-- canvas
130 * +-- statusbar
133 -----------------------------------------------------------------------------*/
136 Display *disp = g_new0 (Display, 1);
137 Image *img = g_new0 (Image, 1);
138 Intreg *intreg = g_new0 (Intreg, 1);
139 GpivPivPar *intreg_pivp = g_new0 (GpivPivPar, 1);
140 PivData *pd = g_new0 (PivData, 1);
141 GpivValidPar *pd_valp = g_new0 (GpivValidPar, 1);
142 GpivPostPar *pd_postp = g_new0 (GpivPostPar, 1);
144 static gint width = 0, height = 0;
145 static gchar title[GPIV_MAX_CHARS];
146 static GdkPixbuf *icon = NULL;
149 gint i = 0;
151 static const gchar * zoom_label[8] = {
152 "Zoom 0.25",
153 "Zoom 0.5",
154 "Zoom 0.83",
155 "Zoom 1.0",
156 "Zoom 1.3",
157 "Zoom 1.6",
158 "Zoom 2.0",
159 "Zoom 4.0"
162 static const gchar * vector_scale_label[9] = {
163 "1",
164 "2",
165 "4",
166 "8",
167 "16",
168 "32",
169 "64",
170 "128",
171 "256"
177 disp->zoom_group = NULL;
178 disp->background_group = NULL;
179 disp->scalar_group = NULL;
180 disp->vector_scale_group = NULL;
181 disp->vector_color_group = NULL;
183 g_snprintf (title,
184 GPIV_MAX_CHARS,
185 "gpiv display #%d",
186 display_id);
188 g_snprintf (disp->msg_display_default,
189 GPIV_MAX_CHARS,
190 "%s",
191 fname);
193 disp->id = display_id;
194 disp->zoom_index = gpiv_par->display__zoom_index;
195 disp->zoom_factor = zfactor[disp->zoom_index];
196 disp->zoom_factor_old = zfactor[disp->zoom_index];
197 /* g_message ("CREATE_DISPLAY:: zoom_factor = %f zoom_factor_old = %f", */
198 /* disp->zoom_factor, disp->zoom_factor_old); */
199 disp->vector_scale = gpiv_par->display__vector_scale;
200 disp->vector_color = gpiv_par->display__vector_color;
201 disp->display_backgrnd = gpiv_par->display__backgrnd;
202 /* disp->display_img1 = gpiv_par->display__img1; */
203 /* disp->display_img2 = gpiv_par->display__img2; */
204 disp->display_intregs = gpiv_par->display__intregs;
205 disp->display_piv = gpiv_par->display__piv;
206 disp->display_scalar = gpiv_par->display__scalar;
207 /* disp->display_vor = gpiv_par->display__vor; */
208 /* disp->display_sstrain = gpiv_par->display__sstrain; */
209 /* disp->display_nstrain = gpiv_par->display__nstrain; */
211 disp->file_uri_name = g_strdup_printf ("%s" , fname);
214 disp->img = img;
215 disp->img->exist_img = FALSE;
216 disp->img->saved_img = FALSE;
217 disp->img->rgb_img_width = 0;
218 disp->img->img_mean = 0.0;
221 * PIV data and related do not exist, yet. 'Saved' is set TRUE to avoid
222 * message of unsaved data while deleting display or console
223 * Values of these boolean variables are updated in the 'exec_' functions.
225 disp->pida = pd;
226 disp->pida->exist_piv = FALSE;
227 disp->pida->saved_piv = TRUE;
228 disp->pida->scaled_piv = FALSE;
229 disp->pida->exist_histo = FALSE;
230 disp->pida->saved_histo = TRUE;
231 disp->pida->exist_valid = FALSE;
232 disp->pida->exist_vor = FALSE;
233 disp->pida->exist_vor_scaled = FALSE;
234 disp->pida->saved_vor = TRUE;
235 disp->pida->exist_sstrain = FALSE;
236 disp->pida->exist_sstrain_scaled = FALSE;
237 disp->pida->saved_sstrain = TRUE;
238 disp->pida->exist_nstrain = FALSE;
239 disp->pida->exist_nstrain_scaled = FALSE;
240 disp->pida->saved_nstrain = TRUE;
245 * Initialising of parameter values for image, evaluation and interrogation regions
247 disp->img->image = image;
248 /* disp->img->image->header = gpiv_img_cp_parameters (gl_image_par); */
249 disp->pida->piv_par = gpiv_piv_cp_parameters (gl_piv_par);
250 disp->pida->valid_par = pd_valp;
251 disp->pida->post_par = pd_postp;
254 if (disp->pida->piv_par->row_start > disp->img->image->header->nrows
255 - disp->pida->piv_par->pre_shift_row - 1) {
256 disp->pida->piv_par->row_start = 0;
258 disp->pida->piv_par->row_end =
259 MIN (disp->img->image->header->nrows, gl_piv_par->row_end);
260 if (disp->pida->piv_par->col_start > disp->img->image->header->ncolumns
261 - disp->pida->piv_par->pre_shift_col - 1) {
262 disp->pida->piv_par->col_start = 0;
264 disp->pida->piv_par->col_end =
265 MIN (disp->img->image->header->ncolumns, gl_piv_par->col_end);
268 * Copy _PART_ of piv_par to intreg for displaying Interrogation Area contours
270 disp->intreg = intreg;
271 disp->intreg->exist_int = FALSE;
272 disp->intreg->row_start_old = 0;
273 disp->intreg->col_start_old = 0;
275 disp->intreg->par = intreg_pivp;
276 disp->intreg->par->row_start = disp->pida->piv_par->row_start;
277 disp->intreg->par->row_end = disp->pida->piv_par->row_end;
278 disp->intreg->par->col_start = disp->pida->piv_par->col_start;
279 disp->intreg->par->col_end = disp->pida->piv_par->col_end;
280 disp->intreg->par->int_size_f = disp->pida->piv_par->int_size_f;
281 disp->intreg->par->int_size_i = disp->pida->piv_par->int_size_i;
282 disp->intreg->par->int_shift = disp->pida->piv_par->int_shift;
283 disp->intreg->par->pre_shift_row = disp->pida->piv_par->pre_shift_row;
284 disp->intreg->par->pre_shift_col = disp->pida->piv_par->pre_shift_col;
286 disp->intreg->par->row_start__set = TRUE;
287 disp->intreg->par->row_end__set = TRUE;
288 disp->intreg->par->col_start__set = TRUE;
289 disp->intreg->par->col_end__set = TRUE;
290 disp->intreg->par->int_size_f__set = TRUE;
291 disp->intreg->par->int_size_i__set = TRUE;
292 disp->intreg->par->int_shift__set = TRUE;
293 disp->intreg->par->pre_shift_row__set = TRUE;
294 disp->intreg->par->pre_shift_col__set = TRUE;
298 width = (gint) (disp->zoom_factor * disp->img->image->header->ncolumns + VIEW_HMARGE);
299 height = (gint) (disp->zoom_factor * disp->img->image->header->nrows + VIEW_VMARGE);
300 /* disp->mwin = g_object_new (GTK_TYPE_WINDOW, */
301 /* "default-height", height, */
302 /* "default-width", width, */
303 /* "title", title, */
304 /* NULL */
305 /* ); */
309 disp->mwin = gtk_window_new (GTK_WINDOW_TOPLEVEL);
310 gtk_window_set_title (GTK_WINDOW (disp->mwin), title);
311 /* gtk_window_set_default_size (GTK_WINDOW (disp->mwin), width, height); */
312 gtk_window_set_default_size (GTK_WINDOW (disp->mwin), 20, 20);
313 gtk_object_set_data (GTK_OBJECT (disp->mwin),
314 "disp",
315 disp);
316 gtk_object_set_data (GTK_OBJECT (disp->mwin),
317 "gpiv",
318 gpiv);
321 * DESTROING ITEM
323 g_signal_connect (GTK_OBJECT (disp->mwin),
324 "delete_event" ,
325 G_CALLBACK (delete_display),
326 NULL);
329 * focussing the actual display
331 g_signal_connect (GTK_OBJECT (disp->mwin),
332 "focus_in_event",
333 G_CALLBACK (on_display_set_focus),
334 NULL);
335 gtk_window_set_resizable (GTK_WINDOW (disp->mwin), FALSE);
338 * icon setting
340 icon = gdk_pixbuf_new_from_file(PIXMAPSDIR "gpiv_logo.png", NULL);
341 gtk_window_set_icon(GTK_WINDOW(disp->mwin), icon);
344 disp->vbox = gtk_vbox_new ( FALSE /* TRUE */, 0);
345 gtk_widget_show (disp->vbox);
346 gtk_container_add (GTK_CONTAINER (disp->mwin), disp->vbox);
349 * Menu bar
351 disp->menubar = gtk_menu_bar_new ();
352 gtk_box_pack_start (GTK_BOX (disp->vbox),
353 disp->menubar,
354 FALSE,
355 FALSE,
357 if (gpiv_par->display__view_menubar) {
358 gtk_widget_show (GTK_WIDGET (disp->menubar));
359 } else {
360 gtk_widget_hide (GTK_WIDGET (disp->menubar));
365 * View menu
367 disp->menuitem_view =
368 gtk_menu_item_new_with_mnemonic (_("_View"));
369 gtk_widget_show (disp->menuitem_view);
370 gtk_container_add (GTK_CONTAINER (disp->menubar),
371 disp->menuitem_view);
372 /* NEW */
373 /* gtk_object_set_data_full (GTK_OBJECT (disp->mwin), */
374 /* "menuitem_view", */
375 /* disp->menuitem_view, */
376 /* (GtkDestroyNotify) gtk_widget_unref); */
379 disp->menuitem_view_menu = gtk_menu_new ();
380 gtk_menu_item_set_submenu (GTK_MENU_ITEM
381 (disp->menuitem_view),
382 disp->menuitem_view_menu);
386 disp->view_menubar =
387 gtk_check_menu_item_new_with_mnemonic (_("View menu bar"));
388 gtk_widget_show (disp->view_menubar);
389 gtk_container_add (GTK_CONTAINER (disp->menuitem_view_menu),
390 disp->view_menubar);
391 g_signal_connect ((gpointer) disp->view_menubar, "activate",
392 G_CALLBACK (on_menu_synchronize_popup),
393 (int *) VIEW_MENUBAR);
397 disp->view_rulers =
398 gtk_check_menu_item_new_with_mnemonic (_("View rulers"));
399 gtk_widget_show (disp->view_rulers);
400 gtk_container_add (GTK_CONTAINER (disp->menuitem_view_menu),
401 disp->view_rulers);
402 g_signal_connect ((gpointer) disp->view_rulers, "activate",
403 G_CALLBACK (on_menu_synchronize_popup),
404 (int *) VIEW_RULERS);
407 * Menu for automatic stretching the window when zooming in
409 disp->stretch_auto =
410 gtk_check_menu_item_new_with_mnemonic (_("Stretch auto"));
411 gtk_widget_show (disp->stretch_auto);
412 gtk_container_add (GTK_CONTAINER (disp->menuitem_view_menu),
413 disp->stretch_auto);
414 g_signal_connect ((gpointer) disp->stretch_auto, "activate",
415 G_CALLBACK (on_menu_synchronize_popup),
416 (int *) STRETCH_AUTO);
419 * Menu for stretching the window
421 disp->stretch =
422 gtk_menu_item_new_with_label (_("Stretch display"));
423 gtk_widget_show (disp->stretch);
424 gtk_container_add (GTK_CONTAINER (disp->menuitem_view_menu),
425 disp->stretch);
426 gtk_tooltips_set_tip (gpiv->tooltips,
427 disp->stretch,
428 _("Stretch or fit display window to the image area"),
429 NULL);
430 g_signal_connect ((gpointer) disp->stretch,
431 "activate",
432 G_CALLBACK (on_stretch_activate),
433 NULL);
436 * Separator
438 disp->separator_zoom = gtk_separator_menu_item_new ();
439 gtk_widget_show (disp->separator_zoom);
440 gtk_container_add (GTK_CONTAINER (disp->menuitem_view_menu),
441 disp->separator_zoom);
444 * Zoom menus
446 for (i = 0; i < 8; i++) {
447 /* gchar *zoom_index = g_strdup_printf ("zoom_%d", i) */
448 disp->zoom_key[i] = g_strdup_printf ("zoom_menu_%d", i);
449 disp->zoom_menu[i] = gtk_radio_menu_item_new_with_label
450 (disp->zoom_group, zoom_label[i]);
451 disp->zoom_group = gtk_radio_menu_item_get_group
452 (GTK_RADIO_MENU_ITEM (disp->zoom_menu[i]));
453 gtk_widget_show (disp->zoom_menu[i]);
454 gtk_container_add (GTK_CONTAINER (disp->menuitem_view_menu),
455 disp->zoom_menu[i]);
456 gtk_tooltips_set_tip (gpiv->tooltips,
457 disp->zoom_menu[i],
458 _("set zoom factor"),
459 NULL);
460 gtk_object_set_data (GTK_OBJECT (disp->mwin),
461 disp->zoom_key[i],
462 disp->zoom_menu[i]);
463 g_signal_connect ((gpointer) disp->zoom_menu[i],
464 "activate",
465 G_CALLBACK (on_zoom_activate),
466 (int *) i);
469 /* if (disp->zoom_index == i) { */
470 /* gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM */
471 /* (disp->zoom_menu[i]), */
472 /* TRUE); */
473 /* } */
478 * Background (image) menu
480 disp->menuitem_background =
481 gtk_menu_item_new_with_mnemonic (_("_Background"));
482 gtk_widget_show (disp->menuitem_background);
483 gtk_container_add (GTK_CONTAINER (disp->menubar),
484 disp->menuitem_background);
487 disp->menuitem_background_menu = gtk_menu_new ();
488 gtk_menu_item_set_submenu (GTK_MENU_ITEM
489 (disp->menuitem_background),
490 disp->menuitem_background_menu);
494 disp->view_blue = gtk_radio_menu_item_new_with_mnemonic
495 (disp->background_group, _("Blue"));
496 disp->background_group = gtk_radio_menu_item_get_group
497 (GTK_RADIO_MENU_ITEM (disp->view_blue));
498 gtk_widget_show (disp->view_blue);
499 gtk_container_add (GTK_CONTAINER (disp->menuitem_background_menu),
500 disp->view_blue);
501 gtk_tooltips_set_tip (gpiv->tooltips,
502 disp->view_blue,
503 _("set blue background"),
504 NULL);
505 gtk_object_set_data (GTK_OBJECT (disp->mwin),
506 "blue_background_menu",
507 disp->view_blue);
508 g_signal_connect ((gpointer) disp->view_blue, "activate",
509 G_CALLBACK (on_menu_synchronize_popup),
510 (int *) VIEW_BLUE);
514 disp->view_black = gtk_radio_menu_item_new_with_mnemonic
515 (disp->background_group, _("Black"));
516 disp->background_group = gtk_radio_menu_item_get_group
517 (GTK_RADIO_MENU_ITEM (disp->view_black));
518 gtk_widget_show (disp->view_black);
519 gtk_container_add (GTK_CONTAINER (disp->menuitem_background_menu),
520 disp->view_black);
521 gtk_tooltips_set_tip (gpiv->tooltips,
522 disp->view_black,
523 _("set black background"),
524 NULL);
525 gtk_object_set_data (GTK_OBJECT (disp->mwin),
526 "black_background_menu",
527 disp->view_black);
528 g_signal_connect ((gpointer) disp->view_black, "activate",
529 G_CALLBACK (on_menu_synchronize_popup),
530 (int *) VIEW_BLACK);
534 disp->view_image_a = gtk_radio_menu_item_new_with_mnemonic
535 (disp->background_group, _("Image_A"));
536 disp->background_group = gtk_radio_menu_item_get_group
537 (GTK_RADIO_MENU_ITEM (disp->view_image_a));
538 gtk_widget_show (disp->view_image_a);
539 gtk_container_add (GTK_CONTAINER (disp->menuitem_background_menu),
540 disp->view_image_a);
541 gtk_tooltips_set_tip (gpiv->tooltips,
542 disp->view_image_a,
543 _("set first image as background"),
544 NULL);
545 gtk_object_set_data (GTK_OBJECT (disp->mwin),
546 "image_a_background_menu",
547 disp->view_image_a);
548 g_signal_connect ((gpointer) disp->view_image_a, "activate",
549 G_CALLBACK (on_menu_synchronize_popup),
550 (int *) VIEW_IMAGE_A);
554 disp->view_image_b = gtk_radio_menu_item_new_with_mnemonic
555 (disp->background_group, ("Image_B"));
556 disp->background_group = gtk_radio_menu_item_get_group
557 (GTK_RADIO_MENU_ITEM (disp->view_image_b));
558 gtk_widget_show (disp->view_image_b);
559 gtk_container_add (GTK_CONTAINER (disp->menuitem_background_menu),
560 disp->view_image_b);
561 gtk_tooltips_set_tip (gpiv->tooltips,
562 disp->view_image_b,
563 _("set second image as background"),
564 NULL);
565 gtk_object_set_data (GTK_OBJECT (disp->mwin),
566 "image_b_background_menu",
567 disp->view_image_b);
568 g_signal_connect ((gpointer) disp->view_image_b, "activate",
569 G_CALLBACK (on_menu_synchronize_popup),
570 (int *) VIEW_IMAGE_B);
574 * Piv display menu
576 disp->menuitem_view_piv_data =
577 gtk_menu_item_new_with_mnemonic (_("_Piv"));
578 gtk_widget_show (disp->menuitem_view_piv_data);
579 gtk_container_add (GTK_CONTAINER (disp->menubar),
580 disp->menuitem_view_piv_data);
583 disp->menuitem_view_piv_data_menu = gtk_menu_new ();
584 gtk_menu_item_set_submenu (GTK_MENU_ITEM (disp->menuitem_view_piv_data),
585 disp->menuitem_view_piv_data_menu);
588 disp->view_interrogation_areas =
589 gtk_check_menu_item_new_with_mnemonic (_("Interrogation area's"));
590 gtk_widget_show (disp->view_interrogation_areas);
591 gtk_container_add (GTK_CONTAINER (disp->menuitem_view_piv_data_menu),
592 disp->view_interrogation_areas);
593 g_signal_connect ((gpointer) disp->view_interrogation_areas, "activate",
594 G_CALLBACK (on_menu_synchronize_popup),
595 (int *) VIEW_INTERROGATION_AREAS);
598 disp->view_velocity_vectors =
599 gtk_check_menu_item_new_with_mnemonic (_("Velocity vectors"));
600 gtk_widget_show (disp->view_velocity_vectors);
601 gtk_container_add (GTK_CONTAINER (disp->menuitem_view_piv_data_menu),
602 disp->view_velocity_vectors);
603 g_signal_connect ((gpointer) disp->view_velocity_vectors, "activate",
604 G_CALLBACK (on_menu_synchronize_popup),
605 (int *) VIEW_VELOCITY_VECTORS);
608 * Scalar data display menu
611 disp->menuitem_view_scalar_data =
612 gtk_menu_item_new_with_mnemonic (_("_Scalar"));
613 gtk_widget_show (disp->menuitem_view_scalar_data);
614 gtk_container_add (GTK_CONTAINER (disp->menubar), disp->menuitem_view_scalar_data);
616 disp->menuitem_view_scalar_data_menu = gtk_menu_new ();
617 gtk_menu_item_set_submenu (GTK_MENU_ITEM (disp->menuitem_view_scalar_data),
618 disp->menuitem_view_scalar_data_menu);
622 disp->view_none =
623 gtk_radio_menu_item_new_with_mnemonic (disp->scalar_group, _("None"));
624 disp->scalar_group =
625 gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (disp->view_none));
626 gtk_widget_show (disp->view_none);
627 gtk_container_add (GTK_CONTAINER (disp->menuitem_view_scalar_data_menu),
628 disp->view_none);
629 gtk_object_set_data (GTK_OBJECT (disp->mwin),
630 "view_none_scalars",
631 disp->view_none);
632 g_signal_connect ((gpointer) disp->view_none, "activate",
633 G_CALLBACK (on_menu_synchronize_popup),
634 (int *) VIEW_NONE_SCALARS);
637 disp->view_vorticity =
638 gtk_radio_menu_item_new_with_mnemonic (disp->scalar_group,
639 _("Vorticity"));
640 disp->scalar_group =
641 gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (disp->view_vorticity));
642 gtk_widget_show (disp->view_vorticity);
643 gtk_container_add (GTK_CONTAINER (disp->menuitem_view_scalar_data_menu),
644 disp->view_vorticity);
645 gtk_object_set_data (GTK_OBJECT (disp->mwin),
646 "view_vorticity",
647 disp->view_vorticity);
648 g_signal_connect ((gpointer) disp->view_vorticity, "activate",
649 G_CALLBACK (on_menu_synchronize_popup),
650 (int *) VIEW_VORTICITY);
653 disp->view_shear_strain =
654 gtk_radio_menu_item_new_with_mnemonic (disp->scalar_group, _("Shear strain"));
655 disp->scalar_group =
656 gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (disp->view_shear_strain));
657 gtk_widget_show (disp->view_shear_strain);
658 gtk_container_add (GTK_CONTAINER (disp->menuitem_view_scalar_data_menu),
659 disp->view_shear_strain);
660 gtk_object_set_data (GTK_OBJECT (disp->mwin),
661 "view_shear_strain",
662 disp->view_shear_strain);
663 g_signal_connect ((gpointer) disp->view_shear_strain, "activate",
664 G_CALLBACK (on_menu_synchronize_popup),
665 (int *) VIEW_SHEAR_STRAIN);
668 disp->view_normal_strain =
669 gtk_radio_menu_item_new_with_mnemonic (disp->scalar_group,
670 _("Normal strain"));
671 disp->scalar_group =
672 gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (disp->view_normal_strain));
673 gtk_widget_show (disp->view_normal_strain);
674 gtk_container_add (GTK_CONTAINER (disp->menuitem_view_scalar_data_menu),
675 disp->view_normal_strain);
676 gtk_object_set_data (GTK_OBJECT (disp->mwin),
677 "view_normal_strain",
678 disp->view_normal_strain);
679 g_signal_connect ((gpointer) disp->view_normal_strain, "activate",
680 G_CALLBACK (on_menu_synchronize_popup),
681 (int *) VIEW_NORMAL_STRAIN);
684 * Vector scale menu
686 disp->menuitem_vector_scale =
687 gtk_menu_item_new_with_mnemonic (_("Scal_e"));
688 gtk_widget_show (disp->menuitem_vector_scale);
689 gtk_container_add (GTK_CONTAINER (disp->menubar),
690 disp->menuitem_vector_scale);
692 disp->menuitem_vector_scale_menu = gtk_menu_new ();
693 gtk_menu_item_set_submenu (GTK_MENU_ITEM (disp->menuitem_vector_scale),
694 disp->menuitem_vector_scale_menu);
697 for (i = 0; i < 9; i++) {
698 disp->vector_scale_key[i] = g_strdup_printf ("vector_scale_menu_%d", i);
700 disp->vector_scale_menu[i] = gtk_radio_menu_item_new_with_label
701 (disp->vector_scale_group, vector_scale_label[i]);
703 disp->vector_scale_group = gtk_radio_menu_item_get_group
704 (GTK_RADIO_MENU_ITEM (disp->vector_scale_menu[i]));
706 gtk_widget_show (disp->vector_scale_menu[i]);
708 gtk_container_add (GTK_CONTAINER (disp->menuitem_vector_scale_menu),
709 disp->vector_scale_menu[i]);
710 gtk_tooltips_set_tip (gpiv->tooltips,
711 disp->vector_scale_menu[i],
712 _("set vector_scale"),
713 NULL);
714 gtk_object_set_data (GTK_OBJECT (disp->mwin),
715 disp->vector_scale_key[i],
716 disp->vector_scale_menu[i]);
717 g_signal_connect ((gpointer) disp->vector_scale_menu[i],
718 "activate",
719 G_CALLBACK (on_vector_scale_activate),
720 (int *) i);
724 * Vector color menu
726 disp->menuitem_vector_color =
727 gtk_menu_item_new_with_mnemonic (_("C_olor"));
728 gtk_widget_show (disp->menuitem_vector_color);
729 gtk_container_add (GTK_CONTAINER (disp->menubar),
730 disp->menuitem_vector_color);
732 disp->menuitem_vector_color_menu = gtk_menu_new ();
733 gtk_menu_item_set_submenu (GTK_MENU_ITEM (disp->menuitem_vector_color),
734 disp->menuitem_vector_color_menu);
737 disp->vector_color_peak_nr =
738 gtk_radio_menu_item_new_with_mnemonic (disp->vector_color_group,
739 ("Peak nr"));
740 disp->vector_color_group =
741 gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM
742 (disp->vector_color_peak_nr));
743 gtk_widget_show (disp->vector_color_peak_nr);
744 gtk_container_add (GTK_CONTAINER (disp->menuitem_vector_color_menu),
745 disp->vector_color_peak_nr);
746 gtk_object_set_data (GTK_OBJECT (disp->mwin),
747 "vector_color_peak_nr",
748 disp->vector_color_peak_nr);
749 g_signal_connect ((gpointer) disp->vector_color_peak_nr, "activate",
750 G_CALLBACK (on_menu_synchronize_popup),
751 (int *) VECTOR_COLOR_PEAK);
754 disp->vector_color_snr =
755 gtk_radio_menu_item_new_with_mnemonic (disp->vector_color_group,
756 ("Snr"));
757 /* disp->vector_color_snr = */
758 /* gtk_radio_menu_item_new_with_mnemonic (disp->vector_color_group, */
759 /* ("SNR")); */
760 disp->vector_color_group =
761 gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM
762 (disp->vector_color_snr));
763 gtk_widget_show (disp->vector_color_snr);
764 gtk_container_add (GTK_CONTAINER (disp->menuitem_vector_color_menu),
765 disp->vector_color_snr);
766 gtk_object_set_data (GTK_OBJECT (disp->mwin),
767 "vector_color_snr",
768 disp->vector_color_snr);
769 g_signal_connect ((gpointer) disp->vector_color_snr, "activate",
770 G_CALLBACK (on_menu_synchronize_popup),
771 (int *) VECTOR_COLOR_SNR);
774 disp->vector_color_magngray =
775 gtk_radio_menu_item_new_with_mnemonic (disp->vector_color_group,
776 ("Magnitude gray"));
777 disp->vector_color_group =
778 gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM
779 (disp->vector_color_magngray));
780 gtk_widget_show (disp->vector_color_magngray);
781 gtk_container_add (GTK_CONTAINER (disp->menuitem_vector_color_menu),
782 disp->vector_color_magngray);
783 gtk_object_set_data (GTK_OBJECT (disp->mwin),
784 "vector_color_magngray",
785 disp->vector_color_magngray);
786 g_signal_connect ((gpointer) disp->vector_color_magngray, "activate",
787 G_CALLBACK (on_menu_synchronize_popup),
788 (int *) VECTOR_COLOR_MAGNGRAY);
792 disp->vector_color_magncolor =
793 gtk_radio_menu_item_new_with_mnemonic (disp->vector_color_group,
794 ("Magnitude color"));
795 disp->vector_color_group =
796 gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM
797 (disp->vector_color_magncolor));
798 gtk_widget_show (disp->vector_color_magncolor);
799 gtk_container_add (GTK_CONTAINER (disp->menuitem_vector_color_menu),
800 disp->vector_color_magncolor);
801 gtk_object_set_data (GTK_OBJECT (disp->mwin),
802 "vector_color_magncolor",
803 disp->vector_color_magncolor);
804 g_signal_connect ((gpointer) disp->vector_color_magncolor, "activate",
805 G_CALLBACK (on_menu_synchronize_popup),
806 (int *) VECTOR_COLOR_MAGNCOLOR);
809 * table
811 disp->table = gtk_table_new (4,
813 FALSE);
814 gtk_widget_ref (disp->table);
815 gtk_object_set_data_full (GTK_OBJECT (disp->mwin),
816 "table",
817 disp->table,
818 (GtkDestroyNotify) gtk_widget_unref);
819 gtk_box_pack_start (GTK_BOX (disp->vbox),
820 disp->table,
821 TRUE,
822 TRUE,
824 gtk_widget_show (disp->table);
828 * Adjustments for scrollbars or scrolled window
830 disp->hadj =
831 gtk_adjustment_new (0.0,
832 0.0,
833 (gdouble) disp->img->image->header->ncolumns - 1.0,
834 1.0,
835 1.0,
836 (gdouble) disp->img->image->header->ncolumns - 1.0
837 /* * disp->zoom_factor */
839 gtk_object_set_data (GTK_OBJECT (disp->hadj),
840 "var_type",
841 "0");
842 gtk_object_set_data (GTK_OBJECT (disp->hadj),
843 "disp",
844 disp);
845 g_signal_connect (GTK_OBJECT (disp->hadj),
846 "value_changed",
847 G_CALLBACK
848 (on_adj_changed),
849 NULL);
853 disp->vadj =
854 gtk_adjustment_new (0.0,
855 0.0,
856 (gdouble) disp->img->image->header->nrows - 1.0,
857 1.0,
858 1.0,
859 (gfloat) disp->img->image->header->nrows - 1.0
860 /* * disp->zoom_factor */
863 gtk_object_set_data (GTK_OBJECT (disp->vadj),
864 "var_type",
865 "1");
866 gtk_object_set_data (GTK_OBJECT (disp->vadj),
867 "disp",
868 disp);
869 g_signal_connect (GTK_OBJECT (disp->vadj),
870 "value_changed",
871 G_CALLBACK
872 (on_adj_changed),
873 NULL);
877 * horizontal ruler
879 disp->hruler = gtk_hruler_new();
880 gtk_widget_ref(disp->hruler);
881 gtk_object_set_data_full(GTK_OBJECT(disp->mwin),
882 "hruler",
883 disp->hruler,
884 (GtkDestroyNotify) gtk_widget_unref);
886 gtk_table_attach (GTK_TABLE (disp->table),
887 disp->hruler,
892 (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL),
893 (GtkAttachOptions) (GTK_FILL),
896 if (gpiv_par->display__view_rulers) {
897 gtk_widget_show (GTK_WIDGET (disp->hruler));
898 } else {
899 gtk_widget_hide (GTK_WIDGET (disp->hruler));
903 gtk_ruler_set_range (GTK_RULER (disp->hruler),
904 0.0,
905 (gfloat) (disp->img->image->header->ncolumns - 1),
906 0.0,
907 (gfloat) (disp->img->image->header->ncolumns - 1));
908 /* gtk_widget_set_size_request (disp->hruler, */
909 /* (gint) (disp->zoom_factor * */
910 /* disp->img.image_par->ncolumns), */
911 /* RULER_WIDTH); */
914 * vertical ruler
916 disp->vruler = gtk_vruler_new ();
917 gtk_widget_ref (disp->vruler);
918 gtk_object_set_data_full (GTK_OBJECT (disp->mwin),
919 "vruler",
920 disp->vruler,
921 (GtkDestroyNotify) gtk_widget_unref);
922 if (gpiv_par->display__view_rulers) {
923 gtk_widget_show (GTK_WIDGET (disp->vruler));
924 } else {
925 gtk_widget_hide (GTK_WIDGET (disp->vruler));
927 gtk_table_attach (GTK_TABLE (disp->table),
928 disp->vruler,
933 (GtkAttachOptions) (GTK_EXPAND ),
934 (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL),
938 gtk_ruler_set_range (GTK_RULER (disp->vruler),
939 0.0,
940 (gfloat) (disp->img->image->header->nrows - 1),
941 0.0,
942 (gfloat) (disp->img->image->header->nrows - 1));
943 /* gtk_widget_set_size_request (disp->vruler, */
944 /* RULER_WIDTH, */
945 /* (gint) (disp->zoom_factor * */
946 /* disp->img.image_par->nrows)); */
948 * Scrollbars
951 disp->vscrollbar =
952 gtk_vscrollbar_new( GTK_ADJUSTMENT (disp->vadj));
953 gtk_widget_ref (disp->vscrollbar);
954 gtk_object_set_data_full (GTK_OBJECT (disp->mwin),
955 "vscrollbar",
956 disp->vscrollbar,
957 (GtkDestroyNotify) gtk_widget_unref);
958 gtk_widget_show (disp->vscrollbar);
959 gtk_table_attach (GTK_TABLE (disp->table),
960 disp->vscrollbar,
961 2 /* 1 */,
965 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
966 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
970 /* gtk_viewport_get_vadjustment (viewport) */
972 disp->hscrollbar =
973 gtk_hscrollbar_new (GTK_ADJUSTMENT (disp->hadj));
974 gtk_widget_ref (disp->hscrollbar);
975 gtk_object_set_data_full (GTK_OBJECT (disp->mwin),
976 "hscrollbar",
977 disp->hscrollbar,
978 (GtkDestroyNotify) gtk_widget_unref);
979 gtk_widget_show (disp->hscrollbar);
980 gtk_table_attach (GTK_TABLE (disp->table),
981 disp->hscrollbar,
986 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
987 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
992 * gnome canvas
994 #ifdef CANVAS_AA
995 gtk_widget_push_visual (gdk_rgb_get_visual ());
996 gtk_widget_push_colormap (gdk_rgb_get_cmap ());
997 disp->canvas = gnome_canvas_new_aa ();
998 #else
999 gtk_widget_push_visual (gdk_imlib_get_visual ());
1000 gtk_widget_push_colormap (NULL);
1001 disp->canvas = gnome_canvas_new ();
1002 #endif
1004 gtk_widget_pop_colormap ();
1005 gtk_widget_pop_visual ();
1006 gtk_widget_ref (disp->canvas);
1007 gtk_object_set_data_full (GTK_OBJECT (disp->mwin),
1008 "canvas",
1009 disp->canvas,
1010 (GtkDestroyNotify) gtk_widget_unref);
1011 gtk_widget_show (disp->canvas);
1012 gnome_canvas_set_scroll_region (GNOME_CANVAS (disp->canvas),
1015 disp->img->image->header->ncolumns - 1,
1016 disp->img->image->header->nrows - 1);
1018 gtk_table_attach (GTK_TABLE (disp->table),
1019 disp->canvas,
1024 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1025 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1031 gtk_widget_set_events (GTK_WIDGET (disp->canvas),
1032 GDK_LEAVE_NOTIFY_MASK
1033 | GDK_BUTTON_PRESS_MASK
1034 | GDK_BUTTON_RELEASE_MASK
1035 | GDK_POINTER_MOTION_MASK
1036 | GDK_POINTER_MOTION_HINT_MASK
1037 | GDK_SHIFT_MASK
1038 | GDK_SCROLL_MASK
1041 gtk_object_set_data (GTK_OBJECT (disp->canvas),
1042 "disp",
1043 disp);
1044 gtk_object_set_data (GTK_OBJECT (disp->canvas),
1045 "gpiv",
1046 gpiv);
1050 * connect rulers to gnome_canvas drawing area
1052 g_signal_connect_swapped (G_OBJECT (disp->canvas),
1053 "motion_notify_event",
1054 G_CALLBACK (EVENT_METHOD (disp->hruler, motion_notify_event)),
1055 G_OBJECT (disp->hruler));
1057 g_signal_connect_swapped (G_OBJECT (disp->canvas),
1058 "motion_notify_event",
1059 G_CALLBACK (GTK_WIDGET_GET_CLASS (disp->vruler)->motion_notify_event),
1060 G_OBJECT (disp->vruler));
1063 g_signal_connect (G_OBJECT (disp->canvas),
1064 "enter_notify_event",
1065 G_CALLBACK (canvas_display_enter_notify),
1066 NULL);
1067 g_signal_connect (G_OBJECT (disp->canvas),
1068 "motion_notify_event",
1069 G_CALLBACK (canvas_display_motion_notify),
1070 NULL);
1071 g_signal_connect (G_OBJECT (disp->canvas),
1072 "button_press_event",
1073 G_CALLBACK (canvas_display_button_press),
1074 NULL);
1075 g_signal_connect (G_OBJECT (disp->canvas),
1076 "button_release_event",
1077 G_CALLBACK (canvas_display_button_release),
1078 NULL);
1079 g_signal_connect (G_OBJECT (disp->canvas),
1080 "leave_notify_event",
1081 G_CALLBACK (canvas_display_leave_notify),
1082 NULL);
1083 g_signal_connect (G_OBJECT (disp->canvas),
1084 "scroll_event",
1085 G_CALLBACK (canvas_display_button_scroll),
1086 NULL);
1090 * application/status bar
1092 disp->appbar = gnome_appbar_new (FALSE,
1093 TRUE,
1094 GNOME_PREFERENCES_NEVER);
1095 gtk_widget_ref (disp->appbar);
1096 gtk_object_set_data_full (GTK_OBJECT (disp->mwin),
1097 "appbar",
1098 disp->appbar,
1099 (GtkDestroyNotify) gtk_widget_unref);
1100 gtk_table_attach (GTK_TABLE (disp->table),
1101 disp->appbar,
1106 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1107 (GtkAttachOptions) (GTK_FILL),
1110 gtk_widget_show (disp->appbar);
1111 gnome_appbar_set_default (GNOME_APPBAR (disp->appbar),
1112 disp->msg_display_default);
1116 gtk_widget_show (disp->mwin);
1117 return disp;
1122 GtkWidget *
1123 create_display_popupmenu (Display *disp
1125 /*-----------------------------------------------------------------------------
1128 GtkWidget *display_menu = NULL;
1131 display_menu = gtk_menu_new ();
1132 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1133 "display_menu",
1134 display_menu);
1135 gnome_app_fill_menu (GTK_MENU_SHELL (display_menu),
1136 display_menu_uiinfo,
1137 NULL,
1138 FALSE,
1143 * view menubar widget
1145 gtk_widget_ref (display_menu_uiinfo[0].widget);
1146 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1147 "view_menubar_popup_menu",
1148 display_menu_uiinfo[0].widget,
1149 (GtkDestroyNotify) gtk_widget_unref);
1150 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1151 "view_menubar_popup_menu",
1152 display_menu_uiinfo[0].widget);
1153 if (gpiv_par->display__view_menubar) {
1154 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1155 (display_menu_uiinfo[0].widget),
1156 TRUE);
1157 } else {
1158 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1159 (display_menu_uiinfo[0].widget),
1160 FALSE);
1162 gtk_object_set_data (GTK_OBJECT (display_menu_uiinfo[0].widget),
1163 "disp",
1164 disp);
1168 * view rulers widget
1170 gtk_widget_ref (display_menu_uiinfo[1].widget);
1171 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1172 "view_rulers_popup_menu",
1173 display_menu_uiinfo[1].widget,
1174 (GtkDestroyNotify) gtk_widget_unref);
1175 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1176 "view_rulers_popup_menu",
1177 display_menu_uiinfo[1].widget);
1178 if (gpiv_par->display__view_rulers) {
1179 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1180 (display_menu_uiinfo[1].widget),
1181 TRUE);
1182 } else {
1183 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1184 (display_menu_uiinfo[1].widget),
1185 FALSE);
1187 gtk_object_set_data (GTK_OBJECT (display_menu_uiinfo[1].widget),
1188 "disp",
1189 disp);
1193 * stretch when zoom automatic
1195 gtk_widget_ref (display_menu_uiinfo[2].widget);
1196 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1197 "stretch_auto_popup_menu",
1198 display_menu_uiinfo[2].widget,
1199 (GtkDestroyNotify) gtk_widget_unref);
1200 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1201 "stretch_auto_popup_menu",
1202 display_menu_uiinfo[2].widget);
1203 if (gpiv_par->display__stretch_auto) {
1204 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1205 (display_menu_uiinfo[2].widget),
1206 TRUE);
1207 } else {
1208 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1209 (display_menu_uiinfo[2].widget),
1210 FALSE);
1212 gtk_object_set_data (GTK_OBJECT (display_menu_uiinfo[2].widget),
1213 "disp",
1214 disp);
1218 * zoom menu widgets
1220 gtk_widget_ref (zoomscale_menu_display[0].widget);
1221 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1222 "zmv_0",
1223 zoomscale_menu_display[0].widget,
1224 (GtkDestroyNotify) gtk_widget_unref);
1225 if (disp->zoom_index == ZOOM_0) {
1226 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1227 (zoomscale_menu_display[0].widget),
1228 TRUE);
1230 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1231 "zmv_0",
1232 zoomscale_menu_display[0].widget);
1233 gtk_object_set_data (GTK_OBJECT (zoomscale_menu_display[0].widget),
1234 "disp",
1235 disp);
1236 gtk_object_set_data (GTK_OBJECT (zoomscale_menu_display[0].widget),
1237 "zoom_index",
1238 (int *) ZOOM_0);
1242 gtk_widget_ref (zoomscale_menu_display[1].widget);
1243 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1244 "zmv_1",
1245 zoomscale_menu_display[1].widget,
1246 (GtkDestroyNotify) gtk_widget_unref);
1247 if (disp->zoom_index == ZOOM_1) {
1248 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1249 (zoomscale_menu_display[1].widget),
1250 TRUE);
1252 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1253 "zmv_1",
1254 zoomscale_menu_display[1].widget);
1255 gtk_object_set_data (GTK_OBJECT (zoomscale_menu_display[1].widget),
1256 "disp",
1257 disp);
1258 gtk_object_set_data (GTK_OBJECT (zoomscale_menu_display[1].widget),
1259 "zoom_index",
1260 (int *) ZOOM_1);
1264 gtk_widget_ref (zoomscale_menu_display[2].widget);
1265 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1266 "zmv_2",
1267 zoomscale_menu_display[2].widget,
1268 (GtkDestroyNotify) gtk_widget_unref);
1269 if (disp->zoom_index == ZOOM_2) {
1270 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1271 (zoomscale_menu_display[2].widget),
1272 TRUE);
1274 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1275 "zmv_2",
1276 zoomscale_menu_display[2].widget);
1277 gtk_object_set_data (GTK_OBJECT (zoomscale_menu_display[2].widget),
1278 "disp",
1279 disp);
1280 gtk_object_set_data (GTK_OBJECT (zoomscale_menu_display[2].widget),
1281 "zoom_index",
1282 (int *) ZOOM_2);
1286 gtk_widget_ref (zoomscale_menu_display[3].widget);
1287 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1288 "zmv_3",
1289 zoomscale_menu_display[3].widget,
1290 (GtkDestroyNotify) gtk_widget_unref);
1291 if (disp->zoom_index == ZOOM_3) {
1292 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1293 (zoomscale_menu_display[3].widget),
1294 TRUE);
1296 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1297 "zmv_3",
1298 zoomscale_menu_display[3].widget);
1299 gtk_object_set_data (GTK_OBJECT (zoomscale_menu_display[3].widget),
1300 "disp",
1301 disp);
1302 gtk_object_set_data (GTK_OBJECT (zoomscale_menu_display[3].widget),
1303 "zoom_index",
1304 (int *) ZOOM_3 );
1308 gtk_widget_ref (zoomscale_menu_display[4].widget);
1309 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1310 "zmv_4",
1311 zoomscale_menu_display[4].widget,
1312 (GtkDestroyNotify) gtk_widget_unref);
1313 if (disp->zoom_index == ZOOM_4) {
1314 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1315 (zoomscale_menu_display[4].widget),
1316 TRUE);
1318 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1319 "zmv_4",
1320 zoomscale_menu_display[4].widget);
1321 gtk_object_set_data (GTK_OBJECT (zoomscale_menu_display[4].widget),
1322 "disp",
1323 disp);
1324 gtk_object_set_data (GTK_OBJECT (zoomscale_menu_display[4].widget),
1325 "zoom_index",
1326 (int *) ZOOM_4);
1330 gtk_widget_ref (zoomscale_menu_display[5].widget);
1331 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1332 "zmv_5",
1333 zoomscale_menu_display[5].widget,
1334 (GtkDestroyNotify) gtk_widget_unref);
1335 if (disp->zoom_index == ZOOM_5) {
1336 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1337 (zoomscale_menu_display[5].widget),
1338 TRUE);
1340 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1341 "zmv_5",
1342 zoomscale_menu_display[5].widget);
1343 gtk_object_set_data (GTK_OBJECT (zoomscale_menu_display[5].widget),
1344 "disp",
1345 disp);
1346 gtk_object_set_data (GTK_OBJECT (zoomscale_menu_display[5].widget),
1347 "zoom_index",
1348 (int *) ZOOM_5);
1351 gtk_widget_ref (zoomscale_menu_display[6].widget);
1352 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1353 "zmv_6",
1354 zoomscale_menu_display[6].widget,
1355 (GtkDestroyNotify) gtk_widget_unref);
1356 if (disp->zoom_index == ZOOM_6) {
1357 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1358 (zoomscale_menu_display[6].widget),
1359 TRUE);
1361 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1362 "zmv_6",
1363 zoomscale_menu_display[6].widget);
1364 gtk_object_set_data (GTK_OBJECT (zoomscale_menu_display[6].widget),
1365 "disp",
1366 disp);
1367 gtk_object_set_data (GTK_OBJECT (zoomscale_menu_display[6].widget),
1368 "zoom_index",
1369 (int *) ZOOM_6);
1372 gtk_widget_ref (zoomscale_menu_display[7].widget);
1373 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1374 "zmv_7",
1375 zoomscale_menu_display[7].widget,
1376 (GtkDestroyNotify) gtk_widget_unref);
1377 if (disp->zoom_index == ZOOM_7) {
1378 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1379 (zoomscale_menu_display[7].widget),
1380 TRUE);
1382 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1383 "zmv_7",
1384 zoomscale_menu_display[7].widget);
1385 gtk_object_set_data (GTK_OBJECT (zoomscale_menu_display[7].widget),
1386 "disp",
1387 disp);
1388 gtk_object_set_data (GTK_OBJECT (zoomscale_menu_display[7].widget),
1389 "zoom_index",
1390 (int *) ZOOM_7);
1394 * background menu widgets
1396 gtk_widget_ref (view_background_display[0].widget);
1397 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1398 "view_blue",
1399 view_background_display[0].widget,
1400 (GtkDestroyNotify) gtk_widget_unref);
1401 if (gpiv_par->display__backgrnd == SHOW_BG_DARKBLUE) {
1402 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1403 (view_background_display[0].widget),
1404 TRUE);
1406 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1407 "view_background_display0",
1408 view_background_display[0].widget);
1409 gtk_object_set_data (GTK_OBJECT (view_background_display[0].widget),
1410 "disp",
1411 disp);
1415 gtk_widget_ref (view_background_display[1].widget);
1416 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1417 "view_black",
1418 view_background_display[1].widget,
1419 (GtkDestroyNotify) gtk_widget_unref);
1420 if (gpiv_par->display__backgrnd == SHOW_BG_BLACK) {
1421 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1422 (view_background_display[1].widget),
1423 TRUE);
1425 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1426 "view_background_display1",
1427 view_background_display[1].widget);
1428 gtk_object_set_data (GTK_OBJECT (view_background_display[1].widget),
1429 "disp",
1430 disp);
1434 gtk_widget_ref (view_background_display[2].widget);
1435 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1436 "view_img1",
1437 view_background_display[2].widget,
1438 (GtkDestroyNotify) gtk_widget_unref);
1439 if (gpiv_par->display__backgrnd == SHOW_BG_IMG1) {
1440 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1441 (view_background_display[2].widget),
1442 TRUE);
1444 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1445 "view_background_display2",
1446 view_background_display[2].widget);
1447 gtk_object_set_data (GTK_OBJECT (view_background_display[2].widget),
1448 "disp",
1449 disp);
1453 gtk_widget_ref (view_background_display[3].widget);
1454 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1455 "view_img2",
1456 view_background_display[3].widget,
1457 (GtkDestroyNotify) gtk_widget_unref);
1458 if (gpiv_par->display__backgrnd == SHOW_BG_IMG2) {
1459 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1460 (view_background_display[3].widget),
1461 TRUE);
1463 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1464 "view_background_display3",
1465 view_background_display[3].widget);
1466 gtk_object_set_data (GTK_OBJECT (view_background_display[3].widget),
1467 "disp",
1468 disp);
1472 * view menu widgets to display PIV data and interrrogation area's
1474 gtk_widget_ref (view_piv_display[0].widget);
1475 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1476 "view_intreg",
1477 view_piv_display[0].widget,
1478 (GtkDestroyNotify) gtk_widget_unref);
1479 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1480 "view_piv_display0",
1481 view_piv_display[0].widget);
1482 if (disp->display_intregs) {
1483 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1484 (view_piv_display[0].widget),
1485 TRUE);
1487 gtk_object_set_data (GTK_OBJECT (view_piv_display[0].widget),
1488 "disp",
1489 disp);
1493 gtk_widget_ref (view_piv_display[1].widget);
1494 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1495 "view_piv",
1496 view_piv_display[1].widget,
1497 (GtkDestroyNotify) gtk_widget_unref);
1498 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1499 "view_piv_display1",
1500 view_piv_display[1].widget);
1501 if (disp->display_piv) {
1502 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1503 (view_piv_display[1].widget),
1504 TRUE);
1505 } else {
1506 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1507 (view_piv_display[1].widget),
1508 FALSE);
1510 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1511 "view_piv_display1",
1512 view_piv_display[1].widget);
1515 * Display scalar data
1517 gtk_widget_ref (view_scalardata_display[0].widget);
1518 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1519 "view_none",
1520 view_scalardata_display[0].widget,
1521 (GtkDestroyNotify) gtk_widget_unref);
1522 if (gpiv_par->display__scalar == SHOW_SC_NONE) {
1523 if (gpiv_par->verbose) g_message ("create_display_popupmenu:: display__scalar == SHOW_SC_NONE");
1524 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1525 (view_scalardata_display[0].widget),
1526 TRUE);
1528 gtk_object_set_data (GTK_OBJECT (view_scalardata_display[0].widget),
1529 "disp",
1530 disp);
1531 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1532 "view_scalardata_display0",
1533 view_scalardata_display[0].widget);
1537 gtk_widget_ref (view_scalardata_display[1].widget);
1538 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1539 "view_vor",
1540 view_scalardata_display[1].widget,
1541 (GtkDestroyNotify) gtk_widget_unref);
1542 if (gpiv_par->display__scalar == SHOW_SC_VORTICITY) {
1543 if (gpiv_par->verbose) g_message ("create_display_popupmenu:: display__scalar == SHOW_SC_VORTICITY");
1544 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1545 (view_scalardata_display[1].widget),
1546 TRUE);
1548 gtk_object_set_data (GTK_OBJECT (view_scalardata_display[1].widget),
1549 "disp",
1550 disp);
1551 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1552 "view_scalardata_display1",
1553 view_scalardata_display[1].widget);
1557 gtk_widget_ref (view_scalardata_display[2].widget);
1558 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1559 "view_sstrain",
1560 view_scalardata_display[2].widget,
1561 (GtkDestroyNotify) gtk_widget_unref);
1562 if (gpiv_par->display__scalar == SHOW_SC_SSTRAIN) {
1563 if (gpiv_par->verbose) g_message ("create_display_popupmenu:: display__scalar == SHOW_SC_SSTRAIN");
1564 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1565 (view_scalardata_display[2].widget),
1566 TRUE);
1568 gtk_object_set_data (GTK_OBJECT (view_scalardata_display[2].widget),
1569 "disp",
1570 disp);
1571 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1572 "view_scalardata_display2",
1573 view_scalardata_display[2].widget);
1577 gtk_widget_ref (view_scalardata_display[3].widget);
1578 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1579 "view_nstrain",
1580 view_scalardata_display[3].widget,
1581 (GtkDestroyNotify) gtk_widget_unref);
1582 if (gpiv_par->display__scalar == SHOW_SC_NSTRAIN) {
1583 if (gpiv_par->verbose) g_message ("create_display_popupmenu:: display__scalar == SHOW_SC_NSTRAIN");
1584 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1585 (view_scalardata_display[3].widget),
1586 TRUE);
1588 gtk_object_set_data (GTK_OBJECT (view_scalardata_display[3].widget),
1589 "disp",
1590 disp);
1591 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1592 "view_scalardata_display3",
1593 view_scalardata_display[3].widget);
1596 * vectorscale menu widgets
1598 gtk_widget_ref (vectorscale_menu_display[0].widget);
1599 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1600 "vs_mv_0",
1601 vectorscale_menu_display[0].widget,
1602 (GtkDestroyNotify) gtk_widget_unref);
1603 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1604 "vs_mv_0",
1605 vectorscale_menu_display[0].widget);
1606 if (gpiv_par->display__vector_scale == 1) {
1607 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1608 (vectorscale_menu_display[0].widget),
1609 TRUE);
1614 gtk_widget_ref (vectorscale_menu_display[1].widget);
1615 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1616 "vs_mv_1",
1617 vectorscale_menu_display[1].widget,
1618 (GtkDestroyNotify) gtk_widget_unref);
1619 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1620 "vs_mv_1",
1621 vectorscale_menu_display[1].widget);
1622 if (gpiv_par->display__vector_scale == 2) {
1623 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1624 (vectorscale_menu_display[1].widget),
1625 TRUE);
1630 gtk_widget_ref (vectorscale_menu_display[2].widget);
1631 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1632 "vs_mv_2",
1633 vectorscale_menu_display[2].widget,
1634 (GtkDestroyNotify) gtk_widget_unref);
1635 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1636 "vs_mv_2",
1637 vectorscale_menu_display[2].widget);
1638 if (gpiv_par->display__vector_scale == 4) {
1639 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1640 (vectorscale_menu_display[2].widget),
1641 TRUE);
1646 gtk_widget_ref (vectorscale_menu_display[3].widget);
1647 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1648 "vs_mv_3",
1649 vectorscale_menu_display[3].widget,
1650 (GtkDestroyNotify) gtk_widget_unref);
1651 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1652 "vs_mv_3",
1653 vectorscale_menu_display[3].widget);
1654 if (gpiv_par->display__vector_scale == 8) {
1655 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1656 (vectorscale_menu_display[3].widget),
1657 TRUE);
1662 gtk_widget_ref (vectorscale_menu_display[4].widget);
1663 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1664 "vs_mv_4",
1665 vectorscale_menu_display[0].widget,
1666 (GtkDestroyNotify) gtk_widget_unref);
1667 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1668 "vs_mv_4",
1669 vectorscale_menu_display[4].widget);
1670 if (gpiv_par->display__vector_scale == 16) {
1671 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1672 (vectorscale_menu_display[4].widget),
1673 TRUE);
1678 gtk_widget_ref (vectorscale_menu_display[5].widget);
1679 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1680 "vs_mv_5",
1681 vectorscale_menu_display[5].widget,
1682 (GtkDestroyNotify) gtk_widget_unref);
1683 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1684 "vs_mv_5",
1685 vectorscale_menu_display[5].widget);
1686 if (gpiv_par->display__vector_scale == 32) {
1687 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1688 (vectorscale_menu_display[5].widget),
1689 TRUE);
1694 gtk_widget_ref (vectorscale_menu_display[6].widget);
1695 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1696 "vs_mv_6",
1697 vectorscale_menu_display[6].widget,
1698 (GtkDestroyNotify) gtk_widget_unref);
1699 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1700 "vs_mv_6",
1701 vectorscale_menu_display[6].widget);
1702 if (gpiv_par->display__vector_scale == 64) {
1703 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1704 (vectorscale_menu_display[6].widget),
1705 TRUE);
1710 gtk_widget_ref (vectorscale_menu_display[7].widget);
1711 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1712 "vs_mv_7",
1713 vectorscale_menu_display[7].widget,
1714 (GtkDestroyNotify) gtk_widget_unref);
1715 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1716 "vs_mv_7",
1717 vectorscale_menu_display[7].widget);
1718 if (gpiv_par->display__vector_scale == 128) {
1719 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1720 (vectorscale_menu_display[7].widget),
1721 TRUE);
1726 gtk_widget_ref (vectorscale_menu_display[8].widget);
1727 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1728 "vs_mv_8",
1729 vectorscale_menu_display[8].widget,
1730 (GtkDestroyNotify) gtk_widget_unref);
1731 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1732 "vs_mv_8",
1733 vectorscale_menu_display[8].widget);
1734 if (gpiv_par->display__vector_scale == 256) {
1735 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1736 (vectorscale_menu_display[8].widget),
1737 TRUE);
1742 * vectorcolor menu widgets
1744 gtk_widget_ref (vectorcolor_menu_display[0].widget);
1745 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1746 "vc_mv_0",
1747 vectorcolor_menu_display[0].widget,
1748 (GtkDestroyNotify) gtk_widget_unref);
1749 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1750 "vectorcolor_menu_display0",
1751 vectorcolor_menu_display[0].widget);
1752 if (gpiv_par->display__vector_color == SHOW_PEAKNR) {
1753 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1754 (vectorcolor_menu_display[0].widget),
1755 TRUE);
1760 gtk_widget_ref (vectorcolor_menu_display[1].widget);
1761 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1762 "vc_mv_1",
1763 vectorcolor_menu_display[1].widget,
1764 (GtkDestroyNotify) gtk_widget_unref);
1765 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1766 "vectorcolor_menu_display1",
1767 vectorcolor_menu_display[1].widget);
1768 if (gpiv_par->display__vector_color == SHOW_SNR) {
1769 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1770 (vectorcolor_menu_display[1].widget),
1771 TRUE);
1776 gtk_widget_ref (vectorcolor_menu_display[2].widget);
1777 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1778 "vc_mv_2",
1779 vectorcolor_menu_display[2].widget,
1780 (GtkDestroyNotify) gtk_widget_unref);
1781 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1782 "vectorcolor_menu_display2",
1783 vectorcolor_menu_display[2].widget);
1784 if (gpiv_par->display__vector_color == SHOW_MAGNITUDE_GRAY) {
1785 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1786 (vectorcolor_menu_display[2].widget),
1787 TRUE);
1792 gtk_widget_ref (vectorcolor_menu_display[3].widget);
1793 gtk_object_set_data_full (GTK_OBJECT (display_menu),
1794 "vc_mv_3",
1795 vectorcolor_menu_display[3].widget,
1796 (GtkDestroyNotify) gtk_widget_unref);
1797 gtk_object_set_data (GTK_OBJECT (disp->mwin),
1798 "vectorcolor_menu_display3",
1799 vectorcolor_menu_display[3].widget);
1800 if (gpiv_par->display__vector_color == SHOW_MAGNITUDE) {
1801 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
1802 (vectorcolor_menu_display[3].widget),
1803 TRUE);
1808 return display_menu;