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 Gerber van der Graaf
10 This file is part of gpiv.
12 Gpiv is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2, or (at your option)
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 ----------------------------------------------------------------------*/
29 * Data acquisition header interface
30 * $Log: dac_cam_interface.c,v $
31 * Revision 1.3 2007-06-06 17:00:48 gerber
32 * Retreives images/data from URI using Gnome Virtual File System.
34 * Revision 1.2 2007-01-29 11:27:43 gerber
35 * added image formats png, gif, tif png, bmp, improved buffer display
37 * Revision 1.1 2006-09-18 07:29:50 gerber
38 * Split up of triggering and image recording (camera)
47 #include "dac_cam_interfac.h"
52 create_camera_menu(GnomeApp
*main_window
,
55 /*-----------------------------------------------------------------------------
56 * From coriander: build_menus.c BuildCameraMenu
60 char tmp
[GPIV_MAX_CHARS
];
63 * remove previous menu
65 if (cam
->camera_select
!= NULL
) {
66 gtk_widget_destroy(GTK_WIDGET (cam
->camera_select
));
69 cam
->camera_select
= gtk_option_menu_new ();
70 gtk_widget_ref (cam
->camera_select
);
71 gtk_object_set_data_full (GTK_OBJECT (main_window
),
74 (GtkDestroyNotify
) gtk_widget_unref
);
75 gtk_widget_show (cam
->camera_select
);
76 gtk_container_add(GTK_CONTAINER (cam
->vbox_cam
),
79 if (cam_var
.numCameras
>= 1) {
80 gtk_widget_set_sensitive (cam
->camera_select
, TRUE
);
82 gtk_widget_set_sensitive (cam
->camera_select
, FALSE
);
87 cam
->camera_select_menu
= gtk_menu_new ();
88 if (cam_var
.numCameras
> 0) {
89 for (i
= 0; i
< cam_var
.numCameras
; i
++) {
94 cam_var
.camera
[i
].vendor
,
95 cam_var
.camera
[i
].model
);
96 cam
->menu_item
= gtk_menu_item_new_with_label (_(tmp
));
97 gtk_widget_show (cam
->menu_item
);
98 gtk_menu_append (GTK_MENU (cam
->camera_select_menu
),
100 gtk_option_menu_set_menu (GTK_OPTION_MENU (cam
->camera_select
),
101 cam
->camera_select_menu
);
102 g_signal_connect (GTK_OBJECT (cam
->menu_item
),
104 GTK_SIGNAL_FUNC (on_menu_camera_select
),
107 * BUGFIX apply last camera to img_par.source
109 g_snprintf(image_par
.source
, GPIV_MAX_CHARS
, "%s %s",
110 cam_var
.camera
[i
].vendor
,
111 cam_var
.camera
[i
].model
);
112 image_par
.source__set
= TRUE
;
118 cam
->menu_item
= gtk_menu_item_new_with_label (_(tmp
));
119 gtk_widget_show (cam
->menu_item
);
120 gtk_menu_append (GTK_MENU (cam
->camera_select_menu
),
122 gtk_option_menu_set_menu (GTK_OPTION_MENU (cam
->camera_select
),
123 cam
->camera_select_menu
);
125 g_snprintf(image_par
.source
, GPIV_MAX_CHARS
, "No camera");
126 image_par
.source__set
= TRUE
;
131 /* gtk_option_menu_set_menu (GTK_OPTION_MENU (cam->camera_select), */
132 /* cam->camera_select_menu); */
135 * sets the active menu item:
137 gtk_option_menu_set_history (GTK_OPTION_MENU (cam
->camera_select
) ,
145 create_format_menu(GnomeApp
*main_window
,
149 /*-----------------------------------------------------------------------------
150 * From coriander: build_menus.c BuildCameraMenu
154 char tmp
[GPIV_MAX_CHARS
];
155 quadlet_t modes
, formats
;
157 if (cam_var
.numCameras
> 0) {
158 dc1394_query_supported_formats(cam_var
.camera
[0].handle
,
159 cam_var
.camera
[0].id
,
161 dc1394_query_supported_modes(cam_var
.camera
[0].handle
,
162 cam_var
.camera
[0].id
,
163 FORMAT_VGA_NONCOMPRESSED
,
167 * remove previous menu
169 if (cam
->format_menu
!= NULL
) {
170 gtk_widget_destroy(GTK_WIDGET (cam
->format_menu
));
173 cam
->format_menu
= gtk_option_menu_new ();
174 gtk_widget_ref (cam
->format_menu
);
175 gtk_object_set_data_full (GTK_OBJECT (main_window
),
178 (GtkDestroyNotify
) gtk_widget_unref
);
179 gtk_widget_show (cam
->format_menu
);
180 gtk_container_add(GTK_CONTAINER (cam
->vbox_cam
),
184 cam
->format_menu_menu
= gtk_menu_new ();
185 if (cam_var
.numCameras
> 0) {
189 if (formats
& (0x1 << 31)) {
190 for (i
= 0; i
< NUM_FORMAT0_MODES
; i
++) {
191 if ( modes
& (0x1 << (31-i
))) {
196 cam
->menu_item
= gtk_menu_item_new_with_label (_(tmp
));
197 gtk_widget_show (cam
->menu_item
);
198 gtk_menu_append (GTK_MENU (cam
->format_menu_menu
),
200 gtk_option_menu_set_menu (GTK_OPTION_MENU (cam
->format_menu
),
201 cam
->format_menu_menu
);
203 gtk_widget_set_sensitive(cam
->menu_item
,
204 modes
& (0x1 << (31-i
)) );
207 gtk_object_set_data(GTK_OBJECT (cam
->menu_item
),
210 g_signal_connect (GTK_OBJECT (cam
->menu_item
),
212 GTK_SIGNAL_FUNC (on_menu_format
),
213 (int*)(i
+ MODE_FORMAT0_MIN
));
222 if (formats
& (0x1 << 30)) {
223 for (i
= 0; i
< NUM_FORMAT1_MODES
; i
++) {
224 if ( modes
& (0x1 << (30-i
))) {
229 cam
->menu_item
= gtk_menu_item_new_with_label (_(tmp
));
230 gtk_widget_show (cam
->menu_item
);
231 gtk_menu_append (GTK_MENU (cam
->format_menu_menu
),
233 gtk_option_menu_set_menu (GTK_OPTION_MENU (cam
->format_menu
),
234 cam
->format_menu_menu
);
236 gtk_widget_set_sensitive(cam
->menu_item
,
237 modes
& (0x1 << (30-i
)) );
238 g_signal_connect (GTK_OBJECT (cam
->menu_item
),
240 GTK_SIGNAL_FUNC (on_menu_format
),
241 (int*)(i
+ MODE_FORMAT1_MIN
));
251 if (formats
& (0x1 << 29)) {
252 for (i
= 0; i
< NUM_FORMAT2_MODES
; i
++) {
253 if ( modes
& (0x1 << (29-i
))) {
258 cam
->menu_item
= gtk_menu_item_new_with_label (_(tmp
));
259 gtk_widget_show (cam
->menu_item
);
260 gtk_menu_append (GTK_MENU (cam
->format_menu_menu
),
262 gtk_option_menu_set_menu (GTK_OPTION_MENU (cam
->format_menu
),
263 cam
->format_menu_menu
);
265 gtk_widget_set_sensitive(cam
->menu_item
,
266 modes
& (0x1 << (29-i
)) );
268 g_signal_connect (GTK_OBJECT (cam
->menu_item
),
270 GTK_SIGNAL_FUNC (on_menu_format
),
271 (int*)(i
+ MODE_FORMAT2_MIN
));
280 if (formats
& (0x1 << 25)) {
281 for (i
= 0; i
< NUM_FORMAT6_MODES
; i
++) {
282 if ( modes
& (0x1 << (25-i
))) {
287 cam
->menu_item
= gtk_menu_item_new_with_label (_(tmp
));
288 gtk_widget_show (cam
->menu_item
);
289 gtk_menu_append (GTK_MENU (cam
->format_menu_menu
),
291 gtk_option_menu_set_menu (GTK_OPTION_MENU (cam
->format_menu
),
292 cam
->format_menu_menu
);
294 gtk_widget_set_sensitive(cam
->menu_item
,
295 modes
& (0x1 << (25-i
)) );
297 g_signal_connect (GTK_OBJECT (cam
->menu_item
),
299 GTK_SIGNAL_FUNC (on_menu_format
),
300 (int*)(i
+ MODE_FORMAT6_MIN
));
310 cam
->menu_item
= gtk_menu_item_new_with_label (_(tmp
));
311 gtk_widget_show (cam
->menu_item
);
312 gtk_menu_append (GTK_MENU (cam
->format_menu_menu
),
314 gtk_option_menu_set_menu (GTK_OPTION_MENU (cam
->format_menu
),
315 cam
->format_menu_menu
);
320 /* gtk_option_menu_set_menu (GTK_OPTION_MENU (cam->format_menu), */
321 /* cam->format_menu_menu); */
324 * sets the active menu item:
326 gtk_option_menu_set_history (GTK_OPTION_MENU (cam
->format_menu
) ,
336 create_fps_menu(GnomeApp
*main_window
,
339 /*-----------------------------------------------------------------------------
340 * From coriander: build_menus.c BuildCameraMenu
343 dc1394bool_t cont
=DC1394_TRUE
;
344 gint new_framerate
= 0;
345 gint index
[NUM_FRAMERATES
];
347 gint i
, f
, k
= 0, err
;
348 gchar tmp
[GPIV_MAX_CHARS
];
351 if (cam_var
.numCameras
> 0) {
352 if (cam_var
.misc_info
[0].format
== FORMAT_SCALABLE_IMAGE_SIZE
) {
353 value
= 0; /* format 7 has no fixed framerates */
355 err
=dc1394_query_supported_framerates(cam_var
.camera
[0].handle
,
356 cam_var
.camera
[0].id
,
357 cam_var
.misc_info
[0].format
,
358 cam_var
.misc_info
[0].mode
,
360 if (!err
) g_warning("Could not query supported framerates");
366 * remove previous menu
368 if (cam
->fps_menu
!= NULL
) {
369 gtk_widget_destroy(GTK_WIDGET (cam
->fps_menu
));
372 cam
->fps_menu
= gtk_option_menu_new ();
373 gtk_widget_ref (cam
->fps_menu
);
374 gtk_object_set_data_full (GTK_OBJECT (main_window
),
377 (GtkDestroyNotify
) gtk_widget_unref
);
378 gtk_widget_show (cam
->fps_menu
);
379 gtk_container_add(GTK_CONTAINER (cam
->vbox_cam
),
383 cam
->fps_menu_menu
= gtk_menu_new ();
384 if (cam_var
.numCameras
> 0) {
386 for (f
=FRAMERATE_MIN
, i
=0; f
<= FRAMERATE_MAX
; i
++, f
++) {
388 * 31 to 31-num_framerates
390 if (value
& (0x1 << (31-i
) ) ) {
393 cam
->menu_item
= gtk_menu_item_new_with_label (_(fps_label_list
[i
]));
394 gtk_widget_show (cam
->menu_item
);
395 gtk_menu_append (GTK_MENU (cam
->fps_menu_menu
),
398 /* gtk_object_set_data(GTK_OBJECT (cam->menu_item), */
401 g_signal_connect (GTK_OBJECT (cam
->menu_item
),
403 GTK_SIGNAL_FUNC (on_menu_fps
),
404 /* (int*)(i + MODE_FPS0_MIN)); */
408 index
[i
] = -1; // framerate not supported
410 gtk_option_menu_set_menu (GTK_OPTION_MENU (cam
->fps_menu
),
413 if (index
[cam_var
.misc_info
[0].framerate
-FRAMERATE_MIN
] < 0 ) {
414 // previously selected framerate unsupported!!
415 // automatically switch to nearest fps available
416 for (i
= 1; i
<= ((NUM_FRAMERATES
>>1) +1); i
++) {
417 // search radius is num_framerates/2 +1 for safe rounding
418 if (((cam_var
.misc_info
[0].framerate
-FRAMERATE_MIN
-i
)>=0) && cont
) {
419 if (index
[cam_var
.misc_info
[0].framerate
- FRAMERATE_MIN
-i
]
422 new_framerate
=cam_var
.misc_info
[0].framerate
- i
;
426 if (((cam_var
.misc_info
[0].framerate
- FRAMERATE_MIN
+ i
)
429 if (index
[cam_var
.misc_info
[0].framerate
- FRAMERATE_MIN
+ i
]
432 new_framerate
=cam_var
.misc_info
[0].framerate
+ i
;
437 snprintf(tmp
, GPIV_MAX_CHARS
,
438 "create_fps_menu: Invalid framerate. Updating to nearest: %s\n",
439 fps_label_list
[new_framerate
-FRAMERATE_MIN
]);
441 err
= dc1394_set_video_framerate(cam_var
.camera
[0].handle
,
442 cam_var
.camera
[0].id
,
445 warning_gpiv("create_fps_menu: Cannot set video framerate");
446 cam_var
.misc_info
[0].framerate
= new_framerate
;
448 gtk_option_menu_set_history (GTK_OPTION_MENU (cam
->fps_menu
),
449 index
[cam_var
.misc_info
[0].framerate
-
460 create_trigger_mode(GnomeApp
*main_window
,
463 /*-----------------------------------------------------------------------------
464 * From coriander: build_menus.c BuildCameraMenu
467 gint err
, i
, f
, modes
= 0;
470 gint index
[NUM_TRIGGER_MODE
];
473 if (cam_var
.numCameras
> 0) {
474 err
= dc1394_query_feature_characteristics(cam_var
.camera
[0].handle
,
475 cam_var
.camera
[0].id
,
478 if (!err
) g_warning("Could not query trigger feature characteristics");
479 modes
= ( (value
& (0xF << 12))>>12 );
485 * remove previous menu
487 if (cam
->trigger_mode
!= NULL
) {
488 gtk_widget_destroy(GTK_WIDGET (cam
->trigger_mode
));
491 cam
->trigger_mode
= gtk_option_menu_new ();
492 gtk_widget_ref (cam
->trigger_mode
);
493 gtk_object_set_data_full (GTK_OBJECT (main_window
),
496 (GtkDestroyNotify
) gtk_widget_unref
);
497 gtk_widget_show (cam
->trigger_mode
);
498 gtk_container_add(GTK_CONTAINER (cam
->vbox_cam
),
502 cam
->trigger_mode_menu
= gtk_menu_new ();
503 if (cam_var
.numCameras
> 0) {
506 * at least one mode present
507 * external trigger available:
509 for (f
= TRIGGER_MODE_MIN
, i
= 0; f
<= TRIGGER_MODE_MAX
; i
++, f
++) {
510 if (modes
& (0x1<<(TRIGGER_MODE_MAX
-f
))) {
514 gtk_menu_item_new_with_label (_(trigger_mode_desc
[i
]));
515 gtk_widget_show (cam
->menu_item
);
516 gtk_menu_append (GTK_MENU (cam
->trigger_mode_menu
),
518 g_signal_connect (GTK_OBJECT (cam
->menu_item
),
520 GTK_SIGNAL_FUNC (on_trigger_mode_activate
),
527 gtk_option_menu_set_menu (GTK_OPTION_MENU (cam
->trigger_mode
),
528 cam
->trigger_mode_menu
);
530 * sets the active menu item:
532 gtk_option_menu_set_history (GTK_OPTION_MENU (cam
->trigger_mode
),
533 index
[cam_var
.feature_set
[0].feature
534 [FEATURE_TRIGGER
- FEATURE_MIN
]
543 create_camera_feature_menu_scale(GnomeApp
*main_window
,
550 GtkWidget
*option_menu
,
551 GtkWidget
*menu_item_option_man
,
552 GtkWidget
*menu_item_option_auto
,
553 GtkWidget
*menu_item_option_na
,
554 GtkObject
*adj_scale
,
557 /*-----------------------------------------------------------------------------
563 label
= gtk_label_new(_(description
));
564 gtk_widget_ref(label
);
565 gtk_object_set_data_full(GTK_OBJECT (main_window
),
568 (GtkDestroyNotify
) gtk_widget_unref
);
569 gtk_widget_show(label
);
573 if (cam_var
.numCameras
> 0
574 && cam_var
.feature_set
[0].feature
[FEATURE
- FEATURE_MIN
].
577 gtk_adjustment_new(0,
578 cam_var
.feature_set
[0].
579 feature
[FEATURE
- FEATURE_MIN
].min
,
580 cam_var
.feature_set
[0].
581 feature
[FEATURE
- FEATURE_MIN
].max
,
587 gtk_adjustment_new(0,
594 scale
= gtk_hscale_new (GTK_ADJUSTMENT
596 gtk_widget_ref (scale
);
597 gtk_object_set_data_full (GTK_OBJECT (main_window
),
600 (GtkDestroyNotify
) gtk_widget_unref
);
601 gtk_widget_show (scale
);
602 gtk_widget_set_sensitive (scale
,
604 gtk_scale_set_digits (GTK_SCALE (scale
),
607 if (cam_var
.numCameras
> 0) {
608 if (cam_var
.feature_set
[0].feature
[FEATURE
- FEATURE_MIN
].
610 gtk_adjustment_set_value(GTK_ADJUSTMENT (adj_scale
),
611 cam_var
.feature_set
[0].
612 feature
[FEATURE
- FEATURE_MIN
].value
);
615 if (cam_var
.feature_set
[0].feature
[FEATURE
- FEATURE_MIN
].
618 * set glider active and connect
620 gtk_widget_set_sensitive (scale
, TRUE
);
621 g_signal_connect (GTK_OBJECT (adj_scale
),
623 GTK_SIGNAL_FUNC (on_scale_changed
),
630 option
= gtk_option_menu_new ();
631 gtk_widget_ref (option
);
632 gtk_object_set_data_full (GTK_OBJECT (main_window
),
635 (GtkDestroyNotify
) gtk_widget_unref
);
636 gtk_widget_show (option
);
637 gtk_widget_set_sensitive (option
, FALSE
);
638 /* gtk_object_set_data(GTK_OBJECT (option), */
644 option_menu
= gtk_menu_new ();
645 if (cam_var
.numCameras
> 0) {
646 if (cam_var
.feature_set
[0].feature
[FEATURE
- FEATURE_MIN
].
651 gtk_widget_set_sensitive (option
,
653 menu_item_option_man
=
654 gtk_menu_item_new_with_label (_("Man"));
655 gtk_widget_show (menu_item_option_man
);
656 gtk_menu_append (GTK_MENU (option_menu
),
657 menu_item_option_man
);
658 gtk_object_set_data(GTK_OBJECT (menu_item_option_man
),
661 gtk_object_set_data(GTK_OBJECT (menu_item_option_man
),
664 g_signal_connect (GTK_OBJECT (menu_item_option_man
),
666 GTK_SIGNAL_FUNC (on_man_auto_menu
),
670 if (cam_var
.feature_set
[0].feature
[FEATURE
- FEATURE_MIN
].
675 gtk_widget_set_sensitive (option
, TRUE
);
676 menu_item_option_auto
= gtk_menu_item_new_with_label (_("Auto"));
677 gtk_widget_show (menu_item_option_auto
);
678 gtk_menu_append (GTK_MENU (option_menu
),
679 menu_item_option_auto
);
680 gtk_object_set_data(GTK_OBJECT (menu_item_option_auto
),
683 gtk_object_set_data(GTK_OBJECT (menu_item_option_auto
),
686 g_signal_connect (GTK_OBJECT (menu_item_option_auto
),
688 GTK_SIGNAL_FUNC (on_man_auto_menu
),
692 * add menu non avail.
694 if (!cam_var
.feature_set
[0].feature
[FEATURE
- FEATURE_MIN
].auto_capable
695 && !cam_var
.feature_set
[0].feature
[FEATURE
- FEATURE_MIN
].
698 gtk_widget_set_sensitive (option
,
700 menu_item_option_na
= gtk_menu_item_new_with_label (_("N/A"));
701 gtk_widget_show (menu_item_option_na
);
702 gtk_menu_append (GTK_MENU (option_menu
),
703 menu_item_option_na
);
706 gtk_option_menu_set_menu (GTK_OPTION_MENU (option
),
712 gtk_table_attach(GTK_TABLE(cam
->table_cam
),
718 (GtkAttachOptions
) 0,
719 (GtkAttachOptions
) 0,
725 gtk_table_attach(GTK_TABLE(cam
->table_cam
),
731 (GtkAttachOptions
) 0,
732 (GtkAttachOptions
) (0),
737 gtk_table_attach(GTK_TABLE(cam
->table_cam
),
743 (GtkAttachOptions
) (GTK_EXPAND
| GTK_FILL
),
744 (GtkAttachOptions
) (GTK_FILL
),
750 create_cam(GnomeApp
*main_window
,
753 /*-----------------------------------------------------------------------------
754 * Image Info window with data from header
757 GpivConsole
* gpiv
= gtk_object_get_data(GTK_OBJECT (main_window
), "gpiv");
758 Cam
* cam
= g_new0(Cam
, 1);
761 dac
->cam
->frame_cam
= gtk_frame_new(_("Camera"));
762 gtk_widget_ref(dac
->cam
->frame_cam
);
763 gtk_object_set_data_full(GTK_OBJECT (main_window
),
766 (GtkDestroyNotify
) gtk_widget_unref
);
767 gtk_widget_show(dac
->cam
->frame_cam
);
768 gtk_table_attach(GTK_TABLE(dac
->table
),
774 (GtkAttachOptions
) (GTK_FILL
),
775 (GtkAttachOptions
) (0),
781 dac
->cam
->vbox_cam
= gtk_vbox_new(FALSE
,
783 gtk_widget_ref(dac
->cam
->vbox_cam
);
784 gtk_object_set_data_full(GTK_OBJECT (main_window
),
787 (GtkDestroyNotify
) gtk_widget_unref
);
788 gtk_widget_show(dac
->cam
->vbox_cam
);
789 gtk_container_add(GTK_CONTAINER (dac
->cam
->frame_cam
),
791 /* gtk_table_attach(GTK_TABLE(dac->cam->table_cam), */
792 /* dac->cam->vbox_cam, */
797 /* (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), */
798 /* (GtkAttachOptions) 0, */
802 /* gtk_container_add(GTK_CONTAINER (hbox), */
809 * Camera Shutter menu's and adjuster
812 create_camera_menu(main_window
,
815 create_format_menu(main_window
,
819 create_fps_menu(main_window
,
825 /* dac->cam->frame_trigger = gtk_frame_new(_("Trigger")); */
826 /* gtk_widget_ref(dac->cam->frame_trigger); */
827 /* gtk_object_set_data_full(GTK_OBJECT (main_window), */
828 /* "dac_frame_trigger", */
829 /* dac->cam->frame_trigger, */
830 /* (GtkDestroyNotify) gtk_widget_unref); */
831 /* gtk_widget_show(dac->cam->frame_trigger); */
832 /* gtk_container_add(GTK_CONTAINER (dac->cam->vbox_cam), */
833 /* dac->cam->frame_trigger); */
838 /* dac->cam->vbox_trigger = gtk_vbox_new(FALSE, */
840 /* gtk_widget_ref(dac->cam->vbox_trigger); */
841 /* gtk_object_set_data_full(GTK_OBJECT (main_window), */
842 /* "vbox_trigger", */
843 /* dac->cam->vbox_trigger, */
844 /* (GtkDestroyNotify) gtk_widget_unref); */
845 /* gtk_widget_show(dac->cam->vbox_trigger); */
846 /* gtk_container_add(GTK_CONTAINER (dac->cam->frame_trigger), */
847 /* dac->cam->vbox_trigger); */
852 dac
->cam
->hbox_trigger
= gtk_hbox_new(FALSE
,
854 gtk_widget_ref(dac
->cam
->hbox_trigger
);
855 gtk_object_set_data_full(GTK_OBJECT (main_window
),
857 dac
->cam
->hbox_trigger
,
858 (GtkDestroyNotify
) gtk_widget_unref
);
859 gtk_widget_show(dac
->cam
->hbox_trigger
);
860 gtk_container_add(GTK_CONTAINER (dac
->cam
->vbox_cam
),
861 dac
->cam
->hbox_trigger
);
866 dac
->cam
->trigger_external
= gtk_toggle_button_new_with_label (_("External trigger"));
867 gtk_widget_ref (dac
->cam
->trigger_external
);
868 gtk_object_set_data_full (GTK_OBJECT (main_window
),
870 dac
->cam
->trigger_external
,
871 (GtkDestroyNotify
) gtk_widget_unref
);
872 gtk_widget_show (dac
->cam
->trigger_external
);
873 gtk_container_add(GTK_CONTAINER (dac
->cam
->hbox_trigger
),
874 dac
->cam
->trigger_external
);
875 gtk_widget_set_sensitive (dac
->cam
->trigger_external
,
877 g_signal_connect (GTK_OBJECT (dac
->cam
->trigger_external
), "toggled",
878 GTK_SIGNAL_FUNC (on_trigger_external_toggled
),
884 dac
->cam
->trigger_polarity
= gtk_toggle_button_new_with_label (_("Polarity"));
885 gtk_widget_ref (dac
->cam
->trigger_polarity
);
886 gtk_object_set_data_full (GTK_OBJECT (main_window
),
888 dac
->cam
->trigger_polarity
,
889 (GtkDestroyNotify
) gtk_widget_unref
);
890 gtk_widget_show (dac
->cam
->trigger_polarity
);
891 gtk_container_add(GTK_CONTAINER (dac
->cam
->hbox_trigger
),
892 dac
->cam
->trigger_polarity
);
893 gtk_widget_set_sensitive (dac
->cam
->trigger_polarity
,
895 g_signal_connect (GTK_OBJECT (dac
->cam
->trigger_polarity
), "toggled",
896 GTK_SIGNAL_FUNC (on_trigger_polarity_toggled
),
901 create_trigger_mode(main_window
,
904 * Enable triggering with the cam
907 dac
->cam
->checkbutton_camera_trigger
=
908 gtk_check_button_new_with_label(_("RTAI triggering"));
909 gtk_widget_ref(dac
->cam
->checkbutton_camera_trigger
);
910 gtk_object_set_data_full(GTK_OBJECT (main_window
),
911 "button_camera_trigger",
912 dac
->cam
->checkbutton_camera_trigger
,
913 (GtkDestroyNotify
) gtk_widget_unref
);
914 gtk_widget_show(dac
->cam
->checkbutton_camera_trigger
);
915 gtk_container_add(GTK_CONTAINER (dac
->cam
->vbox_cam
),
916 dac
->cam
->checkbutton_camera_trigger
);
917 gtk_tooltips_set_tip(gpiv
->tooltips
,
918 dac
->cam
->checkbutton_camera_trigger
,
919 _("Enables triggering of the camera and laser. "
920 "Else, the camera will 'free run', mostly at "
921 "30 frames per second."),
924 gtk_object_set_data(GTK_OBJECT (dac
->cam
->checkbutton_camera_trigger
),
927 g_signal_connect(GTK_OBJECT (dac
->cam
->checkbutton_camera_trigger
),
929 G_CALLBACK (on_checkbutton_camera_trigger_enter
),
931 g_signal_connect(GTK_OBJECT (dac
->cam
->checkbutton_camera_trigger
),
933 G_CALLBACK (on_widget_leave
),
935 g_signal_connect(GTK_OBJECT (dac
->cam
->checkbutton_camera_trigger
),
937 G_CALLBACK (on_checkbutton_camera_trigger
),
939 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON
940 (dac
->cam
->checkbutton_camera_trigger
),
941 gpiv_par
.trigger_cam
);
942 #endif /* ENABLE_TRIG */
946 dac
->cam
->table_cam
= gtk_table_new(9,
949 gtk_widget_ref(dac
->cam
->table_cam
);
950 gtk_object_set_data_full(GTK_OBJECT (main_window
),
953 (GtkDestroyNotify
) gtk_widget_unref
);
954 gtk_widget_show(dac
->cam
->table_cam
);
955 gtk_container_add(GTK_CONTAINER (dac
->cam
->vbox_cam
),
956 dac
->cam
->table_cam
);
961 * Report Camera temperature
966 dac
->cam
->label_label_temp
= gtk_label_new(_("temp (C): "));
967 gtk_widget_ref(dac
->cam
->label_label_temp
);
968 gtk_object_set_data_full(GTK_OBJECT (main_window
),
969 "dac_label_label_temp",
970 dac
->cam
->label_label_temp
,
971 (GtkDestroyNotify
) gtk_widget_unref
);
972 gtk_widget_show(dac
->cam
->label_label_temp
);
973 gtk_table_attach(GTK_TABLE(dac
->cam
->table_cam
),
974 dac
->cam
->label_label_temp
,
979 (GtkAttachOptions
) (GTK_EXPAND
| GTK_FILL
),
980 (GtkAttachOptions
) 0,
987 dac
->cam
->label_temp
= gtk_label_new("");
988 gtk_widget_ref(dac
->cam
->label_temp
);
989 gtk_object_set_data_full(GTK_OBJECT (main_window
),
991 dac
->cam
->label_temp
,
992 (GtkDestroyNotify
) gtk_widget_unref
);
993 gtk_widget_show(dac
->cam
->label_temp
);
994 gtk_table_attach(GTK_TABLE(dac
->cam
->table_cam
),
995 dac
->cam
->label_temp
,
1000 (GtkAttachOptions
) (GTK_EXPAND
| GTK_FILL
),
1001 (GtkAttachOptions
) 0,
1005 /* g_warning("cr_dac:: feature T; %s", */
1006 /* dc1394_feature_desc[FEATURE_TEMPERATURE - FEATURE_MIN]); */
1011 * Camera Exposure menu's and adjuster
1013 * First define the scale as its data are set for the menu items
1015 create_camera_feature_menu_scale(main_window
,
1020 dac
->cam
->camera_exposure
,
1021 dac
->cam
->camera_exposure_menu
,
1022 dac
->cam
->menu_item_camera_exposure_man
,
1023 dac
->cam
->menu_item_camera_exposure_auto
,
1024 dac
->cam
->menu_item_camera_exposure_na
,
1025 dac
->cam
->adj_exposure_scale
,
1026 dac
->cam
->exposure_scale
1029 * Camera Iris menu's and adjuster
1031 create_camera_feature_menu_scale(main_window
,
1036 dac
->cam
->camera_iris
,
1037 dac
->cam
->camera_iris_menu
,
1038 dac
->cam
->menu_item_camera_iris_man
,
1039 dac
->cam
->menu_item_camera_iris_auto
,
1040 dac
->cam
->menu_item_camera_iris_na
,
1041 dac
->cam
->adj_iris_scale
,
1042 dac
->cam
->iris_scale
1046 * Camera Shutter menu's and adjuster
1048 create_camera_feature_menu_scale(main_window
,
1053 dac
->cam
->camera_shutter
,
1054 dac
->cam
->camera_shutter_menu
,
1055 dac
->cam
->menu_item_camera_shutter_man
,
1056 dac
->cam
->menu_item_camera_shutter_auto
,
1057 dac
->cam
->menu_item_camera_shutter_na
,
1058 dac
->cam
->adj_shutter_scale
,
1059 dac
->cam
->shutter_scale
1063 * Camera Gain menu's and adjuster
1065 create_camera_feature_menu_scale(main_window
,
1070 dac
->cam
->camera_gain
,
1071 dac
->cam
->camera_gain_menu
,
1072 dac
->cam
->menu_item_camera_gain_man
,
1073 dac
->cam
->menu_item_camera_gain_auto
,
1074 dac
->cam
->menu_item_camera_gain_na
,
1075 dac
->cam
->adj_gain_scale
,
1076 dac
->cam
->gain_scale
1080 * Camera Temperature menu's and adjuster
1082 create_camera_feature_menu_scale(main_window
,
1084 FEATURE_TEMPERATURE
,
1087 dac
->cam
->camera_temp
,
1088 dac
->cam
->camera_temp_menu
,
1089 dac
->cam
->menu_item_camera_temp_man
,
1090 dac
->cam
->menu_item_camera_temp_auto
,
1091 dac
->cam
->menu_item_camera_temp_na
,
1092 dac
->cam
->adj_temp_scale
,
1093 dac
->cam
->temp_scale
1097 * Camera Zoom menu's and adjuster
1099 create_camera_feature_menu_scale(main_window
,
1104 dac
->cam
->camera_zoom
,
1105 dac
->cam
->camera_zoom_menu
,
1106 dac
->cam
->menu_item_camera_zoom_man
,
1107 dac
->cam
->menu_item_camera_zoom_auto
,
1108 dac
->cam
->menu_item_camera_zoom_na
,
1109 dac
->cam
->adj_zoom_scale
,
1110 dac
->cam
->zoom_scale
1114 * Camera Pan menu's and adjuster
1116 create_camera_feature_menu_scale(main_window
,
1121 dac
->cam
->camera_pan
,
1122 dac
->cam
->camera_pan_menu
,
1123 dac
->cam
->menu_item_camera_pan_man
,
1124 dac
->cam
->menu_item_camera_pan_auto
,
1125 dac
->cam
->menu_item_camera_pan_na
,
1126 dac
->cam
->adj_pan_scale
,
1131 * Camera Tilt menu's and adjuster
1133 create_camera_feature_menu_scale(main_window
,
1138 dac
->cam
->camera_tilt
,
1139 dac
->cam
->camera_tilt_menu
,
1140 dac
->cam
->menu_item_camera_tilt_man
,
1141 dac
->cam
->menu_item_camera_tilt_auto
,
1142 dac
->cam
->menu_item_camera_tilt_na
,
1143 dac
->cam
->adj_tilt_scale
,
1144 dac
->cam
->tilt_scale
1148 * Record activating button
1150 dac
->cam
->button_cam_start
= gtk_button_new_with_label(_("start camera"));
1151 gtk_widget_ref(dac
->cam
->button_cam_start
);
1152 gtk_object_set_data_full(GTK_OBJECT (main_window
),
1154 dac
->cam
->button_cam_start
,
1155 (GtkDestroyNotify
) gtk_widget_unref
);
1156 gtk_widget_show(dac
->cam
->button_cam_start
);
1157 gtk_table_attach(GTK_TABLE(dac
->table
),
1158 dac
->cam
->button_cam_start
,
1163 (GtkAttachOptions
) (GTK_FILL
),
1164 (GtkAttachOptions
) (GTK_FILL
),
1167 gtk_tooltips_set_tip(gpiv
->tooltips
,
1168 dac
->cam
->button_cam_start
,
1169 _("Starts camera to record PIV images of an area that is illuminated "
1170 "by a (double cavity Nd-YAG) laser and is observed "
1171 "by a CCD camera. Camera and lasers are eventually "
1172 "triggered by TTL pulses from the (parallel) output "
1176 gtk_object_set_data(GTK_OBJECT (dac
->cam
->button_cam_start
),
1179 g_signal_connect(GTK_OBJECT (dac
->cam
->button_cam_start
),
1181 G_CALLBACK (on_button_dac_camstart_enter
),
1183 g_signal_connect(GTK_OBJECT (dac
->cam
->button_cam_start
),
1185 G_CALLBACK (on_widget_leave
),
1187 g_signal_connect(GTK_OBJECT (dac
->cam
->button_cam_start
),
1191 G_CALLBACK (on_button_dac_camstart
),
1196 * Record de-activating button
1198 dac
->cam
->button_cam_stop
= gtk_button_new_with_label(_("stop camera"));
1199 gtk_widget_ref(dac
->cam
->button_cam_stop
);
1200 gtk_object_set_data_full(GTK_OBJECT (main_window
),
1202 dac
->cam
->button_cam_stop
,
1203 (GtkDestroyNotify
) gtk_widget_unref
);
1204 gtk_widget_show(dac
->cam
->button_cam_stop
);
1205 gtk_table_attach(GTK_TABLE(dac
->table
),
1206 dac
->cam
->button_cam_stop
,
1211 (GtkAttachOptions
) (GTK_FILL
),
1212 (GtkAttachOptions
) (GTK_FILL
),
1215 gtk_tooltips_set_tip(gpiv
->tooltips
,
1216 dac
->cam
->button_cam_stop
,
1217 _("Stops camera to record of PIV images "
1218 "and, eventually, cancels sending of trigger pulses"),
1221 gtk_object_set_data(GTK_OBJECT (dac
->cam
->button_cam_stop
),
1224 g_signal_connect(GTK_OBJECT (dac
->cam
->button_cam_stop
),
1226 G_CALLBACK (on_button_dac_camstop_enter
),
1228 g_signal_connect(GTK_OBJECT (dac
->cam
->button_cam_stop
),
1230 G_CALLBACK (on_widget_leave
),
1232 g_signal_connect(GTK_OBJECT (dac
->cam
->button_cam_stop
),
1234 G_CALLBACK (on_button_dac_camstop
),