lib/App/SeismicUnixGui/misc/param_widgets_neutral.pm untested

filter: Statementstmt 0.0% 0 / 555 Branchbran 0.0% 0 / 118 Conditioncond 0.0% 0 / 15 MC/DCmcdc 0.0% 0 / 10 Subroutinesub 0.0% 0 / 65 Podpod 0.0% 0 / 55 totaltotal 0.0% 0 / 818 CC 60 SCAR 40.8
CC
60
Cov
0%
_update_check_button_setting
272.0
set_location_in_gui
182.0
_changes
30.0
CRAP 58.9
1 package App::SeismicUnixGui::misc::param_widgets_neutral;
2  
3 =head1 DOCUMENTATION
4  
5 =head2 SYNOPSIS
6  
7 PERL PROGRAM NAME: param_widgets_neutral
8 AUTHOR: Juan Lorenzo
9  
10 =head2 CHANGES and their DATES
11  
12 DATE: V 0.0.1 May 6 2018
13  
14  
15 =head2 DESCRIPTION
16  
17 manages the parameter labels, values and their
18 checkboxes in the guis
19  
20 =head2 USE
21  
22 =head2 Examples
23  
24 =head2
25  
26 =head2 STEPS
27  
28  
29 =head2 NOTES
30 V 0.0.2 Sept. 24 2019 uses gui_history
31  
32 =cut
33  
34 use Moose;
35 our $VERSION = '0.0.2';
36 use Tk;
37 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
38 use aliased 'App::SeismicUnixGui::misc::check_buttons';
39  
40  
41 extends 'App::SeismicUnixGui::misc::gui_history' => { -version => 0.0.2 };
42 use aliased 'App::SeismicUnixGui::misc::gui_history';
43  
44 use App::SeismicUnixGui::misc::control '0.0.3';
45 use aliased 'App::SeismicUnixGui::misc::control';
46  
47 use aliased 'App::SeismicUnixGui::misc::label_boxes';
48 use aliased 'App::SeismicUnixGui::misc::value_boxes';
49  
50 use aliased 'App::SeismicUnixGui::misc::wipe';
51  
52 my $check_buttons = check_buttons->new();
53 my $gui_history = gui_history->new();
54  
55 my $get = L_SU_global_constants->new();
56 my $default_param_specs = $get->param();
57 my $var = $get->var();
58 my $on = $var->{_on};
59 my $off = $var->{_off};
60 my $true = $var->{_true};
61 my $false = $var->{_false};
62 my $nu = $var->{_nu};
63 my $no = $var->{_no};
64 my $empty_string = $var->{_empty_string};
65 my $entry_in_switch = $off;
66 my $this_color = 'neutral';
67  
68 =head2 Declare
69 local variables
70  
71 =cut
72  
73 my $param_widgets_color_href = $gui_history->get_defaults();
74 # print("param_widgets_neutral, default_param_specs,first entry num=$default_param_specs->{_first_entry_num}\n");
75  
76 =head2 sub get_hash_ref
77  
78 bring gui history parameters in to share
79 and update
80 # initialize default parameter values from gui_history
81 # needed herein
82
83 =cut
84  
85 sub get_hash_ref {
86  
87 my ($self) = @_;
88  
89 if ($param_widgets_color_href) {
90  
91 my $result = $param_widgets_color_href;
92 return ($result);
93  
94 }
95 else {
96 print("param_widgets_color,get_hash_ref, missing hash ref\n");
97 }
98  
99 # print("param_widgets_color,_update_hash_ref: $gui_history->get_defaults()\n");
100 }
101  
102 =head2 sub set_hash_ref
103  
104 bring gui history parameters in to share
105 and update
106
107 =cut
108  
109 sub set_hash_ref {
110  
111 my ( $self, $new_hash_ref ) = @_;
112  
113 $gui_history->set_defaults($new_hash_ref);
114 $param_widgets_color_href = $gui_history->get_defaults();
115  
116 # print("1. param_widgets_color,_update_hash_ref: ENTERING\n");
117 # $gui_history->view();
118  
119 # print("param_widgets_color,_update_hash_ref: $gui_history->get_defaults()\n");
120 }
121  
122 =head2 sub _reset
123  
124 private reset of "condition" variables
125 do not reset incoming widgets
126
127 =cut
128  
129 sub _reset {
130 my ($self) = @_;
131  
132 $param_widgets_color_href->{_is_flow_listbox_grey_w} = $false;
133 $param_widgets_color_href->{_is_flow_listbox_pink_w} = $false;
134 $param_widgets_color_href->{_is_flow_listbox_green_w} = $false;
135 $param_widgets_color_href->{_is_flow_listbox_blue_w} = $false;
136 $param_widgets_color_href->{_is_flow_listbox_color_w} = $false;
137 $param_widgets_color_href->{_is_add2flow} = $false; # needed? double confirmation?
138 $param_widgets_color_href->{_is_add2flow_button} = $false; # needed? double confirmation?
139 $param_widgets_color_href->{_is_delete_from_flow_button} = $false;
140 $param_widgets_color_href->{_is_new_listbox_selection} = $false;
141 $param_widgets_color_href->{_is_superflow_select_button} = $false;
142 $param_widgets_color_href->{_is_delete_from_flow_button} = $false;
143 $param_widgets_color_href->{_is_moveNdrop_in_flow} = $false;
144 $param_widgets_color_href->{_is_sunix_listbox} = $false;
145  
146 return ();
147 }
148  
149 =head2 _changes
150  
151 to only one parameter
152 some changes will be false and should be rejected
153  
154 If you are at this subroutine it means that
155 a possible change has been detected in
156 the Entry Widget
157  
158 Currently if we reach this subroutine we
159 will assume that changes always occur to
160 all parameters
161 Somewhere else we will have to
162 forcibly check for and accept all changes
163
164 changes are only allowed for those sunix programs whose spec files
165 have a max_index defined
166
167 currently changes in param_widgets_neutral package only works with regular flows
168 and not with pre-built superflows
169
170 =cut
171  
172 sub _changes {
173 my ( $self, $index ) = @_;
174 my $idx = $index; # individual parameter line
175  
176 my $control = control->new();
177  
178 # two cases possible
179 # in general L_SU
180  
181 # print(" 1. param_widgets_neutral, _changes, entry_in_switch is $entry_in_switch\n");
182  
183 if ( $param_widgets_color_href->{_current_program_name} ) {
184 my $prog_name = $param_widgets_color_href->{_current_program_name};
185  
186 if ( $entry_in_switch eq $off ) { # =0
187  
188 $entry_in_switch = $on;
189  
190 # my $ans = $self->get_index_on_exit();
191 # my $ans = $param_widgets_color_href->{_parameter_index_on_entry};
192 # print(" 2. param_widgets_neutral, _changes, exit index=$ans ENTERED INDEX=$idx\n");
193 $param_widgets_color_href->{_parameter_index_on_entry} = $idx;
194  
195 }
196 elsif ( $entry_in_switch eq $on ) { # i.e., on and set
197  
198 $entry_in_switch = $off;
199  
200 # my $ans = $param_widgets_color_href->{_parameter_index_on_exit};
201 # print(" 3. param_widgets_neutral, _changes, entry index=$ans LEFT INDEX=$idx \n");
202 $param_widgets_color_href->{_parameter_index_on_exit} = $idx;
203  
204 }
205 else {
206 print(" param_widgets_neutral, changes, bad switch \n");
207 }
208  
209 $self->set_hash_ref($param_widgets_color_href);
210  
211 # my $ans= ($self->get_hash_ref())->{_parameter_index_on_exit};
212 # print(" param_widgets_neutral, changes, prog_name: $prog_name \n");
213 # print(" param_widgets_neutral, _changes, _parameter_index_on_exit: $ans \n");
214 # $ans= ($self->get_hash_ref())->{_parameter_index_on_entry};
215 # print(" param_widgets_neutral, _changes, _parameter_index_on_entry: $ans \n");
216  
217 my $max_idx = $control->get_max_index($prog_name);
218  
219 # print(" param_widgets_neutral,max_index, $max_idx \n");
220 # cautious, index must be reasonable
221 if ( $idx >= 0
222 && $idx <= $control->get_max_index($prog_name) )
223 {
224 _set_entry_change_status($true);
225 my $changed_entry = $param_widgets_color_href->{_changed_entry}; #always
226  
227 # print("param_widgets_neutral,changes,changed 1-yes 0 -no? $changed_entry\n");
228 _update_check_button_setting($idx);
229  
230 _set_index_on_entry($idx);
231 }
232  
233 return ($true); # for Entry widget to say there is no error
234  
235 # second case is when we are using project_selector
236 # project_selector does not yet have a max_index defined in a separate module
237 }
238 else {
239 return ($true); # for Entry widget to say there is no error
240 }
241  
242 }
243  
244 =head2 sub error_check
245  
246 When entry values are in error
247  
248 =cut
249  
250 sub error_check {
251 my ($self) = @_;
252 print("param_widgets_neutral,error_check return is $true\n");
253 return ($true);
254 }
255  
256 =head2 sub get_check_buttons_w_aref
257  
258  
259 =cut
260  
261 sub get_check_buttons_w_aref {
262 my ($self) = @_;
263  
264 if ( $param_widgets_color_href->{_check_buttons_w_aref} ) {
265  
266 my $check_buttons_w_aref = $param_widgets_color_href->{_check_buttons_w_aref};
267 return ($check_buttons_w_aref);
268  
269 }
270 else {
271 print("param_widgets_neutral, get_check_buttons_w_aref, missing check_buttons_w_aref \n");
272 return ();
273 }
274 }
275  
276 =head2 sub
277  
278 =cut
279  
280 sub get_current_program {
281  
282 my ( $self, $widget_ref ) = @_;
283 my @selection_index = $$widget_ref->curselection();
284 my $prog_name = $$widget_ref->get( $selection_index[0] );
285  
286 # print("param_widgets_neutral get_current_program: $prog_name,index:$selection_index[0] \n");
287 return ( \$prog_name );
288 }
289  
290 =head2 sub get_entry_change_status
291  
292 =cut
293  
294 sub get_entry_change_status {
295 my @self = @_;
296 my $status = $param_widgets_color_href->{_changed_entry};
297  
298 # print("param_widgets_neutral, get_entry_change_status,changed_entry: $param_widgets_color_href->{_changed_entry}\n");
299 return ($status);
300 }
301  
302 =head2 sub get_labels_w_aref
303  
304 =cut
305  
306 sub get_labels_w_aref {
307 my ($self) = @_;
308  
309 if ( $param_widgets_color_href->{_labels_w_aref} ) {
310  
311 my $labels_w_aref = $param_widgets_color_href->{_labels_w_aref};
312 return ($labels_w_aref);
313  
314 }
315 else {
316 print("param_widgets_neutral,get_labels_w_aref, missing labels_w_aref \n");
317 return ();
318 }
319 }
320  
321 =head2 sub get_length_check_buttons_on
322  
323 =cut
324  
325 sub get_length_check_buttons_on {
326 my ($self) = @_;
327 my ( $length, $count );
328 my $check_buttons_aref = _get_check_buttons_settings_aref();
329  
330 # print("param_widgets_neutral,get_length_check_buttons_on, @$check_buttons_aref)\n");
331 my @button_settings = @$check_buttons_aref;
332 $length = scalar @button_settings;
333  
334 for ( my $i = 0, $count = 0; $i < $length; $i++ ) {
335 if ( $button_settings[$i] ) {
336 if ( $button_settings[$i] eq 'on' ) {
337 $count++;
338 }
339 }
340 }
341  
342 $length = $count;
343 return ($length);
344 }
345  
346 =head2 sub get_index_check_buttons_on
347  
348 =cut
349  
350 sub get_index_check_buttons_on {
351 my ($self) = @_;
352 my ( $length, $count );
353 my $check_buttons_aref = _get_check_buttons_settings_aref();
354  
355 # print("param_widgets_neutral,get_length_check_buttons_on, @$check_buttons_aref)\n");
356 my @button_settings = @$check_buttons_aref;
357 $length = scalar @button_settings;
358 my @saved_index_on;
359 my $j = 0;
360 for ( my $i = 0, $count = 0; $i < $length; $i++ ) {
361 if ( $button_settings[$i] ) {
362 if ( $button_settings[$i] eq 'on' ) {
363 $saved_index_on[$j] = $i;
364 $j++;
365 }
366 }
367 }
368  
369 return ( \@saved_index_on );
370 }
371  
372 =head2 get_values_w_aref
373  
374 return an array widget references
375  
376 =cut
377  
378 sub get_values_w_aref {
379 my ($self) = @_;
380  
381 if ( $param_widgets_color_href->{_values_w_aref} ) {
382  
383 my $values_w_aref = $param_widgets_color_href->{_values_w_aref};
384 return ($values_w_aref);
385  
386 }
387 else {
388 print("param_widgets_neutral,get_values_w_aref, missing values_w_aref \n");
389 return ();
390 }
391 }
392  
393 sub gui_clean {
394 my ($self) = @_;
395
396 my $wipe = wipe->new();
397  
398 # print("param_widgets_neutral, gui_clean, _values_w_aref, $param_widgets_color_href->{_values_w_aref} \n");
399 # print("param_widgets_neutral, gui_clean, _labels_w_aref, $param_widgets_color_href->{_labels_w_aref} \n");
400 $wipe->range($param_widgets_color_href);
401 $wipe->values();
402 $wipe->labels();
403 $wipe->check_buttons();
404  
405 return ();
406 }
407  
408 =head2 sub _max_length_in_gui
409  
410  
411 =cut
412  
413 sub _max_length_in_gui {
414 my ($self) = @_;
415  
416 my $get = L_SU_global_constants->new();
417  
418 my $param = $get->param();
419 my $max_length_in_gui = $param->{_length};
420  
421 $param_widgets_color_href->{_length} = $max_length_in_gui;
422  
423 return ();
424  
425 }
426  
427 =head2 sub _set_length_in_gui
428  
429  
430 =cut
431  
432 sub _set_length_in_gui {
433 my ($new_length_in_gui) = @_;
434  
435 if ( $new_length_in_gui >= 0 ) {
436 $param_widgets_color_href->{_length} = $new_length_in_gui;
437  
438 }
439 else {
440 print("wipe,_set_length_in_gui, unexpected result\n");
441 }
442 return ();
443  
444 }
445  
446 =head2 sub gui_full_clear
447  
448 clear the gui completely of 61 parameter values
449 61 = current defaulted maximum number of variables in a list box
450  
451 =cut
452  
453 sub gui_full_clear {
454 my ($self) = @_;
455  
456 my $wipe = wipe->new();
457  
458 # print("param_widgets_neutral, gui_full_clear, length used for cleaning $param_widgets_color_href->{_length} \n");
459 # print("param_widgets_neutral, gui_clean, _values_w_aref, $param_widgets_color_href->{_values_w_aref} \n");
460 # print("param_widgets_neutral, gui_clean, _labels_w_aref, $param_widgets_color_href->{_labels_w_aref} \n");
461 # rint("4. param_widgets_neutral, gui_full_clear: writing gui_history.txt\n");
462 # gui_history->view();
463
464 # print("1. param_widgets_neutral,gui_full_clear, check button settings:--@{$param_widgets_color_href->{_check_buttons_settings_aref}}--\n");
465
466 $wipe->neutral_range($param_widgets_color_href);
467 # print("2. param_widgets_neutral,gui_full_clear, check button settings:--@{$param_widgets_color_href->{_check_buttons_settings_aref}}--\n");
468 $wipe->values();
469 # print("3. param_widgets_neutral,gui_full_clear, check button settings:--@{$param_widgets_color_href->{_check_buttons_settings_aref}}--\n");
470 $wipe->labels();
471 $wipe->check_buttons();
472
473 # print("param_widgets_neutral, gui_full_clear, restored length $param_widgets_color_href->{_length} \n");
474  
475 return ();
476 }
477  
478 =head2 sub _set_entry_change_status
479  
480 =cut
481  
482 sub _set_entry_change_status {
483 my ($ans) = @_;
484 $param_widgets_color_href->{_changed_entry} = $ans;
485  
486 # print("param_widgets_neutral,_set_entry_change_status,changed_entry,is: success \n");
487  
488 return ();
489 }
490  
491 =head2 sub _update_check_button_setting
492  
493 update for one parameter index
494 in currently active program
495
496 Entry widget uses textvariables
497  
498 =cut
499  
500 sub _update_check_button_setting {
501 my ($index) = @_;
502 my $idx = $index;
503 my @values = @{ $param_widgets_color_href->{_values_aref} };
504 my (@on_off);
505  
506 # apparently empty cases
507 # equal to 0 or 0.0 or empty or undefined
508 if ( !( $values[$idx] ) ) {
509  
510 # if value is defined and initialized
511 if ( defined( $values[$idx] ) ) {
512  
513 if ( $values[$idx] eq '0' ) {
514  
515 $on_off[$idx] = $on;
516  
517 # print("1.20 param_widgets_neutral,,_update_check_button_setting index: $idx , value:$values[$idx] or '0' \n");
518  
519 }
520 elsif ( $values[$idx] eq '0.0' ) {
521  
522 $on_off[$idx] = $on;
523  
524 # print("1.21 param_widgets_neutral,_update_check_button_setting, ndex: $idx , value:$values[$idx] or 0.0 \n");
525  
526 }
527 elsif ( $values[$idx] eq '0' ) {
528  
529 $on_off[$idx] = $on;
530  
531 # print("1.22 param_widgets_neutral,,_update_check_button_setting index: $idx , value:$values[$idx] or '0' \n");
532  
533 }
534 elsif ( $values[$idx] eq '0.0' ) {
535  
536 $on_off[$idx] = $on;
537  
538 # print("1.23 param_widgets_neutral,_update_check_button_setting, ndex: $idx , value:$values[$idx] or 0.0 \n");
539  
540 }
541 else {
542  
543 # print("1.24 param_widgets_neutral,_update_check_button_setting; empty value, :index $idx value: $values[$idx]\n");
544 $on_off[$idx] = $off;
545 }
546  
547 }
548 else {
549 # print("param_widgets_neutral,_update_check_button_setting; values not defined\n");
550 # print("param_widgets_neutral, = $values[$idx]\n");
551 $on_off[$idx] = $off;
552 }
553  
554 # apparently non-empty cases
555 }
556 elsif ( $values[$idx] ) {
557  
558 if ( $values[$idx] eq "0" ) {
559  
560 $on_off[$idx] = $on;
561  
562 # print("1.11.23 1 param_widgets_neutral,_update_check_button_setting, index: $idx value: $values[$idx]\n");
563  
564 }
565 elsif ( $values[$idx] eq '0.0' ) {
566  
567 $on_off[$idx] = $on;
568  
569 # print("1.12 param_widgets_neutral,_update_check_button_setting, ndex: $idx , value:$values[$idx] or 0.0 \n");
570  
571 }
572 elsif ( $values[$idx] eq "" ) {
573  
574 $on_off[$idx] = $off;
575  
576 # print("1.13 param_widgets_neutral,_update_check_button_setting, \"\" \n");
577  
578 }
579 elsif ( $values[$idx] eq '' ) {
580  
581 # print("1.14 param_widgets_neutral,_update_check_button_setting, \'\' \n");
582 $on_off[$idx] = $off;
583  
584 }
585 elsif ( $values[$idx] eq "'nu'" ) {
586  
587 $on_off[$idx] = $off;
588  
589 # print("1. param_widgets_neutral,_update_check_button_setting, \"\'nu\'\" \n");
590  
591 }
592 elsif ( $values[$idx] eq $nu ) {
593 $on_off[$idx] = $off;
594  
595 # print("1.15 param_widgets_neutral,_update_check_button_setting, \$nu \n");
596  
597 }
598 elsif ( $values[$idx] eq $no ) {
599 $on_off[$idx] = $off;
600  
601 # print("2. param_widgets_neutral,_update_check_button_setting, \$no \n");
602  
603 }
604 elsif ( $values[$idx] eq "'0'" ) {
605 $on_off[$idx] = $on;
606  
607 # print("2.1 param_widgets_neutral,_update_check_button_setting, \"\'0\'\" \n");
608  
609 }
610 else {
611 # print("3.1 param_widgets_neutral,_update_check_button_setting, all else\n");
612 $on_off[$idx] = $on;
613 }
614  
615 }
616 else {
617 print("param-widgets,_update_check_button_setting, apparently unconsidered case\n"); # weird TODO
618 }
619  
620 $check_buttons->set_index($idx);
621 $check_buttons->set_switch( \@on_off );
622  
623 # update a single change in private hash
624 @{ $param_widgets_color_href->{_check_buttons_settings_aref} }[$idx] =
625 $on_off[$idx];
626  
627 # print("param_widgets_neutral: _update_check_button_setting :index $idx setting is: $on_off[$idx]\n");
628 # print("param_widgets_neutral: update_check_buttons_settings_aref @{$param_widgets_color_href->{_check_buttons_settings_aref}}\n");
629  
630 return ();
631 }
632  
633 =head2 sub _set_index_on_entry
634  
635 =cut
636  
637 sub _set_index_on_entry {
638 my ($self) = @_;
639 $param_widgets_color_href->{_index_on_entry} = $self;
640  
641 # print("1. param_widgets_neutral,_set_index_on_entry: $param_widgets_color_href->{_index_on_entry} \n");
642 return ();
643 }
644  
645 =head2 sub set_check_buttons
646 a widget reference
647  
648 =cut
649  
650 sub set_check_buttons {
651 my ( $self, $check_buttons_settings_aref ) = @_;
652 if ($check_buttons_settings_aref) {
653 $param_widgets_color_href->{_check_buttons_settings_aref} = $check_buttons_settings_aref;
654  
655 # print("param_widgets_neutral,set_check_buttons, settings are @{$param_widgets_color_href->{_check_buttons_settings_aref}}\n");
656 }
657 return ();
658 }
659  
660 =head2 sub get_current_widget_name
661  
662 screen location by using part of the widget name
663 print(" self:$self widget: $widget\n");
664 print(" currently focus lies in: $screen_location\n");
665 print(" reference: $reference\n");
666 foreach my $i (@fields) {
667 print(" 2. widget is $i\n");
668 my $screen_location = $widget->focusCurrent;
669 my $reference = ref $screen_location;
670 print(" 1. widget is $a\n");
671 print ( "widget is $fields[-1]\n");
672 name is in the last element of the split array
673  
674 if widget_name= frame then we have flow
675 $var->{_flow}
676 if widget_name= menubutton we have superflow
677 $var->{_tool}
678 =cut
679  
680 sub get_current_widget_name {
681 my ( $self, $widget_ref ) = @_;
682 my @fields = split( /\./, $widget_ref->PathName() );
683 my $widget_name = $fields[-1];
684 return ($widget_name);
685 }
686  
687 =head2 sub get_check_buttons_settings_aref
688  
689 =cut
690  
691 sub get_check_buttons_settings_aref {
692 my ($self) = @_;
693  
694 if ( defined $param_widgets_color_href->{_check_buttons_settings_aref}
695 && $param_widgets_color_href->{_check_buttons_settings_aref} ne $empty_string )
696 {
697  
698 my $check_buttons_settings_aref =
699 \@{ $param_widgets_color_href->{_check_buttons_settings_aref} };
700 my $check_buttons_aref = $check_buttons_settings_aref;
701  
702 return ($check_buttons_aref);
703 }
704 else {
705 my @check_buttons_aref = ();
706 # print("param_widgets,get_check_buttons_settings_aref is empty NADA\n");
707 return ( \@check_buttons_aref );
708 }
709  
710 }
711  
712 #=head2 sub get_check_buttons_settings_aref
713 #
714 #=cut
715 #
716 #sub get_check_buttons_settings_aref {
717 # my ($self) = @_;
718 # my $check_buttons_settings_aref = \@{ $param_widgets_color_href->{_check_buttons_settings_aref} };
719 # my $check_buttons_aref = $check_buttons_settings_aref;
720 #
721 # # print("param_widgets_neutral,get_check_buttons_settings_aref: @{$param_widgets_color_href->{_check_buttons_settings_aref}}\n");
722 # return ($check_buttons_aref);
723 #}
724  
725 sub set_entry_button_chosen_index {
726  
727 my ( $self, $index ) = @_;
728 $param_widgets_color_href->{_entry_button_chosen_index} = $index;
729  
730 # print(" param_widgets_neutral,set_entry_button_chosen_index, #$index \n");
731  
732 }
733  
734 =head2 sub _get_check_buttons_settings_aref
735  
736 =cut
737  
738 sub _get_check_buttons_settings_aref {
739 my ($self) = @_;
740 my $check_buttons_settings_aref = \@{ $param_widgets_color_href->{_check_buttons_settings_aref} };
741 my $check_buttons_aref = $check_buttons_settings_aref;
742  
743 # print("param_widgets_neutral,get_check_buttons_settings_aref: @{$param_widgets_color_href->{_check_buttons_settings_aref}}\n");
744 return ($check_buttons_aref);
745 }
746  
747 sub set_entry_button_chosen_widget {
748  
749 my ( $self, $widget_h ) = @_;
750 $param_widgets_color_href->{_entry_button_chosen_widget} = $widget_h;
751  
752 # print (" param_widgets_neutral,set_entry_button_chosen_widget, #$widget_h \n");
753  
754 }
755  
756 =head2 sub get_entry_button_chosen_index
757  
758  
759 =cut
760  
761 sub get_entry_button_chosen_index {
762  
763 my ($self) = @_;
764 my $index;
765  
766 # first and last indices
767 my $first = $param_widgets_color_href->{_first_idx};
768 my $length = $param_widgets_color_href->{_length};
769  
770 # print("param_widget,get_entry_button_chosen_index,first_index=$param_widgets_color_href->{_first_idx}\n");
771 # print("param_widget,get_entry_button_chosen_index,length_=$param_widgets_color_href->{_length} \n");
772  
773 my $widget = $param_widgets_color_href->{_entry_button_chosen_widget};
774  
775 # print("param_widget,get_entry_button_chosen_index,widget,=$widget\n");
776  
777 for ( my $choice = $first; $choice < $length; $choice++ ) {
778 if ( $widget eq @{ $param_widgets_color_href->{_values_w_aref} }[$choice] ) {
779  
780 $param_widgets_color_href->{_entry_button_chosen_index} = $choice;
781  
782 # print (" param_widgets_neutral,get_entry_button_chosen_index, #$choice \n");
783 $index = $choice;
784 }
785 }
786  
787 return ($index);
788 }
789  
790 =head2 sub get_label4entry_button_chosen
791  
792 determine which Entry Button is chosen
793  
794 print("param is $entry_param;\n");
795 print ("selected widget is # $LSU->{_parameter_value_index}\");
796 print ("label is $out\n");
797  
798 =cut
799  
800 sub get_label4entry_button_chosen {
801 my ($self) = @_;
802 my $label;
803  
804 # first and last indices
805 my $first = $param_widgets_color_href->{_first_idx};
806 my $length = $param_widgets_color_href->{_length};
807  
808 # print("param_widget,get_entry_button_chosen,first_index=$param_widgets_color_href->{_first_idx}\n");
809 # print("param_widget,get_entry_button_chosen,length_=$param_widgets_color_href->{_length} \n");
810  
811 my $widget = $param_widgets_color_href->{_entry_button_chosen_widget};
812  
813 # print("param_widget,get_entry_button_chosen,widget,=$widget\n");
814  
815 for ( my $choice = $first; $choice < $length; $choice++ ) {
816 if ( $widget eq @{ $param_widgets_color_href->{_values_w_aref} }[$choice] ) {
817 my $parameter_value_index = $choice;
818 my $parameter_name_index = $choice;
819 $label = @{ $param_widgets_color_href->{_labels_w_aref} }[$choice]->cget('-text');
820 my $value =
821 @{ $param_widgets_color_href->{_values_w_aref} }[$choice]->get;
822  
823 # print("param_widget,get_entry_button_chosen,label,=$label\n");
824 # print("param_widget,get_entry_button_chosen,value,=$value\n");
825 # print("param_widget,get_entry_button_chosen,index,=$choice\n");
826 }
827 }
828 return ($label);
829 }
830  
831 =head2 sub get_value4entry_button_chosen
832  
833 determine which Entry Button is chosen
834  
835 print("param is $entry_param;\n");
836 print ("selected widget is # $LSU->{_parameter_value_index}\");
837 print ("label is $out\n");
838  
839 =cut
840  
841 sub get_value4entry_button_chosen {
842 my ($self) = @_;
843 my $value;
844  
845 # first and last indices
846 my $first = $param_widgets_color_href->{_first_idx};
847 my $length = $param_widgets_color_href->{_length};
848  
849 # print("param_widgets_neutral,get_entry_button_chosen,first_index=$param_widgets_color_href->{_first_idx}\n");
850 # print("param_widgets_neutral,get_entry_button_chosen,length_=$param_widgets_color_href->{_length} \n");
851  
852 my $widget = $param_widgets_color_href->{_entry_button_chosen_widget};
853  
854 # print("param_widgets_neutral,get_entry_button_chosen,widget,=$widget\n");
855  
856 for ( my $choice = $first; $choice < $length; $choice++ ) {
857 if ( $widget eq @{ $param_widgets_color_href->{_values_w_aref} }[$choice] ) {
858 my $parameter_value_index = $choice;
859 my $parameter_name_index = $choice;
860  
861 #$label = @{$param_widgets_color_href->{_labels_w_aref}}[$choice]->cget('-text');
862 $value = @{ $param_widgets_color_href->{_values_w_aref} }[$choice]->get();
863  
864 # print("param_widgets_neutral,get_entry_button_chosen,label,=$label\n");
865 # print("param_widgets_neutral,get_entry_button_chosen,value,=$value\n");
866  
867 # print("param_widgets_neutral,get_entry_button_chosen,index,=$choice\n");
868 }
869 }
870 return ($value);
871 }
872  
873 =head2 sub get_values_aref
874  
875 all the values for one program at a time
876  
877 =cut
878  
879 sub get_values_aref {
880 my ($self) = @_;
881  
882 if ( $param_widgets_color_href->{_values_aref} ne $empty_string ) {
883  
884 my $values_aref = \@{ $param_widgets_color_href->{_values_aref} };
885  
886 # print("param_widgets_neutral,get_values_aref,value[0]= @{$param_widgets_color_href->{_values_aref}}[0]\n");
887 return ($values_aref);
888  
889 }
890 else {
891 # print("param_widgets_neutral, get_values_aref, missing values_aref\n");
892 }
893  
894 }
895  
896 =head2 sub get_labels_aref
897  
898 equivalent to get_naems_aref
899  
900 =cut
901  
902 sub get_labels_aref {
903  
904 my ($self) = @_;
905 my $labels_aref = \@{ $param_widgets_color_href->{_labels_aref} };
906  
907 # print("param_widgets_neutral,get_labels_aref: @{$param_widgets_color_href->{_labels_aref}}\n"); # all labels in array may not be there
908 return ( $param_widgets_color_href->{_labels_aref} );
909 }
910  
911 =head2 sub get_names_aref
912  
913 equivalent to get_labels_aref
914  
915 =cut
916  
917 sub get_names_aref {
918  
919 my ($self) = @_;
920 my $labels_aref = \@{ $param_widgets_color_href->{_labels_aref} };
921  
922 # print("param_widgets_neutral,get_labels_aref: @{$param_widgets_color_href->{_labels_aref}}\n"); # all labels in array may not be there
923 return ( $param_widgets_color_href->{_labels_aref} );
924 }
925  
926 =head2 sub initialize_check_buttons
927  
928 same set of check buttons for all programs
929  
930 =cut
931  
932 sub initialize_check_buttons {
933 my ($self) = @_;
934 my ( $first, $length );
935 my (@off);
936  
937 $first = $param_widgets_color_href->{_first_idx};
938 $length = $param_widgets_color_href->{_length};
939  
940 for ( my $i = $first; $i < $length; $i++ ) {
941 $off[$i] = 'off';
942 }
943  
944 $check_buttons->specs($default_param_specs);
945 $check_buttons->frame( $param_widgets_color_href->{_check_buttons_frame_href} );
946 $check_buttons->make( \@off );
947  
948 $param_widgets_color_href->{_check_buttons_w_aref} = $check_buttons->get_w_aref();
949  
950 # print("param_widgets, initialize_check_buttons check_buttons_w_aref: $param_widgets_color_href->{_check_buttons_w_aref}\n");
951  
952 }
953  
954 =head2 sub initialize_labels
955  
956  
957 =cut
958  
959 sub initialize_labels {
960  
961 my ($self) = @_;
962 my ( $labels, $first, $length );
963 my (@blank_labels);
964  
965 $labels = label_boxes->new();
966 $first = $param_widgets_color_href->{_first_idx};
967 $length = $param_widgets_color_href->{_length};
968  
969 # print("param_widgets_neutral,initialize_labels,first:$first\n");
970 # print("param_widgets_neutral,initialize_labels,length:$length\n");
971  
972 for ( my $i = $first; $i < $length; $i++ ) {
973 $blank_labels[$i] = '';
974 }
975  
976 $labels->specs($default_param_specs);
977 $labels->frame( $param_widgets_color_href->{_labels_frame_href} );
978 $labels->texts( \@blank_labels );
979  
980 $param_widgets_color_href->{_labels_w_aref} = $labels->get_w_aref();
981 }
982  
983 =head2 sub initialize_values
984  
985  
986 =cut
987  
988 sub initialize_values {
989 my ($self) = @_;
990 my ( $values, $first, $length );
991 my @blank_values = ();
992  
993 $values = value_boxes->new();
994  
995 $first = $param_widgets_color_href->{_first_idx};
996 $length = $param_widgets_color_href->{_length};
997  
998 for ( my $i = $first; $i < $length; $i++ ) {
999 $blank_values[$i] = '';
1000 }
1001  
1002 $values->specs($default_param_specs);
1003 $values->frame( $param_widgets_color_href->{_values_frame_href} );
1004 $values->texts( \@blank_values );
1005  
1006 $param_widgets_color_href->{_values_w_aref} = $values->get_w_aref();
1007  
1008 }
1009  
1010 #=head2 sub range
1011 #
1012 # establish the first and last
1013 # indices of the array
1014 # foreach my $key (sort keys %$ref_hash) {
1015 # print (" param_widgets_neutral,range, key is $key, value is $ref_hash->{$key}\n");
1016 # }
1017 #
1018 #=cut
1019 #
1020 #sub range {
1021 # my ( $self, $ref_hash ) = @_;
1022 # my $key = '_param_sunix_length';
1023 #
1024 # # my $value = $ref_hash->{$key};
1025 # # print(" 0. param_widgets_neutral2,range, key is $key, value is $value\n");
1026 #
1027 # # $gui_history->view();
1028 #
1029 # # for adding to flows as a user-built flow
1030 # if ( $param_widgets_color_href->{_is_add2flow_button}
1031 # || $param_widgets_color_href->{_is_add2flow} )
1032 # {
1033 #
1034 # $param_widgets_color_href->{_param_sunix_first_idx} = $ref_hash->{_param_sunix_first_idx};
1035 # $param_widgets_color_href->{_first_idx} = $ref_hash->{_first_idx};
1036 # $param_widgets_color_href->{_length} = $ref_hash->{_param_sunix_length};
1037 #
1038 # print("1.param_widgets_neutral2,range, (add2flow_button and add2flow) first idx:$param_widgets_color_href->{_first_idx}, and length:$param_widgets_color_href->{_length}\n");
1039 # }
1040 #
1041 # # for sunix selections
1042 # elsif ( $param_widgets_color_href->{_is_sunix_listbox} ) {
1043 #
1044 # $param_widgets_color_href->{_first_idx} = $ref_hash->{_param_sunix_first_idx};
1045 # $param_widgets_color_href->{_first_idx} = $ref_hash->{_first_idx};
1046 # $param_widgets_color_href->{_length} = $ref_hash->{_param_sunix_length};
1047 #
1048 # print("2. param_widgets_neutral,range, (sunix_listbox) first idx:$param_widgets_color_href->{_first_idx}, and length:$param_widgets_color_href->{_length}\n");
1049 # }
1050 #
1051 # # for user-built flows, e.g. add2flow is called
1052 # # but list box is not set yet
1053 # elsif ($param_widgets_color_href->{_is_flow_listbox_grey_w}
1054 # || $param_widgets_color_href->{_is_flow_listbox_pink_w}
1055 # || $param_widgets_color_href->{_is_flow_listbox_green_w}
1056 # || $param_widgets_color_href->{_is_flow_listbox_blue_w}
1057 # || $param_widgets_color_href->{_is_flow_listbox_color_w}
1058 # || $param_widgets_color_href->{_is_user_built_flow} )
1059 # {
1060 #
1061 # $param_widgets_color_href->{_first_idx} = $ref_hash->{_param_flow_first_idx};
1062 # $param_widgets_color_href->{_length} = $ref_hash->{_param_flow_length};
1063 #
1064 # # bck
1065 # # $param_widgets_color_href->{_first_idx} = $ref_hash->{_param_flow_first_idx};
1066 # # $param_widgets_color_href->{_length} = $ref_hash->{_param_flow_length};
1067 #
1068 # print("3. param_widgets_neutral,range, (user-built-flow) first idx:$param_widgets_color_href->{_first_idx}, and length:$param_widgets_color_href->{_length}\n");
1069 # }
1070 #
1071 # # button for L_SU and no button for project selector
1072 # elsif ($ref_hash->{_is_superflow_select_button}
1073 # || $ref_hash->{_is_superflow} )
1074 # {
1075 #
1076 # $param_widgets_color_href->{_first_idx} = $ref_hash->{_superflow_first_idx};
1077 # $param_widgets_color_href->{_length} = $ref_hash->{_superflow_length};
1078 #
1079 # print("4. param_widgets_neutral,range, (superflows) first idx:$param_widgets_color_href->{_first_idx}, and length:$param_widgets_color_href->{_length}\n");
1080 #
1081 # }
1082 # else {
1083 # # print("6. param_widgets_neutral,range, _missing ref_hash NADA\n");
1084 # }
1085 #
1086 # # print("6. param_widgets_neutral,range, _values_w_aref: $param_widgets_color_href->{_values_w_aref}\n");
1087 # return ();
1088 #}
1089  
1090 =head2 sub redisplay_check_buttons
1091
1092 update colors in check button boxes
1093  
1094 =cut
1095  
1096 sub redisplay_check_buttons {
1097 my ($self) = @_;
1098 my $button_w_aref = $param_widgets_color_href->{_check_buttons_w_aref};
1099 my $first = $param_widgets_color_href->{_first_idx};
1100 my $length = scalar @{ $param_widgets_color_href->{_check_buttons_settings_aref} };
1101  
1102 # my $length = $param_widgets_color_href->{_length};
1103 my $settings_aref = $param_widgets_color_href->{_check_buttons_settings_aref};
1104  
1105 # print("1. param_widgets_neutral,redisplay_check_buttons,settings @{$settings_aref}[0]\n");
1106 # print("2. param_widgets_neutral,redisplay_check_buttons,settings @{$param_widgets_color_href->{_check_buttons_settings_aref}}[0]\n");
1107 # print("2. param_widgets_neutral,redisplay_check_buttons,length: $length\n");
1108  
1109 if ( $button_w_aref && $settings_aref ) {
1110  
1111 for ( my $i = $first; $i < $length; $i++ ) {
1112  
1113 @$button_w_aref[$i]->configure(
1114 -onvalue => 'on',
1115 -offvalue => 'off',
1116 -selectcolor => 'green',
1117 -activebackground => 'red',
1118 -background => 'red',
1119 -variable => \@$settings_aref[$i],
1120 );
1121 }
1122 }
1123 else {
1124 print("param_widgets_neutral, redisplay_check_buttons missing parameters\n");
1125 }
1126 return ();
1127 }
1128  
1129 =head2 sub redisplay_labels
1130  
1131 print("1. redisplay, resdisplay_labels, text is @{$label_array_ref}[$i]\n");
1132 print("redisplay, resdisplay_labels, i is $i\n");
1133 print("2. redisplay, resdisplay_labels, text is @{$LSU->{_label_array_ref}}[$i]\n");
1134  
1135 =cut
1136  
1137 sub redisplay_labels {
1138 my ($self) = @_;
1139 my $labels_w_aref = $param_widgets_color_href->{_labels_w_aref};
1140 my $labels_aref = $param_widgets_color_href->{_labels_aref};
1141 my $first = $param_widgets_color_href->{_first_idx};
1142 my $length = scalar @{ $param_widgets_color_href->{_labels_aref} };
1143  
1144 # print("param_widgets_neutral,redisplay_labels, length=$length\n");
1145 # print("param_widgets_neutral,redisplay_labels, first=$first\n");
1146
1147 if (length $labels_w_aref) {
1148
1149 for ( my $i = $first; $i < $length; $i++ ) {
1150  
1151 # print("i:$i param_widgets_neutral2,redisplay_labels length:$length\n");
1152 # print(" text is @{$labels_aref}[$i]\n");
1153 # print(" label array widget $labels_w_aref\n");
1154
1155 @$labels_w_aref[$i]->configure( -text => @$labels_aref[$i], );
1156 }
1157 }
1158 else {
1159 print("param_widgets_neutral,redisplay labels, Warning parameters or labels_w_aref missing \n");
1160 }
1161 return ();
1162 }
1163  
1164 =head2 sub redisplay_values
1165  
1166 display parameter values without quotes
1167 although internally we always have quotes for strings
1168 and no quotes if the value looks like a number
1169
1170 i/p: 2 array references
1171 o/p: array reference
1172  
1173 N.B. This is an ENTRY widget
1174 textvariables must be a reference in order
1175 for -validatecommand to work. BEWARE!
1176  
1177 DB
1178  
1179 =cut
1180  
1181 sub redisplay_values {
1182  
1183 my ($self) = @_;
1184 my $values_w_aref = $param_widgets_color_href->{_values_w_aref};
1185 my $values_aref = $param_widgets_color_href->{_values_aref};
1186 my $first = $param_widgets_color_href->{_first_idx};
1187 my $length = scalar @{ $param_widgets_color_href->{_values_aref} };
1188  
1189 # my $length = $param_widgets_color_href->{_length};
1190 # print("param_widgets_neutral, redisplay_values, length is $length\n");
1191 if ( $values_w_aref
1192 && $values_aref )
1193 {
1194  
1195 for ( my $i = $first; $i < $length; $i++ ) {
1196  
1197 my $control = control->new();
1198  
1199 # print("1. param_widgets_neutral,redisplay_values,chkbtn @{$param_widgets_color_href->{_check_buttons_settings_aref}}[$i]\n");
1200  
1201 # print("param_widgets_neutral, redisplay_values, i is $i\n");
1202 # print("1. param_widgets_neutral, redisplay_values, value is @{$values_aref}[$i]\n");
1203  
1204 # &_changes is invoked if
1205 # there is a new selection after an entry change
1206 # or even just if redisplay is selected
1207 # _changes returns a 0 to invoke an error check
1208 # -validate => 'focusout',
1209  
1210 # remove terminal quotes for values, only for display purposes
1211 # when later read again the values will be given quotes if they
1212 # do not look like a number-- this occurs in a superclass
1213 @{$values_aref}[$i] =
1214 $control->get_no_quotes( @{$values_aref}[$i] );
1215  
1216 # print("2. param_widgets_neutral, redisplay_values, quoteless value is @{$values_aref}[$i]\n");
1217 @$values_w_aref[$i]->configure(
1218 -textvariable => \@{$values_aref}[$i],
1219 -validate => 'all',
1220 -validatecommand => [ \&_changes, $self, $i ],
1221 -invalidcommand => \&error_check,
1222 );
1223  
1224 # print("2. param_widgets_neutral,redisplay_values,chkbtn @{$param_widgets_color_href->{_check_buttons_settings_aref}}[$i]\n");
1225 }
1226 }
1227 else {
1228 print("2. param_widgets_neutral,redisplay_values,missing parameters\n");
1229 }
1230  
1231 # print("param_widgets_neutral, redisplay_values, first item's value is @{$values_aref}[$first]\n");
1232 # print("param_widgets_neutral, redisplay_values, last item's values is @{$values_aref}[($length-1)]\n");
1233 # print("param_widgets_neutral, redisplay_values, last values are @{$values_aref}\n");
1234  
1235 return ();
1236 }
1237  
1238 =head2 sub set_current_program
1239  
1240 used in main by
1241 flow_select,
1242 sunix_select
1243 and delete_from_flow_button
1244  
1245 =cut
1246  
1247 sub set_current_program {
1248  
1249 my ( $self, $prog_name_sref ) = @_;
1250 if ($prog_name_sref) {
1251 $param_widgets_color_href->{_current_program_name} = $$prog_name_sref;
1252  
1253 # print("param_widgets_neutral,set_current_program, program name: $param_widgets_color_href->{_current_program_name}\n");
1254 }
1255 }
1256  
1257 =head2 sub set_first_idx
1258  
1259 =0
1260  
1261 =cut
1262  
1263 sub set_first_idx {
1264  
1265 my ($self) = @_;
1266 $param_widgets_color_href->{_first_idx} = 0;
1267  
1268 # print("param-widgets,first_idx:$param_widgets_color_href->{_first_idx}\n");
1269 return ();
1270 }
1271  
1272 =head2 sub set_labels_frame
1273  
1274 a widget reference
1275  
1276 =cut
1277  
1278 sub set_labels_frame {
1279 my ( $self, $labels_frame_href ) = @_;
1280 $param_widgets_color_href->{_labels_frame_href} = $labels_frame_href;
1281  
1282 }
1283  
1284 =head2 sub set_length
1285  
1286 override default length values
1287
1288 =cut
1289  
1290 sub set_length {
1291  
1292 my ( $self, $length ) = @_;
1293 if ($length) {
1294  
1295 $param_widgets_color_href->{_length} = $length;
1296  
1297 # print("param_widgets_neutral,set_length = $param_widgets_color_href->{_length}\n");
1298  
1299 }
1300 else {
1301 print("param_widgets_neutral,missing length\n");
1302 }
1303 }
1304  
1305 =head2 sub set_check_buttons_w_aref
1306  
1307  
1308 =cut
1309  
1310 sub set_check_buttons_w_aref {
1311 my ( $self, $check_buttons_w_aref ) = @_;
1312  
1313 if ($check_buttons_w_aref) {
1314  
1315 $param_widgets_color_href->{_check_buttons_w_aref} = $check_buttons_w_aref;
1316  
1317 # print("param_widgets_neutral,set_check_buttons_w_aref, $check_buttons_w_aref \n");
1318  
1319 }
1320 else {
1321 print("param_widgets_neutral, set_check_buttons_w_aref,missing check_buttons_w_aref \n");
1322  
1323 }
1324 return ();
1325 }
1326  
1327 =head2 set_labels_w_aref
1328  
1329 =cut
1330  
1331 sub set_labels_w_aref {
1332 my ( $self, $labels_w_aref ) = @_;
1333  
1334 if ($labels_w_aref) {
1335  
1336 $param_widgets_color_href->{_labels_w_aref} = $labels_w_aref;
1337  
1338 # print("param_widgets_neutral,set_labels_w_aref, $labels_w_aref \n");
1339  
1340 }
1341 else {
1342 print("param_widgets_neutral,set_labels_w_aref, missing labels_w_aref \n");
1343  
1344 }
1345 return ();
1346 }
1347  
1348 =head2 sub set_values_frame
1349  
1350 a widget reference
1351  
1352 =cut
1353  
1354 sub set_values_frame {
1355  
1356 my ( $self, $values_frame_href ) = @_;
1357  
1358 if ( defined $values_frame_href ) {
1359  
1360 $param_widgets_color_href->{_values_frame_href} = $values_frame_href;
1361  
1362 }
1363 else {
1364 print("param_widgets_neutral, set_values_frame, missing values_frame_href\n");
1365 }
1366  
1367 return ();
1368 }
1369  
1370 =head2 set_values_w_aref
1371  
1372 =cut
1373  
1374 sub set_values_w_aref {
1375 my ( $self, $values_w_aref ) = @_;
1376  
1377 if ($values_w_aref) {
1378  
1379 $param_widgets_color_href->{_values_w_aref} = $values_w_aref;
1380  
1381 # print("param_widgets_neutral,set_values_w_aref, $param_widgets_color_href->{_values_w_aref}\n");
1382  
1383 }
1384 else {
1385 print("param_widgets_neutral,set_values_w_aref, missing values_w_aref \n");
1386 }
1387 return ();
1388 }
1389  
1390 =head2 sub show_values
1391  
1392 packing
1393  
1394 =cut
1395  
1396 sub show_values {
1397 my ($self) = @_;
1398 my ( $first, $length );
1399 my (@values_w);
1400  
1401 @values_w = @{ $param_widgets_color_href->{_values_w_aref} };
1402 $first = $param_widgets_color_href->{_first_idx};
1403 $length = $param_widgets_color_href->{_length};
1404  
1405 # print("param_widgets_neutral,show_values,first:$first\n");
1406 # print("param_widgets_neutral,show_values,length:$length\n");
1407  
1408 for ( my $i = $first; $i < $length; $i++ ) {
1409  
1410 # print("param_widgets_neutral,show_values,values_w at $i $values_w[$i]\n");
1411 $values_w[$i]->pack(
1412 -side => 'top',
1413 -anchor => 'w',
1414 -fill => 'x'
1415 );
1416 }
1417 return ();
1418 }
1419  
1420 =head2 sub set_check_buttons_frame
1421
1422 set check_buttons by user from outside
1423  
1424 =cut
1425  
1426 sub set_check_buttons_frame {
1427 my ( $self, $check_buttons_frame_href ) = @_;
1428 $param_widgets_color_href->{_check_buttons_frame_href} = $check_buttons_frame_href;
1429  
1430 return ();
1431 }
1432  
1433 =head2 sub set_entry_change_status
1434  
1435 =cut
1436  
1437 sub set_entry_change_status {
1438 my ( $self, $status ) = @_;
1439 $param_widgets_color_href->{_changed_entry} = $status;
1440  
1441 # print("param_widgets_neutral, set_entry_change_status: to $status\n");
1442 return ();
1443 }
1444  
1445 =head2 sub set_location_in_gui
1446  
1447 set check_buttons by user from outside
1448
1449 foreach my $key (sort keys %$here) {
1450 print (" param_widgets,set_location_in_gui, key is $key, value is $here->{$key}\n");
1451 }
1452  
1453 =cut
1454  
1455 sub set_location_in_gui {
1456 my ( $self, $location_href ) = @_;
1457 my $here = $location_href;
1458  
1459 # print("param_widgets_neutral, set_location_in_gui , _values_w_aref, $param_widgets_color_href->{_values_w_aref} \n");
1460  
1461 if ( $here->{_is_flow_listbox_grey_w} && $here->{_is_add2flow} ) {
1462  
1463 _reset;
1464 $param_widgets_color_href->{_is_flow_listbox_grey_w} = $true;
1465 $param_widgets_color_href->{_is_flow_listbox_color_w} = $true;
1466  
1467 print("param_widgets_neutral, set_location_in_gui, _is_flow_listbox_grey_w and _is_add2flow \n");
1468  
1469 }
1470 elsif ( $here->{_is_flow_listbox_grey_w} ) {
1471  
1472 _reset;
1473 $param_widgets_color_href->{_is_flow_listbox_grey_w} = $true;
1474 $param_widgets_color_href->{_is_flow_listbox_color_w} = $true;
1475  
1476 print("param_widgets_neutral, set_location_in_gui, _is_flow_listbox_grey_w ++ true\n");
1477  
1478 }
1479 elsif ( $here->{_is_flow_listbox_pink_w} ) {
1480  
1481 _reset;
1482 $param_widgets_color_href->{_is_flow_listbox_pink_w} = $true;
1483 $param_widgets_color_href->{_is_flow_listbox_color_w} = $true;
1484  
1485 print("param_widgets_neutral, set_location_in_gui, _is_flow_listbox_pink_w ++\n");
1486  
1487 }
1488 elsif ( $here->{_is_flow_listbox_green_w} ) {
1489  
1490 _reset;
1491 $param_widgets_color_href->{_is_flow_listbox_green_w} = $true;
1492 $param_widgets_color_href->{_is_flow_listbox_color_w} = $true;
1493  
1494 print("param_widgets_neutral, set_location_in_gui, _is_flow_listbox_green_w ++\n");
1495  
1496 }
1497 elsif ( $here->{_is_flow_listbox_blue_w} ) {
1498  
1499 _reset;
1500 $param_widgets_color_href->{_is_flow_listbox_blue_w} = $true;
1501 $param_widgets_color_href->{_is_flow_listbox_color_w} = $true;
1502  
1503 print("param_widgets_neutral, set_location_in_gui, _is_flow_listbox_blue_w ++\n");
1504  
1505 }
1506 elsif ( $here->{_is_flow_listbox_color_w} ) {
1507  
1508 _reset;
1509 $param_widgets_color_href->{_is_flow_listbox_color_w} = $true;
1510  
1511 print("param_widgets_neutral, set_location_in_gui, _is_flow_listbox_color_w\n");
1512  
1513 }
1514 elsif ( $here->{_is_add2flow} ) {
1515  
1516 $param_widgets_color_href->{_is_new_listbox_selection} = $true; # so change not allowed
1517 # print("param_widgets_neutral, set_location_in_gui, _is_new_listbox_selection \n");
1518  
1519 }
1520 elsif ( $here->{_is_add2flow_button} ) {
1521  
1522 _reset;
1523 $param_widgets_color_href->{_is_new_listbox_selection} = $true; # so change not allowed
1524 # print("param_widgets_neutral, set_location_in_gui, _is_new_listbox_selection \n");
1525  
1526 }
1527 elsif ( $here->{_is_sunix_listbox} ) {
1528  
1529 _reset();
1530 $param_widgets_color_href->{_is_new_listbox_selection} = $true; # so changes not allowed
1531 $param_widgets_color_href->{_is_sunix_listbox} = $true;
1532  
1533 # print("param_widgets_neutral, set_location_in_gui, _is_sunix_listbox and _is_new_listbox_selection\n");
1534  
1535 }
1536 elsif ( $here->{_is_moveNdrop_in_flow} ) {
1537  
1538 _reset();
1539 $param_widgets_color_href->{_is_flow_listbox_grey_w} = $true;
1540 $param_widgets_color_href->{_is_flow_listbox_pink_w} = $true;
1541 $param_widgets_color_href->{_is_flow_listbox_green_w} = $true;
1542 $param_widgets_color_href->{_is_flow_listbox_blue_w} = $true;
1543 $param_widgets_color_href->{_is_flow_listbox_color_w} = $true;
1544 $param_widgets_color_href->{_is_moveNdrop_in_flow} = $true;
1545  
1546 # print("param_widgets_neutral, set_location_in_gui, _is_moveNdrop_in_flow ++ \n");
1547  
1548 }
1549 elsif ( $here->{_is_delete_from_flow_button} ) {
1550  
1551 _reset();
1552 $param_widgets_color_href->{_is_delete_from_flow_button} = $true;
1553  
1554 # TODO double check if next 2-5 lines should be flse instead
1555 $param_widgets_color_href->{_is_flow_listbox_grey_w} = $true;
1556 $param_widgets_color_href->{_is_flow_listbox_pink_w} = $true;
1557 $param_widgets_color_href->{_is_flow_listbox_green_w} = $true;
1558 $param_widgets_color_href->{_is_flow_listbox_blue_w} = $true;
1559 $param_widgets_color_href->{_is_flow_listbox_color_w} = $true;
1560  
1561 # print("param_widgets_neutral, set_location_in_gui, _is_delete_from_flow_button ++\n");
1562  
1563 }
1564 elsif ( $here->{_is_superflow_select_button} ) {
1565  
1566 _reset();
1567  
1568 # print("param_widgets_neutral,NEW set_location_in_gui, superflow_select_button\n");
1569 $param_widgets_color_href->{_is_superflow_select_button} = $true;
1570  
1571 # print("param_widgets_neutral, set_location_in_gui, _is_superflow_select_button \n")
1572  
1573 }
1574 else {
1575 print("param_widgets_neutral, set_location_in_gui, missing params \n");
1576 }
1577 return ();
1578 }
1579  
1580 =head2 sub set_labels
1581
1582 set labels by user from outside
1583  
1584 =cut
1585  
1586 sub set_labels {
1587 my ( $self, $labels_aref ) = @_;
1588 # print("param_widgets_neutral,set_labels\n");
1589 if ( defined $labels_aref ) {
1590  
1591 $param_widgets_color_href->{_labels_aref} = $labels_aref;
1592  
1593 # my $length = scalar @{ $param_widgets_color_href->{_labels_aref} };
1594 # print("param_widgets_neutral,set_labels, length=$length\n");
1595  
1596 }
1597 else {
1598 print("param_widgets_neutral,set_labels, missinglabels\n")
1599 ;
1600 }
1601 return ();
1602 }
1603  
1604 =head2 sub set_prog_name_sref
1605 set prog_name by user from outside
1606  
1607 =cut
1608  
1609 sub set_prog_name_sref {
1610 my ( $self, $prog_name_sref ) = @_;
1611  
1612 if ($prog_name_sref) {
1613 $param_widgets_color_href->{_prog_name_sref} = $prog_name_sref;
1614  
1615 print("param_widgets_neutral,set_prog_name_sref, $$prog_name_sref\n");
1616  
1617 }
1618 else {
1619 print("param_widgets_neutral, set_prog_name_sref, missing prog name\n");
1620 }
1621 return ();
1622 }
1623  
1624 =head2 sub set_value4entry_button_chosen
1625  
1626 assign value to Entry Button chosen
1627  
1628 print("param is $entry_param;\n");
1629 print ("selected widget is # $LSU->{_parameter_value_index}\");
1630 print ("label is $out\n");
1631  
1632 =cut
1633  
1634 sub set_value4entry_button_chosen {
1635 my ( $self, $value ) = @_;
1636  
1637 # first and last indices
1638 my $first = $param_widgets_color_href->{_first_idx};
1639 my $length = $param_widgets_color_href->{_length};
1640  
1641 # print("param_widgets_neutral,set_entry_button_chosen,length_=$param_widgets_color_href->{_length} \n");
1642  
1643 my $widget = $param_widgets_color_href->{_entry_button_chosen_widget};
1644 print("param_widgets_neutral,set_entry_button_chosen,widget,=$widget\n");
1645  
1646 # run through widgets until the match is made
1647 for ( my $choice = $first; $choice < $length; $choice++ ) {
1648 if ( $widget eq @{ $param_widgets_color_href->{_values_w_aref} }[$choice] ) {
1649  
1650 @{ $param_widgets_color_href->{_values_w_aref} }[$choice]->configure( -text => $value );
1651  
1652 print("param_widgets_neutral,set_entry_button_chosen,value= @{$param_widgets_color_href->{_values_w_aref}}[$choice]\n");
1653 print("param_widgets_neutral,set_entry_button_chosen,choice= $choice\n");
1654  
1655 }
1656 }
1657 return ($value);
1658 }
1659  
1660 =head2 sub set_values
1661
1662 set values by user from outside
1663  
1664 =cut
1665  
1666 sub set_values {
1667 my ( $self, $values_aref ) = @_;
1668  
1669 if ( defined $values_aref ) {
1670  
1671 $param_widgets_color_href->{_values_aref} = $values_aref;
1672  
1673 # print("param_widgets_neutral,set_values,@{$param_widgets_color_href->{_values_aref}}\n");
1674  
1675 }
1676 else {
1677 print("param_widgets_neutral,set_values, values_aref missing\n");
1678 }
1679  
1680 return ();
1681 }
1682  
1683 =head2 sub show_check_buttons
1684  
1685 packing
1686  
1687 =cut
1688  
1689 sub show_check_buttons {
1690 my ($self) = @_;
1691 my $button_w_ref = $param_widgets_color_href->{_check_buttons_w_aref};
1692 my $first = $param_widgets_color_href->{_first_idx};
1693 my $length = $param_widgets_color_href->{_length};
1694  
1695 for ( my $i = $first; $i < $length; $i++ ) {
1696 @$button_w_ref[$i]->pack( -anchor => 'n', -fill => 'y' );
1697 }
1698 return ();
1699  
1700 }
1701  
1702 =head2 sub show_labels
1703
1704 specs come from local private variables
1705 uses default specs, unless overwritten
1706 specs are not fed from above
1707
1708 packing
1709  
1710 =cut
1711  
1712 sub show_labels {
1713 my ($self) = @_;
1714 my ( $first, $length );
1715 my (@labels_w);
1716  
1717 @labels_w = @{ $param_widgets_color_href->{_labels_w_aref} };
1718 $first = $param_widgets_color_href->{_first_idx};
1719 $length = $param_widgets_color_href->{_length};
1720  
1721 # print("param_widgets_neutral,show_labels,first:$first\n");
1722 # print("param_widgets_neutral,show_labels,length:$length\n");
1723 for ( my $i = $first; $i < $length; $i++ ) {
1724 $labels_w[$i]->pack(
1725 -side => 'top',
1726 -anchor => 'w',
1727 -fill => 'x'
1728 );
1729 }
1730 return ();
1731 }
1732  
1733 1;