display ruler, line/point evaluation
[gpiv.git] / src / utils.c
blobd75fe25878719c6015be43f6a584113073156314
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 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)
15 any later version.
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 * utility functions for gpiv
30 * $Log: utils.c,v $
31 * Revision 1.2 2003-06-27 13:47:26 gerber
32 * display ruler, line/point evaluation
34 * Revision 1.1.1.1 2003/06/17 17:10:52 gerber
35 * Imported gpiv
39 #include "gpiv_gtk.h"
40 #include "utils.h"
41 #include "display.h"
44 GnomeCanvasItem
45 **alloc_gci_matrix(long nr,
46 long nc
48 /*--------------------------------------------------------------------
49 Allocates 2-dimensional array for GnomeCanvasItem */
51 long i;
52 GnomeCanvasItem **item;
56 * allocate pointers to rows
58 item = (GnomeCanvasItem **) g_malloc((size_t)((nr - 1) *
59 sizeof(GnomeCanvasItem*)));
60 if (!item) gpiv_error("%s: allocation failure 1 in g_malloc()",
61 "alloc_gci_matrix");
62 item += 1;
65 * allocate rows and set pointers to them
67 item[0] = (GnomeCanvasItem *) g_malloc((size_t)((nr * nc - 1) *
68 sizeof(GnomeCanvasItem)));
69 if (!item[0]) gpiv_error("%s: allocation failure 2 in g_malloc()",
70 "alloc_gci_matrix");
71 item[0] += 1;
73 for(i = 1; i <= nr; i++) item[i] = item[i-1] + 1;
76 * return pointer to array of pointers to rows
78 return item;
81 void
82 free_gci_matrix(GnomeCanvasItem **item,
83 long nr,
84 long nc
86 /*--------------------------------------------------------------------
87 Frees 2-dimensional array for GnomeCanvasItem */
89 assert(item[0] != NULL);
91 free((char*) (item[0] - 1));
92 free((char*) (item - 1));
97 void
98 free_all_bufmems(Display * disp
100 /*-------------------------- Frees all dynamic memory of Buffer structure */
102 /* if (disp->mwin != NULL */
103 /* && GTK_WIDGET_VISIBLE(GTK_WIDGET(disp->mwin)) ) { */
104 /* gdk_window_show(GTK_WIDGET(disp->mwin)->window); */
105 /* gdk_window_raise(GTK_WIDGET(disp->mwin)->window); */
106 /* } */
108 free_img_bufmems(disp);
109 free_eval_bufmems(disp);
110 free_post_bufmems(disp);
115 void
116 free_img_bufmems(Display * disp
118 /*--------------------------------------------------------------------
119 * Frees all dynamic memory of Buffer structure of img
122 g_snprintf(disp->fname_base, MAX_CHARS,"");
124 if (disp->img.exist_img) {
125 free_img(disp->img.img1, image_par);
126 /* g_free(disp->img.graybuf_img); */
127 if (image_par.x_corr == 1)
128 free_img(disp->img.img2, image_par);
129 /* g_free(disp->img.graybuf_img2); */
132 destroy_background(disp);
133 if (disp->intreg.exist)
134 destroy_all_intregs(disp);
140 void
141 free_eval_bufmems(Display * disp
143 /*--------------------------------------------------------------------
144 * Frees all dynamic memory of Buffer structure of evaluation processing
147 if (disp->gpd.exist_piv) {
148 destroy_all_vectors(&disp->gpd);
149 gpiv_free_pivdata(&disp->gpd.piv_data);
150 disp->gpd.exist_piv = FALSE;
153 if (disp->gpd.scaled_piv) {
154 gpiv_free_pivdata(&disp->gpd.piv_data_scaled);
155 disp->gpd.scaled_piv = FALSE;
161 void
162 free_post_bufmems(Display * disp
164 /*--------------------------------------------------------------------
165 * Frees all dynamic memory of Buffer structure of post processing
169 if (disp->gpd.exist_vor) {
170 destroy_all_scalars(&display_act->gpd.vor_data, VORTICITY);
171 gpiv_free_scdata(&disp->gpd.vor_data);
172 display_act->gpd.exist_vor = FALSE;
173 display_act->gpd.piv_post_par.diff_type_logic = 0;
174 display_act->gpd.piv_post_par.operator_vorstra_logic = 0;
177 if (disp->gpd.exist_vor_scaled) {
178 gpiv_free_scdata(&disp->gpd.vor_data_scaled);
179 display_act->gpd.exist_vor_scaled = FALSE;
182 if (display_act->gpd.exist_sstrain) {
183 destroy_all_scalars(&display_act->gpd.sstrain_data, S_STRAIN);
184 gpiv_free_scdata (&display_act->gpd.sstrain_data);
185 display_act->gpd.exist_sstrain = FALSE;
186 display_act->gpd.piv_post_par.diff_type_logic = 0;
187 display_act->gpd.piv_post_par.operator_vorstra_logic = 0;
190 if (display_act->gpd.exist_sstrain_scaled) {
191 gpiv_free_scdata (&display_act->gpd.sstrain_data_scaled);
192 display_act->gpd.exist_sstrain_scaled = FALSE;
195 if (display_act->gpd.exist_nstrain) {
196 destroy_all_scalars(&display_act->gpd.nstrain_data, N_STRAIN);
197 gpiv_free_scdata (&display_act->gpd.nstrain_data);
198 display_act->gpd.exist_nstrain = FALSE;
199 display_act->gpd.piv_post_par.diff_type_logic = 0;
200 display_act->gpd.piv_post_par.operator_vorstra_logic = 0;
203 if (display_act->gpd.exist_nstrain_scaled) {
204 gpiv_free_scdata (&display_act->gpd.nstrain_data_scaled);
205 display_act->gpd.exist_nstrain_scaled = FALSE;
211 void
212 copy_img_par (ImagePar image_par_src,
213 ImagePar * image_par_dest,
214 gboolean force,
215 int print_par
218 * copy image parameters from src to dest
221 if (force
222 || (image_par_src.nrows_logic && !image_par_dest->nrows_logic)) {
223 image_par_dest->nrows = image_par_src.nrows;
224 image_par_dest->nrows_logic = 1;
225 if (print_par)
226 gpiv_warning("nrows = %d", image_par_dest->nrows);
229 if (force
230 || (image_par_src.ncolumns_logic && !image_par_dest->ncolumns_logic)) {
231 image_par_dest->ncolumns = image_par_src.ncolumns;
232 image_par_dest->ncolumns_logic = 1;
233 if (print_par)
234 gpiv_warning("ncolumns = %d", image_par_dest->ncolumns);
237 if(force
238 || (image_par_src.nbits_logic && !image_par_dest->nbits_logic)) {
239 image_par_dest->nbits = image_par_src.nbits;
240 image_par_dest->nbits_logic = 1;
241 if (print_par)
242 gpiv_warning("nbits = %d", image_par_dest->nbits);
245 if(force
246 || (image_par_src.x_corr_logic && !image_par_dest->x_corr_logic)) {
247 image_par_dest->x_corr = image_par_src.x_corr;
248 image_par_dest->x_corr_logic = 1;
249 if (print_par)
250 gpiv_warning("x_corr = %d", image_par_dest->x_corr);
253 if (force
254 || (image_par_src.s_scale_logic && !image_par_dest->s_scale_logic)) {
255 image_par_dest->s_scale = image_par_src.s_scale;
256 image_par_dest->s_scale_logic = 1;
257 if (print_par)
258 gpiv_warning("s_scale = %d", image_par_dest->s_scale);
261 if(force
262 || (image_par_src.t_scale_logic && !image_par_dest->t_scale_logic)) {
263 image_par_dest->t_scale = image_par_src.t_scale;
264 image_par_dest->t_scale_logic = 1;
265 if (print_par)
266 gpiv_warning("t_scale = %d", image_par_dest->t_scale);
269 if (force
270 || (image_par_src.z_off_logic && !image_par_dest->z_off_logic)) {
271 image_par_dest->z_off_x = image_par_src.z_off_x;
272 image_par_dest->z_off_y = image_par_src.z_off_y;
273 image_par_dest->z_off_logic = 1;
274 if (print_par) {
275 gpiv_warning("z_off_x = %f", image_par_dest->z_off_x);
276 gpiv_warning("z_off_y = %f", image_par_dest->z_off_x);
280 if (force
281 || (image_par.project_logic && !image_par_dest->project_logic)) {
282 image_par_dest->project_logic = 1;
283 snprintf(image_par_dest->project, MAX_CHARS, "%s",
284 image_par_src.project);
285 if (print_par)
286 gpiv_warning("project = %S", image_par_dest->project);
290 if (force
291 || (image_par.creation_date_logic
292 && !image_par_dest->creation_date_logic)) {
293 image_par_dest->creation_date_logic = 1;
294 snprintf(image_par_dest->creation_date, MAX_CHARS, "%s",
295 image_par_src.creation_date);
296 if (print_par)
297 gpiv_warning("creation_date = %s", image_par_dest->creation_date);
298 } else {
299 char time_string[MAX_CHARS];
300 struct tm time_struct;
301 time_t itime;
302 time(&itime);
303 time_struct = *gmtime(&itime);
304 strftime(time_string, MAX_CHARS, "%a %b %d %Y %T", &time_struct);
305 if (print_par)
306 gpiv_warning("Setting new time = %s", time_string);
307 snprintf(image_par.creation_date, MAX_CHARS, "%s", time_string);
308 image_par_dest->creation_date_logic = 1;
312 if (force
313 || (image_par_src.location_logic && !image_par_dest->location_logic)) {
314 image_par_dest->location_logic = 1;
315 snprintf(image_par_dest->location, MAX_CHARS, "%s",
316 image_par_src.location);
317 if (print_par)
318 gpiv_warning("location = %s", image_par_dest->location);
322 if (force
323 || (image_par_src.comment_logic && !image_par_dest->comment_logic)) {
324 image_par_dest->comment_logic = 1;
325 snprintf(image_par_dest->comment, MAX_CHARS, "%s",
326 image_par_src.comment);
327 if (print_par)
328 gpiv_warning("comment = %s", image_par_dest->comment);
334 void
335 copy_piv_par(PivEvalPar piv_eval_par_src,
336 PivEvalPar * piv_eval_par_dest,
337 gboolean force,
338 int print_par
341 if (force
342 || ( piv_eval_par_src.col_start_logic
343 && !piv_eval_par_dest->col_start_logic)) {
344 piv_eval_par_dest->col_start = piv_eval_par_src.col_start;
345 piv_eval_par_dest->col_start_logic = 1;
348 if (force
349 || ( piv_eval_par_src.col_end_logic
350 && !piv_eval_par_dest->col_end_logic)) {
351 piv_eval_par_dest->col_end = piv_eval_par_src.col_end;
352 piv_eval_par_dest->col_end_logic = 1;
355 if (force
356 || ( piv_eval_par_src.row_start_logic
357 && !piv_eval_par_dest->row_start_logic)) {
358 piv_eval_par_dest->row_start = piv_eval_par_src.row_start;
359 piv_eval_par_dest->row_start_logic = 1;
362 if (force
363 || ( piv_eval_par_src.row_end_logic
364 && !piv_eval_par_dest->row_end_logic)) {
365 piv_eval_par_dest->row_end = piv_eval_par_src.row_end;
366 piv_eval_par_dest->row_end_logic = 1;
370 if (force
371 || ( piv_eval_par_src.int_geo_logic
372 && !piv_eval_par_dest->int_geo_logic)) {
373 piv_eval_par_dest->int_geo = piv_eval_par_src.int_geo;
374 piv_eval_par_dest->int_geo_logic = 1;
377 if (force
378 || ( piv_eval_par_src.int_line_col_logic
379 && !piv_eval_par_dest->int_line_col_logic)) {
380 piv_eval_par_dest->int_line_col = piv_eval_par_src.int_line_col;
381 piv_eval_par_dest->int_line_col_logic = 1;
384 if (force
385 || ( piv_eval_par_src.int_line_col_start_logic
386 && !piv_eval_par_dest->int_line_col_start_logic)) {
387 piv_eval_par_dest->int_line_col_start =
388 piv_eval_par_src.int_line_col_start;
389 piv_eval_par_dest->int_line_col_start_logic = 1;
392 if (force
393 || ( piv_eval_par_src.int_line_col_end_logic
394 && !piv_eval_par_dest->int_line_col_end_logic)) {
395 piv_eval_par_dest->int_line_col_end =
396 piv_eval_par_src.int_line_col_end;
397 piv_eval_par_dest->int_line_col_end_logic = 1;
400 if (force
401 || ( piv_eval_par_src.int_line_row_logic
402 && !piv_eval_par_dest->int_line_row_logic)) {
403 piv_eval_par_dest->int_line_row = piv_eval_par_src.int_line_row;
404 piv_eval_par_dest->int_line_row_logic = 1;
407 if (force
408 || ( piv_eval_par_src.int_line_row_start_logic
409 && !piv_eval_par_dest->int_line_row_start_logic)) {
410 piv_eval_par_dest->int_line_row_start =
411 piv_eval_par_src.int_line_row_start;
412 piv_eval_par_dest->int_line_row_start_logic = 1;
415 if (force
416 || ( piv_eval_par_src.int_line_row_end_logic
417 && !piv_eval_par_dest->int_line_row_end_logic)) {
418 piv_eval_par_dest->int_line_row_end =
419 piv_eval_par_src.int_line_row_end;
420 piv_eval_par_dest->int_line_row_end_logic = 1;
423 if (force
424 || ( piv_eval_par_src.int_point_col_logic
425 && !piv_eval_par_dest->int_point_col_logic)) {
426 piv_eval_par_dest->int_point_col = piv_eval_par_src.int_point_col;
427 piv_eval_par_dest->int_point_col_logic = 1;
430 if (force
431 || ( piv_eval_par_src.int_point_row_logic
432 && !piv_eval_par_dest->int_point_row_logic)) {
433 piv_eval_par_dest->int_point_row = piv_eval_par_src.int_point_row;
434 piv_eval_par_dest->int_point_row_logic = 1;
437 if (force
438 || ( piv_eval_par_src.int_size_1_logic
439 && !piv_eval_par_dest->int_size_1_logic)) {
440 piv_eval_par_dest->int_size_1 = piv_eval_par_src.int_size_1;
441 piv_eval_par_dest->int_size_1_logic = 1;
444 if (force
445 || ( piv_eval_par_src.int_size_2_logic
446 && !piv_eval_par_dest->int_size_2_logic)) {
447 piv_eval_par_dest->int_size_2 = piv_eval_par_src.int_size_2;
448 piv_eval_par_dest->int_size_2_logic = 1;
451 if (force
452 || ( piv_eval_par_src.int_shift_logic
453 && !piv_eval_par_dest->int_shift_logic)) {
454 piv_eval_par_dest->int_shift =
455 piv_eval_par_src.int_shift;
456 piv_eval_par_dest->int_shift_logic = 1;
459 if (force
460 || ( piv_eval_par_src.pre_shift_col_logic
461 && !piv_eval_par_dest->pre_shift_col_logic)) {
462 piv_eval_par_dest->pre_shift_col = piv_eval_par_src.pre_shift_col;
463 piv_eval_par_dest->pre_shift_col_logic = 1;
466 if (force
467 || ( piv_eval_par_src.pre_shift_row_logic
468 && !piv_eval_par_dest->pre_shift_row_logic)) {
469 piv_eval_par_dest->pre_shift_row = piv_eval_par_src.pre_shift_row;
470 piv_eval_par_dest->pre_shift_row_logic = 1;
473 if (force
474 || ( piv_eval_par_src.old_piv_logic
475 && !piv_eval_par_dest->old_piv_logic)) {
476 piv_eval_par_dest->old_piv = piv_eval_par_src.old_piv;
477 piv_eval_par_dest->old_piv_logic = 1;
480 if (force
481 || ( piv_eval_par_src.peak_logic
482 && !piv_eval_par_dest->peak_logic)) {
483 piv_eval_par_dest->peak = piv_eval_par_src.peak;
484 piv_eval_par_dest->peak_logic = 1;
487 if (force
488 || ( piv_eval_par_src.print_cov_logic
489 && !piv_eval_par_dest->print_cov_logic)) {
490 piv_eval_par_dest->print_cov = piv_eval_par_src.print_cov;
491 piv_eval_par_dest->print_cov_logic = 1;
494 if (force
495 || ( piv_eval_par_src.print_par_logic
496 && !piv_eval_par_dest->print_par_logic)) {
497 piv_eval_par_dest->print_par = piv_eval_par_src.print_par;
498 piv_eval_par_dest->print_par_logic = 1;
501 if (force
502 || ( piv_eval_par_src.print_piv_logic
503 && !piv_eval_par_dest->print_piv_logic)) {
504 piv_eval_par_dest->print_piv = piv_eval_par_src.print_piv;
505 piv_eval_par_dest->print_piv_logic = 1;
508 if (force
509 || ( piv_eval_par_src.weight_logic
510 && !piv_eval_par_dest->weight_logic)) {
511 piv_eval_par_dest->weight = piv_eval_par_src.weight;
512 piv_eval_par_dest->weight_logic = 1;
516 if (force
517 || ( piv_eval_par_src.zero_off_logic
518 && !piv_eval_par_dest->zero_off_logic)) {
519 piv_eval_par_dest->zero_off = piv_eval_par_src.zero_off;
520 piv_eval_par_dest->zero_off_logic = 1;
523 if (force
524 || ( piv_eval_par_src.central_diff_logic
525 && !piv_eval_par_dest->central_diff_logic)) {
526 piv_eval_par_dest->central_diff = piv_eval_par_src.central_diff;
527 piv_eval_par_dest->central_diff_logic = 1;
530 if (force
531 || ( piv_eval_par_src.ifit_logic
532 && !piv_eval_par_dest->ifit_logic)) {
533 piv_eval_par_dest->ifit = piv_eval_par_src.ifit;
534 piv_eval_par_dest->ifit_logic = 1;
537 if (force
538 || ( piv_eval_par_src.ad_int_logic
539 && !piv_eval_par_dest->ad_int_logic)) {
540 piv_eval_par_dest->ad_int = piv_eval_par_src.ad_int;
541 piv_eval_par_dest->ad_int_logic = 1;
544 if (force
545 || ( piv_eval_par_src.autokey_logic
546 && !piv_eval_par_dest->autokey_logic)) {
547 piv_eval_par_dest->autokey = piv_eval_par_src.autokey;
548 piv_eval_par_dest->autokey_logic = 1;
551 if (force
552 || ( piv_eval_par_src.cmpr_logic
553 && !piv_eval_par_dest->cmpr_logic)) {
554 piv_eval_par_dest->cmpr = piv_eval_par_src.cmpr;
555 piv_eval_par_dest->cmpr_logic = 1;
563 * gtk routnies
566 void
567 sensitive(GpivConsole *gpiv,
568 enum WidgetSet wi_set,
569 gint sense)
570 /* ---------- Changes the sensitivity of a set of witgets ---------------*/
575 * Setting sensitivity of Image witgets
577 if (wi_set == IMG) {
578 /* gtk_widget_set_sensitive(gpiv->imgh->label_name, sense); */
579 /* gtk_widget_set_sensitive(gpiv->imgh->entry_name, sense); */
580 /* gtk_widget_set_sensitive(gpiv->imgh->spinbutton_ncols, sense); */
582 gtk_widget_set_sensitive(gpiv->imgh->label_colpos, sense);
583 gtk_widget_set_sensitive(gpiv->imgh->label_sscale, sense);
584 gtk_widget_set_sensitive(gpiv->imgh->label_ncols, sense);
585 gtk_widget_set_sensitive(gpiv->imgh->label_nrows, sense);
586 gtk_widget_set_sensitive(gpiv->imgh->label_rowpos, sense);
587 gtk_widget_set_sensitive(gpiv->imgh->label_tscale, sense);
588 gtk_widget_set_sensitive(gpiv->imgh->label_crdate, sense);
589 gtk_widget_set_sensitive(gpiv->imgh->label_location, sense);
590 gtk_widget_set_sensitive(gpiv->imgh->label_project, sense);
591 gtk_widget_set_sensitive(gpiv->imgh->label_comment, sense);
592 gtk_widget_set_sensitive(gpiv->imgh->spinbutton_colpos, sense);
593 gtk_widget_set_sensitive(gpiv->imgh->spinbutton_sscale, sense);
594 gtk_widget_set_sensitive(gpiv->imgh->spinbutton_rowpos, sense);
595 gtk_widget_set_sensitive(gpiv->imgh->spinbutton_tscale, sense);
596 gtk_widget_set_sensitive(gpiv->imgh->entry_crdate, sense);
597 gtk_widget_set_sensitive(gpiv->imgh->entry_location, sense);
598 gtk_widget_set_sensitive(gpiv->imgh->entry_project, sense);
599 gtk_widget_set_sensitive(gpiv->imgh->entry_comment, sense);
604 * Setting sensitivity of Image Processing witgets
606 if (wi_set == IMGPROC) {
611 * Setting sensitivity of PIV witgets
613 if (wi_set == EVAL) {
614 gtk_widget_set_sensitive(gpiv->piveval->spinbutton_colstart, sense);
615 gtk_widget_set_sensitive(gpiv->piveval->spinbutton_colend, sense);
616 gtk_widget_set_sensitive(gpiv->piveval->spinbutton_preshiftcol, sense);
617 gtk_widget_set_sensitive(gpiv->piveval->spinbutton_rowstart, sense);
618 gtk_widget_set_sensitive(gpiv->piveval->spinbutton_rowend, sense);
619 gtk_widget_set_sensitive(gpiv->piveval->spinbutton_preshiftrow, sense);
621 /* gtk_widget_set_sensitive(gpiv->piveval->radiobutton_intsize1_1, sense); */
622 gtk_widget_set_sensitive(gpiv->piveval->radiobutton_intsize1_2, sense);
623 gtk_widget_set_sensitive(gpiv->piveval->radiobutton_intsize1_3, sense);
625 gtk_widget_set_sensitive(gpiv->piveval->radiobutton_intsize1_4, sense);
626 gtk_widget_set_sensitive(gpiv->piveval->radiobutton_intsize1_5, sense);
628 /* gtk_widget_set_sensitive(gpiv->piveval->radiobutton_intsize2_1, sense); */
629 gtk_widget_set_sensitive(gpiv->piveval->radiobutton_intsize2_2, sense);
630 gtk_widget_set_sensitive(gpiv->piveval->radiobutton_intsize2_3, sense);
631 gtk_widget_set_sensitive(gpiv->piveval->radiobutton_intsize2_4, sense);
632 gtk_widget_set_sensitive(gpiv->piveval->radiobutton_intsize2_5, sense);
634 gtk_widget_set_sensitive(gpiv->piveval->radiobutton_intshift_1, sense);
635 gtk_widget_set_sensitive(gpiv->piveval->radiobutton_intshift_2, sense);
636 gtk_widget_set_sensitive(gpiv->piveval->radiobutton_intshift_3, sense);
637 gtk_widget_set_sensitive(gpiv->piveval->radiobutton_intshift_4, sense);
638 gtk_widget_set_sensitive(gpiv->piveval->radiobutton_intshift_5, sense);
640 gtk_widget_set_sensitive(gpiv->piveval->radiobutton_fit_none, sense);
641 gtk_widget_set_sensitive(gpiv->piveval->radiobutton_fit_gauss, sense);
642 gtk_widget_set_sensitive(gpiv->piveval->radiobutton_fit_power, sense);
643 gtk_widget_set_sensitive(gpiv->piveval->radiobutton_fit_gravity, sense);
645 gtk_widget_set_sensitive(gpiv->piveval->radiobutton_mouse_1, sense);
646 gtk_widget_set_sensitive(gpiv->piveval->radiobutton_mouse_2, sense);
647 gtk_widget_set_sensitive(gpiv->piveval->radiobutton_mouse_3, sense);
648 gtk_widget_set_sensitive(gpiv->piveval->radiobutton_mouse_4, sense);
650 gtk_widget_set_sensitive(gpiv->piveval->checkbutton_disprocess, sense);
652 gtk_widget_set_sensitive(gpiv->piveval->radiobutton_peak_1, sense);
653 gtk_widget_set_sensitive(gpiv->piveval->radiobutton_peak_2, sense);
654 gtk_widget_set_sensitive(gpiv->piveval->radiobutton_peak_3, sense);
656 gtk_widget_set_sensitive(gpiv->piveval->checkbutton_weightkernel, sense);
657 gtk_widget_set_sensitive(gpiv->piveval->checkbutton_zerooff, sense);
658 gtk_widget_set_sensitive(gpiv->piveval->checkbutton_centraldiff, sense);
660 gtk_widget_set_sensitive(gpiv->piveval->radiobutton_cross_1, sense);
661 gtk_widget_set_sensitive(gpiv->piveval->radiobutton_cross_2, sense);
663 gtk_widget_set_sensitive(gpiv->piveval->button, sense);
668 * Setting sensitivity of a slection of PIV witgets
670 if (wi_set == INTREGS) {
671 /* if (piv_eval_par.int_size_1 >= 16) { */
672 /* gtk_widget_set_sensitive(GTK_WIDGET */
673 /* (gpiv->piveval->radiobutton_intsize2_1), sense); */
674 if (piv_eval_par.int_size_1 >= 32) {
675 gtk_widget_set_sensitive(GTK_WIDGET
676 (gpiv->piveval->radiobutton_intsize2_2),
677 sense);
678 if (piv_eval_par.int_size_1 >= 64) {
679 gtk_widget_set_sensitive(GTK_WIDGET
680 (gpiv->piveval->radiobutton_intsize2_3),
681 sense);
682 if (piv_eval_par.int_size_1 >= 128) {
683 gtk_widget_set_sensitive(GTK_WIDGET
684 (gpiv->piveval->radiobutton_intsize2_4),
685 sense);
689 /* } */
695 * Setting sensitivity of Validation witgets
697 if (wi_set == VALID) {
698 gtk_widget_set_sensitive(gpiv->pivvalid->radiobutton_errvec_residu_1, sense);
699 gtk_widget_set_sensitive(gpiv->pivvalid->radiobutton_errvec_residu_2, sense);
700 gtk_widget_set_sensitive(gpiv->pivvalid->radiobutton_disable_1, sense);
701 gtk_widget_set_sensitive(gpiv->pivvalid->label_errvec_res, sense);
702 gtk_widget_set_sensitive(gpiv->pivvalid->spinbutton_errvec_res, sense);
703 gtk_widget_set_sensitive(gpiv->pivvalid->checkbutton_errvec_disres, sense);
704 gtk_widget_set_sensitive(gpiv->pivvalid->button_errvec_resstats, sense);
706 gtk_widget_set_sensitive(gpiv->pivvalid->radiobutton_errvec_subst_1, sense);
707 /* gtk_widget_set_sensitive(gpiv->pivvalid->radiobutton_errvec_subst_2, sense); */
708 gtk_widget_set_sensitive(gpiv->pivvalid->radiobutton_errvec_subst_3, sense);
709 gtk_widget_set_sensitive(gpiv->pivvalid->button_errvec, sense);
711 gtk_widget_set_sensitive(gpiv->pivvalid->spinbutton_peaklck_bins, sense);
712 gtk_widget_set_sensitive(gpiv->pivvalid->button_peaklck, sense);
717 * Setting sensitivity of Post processing witgets
719 if (wi_set == POST) {
720 gtk_widget_set_sensitive(gpiv->pivpost->radiobutton_vorstra_output_1, sense);
721 gtk_widget_set_sensitive(gpiv->pivpost->radiobutton_vorstra_output_2, sense);
722 gtk_widget_set_sensitive(gpiv->pivpost->radiobutton_vorstra_output_3, sense);
724 gtk_widget_set_sensitive(gpiv->pivpost->radiobutton_vorstra_diffscheme_1,
725 sense);
726 gtk_widget_set_sensitive(gpiv->pivpost->radiobutton_vorstra_diffscheme_2,
727 sense);
728 gtk_widget_set_sensitive(gpiv->pivpost->radiobutton_vorstra_diffscheme_3,
729 sense);
730 gtk_widget_set_sensitive(gpiv->pivpost->radiobutton_vorstra_diffscheme_4,
731 sense);
732 gtk_widget_set_sensitive(gpiv->pivpost->button_vorstra, sense);
739 void destroy(GtkWidget * widget, gpointer data)
741 gtk_widget_destroy(widget);
745 void gtk_warning(gchar * msg, ...)
747 GtkWidget *gtk_warning_wi;
748 va_list args;
749 char local_msg[MAX_CHARS];
751 va_start(args, msg);
752 vsnprintf (local_msg, MAX_CHARS, msg, args);
753 gtk_warning_wi = create_messagebox(local_msg);
754 gtk_widget_show(gtk_warning_wi);
755 va_end(args);
759 void gtk_error(gchar * msg, ...)
761 GtkWidget *gtk_error_wi;
762 va_list args;
763 char local_msg[MAX_CHARS];
765 va_start(args, msg);
766 vsnprintf (local_msg, MAX_CHARS, msg, args);
767 gtk_error_wi = create_errorbox(local_msg);
768 gtk_widget_show(gtk_error_wi);
769 va_end(args);