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
8 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008
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 * Data acquisition header interface
31 * $Log: dac_cam_interface.c,v $
32 * Revision 1.3 2007-06-06 17:00:48 gerber
33 * Retreives images/data from URI using Gnome Virtual File System.
35 * Revision 1.2 2007-01-29 11:27:43 gerber
36 * added image formats png, gif, tif png, bmp, improved buffer display
38 * Revision 1.1 2006-09-18 07:29:50 gerber
39 * Split up of triggering and image recording (camera)
48 #include "dac_cam_interfac.h"
53 create_camera_menu(GnomeApp
*main_window
,
56 /*-----------------------------------------------------------------------------
57 * From coriander: build_menus.c BuildCameraMenu
61 char tmp
[GPIV_MAX_CHARS
];
64 * remove previous menu
66 if (cam
->camera_select
!= NULL
) {
67 gtk_widget_destroy(GTK_WIDGET (cam
->camera_select
));
70 cam
->camera_select
= gtk_option_menu_new ();
71 gtk_widget_ref (cam
->camera_select
);
72 gtk_object_set_data_full (GTK_OBJECT (main_window
),
75 (GtkDestroyNotify
) gtk_widget_unref
);
76 gtk_widget_show (cam
->camera_select
);
77 gtk_container_add(GTK_CONTAINER (cam
->vbox_cam
),
80 if (cam_var
.numCameras
>= 1) {
81 gtk_widget_set_sensitive (cam
->camera_select
, TRUE
);
83 gtk_widget_set_sensitive (cam
->camera_select
, FALSE
);
88 cam
->camera_select_menu
= gtk_menu_new ();
89 if (cam_var
.numCameras
> 0) {
90 for (i
= 0; i
< cam_var
.numCameras
; i
++) {
95 cam_var
.camera
[i
].vendor
,
96 cam_var
.camera
[i
].model
);
97 cam
->menu_item
= gtk_menu_item_new_with_label (_(tmp
));
98 gtk_widget_show (cam
->menu_item
);
99 gtk_menu_append (GTK_MENU (cam
->camera_select_menu
),
101 gtk_option_menu_set_menu (GTK_OPTION_MENU (cam
->camera_select
),
102 cam
->camera_select_menu
);
103 g_signal_connect (GTK_OBJECT (cam
->menu_item
),
105 GTK_SIGNAL_FUNC (on_menu_camera_select
),
108 * BUGFIX apply last camera to img_par.source
110 g_snprintf(image_par
.source
, GPIV_MAX_CHARS
, "%s %s",
111 cam_var
.camera
[i
].vendor
,
112 cam_var
.camera
[i
].model
);
113 image_par
.source__set
= TRUE
;
119 cam
->menu_item
= gtk_menu_item_new_with_label (_(tmp
));
120 gtk_widget_show (cam
->menu_item
);
121 gtk_menu_append (GTK_MENU (cam
->camera_select_menu
),
123 gtk_option_menu_set_menu (GTK_OPTION_MENU (cam
->camera_select
),
124 cam
->camera_select_menu
);
126 g_snprintf(image_par
.source
, GPIV_MAX_CHARS
, "No camera");
127 image_par
.source__set
= TRUE
;
132 /* gtk_option_menu_set_menu (GTK_OPTION_MENU (cam->camera_select), */
133 /* cam->camera_select_menu); */
136 * sets the active menu item:
138 gtk_option_menu_set_history (GTK_OPTION_MENU (cam
->camera_select
) ,
146 create_format_menu(GnomeApp
*main_window
,
150 /*-----------------------------------------------------------------------------
151 * From coriander: build_menus.c BuildCameraMenu
155 char tmp
[GPIV_MAX_CHARS
];
156 quadlet_t modes
, formats
;
158 if (cam_var
.numCameras
> 0) {
159 dc1394_query_supported_formats(cam_var
.camera
[0].handle
,
160 cam_var
.camera
[0].id
,
162 dc1394_query_supported_modes(cam_var
.camera
[0].handle
,
163 cam_var
.camera
[0].id
,
164 FORMAT_VGA_NONCOMPRESSED
,
168 * remove previous menu
170 if (cam
->format_menu
!= NULL
) {
171 gtk_widget_destroy(GTK_WIDGET (cam
->format_menu
));
174 cam
->format_menu
= gtk_option_menu_new ();
175 gtk_widget_ref (cam
->format_menu
);
176 gtk_object_set_data_full (GTK_OBJECT (main_window
),
179 (GtkDestroyNotify
) gtk_widget_unref
);
180 gtk_widget_show (cam
->format_menu
);
181 gtk_container_add(GTK_CONTAINER (cam
->vbox_cam
),
185 cam
->format_menu_menu
= gtk_menu_new ();
186 if (cam_var
.numCameras
> 0) {
190 if (formats
& (0x1 << 31)) {
191 for (i
= 0; i
< NUM_FORMAT0_MODES
; i
++) {
192 if ( modes
& (0x1 << (31-i
))) {
197 cam
->menu_item
= gtk_menu_item_new_with_label (_(tmp
));
198 gtk_widget_show (cam
->menu_item
);
199 gtk_menu_append (GTK_MENU (cam
->format_menu_menu
),
201 gtk_option_menu_set_menu (GTK_OPTION_MENU (cam
->format_menu
),
202 cam
->format_menu_menu
);
204 gtk_widget_set_sensitive(cam
->menu_item
,
205 modes
& (0x1 << (31-i
)) );
208 gtk_object_set_data(GTK_OBJECT (cam
->menu_item
),
211 g_signal_connect (GTK_OBJECT (cam
->menu_item
),
213 GTK_SIGNAL_FUNC (on_menu_format
),
214 (int*)(i
+ MODE_FORMAT0_MIN
));
223 if (formats
& (0x1 << 30)) {
224 for (i
= 0; i
< NUM_FORMAT1_MODES
; i
++) {
225 if ( modes
& (0x1 << (30-i
))) {
230 cam
->menu_item
= gtk_menu_item_new_with_label (_(tmp
));
231 gtk_widget_show (cam
->menu_item
);
232 gtk_menu_append (GTK_MENU (cam
->format_menu_menu
),
234 gtk_option_menu_set_menu (GTK_OPTION_MENU (cam
->format_menu
),
235 cam
->format_menu_menu
);
237 gtk_widget_set_sensitive(cam
->menu_item
,
238 modes
& (0x1 << (30-i
)) );
239 g_signal_connect (GTK_OBJECT (cam
->menu_item
),
241 GTK_SIGNAL_FUNC (on_menu_format
),
242 (int*)(i
+ MODE_FORMAT1_MIN
));
252 if (formats
& (0x1 << 29)) {
253 for (i
= 0; i
< NUM_FORMAT2_MODES
; i
++) {
254 if ( modes
& (0x1 << (29-i
))) {
259 cam
->menu_item
= gtk_menu_item_new_with_label (_(tmp
));
260 gtk_widget_show (cam
->menu_item
);
261 gtk_menu_append (GTK_MENU (cam
->format_menu_menu
),
263 gtk_option_menu_set_menu (GTK_OPTION_MENU (cam
->format_menu
),
264 cam
->format_menu_menu
);
266 gtk_widget_set_sensitive(cam
->menu_item
,
267 modes
& (0x1 << (29-i
)) );
269 g_signal_connect (GTK_OBJECT (cam
->menu_item
),
271 GTK_SIGNAL_FUNC (on_menu_format
),
272 (int*)(i
+ MODE_FORMAT2_MIN
));
281 if (formats
& (0x1 << 25)) {
282 for (i
= 0; i
< NUM_FORMAT6_MODES
; i
++) {
283 if ( modes
& (0x1 << (25-i
))) {
288 cam
->menu_item
= gtk_menu_item_new_with_label (_(tmp
));
289 gtk_widget_show (cam
->menu_item
);
290 gtk_menu_append (GTK_MENU (cam
->format_menu_menu
),
292 gtk_option_menu_set_menu (GTK_OPTION_MENU (cam
->format_menu
),
293 cam
->format_menu_menu
);
295 gtk_widget_set_sensitive(cam
->menu_item
,
296 modes
& (0x1 << (25-i
)) );
298 g_signal_connect (GTK_OBJECT (cam
->menu_item
),
300 GTK_SIGNAL_FUNC (on_menu_format
),
301 (int*)(i
+ MODE_FORMAT6_MIN
));
311 cam
->menu_item
= gtk_menu_item_new_with_label (_(tmp
));
312 gtk_widget_show (cam
->menu_item
);
313 gtk_menu_append (GTK_MENU (cam
->format_menu_menu
),
315 gtk_option_menu_set_menu (GTK_OPTION_MENU (cam
->format_menu
),
316 cam
->format_menu_menu
);
321 /* gtk_option_menu_set_menu (GTK_OPTION_MENU (cam->format_menu), */
322 /* cam->format_menu_menu); */
325 * sets the active menu item:
327 gtk_option_menu_set_history (GTK_OPTION_MENU (cam
->format_menu
) ,
337 create_fps_menu(GnomeApp
*main_window
,
340 /*-----------------------------------------------------------------------------
341 * From coriander: build_menus.c BuildCameraMenu
344 dc1394bool_t cont
=DC1394_TRUE
;
345 gint new_framerate
= 0;
346 gint index
[NUM_FRAMERATES
];
348 gint i
, f
, k
= 0, err
;
349 gchar tmp
[GPIV_MAX_CHARS
];
352 if (cam_var
.numCameras
> 0) {
353 if (cam_var
.misc_info
[0].format
== FORMAT_SCALABLE_IMAGE_SIZE
) {
354 value
= 0; /* format 7 has no fixed framerates */
356 err
=dc1394_query_supported_framerates(cam_var
.camera
[0].handle
,
357 cam_var
.camera
[0].id
,
358 cam_var
.misc_info
[0].format
,
359 cam_var
.misc_info
[0].mode
,
361 if (!err
) g_warning("Could not query supported framerates");
367 * remove previous menu
369 if (cam
->fps_menu
!= NULL
) {
370 gtk_widget_destroy(GTK_WIDGET (cam
->fps_menu
));
373 cam
->fps_menu
= gtk_option_menu_new ();
374 gtk_widget_ref (cam
->fps_menu
);
375 gtk_object_set_data_full (GTK_OBJECT (main_window
),
378 (GtkDestroyNotify
) gtk_widget_unref
);
379 gtk_widget_show (cam
->fps_menu
);
380 gtk_container_add(GTK_CONTAINER (cam
->vbox_cam
),
384 cam
->fps_menu_menu
= gtk_menu_new ();
385 if (cam_var
.numCameras
> 0) {
387 for (f
=FRAMERATE_MIN
, i
=0; f
<= FRAMERATE_MAX
; i
++, f
++) {
389 * 31 to 31-num_framerates
391 if (value
& (0x1 << (31-i
) ) ) {
394 cam
->menu_item
= gtk_menu_item_new_with_label (_(fps_label_list
[i
]));
395 gtk_widget_show (cam
->menu_item
);
396 gtk_menu_append (GTK_MENU (cam
->fps_menu_menu
),
399 /* gtk_object_set_data(GTK_OBJECT (cam->menu_item), */
402 g_signal_connect (GTK_OBJECT (cam
->menu_item
),
404 GTK_SIGNAL_FUNC (on_menu_fps
),
405 /* (int*)(i + MODE_FPS0_MIN)); */
409 index
[i
] = -1; // framerate not supported
411 gtk_option_menu_set_menu (GTK_OPTION_MENU (cam
->fps_menu
),
414 if (index
[cam_var
.misc_info
[0].framerate
-FRAMERATE_MIN
] < 0 ) {
415 // previously selected framerate unsupported!!
416 // automatically switch to nearest fps available
417 for (i
= 1; i
<= ((NUM_FRAMERATES
>>1) +1); i
++) {
418 // search radius is num_framerates/2 +1 for safe rounding
419 if (((cam_var
.misc_info
[0].framerate
-FRAMERATE_MIN
-i
)>=0) && cont
) {
420 if (index
[cam_var
.misc_info
[0].framerate
- FRAMERATE_MIN
-i
]
423 new_framerate
=cam_var
.misc_info
[0].framerate
- i
;
427 if (((cam_var
.misc_info
[0].framerate
- FRAMERATE_MIN
+ i
)
430 if (index
[cam_var
.misc_info
[0].framerate
- FRAMERATE_MIN
+ i
]
433 new_framerate
=cam_var
.misc_info
[0].framerate
+ i
;
438 snprintf(tmp
, GPIV_MAX_CHARS
,
439 "create_fps_menu: Invalid framerate. Updating to nearest: %s\n",
440 fps_label_list
[new_framerate
-FRAMERATE_MIN
]);
442 err
= dc1394_set_video_framerate(cam_var
.camera
[0].handle
,
443 cam_var
.camera
[0].id
,
446 warning_gpiv("create_fps_menu: Cannot set video framerate");
447 cam_var
.misc_info
[0].framerate
= new_framerate
;
449 gtk_option_menu_set_history (GTK_OPTION_MENU (cam
->fps_menu
),
450 index
[cam_var
.misc_info
[0].framerate
-
461 create_trigger_mode(GnomeApp
*main_window
,
464 /*-----------------------------------------------------------------------------
465 * From coriander: build_menus.c BuildCameraMenu
468 gint err
, i
, f
, modes
= 0;
471 gint index
[NUM_TRIGGER_MODE
];
474 if (cam_var
.numCameras
> 0) {
475 err
= dc1394_query_feature_characteristics(cam_var
.camera
[0].handle
,
476 cam_var
.camera
[0].id
,
479 if (!err
) g_warning("Could not query trigger feature characteristics");
480 modes
= ( (value
& (0xF << 12))>>12 );
486 * remove previous menu
488 if (cam
->trigger_mode
!= NULL
) {
489 gtk_widget_destroy(GTK_WIDGET (cam
->trigger_mode
));
492 cam
->trigger_mode
= gtk_option_menu_new ();
493 gtk_widget_ref (cam
->trigger_mode
);
494 gtk_object_set_data_full (GTK_OBJECT (main_window
),
497 (GtkDestroyNotify
) gtk_widget_unref
);
498 gtk_widget_show (cam
->trigger_mode
);
499 gtk_container_add(GTK_CONTAINER (cam
->vbox_cam
),
503 cam
->trigger_mode_menu
= gtk_menu_new ();
504 if (cam_var
.numCameras
> 0) {
507 * at least one mode present
508 * external trigger available:
510 for (f
= TRIGGER_MODE_MIN
, i
= 0; f
<= TRIGGER_MODE_MAX
; i
++, f
++) {
511 if (modes
& (0x1<<(TRIGGER_MODE_MAX
-f
))) {
515 gtk_menu_item_new_with_label (_(trigger_mode_desc
[i
]));
516 gtk_widget_show (cam
->menu_item
);
517 gtk_menu_append (GTK_MENU (cam
->trigger_mode_menu
),
519 g_signal_connect (GTK_OBJECT (cam
->menu_item
),
521 GTK_SIGNAL_FUNC (on_trigger_mode_activate
),
528 gtk_option_menu_set_menu (GTK_OPTION_MENU (cam
->trigger_mode
),
529 cam
->trigger_mode_menu
);
531 * sets the active menu item:
533 gtk_option_menu_set_history (GTK_OPTION_MENU (cam
->trigger_mode
),
534 index
[cam_var
.feature_set
[0].feature
535 [FEATURE_TRIGGER
- FEATURE_MIN
]
544 create_camera_feature_menu_scale(GnomeApp
*main_window
,
551 GtkWidget
*option_menu
,
552 GtkWidget
*menu_item_option_man
,
553 GtkWidget
*menu_item_option_auto
,
554 GtkWidget
*menu_item_option_na
,
555 GtkObject
*adj_scale
,
558 /*-----------------------------------------------------------------------------
564 label
= gtk_label_new(_(description
));
565 gtk_widget_ref(label
);
566 gtk_object_set_data_full(GTK_OBJECT (main_window
),
569 (GtkDestroyNotify
) gtk_widget_unref
);
570 gtk_widget_show(label
);
574 if (cam_var
.numCameras
> 0
575 && cam_var
.feature_set
[0].feature
[FEATURE
- FEATURE_MIN
].
578 gtk_adjustment_new(0,
579 cam_var
.feature_set
[0].
580 feature
[FEATURE
- FEATURE_MIN
].min
,
581 cam_var
.feature_set
[0].
582 feature
[FEATURE
- FEATURE_MIN
].max
,
588 gtk_adjustment_new(0,
595 scale
= gtk_hscale_new (GTK_ADJUSTMENT
597 gtk_widget_ref (scale
);
598 gtk_object_set_data_full (GTK_OBJECT (main_window
),
601 (GtkDestroyNotify
) gtk_widget_unref
);
602 gtk_widget_show (scale
);
603 gtk_widget_set_sensitive (scale
,
605 gtk_scale_set_digits (GTK_SCALE (scale
),
608 if (cam_var
.numCameras
> 0) {
609 if (cam_var
.feature_set
[0].feature
[FEATURE
- FEATURE_MIN
].
611 gtk_adjustment_set_value(GTK_ADJUSTMENT (adj_scale
),
612 cam_var
.feature_set
[0].
613 feature
[FEATURE
- FEATURE_MIN
].value
);
616 if (cam_var
.feature_set
[0].feature
[FEATURE
- FEATURE_MIN
].
619 * set glider active and connect
621 gtk_widget_set_sensitive (scale
, TRUE
);
622 g_signal_connect (GTK_OBJECT (adj_scale
),
624 GTK_SIGNAL_FUNC (on_scale_changed
),
631 option
= gtk_option_menu_new ();
632 gtk_widget_ref (option
);
633 gtk_object_set_data_full (GTK_OBJECT (main_window
),
636 (GtkDestroyNotify
) gtk_widget_unref
);
637 gtk_widget_show (option
);
638 gtk_widget_set_sensitive (option
, FALSE
);
639 /* gtk_object_set_data(GTK_OBJECT (option), */
645 option_menu
= gtk_menu_new ();
646 if (cam_var
.numCameras
> 0) {
647 if (cam_var
.feature_set
[0].feature
[FEATURE
- FEATURE_MIN
].
652 gtk_widget_set_sensitive (option
,
654 menu_item_option_man
=
655 gtk_menu_item_new_with_label (_("Man"));
656 gtk_widget_show (menu_item_option_man
);
657 gtk_menu_append (GTK_MENU (option_menu
),
658 menu_item_option_man
);
659 gtk_object_set_data(GTK_OBJECT (menu_item_option_man
),
662 gtk_object_set_data(GTK_OBJECT (menu_item_option_man
),
665 g_signal_connect (GTK_OBJECT (menu_item_option_man
),
667 GTK_SIGNAL_FUNC (on_man_auto_menu
),
671 if (cam_var
.feature_set
[0].feature
[FEATURE
- FEATURE_MIN
].
676 gtk_widget_set_sensitive (option
, TRUE
);
677 menu_item_option_auto
= gtk_menu_item_new_with_label (_("Auto"));
678 gtk_widget_show (menu_item_option_auto
);
679 gtk_menu_append (GTK_MENU (option_menu
),
680 menu_item_option_auto
);
681 gtk_object_set_data(GTK_OBJECT (menu_item_option_auto
),
684 gtk_object_set_data(GTK_OBJECT (menu_item_option_auto
),
687 g_signal_connect (GTK_OBJECT (menu_item_option_auto
),
689 GTK_SIGNAL_FUNC (on_man_auto_menu
),
693 * add menu non avail.
695 if (!cam_var
.feature_set
[0].feature
[FEATURE
- FEATURE_MIN
].auto_capable
696 && !cam_var
.feature_set
[0].feature
[FEATURE
- FEATURE_MIN
].
699 gtk_widget_set_sensitive (option
,
701 menu_item_option_na
= gtk_menu_item_new_with_label (_("N/A"));
702 gtk_widget_show (menu_item_option_na
);
703 gtk_menu_append (GTK_MENU (option_menu
),
704 menu_item_option_na
);
707 gtk_option_menu_set_menu (GTK_OPTION_MENU (option
),
713 gtk_table_attach(GTK_TABLE(cam
->table_cam
),
719 (GtkAttachOptions
) 0,
720 (GtkAttachOptions
) 0,
726 gtk_table_attach(GTK_TABLE(cam
->table_cam
),
732 (GtkAttachOptions
) 0,
733 (GtkAttachOptions
) (0),
738 gtk_table_attach(GTK_TABLE(cam
->table_cam
),
744 (GtkAttachOptions
) (GTK_EXPAND
| GTK_FILL
),
745 (GtkAttachOptions
) (GTK_FILL
),
751 create_cam(GnomeApp
*main_window
,
754 /*-----------------------------------------------------------------------------
755 * Image Info window with data from header
758 GpivConsole
* gpiv
= gtk_object_get_data(GTK_OBJECT (main_window
), "gpiv");
759 Cam
* cam
= g_new0(Cam
, 1);
762 dac
->cam
->frame_cam
= gtk_frame_new(_("Camera"));
763 gtk_widget_ref(dac
->cam
->frame_cam
);
764 gtk_object_set_data_full(GTK_OBJECT (main_window
),
767 (GtkDestroyNotify
) gtk_widget_unref
);
768 gtk_widget_show(dac
->cam
->frame_cam
);
769 gtk_table_attach(GTK_TABLE(dac
->table
),
775 (GtkAttachOptions
) (GTK_FILL
),
776 (GtkAttachOptions
) (0),
782 dac
->cam
->vbox_cam
= gtk_vbox_new(FALSE
,
784 gtk_widget_ref(dac
->cam
->vbox_cam
);
785 gtk_object_set_data_full(GTK_OBJECT (main_window
),
788 (GtkDestroyNotify
) gtk_widget_unref
);
789 gtk_widget_show(dac
->cam
->vbox_cam
);
790 gtk_container_add(GTK_CONTAINER (dac
->cam
->frame_cam
),
792 /* gtk_table_attach(GTK_TABLE(dac->cam->table_cam), */
793 /* dac->cam->vbox_cam, */
798 /* (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), */
799 /* (GtkAttachOptions) 0, */
803 /* gtk_container_add(GTK_CONTAINER (hbox), */
810 * Camera Shutter menu's and adjuster
813 create_camera_menu(main_window
,
816 create_format_menu(main_window
,
820 create_fps_menu(main_window
,
826 /* dac->cam->frame_trigger = gtk_frame_new(_("Trigger")); */
827 /* gtk_widget_ref(dac->cam->frame_trigger); */
828 /* gtk_object_set_data_full(GTK_OBJECT (main_window), */
829 /* "dac_frame_trigger", */
830 /* dac->cam->frame_trigger, */
831 /* (GtkDestroyNotify) gtk_widget_unref); */
832 /* gtk_widget_show(dac->cam->frame_trigger); */
833 /* gtk_container_add(GTK_CONTAINER (dac->cam->vbox_cam), */
834 /* dac->cam->frame_trigger); */
839 /* dac->cam->vbox_trigger = gtk_vbox_new(FALSE, */
841 /* gtk_widget_ref(dac->cam->vbox_trigger); */
842 /* gtk_object_set_data_full(GTK_OBJECT (main_window), */
843 /* "vbox_trigger", */
844 /* dac->cam->vbox_trigger, */
845 /* (GtkDestroyNotify) gtk_widget_unref); */
846 /* gtk_widget_show(dac->cam->vbox_trigger); */
847 /* gtk_container_add(GTK_CONTAINER (dac->cam->frame_trigger), */
848 /* dac->cam->vbox_trigger); */
853 dac
->cam
->hbox_trigger
= gtk_hbox_new(FALSE
,
855 gtk_widget_ref(dac
->cam
->hbox_trigger
);
856 gtk_object_set_data_full(GTK_OBJECT (main_window
),
858 dac
->cam
->hbox_trigger
,
859 (GtkDestroyNotify
) gtk_widget_unref
);
860 gtk_widget_show(dac
->cam
->hbox_trigger
);
861 gtk_container_add(GTK_CONTAINER (dac
->cam
->vbox_cam
),
862 dac
->cam
->hbox_trigger
);
867 dac
->cam
->trigger_external
= gtk_toggle_button_new_with_label (_("External trigger"));
868 gtk_widget_ref (dac
->cam
->trigger_external
);
869 gtk_object_set_data_full (GTK_OBJECT (main_window
),
871 dac
->cam
->trigger_external
,
872 (GtkDestroyNotify
) gtk_widget_unref
);
873 gtk_widget_show (dac
->cam
->trigger_external
);
874 gtk_container_add(GTK_CONTAINER (dac
->cam
->hbox_trigger
),
875 dac
->cam
->trigger_external
);
876 gtk_widget_set_sensitive (dac
->cam
->trigger_external
,
878 g_signal_connect (GTK_OBJECT (dac
->cam
->trigger_external
), "toggled",
879 GTK_SIGNAL_FUNC (on_trigger_external_toggled
),
885 dac
->cam
->trigger_polarity
= gtk_toggle_button_new_with_label (_("Polarity"));
886 gtk_widget_ref (dac
->cam
->trigger_polarity
);
887 gtk_object_set_data_full (GTK_OBJECT (main_window
),
889 dac
->cam
->trigger_polarity
,
890 (GtkDestroyNotify
) gtk_widget_unref
);
891 gtk_widget_show (dac
->cam
->trigger_polarity
);
892 gtk_container_add(GTK_CONTAINER (dac
->cam
->hbox_trigger
),
893 dac
->cam
->trigger_polarity
);
894 gtk_widget_set_sensitive (dac
->cam
->trigger_polarity
,
896 g_signal_connect (GTK_OBJECT (dac
->cam
->trigger_polarity
), "toggled",
897 GTK_SIGNAL_FUNC (on_trigger_polarity_toggled
),
902 create_trigger_mode(main_window
,
905 * Enable triggering with the cam
908 dac
->cam
->checkbutton_camera_trigger
=
909 gtk_check_button_new_with_label(_("RTAI triggering"));
910 gtk_widget_ref(dac
->cam
->checkbutton_camera_trigger
);
911 gtk_object_set_data_full(GTK_OBJECT (main_window
),
912 "button_camera_trigger",
913 dac
->cam
->checkbutton_camera_trigger
,
914 (GtkDestroyNotify
) gtk_widget_unref
);
915 gtk_widget_show(dac
->cam
->checkbutton_camera_trigger
);
916 gtk_container_add(GTK_CONTAINER (dac
->cam
->vbox_cam
),
917 dac
->cam
->checkbutton_camera_trigger
);
918 gtk_tooltips_set_tip(gpiv
->tooltips
,
919 dac
->cam
->checkbutton_camera_trigger
,
920 _("Enables triggering of the camera and laser. "
921 "Else, the camera will 'free run', mostly at "
922 "30 frames per second."),
925 gtk_object_set_data(GTK_OBJECT (dac
->cam
->checkbutton_camera_trigger
),
928 g_signal_connect(GTK_OBJECT (dac
->cam
->checkbutton_camera_trigger
),
930 G_CALLBACK (on_checkbutton_camera_trigger_enter
),
932 g_signal_connect(GTK_OBJECT (dac
->cam
->checkbutton_camera_trigger
),
934 G_CALLBACK (on_widget_leave
),
936 g_signal_connect(GTK_OBJECT (dac
->cam
->checkbutton_camera_trigger
),
938 G_CALLBACK (on_checkbutton_camera_trigger
),
940 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
941 (dac
->cam
->checkbutton_camera_trigger
),
942 gpiv_par
.trigger_cam
);
943 #endif /* ENABLE_TRIG */
947 dac
->cam
->table_cam
= gtk_table_new(9,
950 gtk_widget_ref(dac
->cam
->table_cam
);
951 gtk_object_set_data_full(GTK_OBJECT (main_window
),
954 (GtkDestroyNotify
) gtk_widget_unref
);
955 gtk_widget_show(dac
->cam
->table_cam
);
956 gtk_container_add(GTK_CONTAINER (dac
->cam
->vbox_cam
),
957 dac
->cam
->table_cam
);
962 * Report Camera temperature
967 dac
->cam
->label_label_temp
= gtk_label_new(_("temp (C): "));
968 gtk_widget_ref(dac
->cam
->label_label_temp
);
969 gtk_object_set_data_full(GTK_OBJECT (main_window
),
970 "dac_label_label_temp",
971 dac
->cam
->label_label_temp
,
972 (GtkDestroyNotify
) gtk_widget_unref
);
973 gtk_widget_show(dac
->cam
->label_label_temp
);
974 gtk_table_attach(GTK_TABLE(dac
->cam
->table_cam
),
975 dac
->cam
->label_label_temp
,
980 (GtkAttachOptions
) (GTK_EXPAND
| GTK_FILL
),
981 (GtkAttachOptions
) 0,
988 dac
->cam
->label_temp
= gtk_label_new("");
989 gtk_widget_ref(dac
->cam
->label_temp
);
990 gtk_object_set_data_full(GTK_OBJECT (main_window
),
992 dac
->cam
->label_temp
,
993 (GtkDestroyNotify
) gtk_widget_unref
);
994 gtk_widget_show(dac
->cam
->label_temp
);
995 gtk_table_attach(GTK_TABLE(dac
->cam
->table_cam
),
996 dac
->cam
->label_temp
,
1001 (GtkAttachOptions
) (GTK_EXPAND
| GTK_FILL
),
1002 (GtkAttachOptions
) 0,
1006 /* g_warning("cr_dac:: feature T; %s", */
1007 /* dc1394_feature_desc[FEATURE_TEMPERATURE - FEATURE_MIN]); */
1012 * Camera Exposure menu's and adjuster
1014 * First define the scale as its data are set for the menu items
1016 create_camera_feature_menu_scale(main_window
,
1021 dac
->cam
->camera_exposure
,
1022 dac
->cam
->camera_exposure_menu
,
1023 dac
->cam
->menu_item_camera_exposure_man
,
1024 dac
->cam
->menu_item_camera_exposure_auto
,
1025 dac
->cam
->menu_item_camera_exposure_na
,
1026 dac
->cam
->adj_exposure_scale
,
1027 dac
->cam
->exposure_scale
1030 * Camera Iris menu's and adjuster
1032 create_camera_feature_menu_scale(main_window
,
1037 dac
->cam
->camera_iris
,
1038 dac
->cam
->camera_iris_menu
,
1039 dac
->cam
->menu_item_camera_iris_man
,
1040 dac
->cam
->menu_item_camera_iris_auto
,
1041 dac
->cam
->menu_item_camera_iris_na
,
1042 dac
->cam
->adj_iris_scale
,
1043 dac
->cam
->iris_scale
1047 * Camera Shutter menu's and adjuster
1049 create_camera_feature_menu_scale(main_window
,
1054 dac
->cam
->camera_shutter
,
1055 dac
->cam
->camera_shutter_menu
,
1056 dac
->cam
->menu_item_camera_shutter_man
,
1057 dac
->cam
->menu_item_camera_shutter_auto
,
1058 dac
->cam
->menu_item_camera_shutter_na
,
1059 dac
->cam
->adj_shutter_scale
,
1060 dac
->cam
->shutter_scale
1064 * Camera Gain menu's and adjuster
1066 create_camera_feature_menu_scale(main_window
,
1071 dac
->cam
->camera_gain
,
1072 dac
->cam
->camera_gain_menu
,
1073 dac
->cam
->menu_item_camera_gain_man
,
1074 dac
->cam
->menu_item_camera_gain_auto
,
1075 dac
->cam
->menu_item_camera_gain_na
,
1076 dac
->cam
->adj_gain_scale
,
1077 dac
->cam
->gain_scale
1081 * Camera Temperature menu's and adjuster
1083 create_camera_feature_menu_scale(main_window
,
1085 FEATURE_TEMPERATURE
,
1088 dac
->cam
->camera_temp
,
1089 dac
->cam
->camera_temp_menu
,
1090 dac
->cam
->menu_item_camera_temp_man
,
1091 dac
->cam
->menu_item_camera_temp_auto
,
1092 dac
->cam
->menu_item_camera_temp_na
,
1093 dac
->cam
->adj_temp_scale
,
1094 dac
->cam
->temp_scale
1098 * Camera Zoom menu's and adjuster
1100 create_camera_feature_menu_scale(main_window
,
1105 dac
->cam
->camera_zoom
,
1106 dac
->cam
->camera_zoom_menu
,
1107 dac
->cam
->menu_item_camera_zoom_man
,
1108 dac
->cam
->menu_item_camera_zoom_auto
,
1109 dac
->cam
->menu_item_camera_zoom_na
,
1110 dac
->cam
->adj_zoom_scale
,
1111 dac
->cam
->zoom_scale
1115 * Camera Pan menu's and adjuster
1117 create_camera_feature_menu_scale(main_window
,
1122 dac
->cam
->camera_pan
,
1123 dac
->cam
->camera_pan_menu
,
1124 dac
->cam
->menu_item_camera_pan_man
,
1125 dac
->cam
->menu_item_camera_pan_auto
,
1126 dac
->cam
->menu_item_camera_pan_na
,
1127 dac
->cam
->adj_pan_scale
,
1132 * Camera Tilt menu's and adjuster
1134 create_camera_feature_menu_scale(main_window
,
1139 dac
->cam
->camera_tilt
,
1140 dac
->cam
->camera_tilt_menu
,
1141 dac
->cam
->menu_item_camera_tilt_man
,
1142 dac
->cam
->menu_item_camera_tilt_auto
,
1143 dac
->cam
->menu_item_camera_tilt_na
,
1144 dac
->cam
->adj_tilt_scale
,
1145 dac
->cam
->tilt_scale
1149 * Record activating button
1151 dac
->cam
->button_cam_start
= gtk_button_new_with_label(_("start camera"));
1152 gtk_widget_ref(dac
->cam
->button_cam_start
);
1153 gtk_object_set_data_full(GTK_OBJECT (main_window
),
1155 dac
->cam
->button_cam_start
,
1156 (GtkDestroyNotify
) gtk_widget_unref
);
1157 gtk_widget_show(dac
->cam
->button_cam_start
);
1158 gtk_table_attach(GTK_TABLE(dac
->table
),
1159 dac
->cam
->button_cam_start
,
1164 (GtkAttachOptions
) (GTK_FILL
),
1165 (GtkAttachOptions
) (GTK_FILL
),
1168 gtk_tooltips_set_tip(gpiv
->tooltips
,
1169 dac
->cam
->button_cam_start
,
1170 _("Starts camera to record PIV images of an area that is illuminated "
1171 "by a (double cavity Nd-YAG) laser and is observed "
1172 "by a CCD camera. Camera and lasers are eventually "
1173 "triggered by TTL pulses from the (parallel) output "
1177 gtk_object_set_data(GTK_OBJECT (dac
->cam
->button_cam_start
),
1180 g_signal_connect(GTK_OBJECT (dac
->cam
->button_cam_start
),
1182 G_CALLBACK (on_button_dac_camstart_enter
),
1184 g_signal_connect(GTK_OBJECT (dac
->cam
->button_cam_start
),
1186 G_CALLBACK (on_widget_leave
),
1188 g_signal_connect(GTK_OBJECT (dac
->cam
->button_cam_start
),
1192 G_CALLBACK (on_button_dac_camstart
),
1197 * Record de-activating button
1199 dac
->cam
->button_cam_stop
= gtk_button_new_with_label(_("stop camera"));
1200 gtk_widget_ref(dac
->cam
->button_cam_stop
);
1201 gtk_object_set_data_full(GTK_OBJECT (main_window
),
1203 dac
->cam
->button_cam_stop
,
1204 (GtkDestroyNotify
) gtk_widget_unref
);
1205 gtk_widget_show(dac
->cam
->button_cam_stop
);
1206 gtk_table_attach(GTK_TABLE(dac
->table
),
1207 dac
->cam
->button_cam_stop
,
1212 (GtkAttachOptions
) (GTK_FILL
),
1213 (GtkAttachOptions
) (GTK_FILL
),
1216 gtk_tooltips_set_tip(gpiv
->tooltips
,
1217 dac
->cam
->button_cam_stop
,
1218 _("Stops camera to record of PIV images "
1219 "and, eventually, cancels sending of trigger pulses"),
1222 gtk_object_set_data(GTK_OBJECT (dac
->cam
->button_cam_stop
),
1225 g_signal_connect(GTK_OBJECT (dac
->cam
->button_cam_stop
),
1227 G_CALLBACK (on_button_dac_camstop_enter
),
1229 g_signal_connect(GTK_OBJECT (dac
->cam
->button_cam_stop
),
1231 G_CALLBACK (on_widget_leave
),
1233 g_signal_connect(GTK_OBJECT (dac
->cam
->button_cam_stop
),
1235 G_CALLBACK (on_button_dac_camstop
),