parameter flags (parameter_logic) defined as gboolean
[gpiv.git] / src / dac.c
blob9dc5a8e6828072cebf7350ae9c202316f4df8701
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
9 Gerber van der Graaf <gerber_graaf@users.sourceforge.net>
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 * Dac callbacks
31 * $Id: dac.c,v 1.5 2005-02-26 09:43:30 gerber Exp $
35 #ifndef DISABLE_DAC
37 #include <pthread.h>
38 #include "gpiv_gtk.h"
39 #include "utils.h"
40 #include "console.h"
41 #include "display.h"
42 #include "dac.h"
43 /* #include "dac_cam.h" */
44 #include <libdc1394/dc1394_control.h>
46 /* #include <sys/types.h> */
47 /* #include <sys/stat.h> */
48 /* #include <fcntl.h> */
52 * BUGFIX: Put somwhere to update on regular basis:
53 gtk_label_set_text(GTK_LABEL(gpiv->dac->label_temp),
54 "Temp");
57 static int init, start, stop, error;
59 typedef struct _ImgFrame ImgFrame;
60 struct _ImgFrame {
61 unsigned char **A;
62 unsigned char **B;
63 /* gint count; */
66 pthread_mutex_t mutex_rec = PTHREAD_MUTEX_INITIALIZER;
68 void
69 thread_rec_frame(void *img_frame);
72 static void
73 thread_rec_frame_serie(ImgFrame img_frame[GPIV_NIMG_MAX]
76 static void
77 rec_frame(ImgFrame *img_frame
80 static void
81 add_buffer(GpivConsole *gpiv,
82 gchar *fname_base,
83 gint ibuf,
84 unsigned char **frameA,
85 unsigned char **frameB
88 static void
89 renew_buffer(GpivConsole *gpiv,
90 gchar *fname_base,
91 gint ibuf,
92 unsigned char **frameA,
93 unsigned char **frameB
96 static void
97 recreate_img(Display * disp,
98 unsigned char **frameA,
99 unsigned char **frameB
103 static int
104 open_dac_img(GpivCamVar *cam_var,
105 unsigned char **frameA,
106 unsigned char **frameB,
107 Image * img,
108 gboolean alloc_mem
110 /*-----------------------------------------------------------------------------
111 * Opens an image obtained from the camera (<=> open_img from file)
114 gint i, j;
116 * parameter initializing of image
118 img->image_par.depth_logic = FALSE;
119 img->image_par.ncolumns_logic = FALSE;
120 img->image_par.nrows_logic = FALSE;
121 img->image_par.x_corr_logic = FALSE;
122 img->image_par.s_scale_logic = FALSE;
123 img->image_par.t_scale_logic = FALSE;
124 img->image_par.z_off_logic = FALSE;
125 img->image_par.project_logic = FALSE;
126 img->image_par.creation_date_logic = FALSE;
127 img->image_par.location_logic = FALSE;
128 img->image_par.comment_logic = FALSE;
130 img->image_par.ncolumns = cam_var->capture[0].frame_width;
131 img->image_par.nrows = cam_var->capture[0].frame_height;
132 img->image_par.x_corr = gpiv_par.x_corr;
133 img->image_par.ncolumns_logic = TRUE;
134 img->image_par.nrows_logic = TRUE;
135 img->image_par.x_corr_logic = TRUE;
139 gpiv_img_cp_parameters (image_par, &img->image_par, FALSE, FALSE);
142 /* if(alloc_mem) { */
143 img->img1 = gpiv_alloc_img(img->image_par);
144 /* } */
146 for (i = 0; i < img->image_par.nrows ; i++) {
147 for (j = 0; j < img->image_par.ncolumns; j++) {
149 * format 640x480 = 1:1.3
151 img->img1[i][j/* + i/3 */] = (guint16) frameA[i][j];
157 if (gpiv_par.x_corr) {
158 /* if(alloc_mem) { */
159 img->img2 = gpiv_alloc_img(img->image_par);
160 /* } */
161 for (i = 0; i < img->image_par.nrows ; i++) {
162 for (j = 0; j < img->image_par.ncolumns; j++) {
164 * format 640x480 = 1:1.3
166 img->img2[i][j/* + i/3 */] = (guint16) frameB[i][j];
169 } else {
170 img->img2 = img->img1;
174 img->exist_img = TRUE;
175 return 0;
179 static void
180 load_dac_buffer(GpivConsole *gpiv,
181 GpivCamVar *cam_var,
182 gboolean second_image,
183 char *fname,
184 int ibuf,
185 unsigned char **frameA,
186 unsigned char **frameB,
187 enum ClistPut clist_put)
188 /*-----------------------------------------------------------------------------
189 * create display and its (popup) menu, load image, piv data and puts
190 * buffername into clist
193 gint return_val = 0;
194 gchar *clist_buf_txt[MAX_BUFS][2], cl_int[4];
197 display[ibuf] = create_display(fname, ibuf, gpiv);
198 display_act = display[ibuf];
199 gtk_widget_show(display_act->mwin);
201 /* zoom_display(display_act, display_act->zoom_index); */
205 g_snprintf(display_act->fname_base, GPIV_MAX_CHARS, "%s", fname);
206 if((return_val = open_dac_img(cam_var, frameA, frameB,
207 &display_act->img, FALSE)) != 0) {
208 gtk_object_destroy(GTK_OBJECT(display[ibuf]->mwin));
209 if (ibuf > 0) {
210 ibuf = nbufs - 1;;
211 display_act = display[ibuf];
212 } else {
213 display_act = NULL;
215 nbufs--;
216 return;
220 * Pop-up menu after loading data
222 display_act->display_menu = create_display_menu(display_act);
223 gtk_widget_show(display_act->display_menu);
224 gtk_signal_connect_object(GTK_OBJECT(display_act->mwin),
225 "button_press_event",
226 GTK_SIGNAL_FUNC (on_my_popup_handler),
227 GTK_OBJECT(display_act->display_menu));
230 zoom_display(display_act, display_act->zoom_index);
233 * Displaying
235 /* display_act->img.exist_img = TRUE; */
236 create_background(display_act);
237 create_img(display_act);
238 if (display_act->display_img1) {
239 show_img1(display_act);
240 } else {
241 hide_img1(display_act);
244 if (image_par.x_corr) {
245 if (display_act->display_img2) {
246 show_img2(display_act);
247 } else {
248 hide_img2(display_act);
253 /* display_act->img.img_mean = image_mean(display_act->img.img1, */
254 /* gpiv_par.img_width, */
255 /* gpiv_par.img_height); */
258 if (gpiv_par.display_intregs == 1) create_all_intregs(display_act);
261 * Add buffer to list
263 g_snprintf(cl_int, 4, "%d", ibuf);
264 clist_buf_txt[ibuf][0] = (gchar *) cl_int;
265 clist_buf_txt[ibuf][1] = fname;
266 if (clist_put == PREPEND) {
267 gtk_clist_prepend(GTK_CLIST(gpiv->clist_buf),
268 clist_buf_txt[ibuf]);
269 } else if (clist_put == INSERT) {
270 gtk_clist_insert(GTK_CLIST(gpiv->clist_buf), ibuf,
271 clist_buf_txt[ibuf]);
272 } else if (clist_put == APPEND) {
273 gtk_clist_append(GTK_CLIST(gpiv->clist_buf),
274 clist_buf_txt[ibuf]);
275 } else {
276 gtk_error("non-existent CLIST enumerate");
279 gtk_clist_set_row_data(GTK_CLIST(gpiv->clist_buf), ibuf,
280 display_act);
286 static void
287 rec_and_display(GpivConsole *gpiv
288 /* , ImgFrame *img_frame */
290 /*-----------------------------------------------------------------------------
293 gint ibuf = 0;
294 ImgFrame img_frame[GPIV_NIMG_MAX];
296 gint return_val = 0;
297 pthread_t thread_rec;
298 pthread_attr_t attr;
300 pthread_attr_init(&attr);
301 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
304 if (dac_par.ttime.mode == GPIV_TIMER_MODE__DURATION) {
306 * Closing existing buffer windows and cleaning up Clist
308 for (ibuf = 0; ibuf < nbufs; ibuf++) {
309 if (display[ibuf] != NULL) {
310 close_buffer(gpiv, display[ibuf], &ibuf);
313 gtk_clist_clear(GTK_CLIST(gpiv->clist_buf));
314 nbufs = 0;
317 * allocating image mem
319 for (ibuf = 0; ibuf < dac_par.ttime.cycles; ibuf++) {
320 img_frame[ibuf].A =
321 gpiv_ucmatrix(0, cam_var.capture[0].frame_height - 1,
322 0, cam_var.capture[0].frame_width - 1);
323 if (gpiv_par.x_corr) {
324 img_frame[ibuf].B = gpiv_ucmatrix(0, gpiv_par.img_height - 1,
325 0, gpiv_par.img_width - 1);
330 * recording
334 * use threading
336 /* if (verbose) */
337 /* g_message("rec_and_display:: Creating thread_rec from %d", pthread_self ()); */
338 if ((return_val = pthread_create(&thread_rec,
339 &attr,
340 (void *) &thread_rec_frame_serie,
341 (void *) &img_frame)) == TRUE) {
342 pthread_exit(NULL);
343 g_error("return code from pthread_create() is %d\n", return_val);
345 pthread_join(thread_rec, NULL);
346 g_message ("rec_and_display:: waited on thread_rec. Done");
349 * use no threading
351 /* for (ibuf = 0; ibuf < dac_par.ttime.cycles; ibuf++) { */
352 /* if (cancel_process) break; */
353 /* rec_frame(&img_frame[ibuf]); */
355 /* progress_value = (gfloat) (ibuf + 1.0) / */
356 /* (gfloat) dac_par.ttime.cycles; */
357 /* g_snprintf(progress_string, GPIV_MAX_CHARS, */
358 /* "recording image #%d", ibuf); */
359 /* while (g_main_iteration(FALSE)); */
360 /* gtk_progress_set_value(gnome_appbar_get_progress */
361 /* (GNOME_APPBAR(gpiv->appbar)), */
362 /* progress_value * 100.0); */
363 /* gnome_appbar_push(GNOME_APPBAR(gpiv->appbar), */
364 /* progress_string); */
365 /* } */
368 * displaying and freeing image mem
370 for (ibuf = 0; ibuf < dac_par.ttime.cycles; ibuf++) {
371 add_buffer(gpiv, gpiv_var.fn_last[0], ibuf, img_frame[ibuf].A,
372 img_frame[ibuf].B);
373 gpiv_free_ucmatrix(img_frame[ibuf].A, 0,
374 cam_var.capture[0].frame_height - 1,
375 0, cam_var.capture[0].frame_width - 1);
376 if (gpiv_par.x_corr) {
377 gpiv_free_ucmatrix(img_frame[ibuf].B, 0,
378 cam_var.capture[0].frame_height - 1,
379 0, cam_var.capture[0].frame_width - 1);
384 * timing is indefinite periodic
385 * display only and continuously images in buffer 0
387 } else {
388 ibuf = 0;
389 gtk_clist_select_row(GTK_CLIST(gpiv->clist_buf), ibuf, 0);
390 g_message("rec_and_display:: INDEFINITE");
392 /* BUGFIX: for Gtk2 */
393 /* gtk_progress_bar_set_pulse_step (GNOME_APPBAR(gpiv->appbar), */
394 /* 0.1); */
396 img_frame[ibuf].A =
397 gpiv_ucmatrix(0, cam_var.capture[0].frame_height - 1,
398 0, cam_var.capture[0].frame_width - 1);
399 if (gpiv_par.x_corr) {
400 img_frame[ibuf].B = gpiv_ucmatrix(0, gpiv_par.img_height - 1,
401 0, gpiv_par.img_width - 1);
404 while (!cancel_process) {
405 rec_frame(&img_frame[ibuf]);
406 while (g_main_iteration(FALSE));
407 renew_buffer(gpiv, gpiv_var.fn_last[0], ibuf, img_frame[ibuf].A,
408 img_frame[ibuf].B);
409 /* BUGFIX: for Gtk2 */
410 /* gtk_progress_bar_pulse ((GNOME_APPBAR(gpiv->appbar)) */
415 gpiv_free_ucmatrix(img_frame[ibuf].A, 0,
416 cam_var.capture[0].frame_height - 1,
417 0, cam_var.capture[0].frame_width - 1);
418 if (gpiv_par.x_corr) {
419 gpiv_free_ucmatrix(img_frame[ibuf].B, 0,
420 cam_var.capture[0].frame_height - 1,
421 0, cam_var.capture[0].frame_width - 1);
426 pthread_attr_destroy(&attr);
434 * Global functions
437 /* static */ void
438 exec_trigger_start (void
440 /*-----------------------------------------------------------------------------
443 gchar *err_msg = NULL;
444 int on = 1, param_ok;
446 if (!gpiv_dac_openrtfs(&init, &start, &stop, &error)) {
447 err_msg = "Fail in fifo open";
448 gtk_warning(err_msg);
449 return;
453 gpiv_dac_test_parameter(&dac_par);
455 if((write(init, &dac_par.ttime, sizeof(GpivTrigTime))) < 0) {
456 err_msg = "fail in setting camera and Laser timing";
457 gtk_warning(err_msg);
458 return;
461 if((read(error, &param_ok, sizeof(int))) < 0) {
462 err_msg = "fail in receipt of confirmation";
463 gtk_warning(err_msg);
464 return;
467 if (verbose)
468 g_message ("Parameters: \n\
469 cam_acq_period: %lld \n\
470 laser_trig_pw: %lld \n\
471 time2laser: %lld \n\
472 dt: %lld \n\
473 mode: %d \n\
474 cycles: %d \n\
475 increment: %d\n",
476 dac_par.ttime.cam_acq_period,
477 dac_par.ttime.laser_trig_pw,
478 dac_par.ttime.time2laser,
479 dac_par.ttime.dt,
480 dac_par.ttime.mode,
481 dac_par.ttime.cycles,
482 (int) dac_par.ttime.increment);
484 if((write(start, &on, sizeof(int))) < 0) {
485 err_msg = "fail in starting camera and Laser timing";
486 gtk_warning(err_msg);
487 return;
491 /* gpiv_par.process_dac = TRUE; */
496 void
497 exec_trigger_stop (void
499 /*-----------------------------------------------------------------------------
502 gchar *err_msg = NULL;
503 int off = 0;
505 if((write(stop, &off, sizeof(int))) < 0) {
506 err_msg = "fail stopping camera and Laser timing";
507 gtk_warning(err_msg);
508 return;
511 /* gpiv_par.process_dac = FALSE; */
516 void
517 exec_rec_start(GpivConsole * gpiv
519 /*-----------------------------------------------------------------------------
523 * dc1394 stuff
525 /* quadlet_t value; */
527 cancel_process = FALSE;
530 * report camera's feature set
531 * in: on_menu_camera_select
533 /* dc1394_print_feature_set(&cam_var.feature_set[0]); */
535 /* g_message("exec_rec_start:: mode[%d] = %s", */
536 /* cam_var.misc_info[0].mode, */
537 /* format0_desc[cam_var.misc_info[0].mode - MODE_FORMAT0_MIN]); */
538 /* g_message("exec_rec_start:: format[%d] = %s", */
539 /* cam_var.misc_info[0].format, */
540 /* format_desc[cam_var.misc_info[0].format - FORMAT_MIN]); */
542 g_warning("exec_rec_start:: fps = %d", cam_var.misc_info[0].framerate/* - FRAMERATE_MIN */);
543 if (dc1394_setup_capture(cam_var.camera[0].handle,
544 cam_var.camera[0].id,
545 cam_var.misc_info[0].iso_channel,
546 cam_var.misc_info[0].format,
547 cam_var.misc_info[0].mode,
548 cam_var.maxspeed,
550 cam_var.misc_info[0].framerate,
552 /* FRAMERATE_7_5, */
554 /* FRAMERATE_3_75, */
556 &cam_var.capture[0])
557 != DC1394_SUCCESS) {
558 dc1394_release_camera(cam_var.handle, &cam_var.capture[0]);
559 raw1394_destroy_handle(cam_var.handle);
560 gtk_warning("unable to setup camera-\n\
561 check line %d of %s to make sure\n\
562 that the video mode,framerate and format are\n\
563 supported by your camera\n",
564 __LINE__,__FILE__);
565 return;
570 * have the camera start sending us data
572 if (dc1394_start_iso_transmission(cam_var.handle, cam_var.capture[0].node)
573 != DC1394_SUCCESS) {
574 dc1394_release_camera(cam_var.handle, &cam_var.capture[0]);
575 raw1394_destroy_handle(cam_var.handle);
576 gtk_warning("unable to start camera iso transmission");
577 return;
581 * let sending data for a while before grabbing and storing in order to stabilize
582 * data transfer
584 /* sleep(1); */
585 usleep(1000);
589 * set trigger mode and use triggering or just free run
592 if (gpiv_par.trigger_cam) {
593 g_warning("exec_rec_start:: trigger_cam");
594 /* if (dc1394_set_trigger_mode(cam_var.handle, */
595 /* cam_var.capture[0].node, */
596 /* TRIGGER_MODE_0) != DC1394_SUCCESS) */
597 /* { */
598 /* gtk_warning("unable to set camera trigger mode"); */
599 /* } */
600 /* exec_trigger_start(); */
602 rec_and_display(gpiv);
604 /* exec_trigger_stop(); */
605 } else {
606 g_warning("exec_rec_start:: !trigger_cam");
607 rec_and_display(gpiv);
611 /* pthread_exit(NULL); */
614 * Stop data transmission
616 g_warning("exec_rec_start:: Stop data transmission and release camera");
617 if (dc1394_stop_iso_transmission(cam_var.handle, cam_var.capture[0].node)
618 != DC1394_SUCCESS
619 /* && dc1394_release_camera(cam_var.handle, &cam_var.capture[0]) */
620 /* != DC1394_SUCCESS */
622 gtk_warning("couldn't stop the camera?\n");
624 /* in: exec_stop_rec dc1394_release_camera(cam_var.handle, &cam_var.capture[0]); */
625 /*in: exec_stop_rec: raw1394_destroy_handle(cam_var.handle); */
631 void
632 thread_rec_frame(void *img_frame)
633 /*-----------------------------------------------------------------------------
636 ImgFrame *my_frame = NULL;
637 unsigned char **frameA = my_frame->A;
638 unsigned char **frameB = my_frame->B;
640 g_warning("thread_rec_frame:: 0");
641 my_frame = (ImgFrame *) img_frame;
644 /* unsigned char **frameA = gpiv_ucmatrix(0, cam_var.capture[0].frame_height - 1, */
645 /* 0, cam_var.capture[0].frame_width - 1); */
648 g_message("thread_rec_frame:: 0.1");
650 * capture one frame
652 if (dc1394_single_capture(cam_var.handle, &cam_var.capture[0])
653 != DC1394_SUCCESS) {
654 dc1394_release_camera(cam_var.handle, &cam_var.capture[0]);
655 raw1394_destroy_handle(cam_var.handle);
656 gtk_warning("unable to capture a frame");
657 /* return(); */
658 } else {
659 g_message("thread_rec_frame:: 1");
663 * Copy buffer content to tmp buffer array
664 * block data for thread
667 pthread_mutex_lock(&mutex_rec);
668 memcpy( frameA[0], (const char *) cam_var.capture[0].capture_buffer,
669 sizeof(char) * cam_var.capture[0].frame_width *
670 cam_var.capture[0].frame_height);
671 pthread_mutex_unlock(&mutex_rec);
672 g_message("thread_rec_frame:: 2");
676 * Repeat if cross correlation; x_corr = TRUE
678 if (gpiv_par.x_corr) {
679 if (dc1394_single_capture(cam_var.handle, &cam_var.capture[0])
680 != DC1394_SUCCESS) {
681 dc1394_release_camera(cam_var.handle, &cam_var.capture[0]);
682 raw1394_destroy_handle(cam_var.handle);
683 gtk_warning("unable to capture a frame");
684 /* return(); */
685 } else {
687 pthread_mutex_lock(&mutex_rec);
688 memcpy( frameB[0], (const char *) cam_var.capture[0].capture_buffer,
689 sizeof(char) * cam_var.capture[0].frame_width *
690 cam_var.capture[0].frame_height);
691 pthread_mutex_unlock(&mutex_rec);
696 /* gpiv_free_ucmatrix(frameA, 0, cam_var.capture[0].frame_height - 1, */
697 /* 0, cam_var.capture[0].frame_width - 1); */
699 g_warning("thread_rec_frame:: 3/3");
700 pthread_exit(0);
706 static void
707 thread_rec_frame_serie(ImgFrame img_frame[GPIV_NIMG_MAX]
709 /*-----------------------------------------------------------------------------
712 gint ibuf;
714 /* g_message("rec_frame_series:: 0 with id = %d", (int) pthread_self ()); */
715 for (ibuf = 0; ibuf < dac_par.ttime.cycles; ibuf++) {
716 if (cancel_process) break;
717 rec_frame(&img_frame[ibuf]);
719 /* g_message("rec_frame_series:: 1/1"); */
720 pthread_exit(NULL);
724 static void
725 rec_frame(ImgFrame *img_frame
727 /*-----------------------------------------------------------------------------
731 * capture one frame
733 /* g_message("rec_frame:: 0"); */
734 if (dc1394_single_capture(cam_var.handle, &cam_var.capture[0])
735 != DC1394_SUCCESS) {
736 dc1394_release_camera(cam_var.handle, &cam_var.capture[0]);
737 raw1394_destroy_handle(cam_var.handle);
738 g_warning("unable to capture a frame");
739 return;
743 * Copy buffer content to tmp buffer array
745 memcpy( img_frame->A[0],
746 (const char *) cam_var.capture[0].capture_buffer,
747 sizeof(char) * cam_var.capture[0].frame_width *
748 cam_var.capture[0].frame_height);
750 if (gpiv_par.x_corr) {
752 * capture second frame
754 if (dc1394_single_capture(cam_var.handle, &cam_var.capture[0])
755 != DC1394_SUCCESS) {
756 dc1394_release_camera(cam_var.handle, &cam_var.capture[0]);
757 raw1394_destroy_handle(cam_var.handle);
758 g_warning("unable to capture a frame");
759 return;
762 memcpy( img_frame->B[0],
763 (const char *) cam_var.capture[0].capture_buffer,
764 sizeof(char) * cam_var.capture[0].frame_width *
765 cam_var.capture[0].frame_height);
768 /* g_message("rec_frame:: 3/3"); */
773 static void
774 add_buffer(GpivConsole *gpiv,
775 gchar *fname_base,
776 gint ibuf,
777 unsigned char **frameA,
778 unsigned char **frameB
780 /*-----------------------------------------------------------------------------
783 gchar cbuf[4], cdate[GPIV_MAX_CHARS], ctime[GPIV_MAX_CHARS];
784 GDate *date = g_date_new ();
785 GTimeVal *my_gtime = NULL;
786 time_t my_time;
787 struct tm *my_ltime;
789 * use numbers or timing to concanate after buffer names
793 my_time = time(&my_time);
794 my_ltime = localtime(&my_time);
795 g_snprintf(ctime, sizeof(gint) * 3 + 2,
796 "%d.%d.%d_",
797 my_ltime->tm_hour,
798 my_ltime->tm_min,
799 my_ltime->tm_sec);
802 g_date_set_time(date, time(NULL));
803 my_gtime = g_malloc(sizeof(GTimeVal));
804 g_get_current_time(my_gtime);
805 g_snprintf(cdate, sizeof(gint) * 3 + 2,
806 "%d.%d.%d_",
807 g_date_day(date),
808 g_date_month(date),
809 g_date_year(date));
812 g_snprintf(cbuf, 4, "%d", ibuf);
815 if (gpiv_var.fname_date
816 && gpiv_var.fname_time) {
817 fname_base = g_strdup(g_strconcat(gpiv_var.fn_last[0],
818 (gchar *) cdate,
819 (gchar *) ctime,
820 (gchar *) cbuf,
821 NULL));
822 } else if (gpiv_var.fname_date) {
823 fname_base = g_strdup(g_strconcat(gpiv_var.fn_last[0],
824 (gchar *) cdate,
825 (gchar *) cbuf,
826 NULL));
827 } else if (gpiv_var.fname_time) {
828 fname_base = g_strdup(g_strconcat(gpiv_var.fn_last[0],
829 (gchar *) ctime,
830 (gchar *) cbuf,
831 NULL));
832 } else {
833 fname_base = g_strdup(g_strconcat(gpiv_var.fn_last[0],
834 (gchar *) cbuf,
835 NULL));
838 load_dac_buffer(gpiv, &cam_var, FALSE, fname_base, ibuf, frameA, frameB,
839 INSERT);
840 /* exist_buf = TRUE; */
841 nbufs++;
843 g_free(my_gtime);
844 g_free(fname_base);
845 g_date_free(date);
846 return;
851 static void
852 renew_buffer(GpivConsole *gpiv,
853 gchar *fname_base,
854 gint ibuf,
855 unsigned char **frameA,
856 unsigned char **frameB
858 /*-----------------------------------------------------------------------------
859 * updates image of buffer
863 * Open buffer 0 if not exist
866 if (display[ibuf] == NULL) {
867 add_buffer(gpiv, fname_base, ibuf, frameA, frameB);
868 } else {
869 display_act = display[ibuf];
871 recreate_img(display_act, frameA, frameB);
872 if (display_act->display_img1) {
873 show_img1(display_act);
874 } else {
875 hide_img1(display_act);
878 if (image_par.x_corr) {
879 if (display_act->display_img2) {
880 show_img2(display_act);
881 } else {
882 hide_img2(display_act);
893 static void
894 recreate_img(Display * disp,
895 unsigned char **frameA,
896 unsigned char **frameB
898 /* ----------------------------------------------------------------------------
899 * Re-creates image in gnome canvas; without memallocating of rgbbuf_img1 and
900 * rgbbuf_img2
901 * row stride; each row is a 4-byte buffer array
905 GpivImagePar image_par = disp->img.image_par;
906 guchar *pos1 = NULL;
907 /* guchar *pos2 = NULL; */
908 gint i, j;
909 GdkPixbuf *pixbuf1 = NULL;
910 /* GdkPixbuf *pixbuf2 = NULL; */
911 guint16 fact = 1;
912 gint depth = 8;
914 assert (disp != NULL);
915 assert (disp->img.img1 != NULL);
916 assert (disp->img.rgbbuf_img1 != NULL);
917 if(image_par.x_corr) {
918 assert (disp->img.img2 != NULL);
919 assert (disp->img.rgbbuf_img2 != NULL);
921 assert (disp->img.exist_img);
924 fact = fact << (image_par.depth - depth);
925 disp->img.rgb_img_width = gpiv_par.img_width * 3;
926 while ((disp->img.rgb_img_width) % 4 != 0) {
927 disp->img.rgb_img_width++;
930 pixbuf1 = gdk_pixbuf_new_from_data(disp->img.rgbbuf_img1,
931 GDK_COLORSPACE_RGB,
932 FALSE, /* gboolean has_alpha */
933 depth, /* image_par.depth */
934 gpiv_par.img_width,
935 gpiv_par.img_height,
936 disp->img.rgb_img_width, /* rowstride */
937 NULL,
938 NULL);
942 pos1 = disp->img.rgbbuf_img1;
943 for (i = 0; i < gpiv_par.img_height; i++) {
944 for (j = 0; j < gpiv_par.img_width; j++) {
945 *pos1++ = (guchar) (frameA[i][j] / fact);
946 *pos1++ = (guchar) (frameA[i][j] / fact);
947 *pos1++ = (guchar) (frameA[i][j] / fact);
952 gnome_canvas_item_set(GNOME_CANVAS_ITEM (disp->img.gci_img1),
953 "pixbuf", pixbuf1,
954 NULL);
955 /* gnome_canvas_item_raise_to_top (GNOME_CANVAS_ITEM (disp->img.gci_img1)); */
956 /* gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (disp->img.gci_img1)); */
958 /* gtk_widget_pop_visual(); */
959 /* gtk_widget_pop_colormap(); */
962 gdk_pixbuf_unref (pixbuf1);
966 /* if(image_par.x_corr) { */
967 /* pos2 = NULL; */
969 /* disp->img.rgbbuf_img2 = g_malloc(disp->img.rgb_img_width * 3 * */
970 /* gpiv_par.img_height); */
972 /* pixbuf2 = gdk_pixbuf_new_from_data(disp->img.rgbbuf_img2, */
973 /* GDK_COLORSPACE_RGB, */
974 /* FALSE, */
975 /* depth, */
976 /* gpiv_par.img_width, */
977 /* gpiv_par.img_height, */
978 /* disp->img.rgb_img_width, */
979 /* NULL, */
980 /* NULL); */
982 /* if (disp->img.gci_img2 != NULL) { */
983 /* destroy_img(disp); */
984 /* } */
986 /* disp->img.gci_img2 = */
987 /* gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS */
988 /* (disp->canvas)), */
989 /* gnome_canvas_pixbuf_get_type (), */
990 /* "pixbuf", pixbuf2, */
991 /* NULL); */
994 /* pos2 = disp->img.rgbbuf_img2; */
995 /* for (i = 0; i < gpiv_par.img_height; i++) { */
996 /* for (j = 0; j < gpiv_par.img_width; j++) { */
997 /* *pos2++ = (guchar) (frameB[i][j] / fact); */
998 /* *pos2++ = (guchar) (frameB[i][j] / fact); */
999 /* *pos2++ = (guchar) (frameB[i][j] / fact); */
1000 /* } */
1001 /* } */
1003 /* gdk_pixbuf_unref (pixbuf2); */
1005 /* } else { */
1006 disp->img.gci_img2 = disp->img.gci_img2;
1007 /* } */
1013 void
1014 exec_rec_stop(void
1016 /*-----------------------------------------------------------------------------
1019 cancel_process = TRUE;
1020 /* if (dc1394_stop_iso_transmission(cam_var.handle, cam_var.capture[0].node) != DC1394_SUCCESS */
1021 /* != DC1394_SUCCESS) */
1022 /* { */
1023 /* gtk_warning("couldn't stop the camera?\n"); */
1024 /* } */
1026 /* pthread_exit(NULL); */
1027 /* dc1394_release_camera(cam_var.handle, &cam_var.capture[0]); */
1028 /* raw1394_destroy_handle(cam_var.handle); */
1034 * Callback functions
1037 void
1038 on_entry_dac_fname(GtkSpinButton *widget,
1039 GtkWidget *entry
1041 /*-----------------------------------------------------------------------------
1044 gint i;
1045 Dac * dac = gtk_object_get_data(GTK_OBJECT(widget), "dac");
1047 push_list_lastfnames(gtk_entry_get_text(GTK_ENTRY(dac->entry_fname)));
1048 dac->combo_fname_items = NULL;
1049 for (i = 0; i < gpiv_var.number_fnames_last; i++) {
1050 dac->combo_fname_items = g_list_append (dac->combo_fname_items,
1051 gpiv_var.fn_last[i]);
1053 gtk_combo_set_popdown_strings (GTK_COMBO (dac->combo_fname),
1054 dac->combo_fname_items);
1055 g_list_free (dac->combo_fname_items);
1058 * not used:
1059 * dac_par.fname_logic = TRUE;
1064 void
1065 on_checkbutton_fname_date_enter(GtkWidget *widget,
1066 gpointer data
1068 /* ----------------------------------------------------------------------------
1071 GpivConsole * gpiv = gtk_object_get_data(GTK_OBJECT(widget), "gpiv");
1072 gchar *msg = _("Extends the name with current date");
1073 gnome_appbar_set_status(GNOME_APPBAR(gpiv->appbar), msg);
1078 void
1079 on_checkbutton_fname_date(GtkWidget *widget,
1080 gpointer data
1082 /* ----------------------------------------------------------------------------
1085 if (GTK_TOGGLE_BUTTON(widget)->active) {
1086 gpiv_var.fname_date = TRUE;
1087 } else {
1088 gpiv_var.fname_date = FALSE;
1090 gnome_config_set_bool("fname_date", gpiv_var.fname_date);
1091 gnome_config_sync();
1096 void
1097 on_checkbutton_fname_time_enter(GtkWidget *widget,
1098 gpointer data
1100 /* ----------------------------------------------------------------------------
1103 GpivConsole * gpiv = gtk_object_get_data(GTK_OBJECT(widget), "gpiv");
1104 gchar *msg = _("Extends the name with current time");
1105 gnome_appbar_set_status(GNOME_APPBAR(gpiv->appbar), msg);
1110 void
1111 on_checkbutton_fname_time(GtkWidget *widget,
1112 gpointer data
1114 /* ----------------------------------------------------------------------------
1117 if (GTK_TOGGLE_BUTTON(widget)->active) {
1118 gpiv_var.fname_time = TRUE;
1119 } else {
1120 gpiv_var.fname_time = FALSE;
1122 gnome_config_set_bool("fname_time", gpiv_var.fname_time);
1123 gnome_config_sync();
1128 void
1129 on_radiobutton_dac_mouse_1_enter(GtkWidget * widget,
1130 GtkWidget * entry
1132 /*-----------------------------------------------------------------------------
1135 GpivConsole *gpiv = gtk_object_get_data(GTK_OBJECT(widget), "gpiv");
1136 gchar *msg = _("indefinite periodic recording");
1137 gnome_appbar_set_status(GNOME_APPBAR(gpiv->appbar), msg);
1142 void
1143 on_radiobutton_dac_mouse_2_enter(GtkWidget * widget,
1144 GtkWidget * entry
1146 /*-----------------------------------------------------------------------------
1149 GpivConsole *gpiv = gtk_object_get_data(GTK_OBJECT(widget), "gpiv");
1150 gchar *msg = _("with pre-defined number of images");
1151 gnome_appbar_set_status(GNOME_APPBAR(gpiv->appbar), msg);
1156 void
1157 on_radiobutton_dac_mouse_3_enter(GtkWidget * widget,
1158 GtkWidget * entry
1160 /*-----------------------------------------------------------------------------
1163 GpivConsole *gpiv = gtk_object_get_data(GTK_OBJECT(widget), "gpiv");
1164 gchar *msg = _("one shot with interrupd");
1165 gnome_appbar_set_status(GNOME_APPBAR(gpiv->appbar), msg);
1170 void
1171 on_radiobutton_dac_mouse_4_enter(GtkWidget * widget,
1172 GtkWidget * entry
1174 /*-----------------------------------------------------------------------------
1177 GpivConsole *gpiv = gtk_object_get_data(GTK_OBJECT(widget), "gpiv");
1178 gchar *msg = _("periodic with interrupt");
1179 gnome_appbar_set_status(GNOME_APPBAR(gpiv->appbar), msg);
1184 void
1185 on_radiobutton_dac_mouse_5_enter(GtkWidget * widget,
1186 GtkWidget * entry
1188 /*-----------------------------------------------------------------------------
1191 GpivConsole *gpiv = gtk_object_get_data(GTK_OBJECT(widget), "gpiv");
1192 gchar *msg = _("with incremental separation time dt");
1193 gnome_appbar_set_status(GNOME_APPBAR(gpiv->appbar), msg);
1198 void
1199 on_radiobutton_dac_mouse_6_enter(GtkWidget * widget,
1200 GtkWidget * entry
1202 /*-----------------------------------------------------------------------------
1205 GpivConsole *gpiv = gtk_object_get_data(GTK_OBJECT(widget), "gpiv");
1206 gchar *msg = _("double exposure");
1207 gnome_appbar_set_status(GNOME_APPBAR(gpiv->appbar), msg);
1212 void
1213 on_radiobutton_dac_mouse(GtkWidget * widget,
1214 GtkWidget * entry
1216 /*-----------------------------------------------------------------------------
1219 gint mouse_select = atoi(gtk_object_get_data(GTK_OBJECT(widget),
1220 "mouse_select"));
1221 dac_par.ttime.mode = mouse_select;
1222 /* g_warning("on_radiobutton_dac_mouse:: ttime.mode = %d", */
1223 /* dac_par.ttime.mode); */
1225 if (mouse_select == GPIV_TIMER_MODE__PERIODIC) {}
1226 if (mouse_select == GPIV_TIMER_MODE__DURATION) {}
1227 if (mouse_select == GPIV_TIMER_MODE__ONE_SHOT_IRQ) {}
1228 if (mouse_select == GPIV_TIMER_MODE__TRIGGER_IRQ) {}
1229 if (mouse_select == GPIV_TIMER_MODE__INCREMENT) {}
1230 if (mouse_select == GPIV_TIMER_MODE__DOUBLE) {}
1236 void
1237 on_spinbutton_dac_trigger_dt(GtkSpinButton * widget,
1238 GtkWidget * entry
1240 /*-----------------------------------------------------------------------------
1243 gfloat val = gtk_spin_button_get_value_as_float(widget);
1244 dac_par.ttime.dt = (RTIME) (GPIV_MILI2NANO * val);
1249 void
1250 on_spinbutton_dac_trigger_incrdt(GtkSpinButton * widget,
1251 GtkWidget * entry
1253 /*-----------------------------------------------------------------------------
1256 gfloat val = gtk_spin_button_get_value_as_float(widget);
1257 dac_par.ttime.increment = (RTIME) (GPIV_MILI2NANO * val);
1262 void
1263 on_spinbutton_dac_trigger_cap(GtkSpinButton * widget,
1264 GtkWidget * entry
1266 /*-----------------------------------------------------------------------------
1269 gfloat val = gtk_spin_button_get_value_as_float(widget);
1270 dac_par.ttime.cam_acq_period = (RTIME) (GPIV_MILI2NANO * val);
1275 void
1276 on_spinbutton_dac_trigger_nf(GtkSpinButton * widget,
1277 GtkWidget * entry
1279 /*-----------------------------------------------------------------------------
1282 dac_par.ttime.cycles = gtk_spin_button_get_value_as_int(widget);
1287 void
1288 on_button_dac_triggerstart_enter(GtkWidget *widget,
1289 gpointer data
1291 /*-----------------------------------------------------------------------------
1294 GpivConsole * gpiv = gtk_object_get_data(GTK_OBJECT(widget), "gpiv");
1295 gchar *msg = _("Uploads and Starts timings to kernel module");
1296 gnome_appbar_set_status(GNOME_APPBAR(gpiv->appbar), msg);
1301 void
1302 on_button_dac_triggerstart(GtkWidget * widget,
1303 gpointer data
1305 /* ----------------------------------------------------------------------------
1308 /* gchar *msg = */
1309 /* gtk_warning(msg); */
1310 exec_trigger_start();
1315 void
1316 on_button_dac_triggerstop_enter(GtkWidget *widget,
1317 gpointer data
1319 /*-----------------------------------------------------------------------------
1322 GpivConsole * gpiv = gtk_object_get_data(GTK_OBJECT(widget), "gpiv");
1323 gchar *msg = _("Stops timings");
1324 gnome_appbar_set_status(GNOME_APPBAR(gpiv->appbar), msg);
1329 void
1330 on_button_dac_triggerstop(GtkWidget * widget,
1331 gpointer data
1333 /* ----------------------------------------------------------------------------
1336 /* gchar *msg = */
1337 /* gtk_warning(msg); */
1338 exec_trigger_stop();
1343 void
1344 on_menu_camera_select(GtkWidget *widget,
1345 gpointer data)
1346 /* ----------------------------------------------------------------------------
1353 void
1354 on_menu_format(GtkWidget *widget,
1355 gpointer data)
1356 /* ----------------------------------------------------------------------------
1359 GpivConsole * gpiv = gtk_object_get_data(GTK_OBJECT(widget), "gpiv");
1360 gint mode = (int) data;
1361 gint format = 0;
1362 gint was_iso_on;
1363 /* change_mode_and_format(format, FORMAT_VGA_NONCOMPRESSED); */
1364 /* IsoFlowCheck(state); */
1366 g_message("on_menu_format:: ");
1367 if (!dc1394_get_iso_status(cam_var.camera[0].handle, cam_var.camera[0].id,
1368 &cam_var.misc_info[0].is_iso_on)) {
1369 g_warning("Could not get ISO status");
1370 } else {
1371 if (cam_var.misc_info[0].is_iso_on > 0) {
1372 cancel_process = TRUE;
1375 was_iso_on = cam_var.misc_info[0].is_iso_on;
1376 /* g_message("on_menu_format:: is_iso_on = %d", was_iso_on); */
1379 if (mode >= MODE_FORMAT0_MIN && mode <= MODE_FORMAT0_MAX) {
1380 format = FORMAT_VGA_NONCOMPRESSED;
1382 /* g_message("on_menu_format:: mode[%d] = %s", */
1383 /* mode, format0_desc[mode - MODE_FORMAT0_MIN]); */
1385 /* g_message(":n_menu_format: format[%d] = %s", */
1386 /* format, */
1387 /* format_desc[format - FORMAT_MIN]); */
1388 } else if (mode >= MODE_FORMAT1_MIN && mode <= MODE_FORMAT1_MAX) {
1389 format = FORMAT_SVGA_NONCOMPRESSED_1;
1390 } else if (mode >= MODE_FORMAT2_MIN && mode <= MODE_FORMAT2_MAX) {
1391 format = FORMAT_SVGA_NONCOMPRESSED_2;
1392 } else if (mode >= MODE_FORMAT6_MIN && mode <= MODE_FORMAT6_MAX) {
1393 format = FORMAT_STILL_IMAGE;
1394 } else if (mode >= MODE_FORMAT7_MIN && mode <= MODE_FORMAT7_MAX) {
1395 format = FORMAT_SCALABLE_IMAGE_SIZE;
1396 /* } else if (mode >= COLOR_FORMAT7_MIN && mode <= COLOR_FORMAT7_MAX) { */
1397 /* format = FORMAT_SCALABLE_IMAGE_SIZE; */
1398 } else {
1399 gtk_warning("on_menu_format: non valid format");
1402 if (!dc1394_set_video_format(cam_var.camera[0].handle,
1403 cam_var.camera[0].id,
1404 format)) {
1405 g_warning("on_menu_format:: Could not set video format");
1406 } else {
1407 cam_var.misc_info[0].format = format;
1410 if (!dc1394_set_video_mode(cam_var.camera[0].handle,
1411 cam_var.camera[0].id,
1412 mode)) {
1413 g_warning("on_menu_format:: Could not set video format");
1414 } else {
1415 cam_var.misc_info[0].mode = mode;
1420 if (was_iso_on > 0) {
1421 exec_rec_start(gpiv);
1424 /* BuildFpsMenu(); */
1427 /* UpdateTriggerFrame(); */
1429 /* IsoFlowResume(state); */
1432 /* MODE_320x240_YUV422, */
1433 /* MODE_640x480_YUV411, */
1434 /* MODE_640x480_YUV422, */
1435 /* MODE_640x480_RGB, */
1436 /* MODE_640x480_MONO, */
1437 /* MODE_640x480_MONO16 */
1442 void
1443 on_menu_fps(GtkWidget *widget,
1444 gpointer data)
1445 /* ----------------------------------------------------------------------------
1448 cam_var.misc_info[0].framerate = (int) data/* - FRAMERATE_MIN */;
1449 /* cam_var.misc_info[0].framerat */
1450 g_warning("on_menu_fps:: fps = %d", cam_var.misc_info[0].framerate);
1455 * BUGFIX: include in trigger callbacks?
1457 void
1458 on_trigger_polarity_toggled (GtkToggleButton *togglebutton,
1459 gpointer user_data)
1461 if (!dc1394_set_trigger_polarity(cam_var.camera[0].handle,
1462 cam_var.camera[0].id,
1463 togglebutton->active)) {
1464 gtk_warning("Cannot set trigger polarity");
1465 } else {
1466 cam_var.feature_set[0].feature[FEATURE_TRIGGER-FEATURE_MIN].
1467 trigger_polarity = (int) togglebutton->active;
1473 void
1474 on_trigger_external_toggled (GtkToggleButton *togglebutton,
1475 gpointer user_data)
1477 if (!dc1394_feature_on_off(cam_var.camera[0].handle,
1478 cam_var.camera[0].id,
1479 FEATURE_TRIGGER,
1480 togglebutton->active)) {
1481 gtk_warning("Could not set external trigger source");
1482 } else {
1483 cam_var.feature_set[0].feature[FEATURE_TRIGGER - FEATURE_MIN].is_on =
1484 togglebutton->active;
1486 /* UpdateTriggerFrame(); */
1491 void
1492 on_trigger_mode_activate(GtkWidget *widget,
1493 gpointer user_data)
1494 /* ----------------------------------------------------------------------------
1497 if (!dc1394_set_trigger_mode(cam_var.camera[0].handle, cam_var.camera[0].id,
1498 (int) user_data)) {
1499 gtk_warning("Could not set trigger mode");
1500 } else {
1501 cam_var.feature_set[0].feature[FEATURE_TRIGGER-FEATURE_MIN].
1502 trigger_mode = (int) user_data;
1505 /* UpdateTriggerFrame(); */
1510 /* void */
1511 /* on_trigger_value_changed (GtkAdjustment *adj, */
1512 /* gpointer user_data) */
1513 /* { */
1514 /* if (!dc1394_set_feature_value(cam_var.camera[0].handle, cam_var.camera[0].id, */
1515 /* FEATURE_TRIGGER, adj->value)) */
1516 /* gtk_warning("Could not set external trigger count"); */
1517 /* else */
1518 /* cam_var.feature_set[0].feature[FEATURE_TRIGGER-FEATURE_MIN].value = */
1519 /* adj->value; */
1520 /* } */
1523 void
1524 on_checkbutton_camera_trigger_enter(GtkWidget *widget,
1525 gpointer data)
1526 /* ----------------------------------------------------------------------------
1529 GpivConsole * gpiv = gtk_object_get_data(GTK_OBJECT(widget), "gpiv");
1530 gchar *msg = _("Enables triggering of the camera");
1531 gnome_appbar_set_status(GNOME_APPBAR(gpiv->appbar), msg);
1536 void
1537 on_checkbutton_camera_trigger(GtkWidget *widget,
1538 gpointer data)
1539 /* ----------------------------------------------------------------------------
1542 if (GTK_TOGGLE_BUTTON(widget)->active) {
1543 gpiv_par.trigger_cam = TRUE;
1544 } else {
1545 gpiv_par.trigger_cam = FALSE;
1551 void
1552 on_man_auto_menu(GtkWidget *widget,
1553 gpointer data)
1554 /* ----------------------------------------------------------------------------
1557 GtkWidget *scale = gtk_object_get_data(GTK_OBJECT(widget), "scale");
1558 int feature = (int) data;
1559 enum VariableType {
1560 MAN,
1561 AUTO
1562 } var_type;
1564 var_type = atoi(gtk_object_get_data(GTK_OBJECT(widget), "var_type"));
1565 if (!dc1394_auto_on_off(cam_var.camera[0].handle,
1566 cam_var.camera[0].id,
1567 feature, var_type)) {
1568 gtk_warning("on_man_auto_menu: Could not set auto / manual");
1571 if (var_type == MAN) {
1572 gtk_widget_set_sensitive (GTK_WIDGET(scale), TRUE);
1573 } else if (var_type == AUTO) {
1574 gtk_widget_set_sensitive (GTK_WIDGET(scale), FALSE);
1581 void
1582 on_scale_changed(GtkAdjustment *adj,
1583 gpointer user_data)
1584 /* ----------------------------------------------------------------------------
1587 switch((int)user_data) {
1588 case FEATURE_TEMPERATURE:
1589 if (!dc1394_set_temperature(cam_var.camera[0].handle,
1590 cam_var.camera[0].id,
1591 adj->value))
1592 gtk_warning("on_scale_changed:Could not set temperature");
1593 else
1594 cam_var.feature_set[0].feature[FEATURE_TEMPERATURE-FEATURE_MIN].
1595 value = adj->value;
1596 break;
1598 default:
1599 /* g_message("on_scale_changed:: feature = %d value = %f", */
1600 /* (gint) user_data, adj->value); */
1601 if (!dc1394_set_feature_value(cam_var.camera[0].handle,
1602 cam_var.camera[0].id,
1603 (gint) user_data,
1604 adj->value)) {
1605 gtk_warning("on_scale_changed: Could not set feature");
1606 } else {
1607 cam_var.feature_set[0].feature[(gint) user_data - FEATURE_MIN].
1608 value = adj->value;
1610 break;
1617 void
1618 on_button_dac_recstart_enter(GtkWidget *widget,
1619 gpointer data
1621 /*-----------------------------------------------------------------------------
1624 GpivConsole * gpiv = gtk_object_get_data(GTK_OBJECT(widget), "gpiv");
1625 gchar *msg = _("Records PIV images");
1626 gnome_appbar_set_status(GNOME_APPBAR(gpiv->appbar), msg);
1631 void
1632 on_button_dac_recstart(GtkWidget * widget,
1633 gpointer data
1635 /* ----------------------------------------------------------------------------
1636 * The actual calculation of particle image displacements
1639 GpivConsole * gpiv = gtk_object_get_data(GTK_OBJECT(widget), "gpiv");
1641 /*in exec_rec_start: exec_trigger_start(); */
1642 exec_rec_start(gpiv);
1648 void
1649 on_button_dac_recstop_enter(GtkWidget *widget,
1650 gpointer data
1652 /*-----------------------------------------------------------------------------
1655 GpivConsole * gpiv = gtk_object_get_data(GTK_OBJECT(widget), "gpiv");
1656 gchar *msg = _("Stops recording PIV images");
1657 gnome_appbar_set_status(GNOME_APPBAR(gpiv->appbar), msg);
1662 void
1663 on_button_dac_recstop(GtkWidget * widget,
1664 gpointer data
1666 /* ----------------------------------------------------------------------------
1667 * The actual calculation of particle image displacements
1670 exec_trigger_stop();
1671 exec_rec_stop();
1676 #endif /* DISABLE_DAC */