bugrepair VFS, update autotools files
[gpiv.git] / src / dac_cam_interface.c
blobbae5651524d6982f6f1f264528070287f7a26550
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 * 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)
42 #ifdef ENABLE_CAM
43 #ifdef HAVE_CONFIG_H
44 # include <config.h>
45 #endif
47 #include "gpiv_gui.h"
48 #include "dac_cam_interfac.h"
49 #include "dac_cam.h"
52 static void
53 create_camera_menu(GnomeApp *main_window,
54 Cam *cam
56 /*-----------------------------------------------------------------------------
57 * From coriander: build_menus.c BuildCameraMenu
60 int i;
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),
73 "camera_select",
74 cam->camera_select,
75 (GtkDestroyNotify) gtk_widget_unref);
76 gtk_widget_show (cam->camera_select);
77 gtk_container_add(GTK_CONTAINER (cam->vbox_cam),
78 cam->camera_select);
80 if (cam_var.numCameras >= 1) {
81 gtk_widget_set_sensitive (cam->camera_select, TRUE);
82 } else {
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++) {
91 g_snprintf(tmp,
92 GPIV_MAX_CHARS,
93 "Node %d: %s %s",
94 cam_var.camera[i].id,
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),
100 cam->menu_item);
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),
104 "activate",
105 GTK_SIGNAL_FUNC (on_menu_camera_select),
106 (int *) i);
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;
115 } else {
116 g_snprintf(tmp,
117 GPIV_MAX_CHARS,
118 "No camera");
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),
122 cam->menu_item);
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) ,
139 /* camera_act */ 0);
145 static void
146 create_format_menu(GnomeApp *main_window,
147 GpivConsole * gpiv,
148 Cam *cam
150 /*-----------------------------------------------------------------------------
151 * From coriander: build_menus.c BuildCameraMenu
154 int i;
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,
161 &formats);
162 dc1394_query_supported_modes(cam_var.camera[0].handle,
163 cam_var.camera[0].id,
164 FORMAT_VGA_NONCOMPRESSED,
165 &modes);
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),
177 "format_menu",
178 cam->format_menu,
179 (GtkDestroyNotify) gtk_widget_unref);
180 gtk_widget_show (cam->format_menu);
181 gtk_container_add(GTK_CONTAINER (cam->vbox_cam),
182 cam->format_menu);
185 cam->format_menu_menu = gtk_menu_new ();
186 if (cam_var.numCameras > 0) {
188 * Format 0
190 if (formats & (0x1 << 31)) {
191 for (i = 0; i < NUM_FORMAT0_MODES; i++) {
192 if ( modes & (0x1 << (31-i))) {
193 g_snprintf(tmp,
194 GPIV_MAX_CHARS,
195 "Format 0: %s",
196 format0_desc[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),
200 cam->menu_item);
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),
209 "gpiv",
210 gpiv);
211 g_signal_connect (GTK_OBJECT (cam->menu_item),
212 "activate",
213 GTK_SIGNAL_FUNC (on_menu_format),
214 (int*)(i + MODE_FORMAT0_MIN));
221 * Format 1
223 if (formats & (0x1 << 30)) {
224 for (i = 0; i < NUM_FORMAT1_MODES; i++) {
225 if ( modes & (0x1 << (30-i))) {
226 g_snprintf(tmp,
227 GPIV_MAX_CHARS,
228 "Format 1: %s",
229 format1_desc[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),
233 cam->menu_item);
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),
240 "activate",
241 GTK_SIGNAL_FUNC (on_menu_format),
242 (int*)(i + MODE_FORMAT1_MIN));
250 * Format 2
252 if (formats & (0x1 << 29)) {
253 for (i = 0; i < NUM_FORMAT2_MODES; i++) {
254 if ( modes & (0x1 << (29-i))) {
255 g_snprintf(tmp,
256 GPIV_MAX_CHARS,
257 "Format 2: %s",
258 format2_desc[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),
262 cam->menu_item);
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),
270 "activate",
271 GTK_SIGNAL_FUNC (on_menu_format),
272 (int*)(i + MODE_FORMAT2_MIN));
279 * Format 6
281 if (formats & (0x1 << 25)) {
282 for (i = 0; i < NUM_FORMAT6_MODES; i++) {
283 if ( modes & (0x1 << (25-i))) {
284 g_snprintf(tmp,
285 GPIV_MAX_CHARS,
286 "Format 6: %s",
287 format6_desc[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),
291 cam->menu_item);
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),
299 "activate",
300 GTK_SIGNAL_FUNC (on_menu_format),
301 (int*)(i + MODE_FORMAT6_MIN));
307 } else {
308 g_snprintf(tmp,
309 GPIV_MAX_CHARS,
310 "No Formats");
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),
314 cam->menu_item);
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) ,
328 /* camera_act */ 0);
336 static void
337 create_fps_menu(GnomeApp *main_window,
338 Cam *cam
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];
350 quadlet_t value;
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 */
355 } else {
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,
360 &value);
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),
376 "fps_menu",
377 cam->fps_menu,
378 (GtkDestroyNotify) gtk_widget_unref);
379 gtk_widget_show (cam->fps_menu);
380 gtk_container_add(GTK_CONTAINER (cam->vbox_cam),
381 cam->fps_menu);
384 cam->fps_menu_menu = gtk_menu_new ();
385 if (cam_var.numCameras > 0) {
386 k = 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) ) ) {
392 index[i]=k;
393 k++;
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),
397 cam->menu_item);
399 /* gtk_object_set_data(GTK_OBJECT (cam->menu_item), */
400 /* "gpiv", */
401 /* gpiv); */
402 g_signal_connect (GTK_OBJECT (cam->menu_item),
403 "activate",
404 GTK_SIGNAL_FUNC (on_menu_fps),
405 /* (int*)(i + MODE_FPS0_MIN)); */
406 (int*)f);
408 else
409 index[i] = -1; // framerate not supported
411 gtk_option_menu_set_menu (GTK_OPTION_MENU (cam->fps_menu),
412 cam->fps_menu_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]
421 >= 0) {
422 // try down
423 new_framerate=cam_var.misc_info[0].framerate - i;
424 cont=DC1394_FALSE;
427 if (((cam_var.misc_info[0].framerate - FRAMERATE_MIN + i)
428 < NUM_FRAMERATES)
429 && cont) {
430 if (index[cam_var.misc_info[0].framerate - FRAMERATE_MIN + i]
431 >=0) {
432 // try up
433 new_framerate=cam_var.misc_info[0].framerate + i;
434 cont=DC1394_FALSE;
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]);
441 warning_gpiv(tmp);
442 err = dc1394_set_video_framerate(cam_var.camera[0].handle,
443 cam_var.camera[0].id,
444 new_framerate);
445 if (!err)
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 -
451 FRAMERATE_MIN]);
460 static void
461 create_trigger_mode(GnomeApp *main_window,
462 Cam *cam
464 /*-----------------------------------------------------------------------------
465 * From coriander: build_menus.c BuildCameraMenu
468 gint err, i, f, modes = 0;
469 quadlet_t value;
470 gint k=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,
477 FEATURE_TRIGGER,
478 &value);
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),
495 "trigger_mode",
496 cam->trigger_mode,
497 (GtkDestroyNotify) gtk_widget_unref);
498 gtk_widget_show (cam->trigger_mode);
499 gtk_container_add(GTK_CONTAINER (cam->vbox_cam),
500 cam->trigger_mode);
503 cam->trigger_mode_menu = gtk_menu_new ();
504 if (cam_var.numCameras > 0) {
505 if (modes) {
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))) {
512 index[i]=k;
513 k++;
514 cam->menu_item =
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),
518 cam->menu_item);
519 g_signal_connect (GTK_OBJECT (cam->menu_item),
520 "activate",
521 GTK_SIGNAL_FUNC (on_trigger_mode_activate),
522 (int*) f);
524 else
525 index[i]=0;
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]
536 .trigger_mode]);
543 static void
544 create_camera_feature_menu_scale(GnomeApp *main_window,
545 Cam *cam,
546 gint FEATURE,
547 gchar *description,
548 gint row,
550 GtkWidget *option,
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,
556 GtkWidget *scale
558 /*-----------------------------------------------------------------------------
561 GtkWidget *label;
562 gint col = 0;
564 label = gtk_label_new(_(description));
565 gtk_widget_ref(label);
566 gtk_object_set_data_full(GTK_OBJECT (main_window),
567 "label",
568 label,
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].
576 readout_capable) {
577 adj_scale =
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,
586 } else {
587 adj_scale =
588 gtk_adjustment_new(0,
590 255,
595 scale = gtk_hscale_new (GTK_ADJUSTMENT
596 (adj_scale));
597 gtk_widget_ref (scale);
598 gtk_object_set_data_full (GTK_OBJECT (main_window),
599 "scale",
600 scale,
601 (GtkDestroyNotify) gtk_widget_unref);
602 gtk_widget_show (scale);
603 gtk_widget_set_sensitive (scale,
604 FALSE);
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].
610 readout_capable) {
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].
617 manual_capable) {
619 * set glider active and connect
621 gtk_widget_set_sensitive (scale, TRUE);
622 g_signal_connect (GTK_OBJECT (adj_scale),
623 "value_changed",
624 GTK_SIGNAL_FUNC (on_scale_changed),
625 (int*) FEATURE);
631 option = gtk_option_menu_new ();
632 gtk_widget_ref (option);
633 gtk_object_set_data_full (GTK_OBJECT (main_window),
634 "option",
635 option,
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), */
640 /* "dac", */
641 /* dac); */
645 option_menu = gtk_menu_new ();
646 if (cam_var.numCameras > 0) {
647 if (cam_var.feature_set[0].feature[FEATURE - FEATURE_MIN].
648 manual_capable) {
650 * add menu man
652 gtk_widget_set_sensitive (option,
653 TRUE);
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),
660 "scale",
661 scale);
662 gtk_object_set_data(GTK_OBJECT (menu_item_option_man),
663 "var_type",
664 "0");
665 g_signal_connect (GTK_OBJECT (menu_item_option_man),
666 "activate",
667 GTK_SIGNAL_FUNC (on_man_auto_menu),
668 (int*) FEATURE);
671 if (cam_var.feature_set[0].feature[FEATURE - FEATURE_MIN].
672 auto_capable) {
674 * add menu auto
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),
682 "scale",
683 scale);
684 gtk_object_set_data(GTK_OBJECT (menu_item_option_auto),
685 "var_type",
686 "1");
687 g_signal_connect (GTK_OBJECT (menu_item_option_auto),
688 "activate",
689 GTK_SIGNAL_FUNC (on_man_auto_menu),
690 (int*) FEATURE);
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].
697 manual_capable
699 gtk_widget_set_sensitive (option,
700 FALSE);
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),
708 option_menu);
713 gtk_table_attach(GTK_TABLE(cam->table_cam),
714 label,
715 col,
716 col + 1,
717 row,
718 row + 1,
719 (GtkAttachOptions) 0,
720 (GtkAttachOptions) 0,
726 gtk_table_attach(GTK_TABLE(cam->table_cam),
727 option,
728 col + 1,
729 col + 2,
730 row,
731 row + 1,
732 (GtkAttachOptions) 0,
733 (GtkAttachOptions) (0),
738 gtk_table_attach(GTK_TABLE(cam->table_cam),
739 scale,
740 col + 2,
741 col + 3,
742 row,
743 row + 1,
744 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
745 (GtkAttachOptions) (GTK_FILL),
750 Cam *
751 create_cam(GnomeApp *main_window,
752 GtkWidget *container
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),
765 "dac_frame_cam",
766 dac->cam->frame_cam,
767 (GtkDestroyNotify) gtk_widget_unref);
768 gtk_widget_show(dac->cam->frame_cam);
769 gtk_table_attach(GTK_TABLE(dac->table),
770 dac->cam->frame_cam,
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),
786 "vbox_cam",
787 dac->cam->vbox_cam,
788 (GtkDestroyNotify) gtk_widget_unref);
789 gtk_widget_show(dac->cam->vbox_cam);
790 gtk_container_add(GTK_CONTAINER (dac->cam->frame_cam),
791 dac->cam->vbox_cam);
792 /* gtk_table_attach(GTK_TABLE(dac->cam->table_cam), */
793 /* dac->cam->vbox_cam, */
794 /* 0, */
795 /* 3, */
796 /* 6, */
797 /* 7, */
798 /* (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), */
799 /* (GtkAttachOptions) 0, */
800 /* 0, */
801 /* 0); */
803 /* gtk_container_add(GTK_CONTAINER (hbox), */
804 /* label); */
807 * Camera select
810 * Camera Shutter menu's and adjuster
813 create_camera_menu(main_window,
814 dac->cam);
816 create_format_menu(main_window,
817 gpiv,
818 dac->cam);
820 create_fps_menu(main_window,
821 dac->cam);
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, */
840 /* 0); */
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),
857 "hbox_trigger",
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),
870 "trigger_external",
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,
877 FALSE);
878 g_signal_connect (GTK_OBJECT (dac->cam->trigger_external), "toggled",
879 GTK_SIGNAL_FUNC (on_trigger_external_toggled),
880 NULL);
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),
888 "trigger_polarity",
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,
895 FALSE);
896 g_signal_connect (GTK_OBJECT (dac->cam->trigger_polarity), "toggled",
897 GTK_SIGNAL_FUNC (on_trigger_polarity_toggled),
898 NULL);
902 create_trigger_mode(main_window,
903 dac->cam);
905 * Enable triggering with the cam
907 #ifdef ENABLE_TRIG
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."),
923 NULL);
925 gtk_object_set_data(GTK_OBJECT (dac->cam->checkbutton_camera_trigger),
926 "gpiv",
927 gpiv);
928 g_signal_connect(GTK_OBJECT (dac->cam->checkbutton_camera_trigger),
929 "enter",
930 G_CALLBACK (on_checkbutton_camera_trigger_enter),
931 NULL);
932 g_signal_connect(GTK_OBJECT (dac->cam->checkbutton_camera_trigger),
933 "leave",
934 G_CALLBACK (on_widget_leave),
935 NULL);
936 g_signal_connect(GTK_OBJECT (dac->cam->checkbutton_camera_trigger),
937 "clicked",
938 G_CALLBACK (on_checkbutton_camera_trigger),
939 NULL);
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,
949 FALSE);
950 gtk_widget_ref(dac->cam->table_cam);
951 gtk_object_set_data_full(GTK_OBJECT (main_window),
952 "dac_table_cam",
953 dac->cam->table_cam,
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),
991 "dac_label_temp",
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,
1017 dac->cam,
1018 FEATURE_EXPOSURE,
1019 "Exp:",
1020 /* row */ 2,
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,
1033 dac->cam,
1034 FEATURE_IRIS,
1035 "Iris:",
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,
1050 dac->cam,
1051 FEATURE_SHUTTER,
1052 "Shut:",
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,
1067 dac->cam,
1068 FEATURE_GAIN,
1069 "Gain:",
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,
1084 dac->cam,
1085 FEATURE_TEMPERATURE,
1086 "Temp:",
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,
1101 dac->cam,
1102 FEATURE_ZOOM,
1103 "Zoom:",
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,
1118 dac->cam,
1119 FEATURE_PAN,
1120 "Pan:",
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,
1128 dac->cam->pan_scale
1132 * Camera Tilt menu's and adjuster
1134 create_camera_feature_menu_scale(main_window,
1135 dac->cam,
1136 FEATURE_TILT,
1137 "Tilt:",
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),
1154 "button_cam_start",
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 "
1174 "port."),
1175 NULL);
1177 gtk_object_set_data(GTK_OBJECT (dac->cam->button_cam_start),
1178 "gpiv",
1179 gpiv);
1180 g_signal_connect(GTK_OBJECT (dac->cam->button_cam_start),
1181 "enter",
1182 G_CALLBACK (on_button_dac_camstart_enter),
1183 NULL);
1184 g_signal_connect(GTK_OBJECT (dac->cam->button_cam_start),
1185 "leave",
1186 G_CALLBACK (on_widget_leave),
1187 NULL);
1188 g_signal_connect(GTK_OBJECT (dac->cam->button_cam_start),
1189 /* "clicked", */
1190 /* "released", */
1191 "pressed",
1192 G_CALLBACK (on_button_dac_camstart),
1193 NULL);
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),
1202 "button_cam_stop",
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"),
1220 NULL);
1222 gtk_object_set_data(GTK_OBJECT (dac->cam->button_cam_stop),
1223 "gpiv",
1224 gpiv);
1225 g_signal_connect(GTK_OBJECT (dac->cam->button_cam_stop),
1226 "enter",
1227 G_CALLBACK (on_button_dac_camstop_enter),
1228 NULL);
1229 g_signal_connect(GTK_OBJECT (dac->cam->button_cam_stop),
1230 "leave",
1231 G_CALLBACK (on_widget_leave),
1232 NULL);
1233 g_signal_connect(GTK_OBJECT (dac->cam->button_cam_stop),
1234 "clicked",
1235 G_CALLBACK (on_button_dac_camstop),
1236 NULL);
1237 return cam;