App-SeismicUnixGui

 view release on metacpan or  search on metacpan

lib/App/SeismicUnixGui/misc/L_SU.pm  view on Meta::CPAN

);
my (
	$flow_name_grey_w,  $flow_name_pink_w,
	$flow_name_green_w, $flow_name_blue_w
);
my ($flowNsuperflow_name_w);
my $gui_history_aref;

my $is_pre_built_superflow;
my $is_user_built_flow;

my ( $set_run_button_w, $save_button_w, $message_w );
my ($sunix_listbox);
my (
	$add2flow_button_grey,  $add2flow_button_pink,
	$add2flow_button_green, $add2flow_button_blue
);

my $var                           = $get->var();
my $alias_superflow_names_h       = $get->alias_superflow_names_h();
my $alias_help_menubutton_label_h = $get->alias_help_menubutton_label_h();
my $false                         = $var->{_false};
my $neutral                       = $var->{_neutral};
my $no                            = $var->{_no};
my $on                            = $var->{_on};
my $superflow_names               = $get->superflow_names_h();
my $true                          = $var->{_true};
my $yes                           = $var->{_yes};

=head2 defaults

=cut

my $my_dialogs_ans4ok_default     = $yes;
my $my_dialogs_ans4cancel_default = $no;

=head2 declare private variables

=cut

=head2 private hash
to manage listbox occupation

=cut

my $L_SU_gui = {

	_occupied_listbox_aref => $color_listbox->get_flow_listbox_occupancy_aref(),
	_vacant_listbox_aref   => $color_listbox->get_flow_listbox_vacancy_aref(),
	_my_dialogs_ans4cancel => $my_dialogs_ans4cancel_default,
	_my_dialogs_ans4ok     => $my_dialogs_ans4ok_default,

};

# print("1. init L_SU_gui->{_occupied_listbox} = @{$L_SU_gui->{_occupied_listbox_aref }}\n");
# print("1. init L_SU_gui->{_vacant_listbox} = @{$L_SU_gui->{_vacant_listbox_aref }}\n");

=head2

	Opening a file of folder for a superflow
	Only superflow bindings use this private (' _') subroutine.
	Superflows that are opening Data files from GUI are directed here
	
	FileDialog_button is mainly used for user-built flows 
	and directs superflows
	to _FileDialog_button
	
	For safety, place set_hash_ref first
	$$dialog_type_sref can be Data, Save or SaveAs
	
	print(" 43 L_SU,_FileDialog_button, dialog type: $L_SU_href->{_dialog_type}\n");
   print(" L_SU,_FileDialog_button, values_aref: @{$L_SU_href->{_values_aref}}\n");

=cut 

sub _FileDialog_button {
	my ( $self, $dialog_type_sref ) = @_;

	if ( length $dialog_type_sref ) {

		$L_SU_href->{_dialog_type} = $$dialog_type_sref;
		$file_dialog->set_hash_ref($L_SU_href);
		$file_dialog->FileDialog_director();
		$L_SU_href = $file_dialog->get_hash_ref();

	}
	else {
		print(
"L_SU, for superflows only, _FileDialog_button (binding),option type missing "
		);
	}
	return ();
}

=head2 sub _get_flow_color

=cut 

sub _get_flow_color {
	my ($self) = @_;
	my $color;
	if ( $L_SU_href->{_flow_color} ) {

		# print("L_SU, _get_flow_color, color:$L_SU_href->{_flow_color} \n");
		$color = $L_SU_href->{_flow_color};
		return ($color);

	}
	else {
	   #		print("L_SU, _get_flow_color, color:--$L_SU_href->{_flow_color}--\n");
		$color = '';

		#		print("L_SU, _get_flow_color, missing color\n");
		return ($color);
	}
}

=head2 sub _set_flow_color

set the flow color even if it is blank (=no color))

=cut 

sub _set_flow_color {

	my ($color) = @_;

	if ( $color or $color eq '' ) {
		$L_SU_href->{_flow_color} = $color;

	}
	else {
		print("L_SU,_set_flow_color, missing color \n");
	}
	return ();
}

=head2 sub _set_flow_listbox_color_w

=cut 

sub _set_flow_listbox_color_w {
	my ($color) = @_;

	if ( $color eq 'grey' ) {

		$L_SU_href->{_is_flow_listbox_grey_w} = $true;

		# print("1. L_SU,_set_flow_listbox, color:$color \n");

lib/App/SeismicUnixGui/misc/L_SU.pm  view on Meta::CPAN


			}
			else {
				print("L_SU, FileDialog_button, unexpected answer\n");
			}    # end of whether answers exists

		}
		else {
			print(
"CASE 0 L_SU, FileDialog_button, color to occupy (if vacant already) = $color \n"
			);
		}

	}
	else {
		#		print("L_SU,FileDialog_button, end of Open\n");
	}    # end all CASES 1 through 2.X

	if ( not $color ) {

		$color = _get_flow_color();

	}
	else {
	  # print("L_SU, FileDialog_button, Good, color already chosen: $color \n");
	  #			NADA
	}

	if (
		( $L_SU_gui->{_my_dialogs_ans4cancel} eq $no )

		&& ( $L_SU_gui->{_my_dialogs_ans4ok} eq $yes )
		&& $color
		&& (   $L_SU_href->{_is_flow_listbox_grey_w}
			|| $L_SU_href->{_is_flow_listbox_pink_w}
			|| $L_SU_href->{_is_flow_listbox_green_w}
			|| $L_SU_href->{_is_flow_listbox_blue_w}
			|| ( $L_SU_href->{_flow_type} eq 'user_built' && $color ) )
	  )
	{

	# CASES 3A-3D
	# General case of user-built flows in grey, pink, green or blue.
	#
	# = 'neutral', when flow listbox is not a color and sunix_select is selected
	# but add2flow_button has not been activated
	#
	# = nothing,  if chosen before a colored flow exists,
	# when coming from a user-built flow
	#
	# = neutral,  when superflow Data is chosen
##			$color_listbox->set_flow_listbox_color_reservation( _get_flow_color() );
##			my $reservation_color = $color_listbox->get_flow_listbox_color_reservation( );
		#
		if (   $L_SU_href->{_is_flow_listbox_grey_w}
			&& $color eq 'grey' )
		{    # for added certainty

			# CASE 3A
			# mark the neutral-colored flow as unused
			# helps bind flow parameters to the opening files

			$color_listbox->set_next_available_flow_listbox_color($color);
			my $which_color =
			  $color_listbox->get_next_available_flow_listbox_color();

#				print(
#               "CASE 3A L_SU, FileDialog_button, the next available listbox color is set as: $color\n"
#				);

#	            print("1.  L_SU,FileDialog_button, color is $L_SU_href->{_flow_color}\n");
#				print("CASE 3A 1.L_SU, FileDialog_button, $which_color will be occupied\n");

			# opens file and populates GUI
			$grey_flow->set_hash_ref($L_SU_href);
			$grey_flow->FileDialog_button($dialog_type_sref);
			$L_SU_href->{_flow_color} = $grey_flow->get_flow_color();
			my $Flow_file_exists = $grey_flow->get_Flow_file_exists();
			my $perl_flow_errors = $grey_flow->get_perl_flow_errors();

			if (   $Flow_file_exists
				&& $perl_flow_errors eq $false )
			{

				# only confirm occupation/vacancy AFTER  file is read into GUI
				# update any newly added listboxes for all case 3A
				$color_listbox->set_flow_listbox_color($color);
				$L_SU_gui->{_occupied_listbox_aref} =
				  $color_listbox->get_flow_listbox_occupancy_aref();
				$L_SU_gui->{_vacant_listbox_aref} =
				  $color_listbox->get_flow_listbox_vacancy_aref();

#					print(
#						"Successful read Case 3A L_SU,FileDialog_button, L_SU_gui->{_occupied_listbox_aref},@{$L_SU_gui->{_occupied_listbox_aref}}\n"
#					);
#					print(
#						"Successful read Case 3A L_SU,FileDialog_button, L_SU_gui->{_vacant_listbox_aref},@{$L_SU_gui->{_vacant_listbox_aref}}\n"
#					);
#
			}
			else {
		# if flow is not successful, occupied and vacant listbox need not be set
				$color_listbox->set_prior_available_flow_listbox_color($color);

#						print(
#						"Non-successful read Case 3A L_SU,FileDialog_button, L_SU_gui->{_occupied_listbox_aref},@{$L_SU_gui->{_occupied_listbox_aref}}\n"
#					);
#					print(
#						"Non-successful read Case 3A L_SU,FileDialog_button, L_SU_gui->{_vacant_listbox_aref},@{$L_SU_gui->{_vacant_listbox_aref}}\n"
#					);

			}

		}
		elsif ($L_SU_href->{_is_flow_listbox_pink_w}
			&& $color eq 'pink' )
		{    # for added certainty
			 # CASE 3B - pink flow box
			 # mark the neutral-colored flow as unused
			 # helps bind flow parameters to the opening files

			$color_listbox->set_next_available_flow_listbox_color($color);
			my $which_color =
			  $color_listbox->get_next_available_flow_listbox_color();

#				print("CASE 3B _SU, FileDialog_button, the next available listbox color is set as: $color\n");
#	print("1.  L_SU,FileDialog_button, color is $L_SU_href->{_flow_color}\n");
#				print("CASE 3B 1.L_SU,FileDialog_button, $which_color will be occupied\n");

			# opens file and populates GUI
			$pink_flow->set_hash_ref($L_SU_href);
			$pink_flow->FileDialog_button($dialog_type_sref);
			$L_SU_href->{_flow_color} = $pink_flow->get_flow_color();
			my $Flow_file_exists = $pink_flow->get_Flow_file_exists();
			my $perl_flow_errors = $pink_flow->get_perl_flow_errors();

			if (   $Flow_file_exists
				&& $perl_flow_errors eq $false )
			{
				#
				# only confirm occupation/vacancy AFTER  file is read into GUI
				# update any newly added listboxes for all case 3B
				$color_listbox->set_flow_listbox_color($color);

				$L_SU_gui->{_occupied_listbox_aref} =
				  $color_listbox->get_flow_listbox_occupancy_aref();
				$L_SU_gui->{_vacant_listbox_aref} =
				  $color_listbox->get_flow_listbox_vacancy_aref();

#					print(
#						"Successful read Case 3B L_SU,FileDialog_button, L_SU_gui->{_occupied_listbox_aref},@{$L_SU_gui->{_occupied_listbox_aref}}\n"
#					);
#					print(
#						"Successful read Case 3B L_SU,FileDialog_button, L_SU_gui->{_vacant_listbox_aref},@{$L_SU_gui->{_vacant_listbox_aref}}\n"
#					);

			}
			else {
		# if flow is not successful, occupied and vacant listbox need not be set
				$color_listbox->set_prior_available_flow_listbox_color(
					_get_flow_color() );

#					print(
#						"Non-successful read Case 3B L_SU,FileDialog_button, L_SU_gui->{_occupied_listbox_aref},@{$L_SU_gui->{_occupied_listbox_aref}}\n"
#					);
#					print(
#						"Non-successful read Case 3B L_SU,FileDialog_button, L_SU_gui->{_vacant_listbox_aref},@{$L_SU_gui->{_vacant_listbox_aref}}\n"
#					);

			}

		}
		elsif ($L_SU_href->{_is_flow_listbox_green_w}
			&& $color eq 'green' )
		{    # more certainty
			 # CASE 3C - green flow box
			 # mark the neutral-colored flow as unused
			 # helps bind flow parameters to the opening files

			$color_listbox->set_next_available_flow_listbox_color($color);
			my $which_color =
			  $color_listbox->get_next_available_flow_listbox_color();

#				print("CASE 3C L_SU, _SU, FileDialog_button, the next available listbox color is set as: $color\n");;
#	            print("1.  L_SU,FileDialog_button, color is $L_SU_href->{_flow_color}\n");
#				print("CASE 3C 1.L_SU,FileDialog_button, $which_color will be occupied\n");
#
# opens file and populates GUI
			$green_flow->set_hash_ref($L_SU_href);
			$green_flow->FileDialog_button($dialog_type_sref);
			$L_SU_href->{_flow_color} = $green_flow->get_flow_color();
			my $Flow_file_exists = $green_flow->get_Flow_file_exists();
			my $perl_flow_errors = $green_flow->get_perl_flow_errors();

			if (   $Flow_file_exists
				&& $perl_flow_errors eq $false )
			{

				# only confirm occupation/vacancy AFTER  file is read into GUI
				# update any newly added listboxes for all case 3C
				$color_listbox->set_flow_listbox_color($color);

				$L_SU_gui->{_occupied_listbox_aref} =
				  $color_listbox->get_flow_listbox_occupancy_aref();
				$L_SU_gui->{_vacant_listbox_aref} =
				  $color_listbox->get_flow_listbox_vacancy_aref();

#					print(
#						"Successful read  Case 3C L_SU,FileDialog_button, L_SU_gui->{_occupied_listbox_aref},@{$L_SU_gui->{_occupied_listbox_aref}}\n"
#					);
#					print(
#						"Successful read  Case 3C L_SU,FileDialog_button, L_SU_gui->{_vacant_listbox_aref},@{$L_SU_gui->{_vacant_listbox_aref}}\n"
#					);

			}
			else {
		# if flow is not successful, occupied and vacant listbox need not be set
				$color_listbox->set_prior_available_flow_listbox_color(
					_get_flow_color() );

#					print(
#						"Non-Successful read Case 3C L_SU,FileDialog_button, L_SU_gui->{_occupied_listbox_aref},@{$L_SU_gui->{_occupied_listbox_aref}}\n"
#					);
#					print(
#						"Non-Successful read Case 3C L_SU,FileDialog_button, L_SU_gui->{_vacant_listbox_aref},@{$L_SU_gui->{_vacant_listbox_aref}}\n"
#					);
			}

		}
		elsif ($L_SU_href->{_is_flow_listbox_blue_w}
			&& $color eq 'blue' )
		{    # more certainty
			 # CASE 3D - blue flow box
			 # mark the neutral-colored flow as unused
			 # helps bind flow parameters to the opening files

			$color_listbox->set_next_available_flow_listbox_color($color);
			my $which_color =
			  $color_listbox->get_next_available_flow_listbox_color();

#	print("CASE 3D L_SU, FileDialog_button, the next available listbox color is set as: $color\n");
#	print("1.  L_SU,FileDialog_button, color is $L_SU_href->{_flow_color}\n");
#   print("CASE 3D 1.L_SU,FileDialog_button, $which_color will be occupied\n");

			# opens file and populates GUI
			$blue_flow->set_hash_ref($L_SU_href);
			$blue_flow->FileDialog_button($dialog_type_sref);
			$L_SU_href->{_flow_color} = $blue_flow->get_flow_color();
			my $Flow_file_exists = $blue_flow->get_Flow_file_exists();
			my $perl_flow_errors = $blue_flow->get_perl_flow_errors();

			if (   $Flow_file_exists
				&& $perl_flow_errors eq $false )
			{

#	only confirm occupation / vacancy AFTER file is read into GUI update any newly added listboxes
#	for all case 3 D
				$color_listbox->set_flow_listbox_color($color);
				$L_SU_gui->{_occupied_listbox_aref} =
				  $color_listbox->get_flow_listbox_occupancy_aref();
				$L_SU_gui->{_vacant_listbox_aref} =
				  $color_listbox->get_flow_listbox_vacancy_aref();

#					print(
#						"Successful read  Case 3D L_SU,FileDialog_button, L_SU_gui->{_occupied_listbox_aref},@{$L_SU_gui->{_occupied_listbox_aref}}\n"
#					);
#					print(
#						"Successful read  Case 3D L_SU,FileDialog_button, L_SU_gui->{_vacant_listbox_aref},@{$L_SU_gui->{_vacant_listbox_aref}}\n"
#					);

			}
			else {
		# if flow is not successful, occupied and vacant listbox need not be set
				$color_listbox->set_prior_available_flow_listbox_color(
					_get_flow_color() );

#					print(
#						"Non-Successful read  Case 3D L_SU,FileDialog_button, L_SU_gui->{_occupied_listbox_aref},@{$L_SU_gui->{_occupied_listbox_aref}}\n"
#					);
#					print(
#						"Non-Successful read  Case 3D L_SU,FileDialog_button, L_SU_gui->{_vacant_listbox_aref},@{$L_SU_gui->{_vacant_listbox_aref}}\n"
#					);
			}

		}
		else {
			print("L_SU, FileDialog_button, unexpected missing settings \n");
		}

	}
	elsif ( $L_SU_href->{_flow_type} eq 'pre_built_superflow' ) {

		# CASE 4
		# when GUI opens Data for a superflow
		# deprecated 1.19.23

lib/App/SeismicUnixGui/misc/L_SU.pm  view on Meta::CPAN

until OK or cancels clicked and wait variable changes 
from no/yes to yes/no.

=cut

sub initialize_my_dialogs {
	my ( $self, $ok_button, $label, $cancel_button, $top_level ) = @_;

	if (   length $ok_button
		&& length $label
		&& $cancel_button
		&& $top_level )
	{

		#	$color_listbox->set_hash_ref($L_SU_href);
		$color_listbox->initialize_my_dialogs( $ok_button, $label,
			$cancel_button, $top_level );

	}
	else {
		print("L_SU,initialize_my_dialogs, missing widgets\n");
	}
	return ();
}

=head2 sub initialize messages

Create widgets that show messages
Show warnings or errors in a message box
Message box is defined in main where it is
also made invisible (withdraw)
Here we turn on the message box (deiconify, raise)
The message does not release the program
until OK is clicked and wait variable changes from yes 
to no.

=cut

sub initialize_messages {
	my ($self) = @_;

	$color_listbox->set_hash_ref($L_SU_href);
	$color_listbox->initialize_messages();

	return ();
}

=head2 sub pre_built_superflows
   
   scalar reference:
     print("LSU_Tk,superflow_select,prog_name: ${$L_SU_href->{_prog_name_sref}}\n");
    array reference:
      print("LSU_Tk,superflow_select: _names_aref @{$L_SU_href->{_names_aref}}\n");
      sets flow type = pre-built superflow
      
      # print complete hash
 		while (my ( $key,$value ) = each %{$L_SU_href} ){
 			print ("$key \t\t=> $value\n");
 		}

 		 binding needs:
 		  	$pre_built_big_stream	->select(); 
			$pre_built_big_stream	->set_sub_ref
		$pre_built_big_stream	->set_flowNsuperflow_name_w  displays superflow name at top of gui 
			
	);

  	 	foreach my $key (sort keys %$L_SU_href) {
 		print (" file_dialog,key is $key, value is $L_SU_href->{$key}\n");
    			
=cut

sub pre_built_superflows {
	my ( $self, $superflow_name_sref ) = @_;

#print("2. L_SU,pre_built_superflows ,superflow_name_sref=$$superflow_name_sref\n");

	if ($superflow_name_sref) {

		$L_SU_href->{_prog_name_sref} = $superflow_name_sref;
		$gui_history->set_hash_ref($L_SU_href);
		$gui_history->set4superflow_open_data_file_start();
		$L_SU_href = $gui_history->get_hash_ref();
		$pre_built_big_stream->set_hash_ref($L_SU_href);

		# displays superflow name at top of gui
		$pre_built_big_stream->set_flowNsuperflow_name_w(
			$flowNsuperflow_name_w);

		# for binding to file dialog options
		my $sub_ref = \&_FileDialog_button;
		$pre_built_big_stream->set_sub_ref($sub_ref);

		# print("41 L_SU,pre_built_superflows, gui_history.txt\n");
		# $gui_history->view();

		# display parameters values and names
		# of a chosen superflow
		# but do not write them to a file
		$pre_built_big_stream->select();

# print("41 L_SU,pre_built_superflows, parameter_values_frame: $L_SU_href->{_parameter_values_frame}\n");
# print("41 L_SU,pre_built_superflows, parameter_values_frame: $parameter_values_frame\n");

		# return changes to $L_SU_href without altering other original values
		$L_SU_href = $pre_built_big_stream->get_hash_ref();

# print("41 L_SU,pre_built_superflows, values_aref: @{$L_SU_href->{_values_aref}}\n");

	}
	else {
		print("L_SU,pre_built_superflow, missing name \n");
	}
	return ();
}

=head2 sub set_run_button

comes from MAIN and is used by superflow
     
    uses flow or pre_built superflow names  
	
	original L_SU plus changes is returned	
    
    for safety, place set_hash_ref first
    
 	foreach my $key (sort keys %$L_SU_href) {
      	print (" L_SU,set_run_button, key is $key, value is $L_SU_href->{$key}\n");
 	}
 				      	
     
=cut

sub set_run_button {
	my ( $self, $value_ref ) = @_;

	# print("L_SU,set_run_button, value: ${$value_ref} \n");

	if ( $$value_ref eq 'Run' ) {    # i.e., 'Run'... double check

		# e.g., user-built or pre-built superflow
		if ( $L_SU_href->{_flow_type} ) {
			my $flow_type = $L_SU_href->{_flow_type};

			if ( $flow_type eq 'user_built' ) {

				my $flow_color = $L_SU_href->{_flow_color};

	# print("1. L_SU,set_run_button, flow_color: $L_SU_href->{_flow_color} \n");
				my $color_flow = $flow_color . '_flow';

lib/App/SeismicUnixGui/misc/L_SU.pm  view on Meta::CPAN

  are green ("on") or red ("off"), and
  Labels and Entry Widgets are made blank.
  get back the Label and Entry widgets 
  
  print("L_SU, set_param_widgets _check_buttons_settings_aref: @{$L_SU_href->{_check_buttons_settings_aref}}\n")
  print("L_SU, set_param_widgets _labels_w_aref: @{$L_SU_href->{_labels_w_aref}}\n");
  
=cut

sub set_param_widgets {
	my ($self) = @_;

	my $param_widgets = param_widgets->new();

# print("L_SU,set_param_widgets, parameter_names_frame: $parameter_names_frame\n");
# $gui_history->view();

	$param_widgets->set_labels_frame( \$parameter_names_frame );
	$param_widgets->set_values_frame( \$parameter_values_frame );
	$param_widgets->set_check_buttons_frame( \$parameter_values_button_frame );
	$param_widgets->initialize_labels();
	$param_widgets->initialize_values();
	$param_widgets->initialize_check_buttons();
	$param_widgets->show_labels();
	$param_widgets->show_values();
	$param_widgets->show_check_buttons();

	$L_SU_href->{_check_buttons_w_aref} =
	  $param_widgets->get_check_buttons_w_aref();
	$L_SU_href->{_check_buttons_settings_aref} =
	  $param_widgets->get_check_buttons_settings_aref();
	$L_SU_href->{_labels_w_aref} = $param_widgets->get_labels_w_aref();
	$L_SU_href->{_values_w_aref} = $param_widgets->get_values_w_aref();

	return ();
}

=head2 sub user_built_flows

 USE:

  for any colored flow
 to delete an item from a flow
 'delete_from_flow_button'
 to move up and down a list of flow items
 'flow_item_up_arrow_button'
 'flow_item_down_arrow_button '
 'delete_whole_flow_button '
 add2flows
 
 sunix_listbox get_help (MB3)
 flow-item selection ('flow_select') (MB1)

if neutral-colored stored parameters exist
they have to be transferred from 
neutral_flow to either grey, pink, green, or blue, _flow
 		 			
displays superflow name at top of gui
 		$pre_built_big_stream	->set_flowNsuperflow_name_w($flowNsuperflow_name_w);	

needed for binding to file dialog options
 		$grey_flow	->set_sub_ref(\&_FileDialog_button);
 		
Display of all the parameters and names occurs via select method
 		$pre_built_big_stream	->select();  
 		
return changes to $L_SU_href without altering other original values
 		$L_SU_href 					= $pre_built_big_stream->get_hash_ref();	
 			
 listbox color is selected, e.g., with a MB1 click in Main

=cut

sub user_built_flows {
	my ( $self, $method ) = @_;

	my $color = _get_flow_color;
	my $idx;

	# Dealing with a color flow ?
	# Is color flow listbox occupied ?
	# Skip the listbox if it is contains no flow
	# Don' t skip the listbox if it does contain a flow

	if (   $color eq 'grey'
		|| $color eq 'pink'
		|| $color eq 'green'
		|| $color eq 'blue'
		|| $color eq 'neutral' )
	{

		if ( $color eq 'grey' ) {
			$idx = 0;
		}
		elsif ( $color eq 'pink' ) {
			$idx = 1;
		}
		elsif ( $color eq 'green' ) {
			$idx = 2;
		}
		elsif ( $color eq 'blue' ) {
			$idx = 3;
		}
		elsif ( $color eq 'neutral' ) {

			# print("color should = neutral\n");
		}
		else {
			print("L_SU,user_built_flows,unexpected value  \n");
		}

#		print("L_SU,start of user_built_flows, occupied listboxes= @{$L_SU_gui->{_occupied_listbox_aref}} \n");
#		print("L_SU,user_built_flows, occupied listboxes= @{$L_SU_gui->{_vacant_listbox_aref}} \n");

		if ( $color eq 'grey' ) {

			# Dealing with the grey flow ?
			# Is grey flow listbox occupied ?
			# A prior flow should exist in the list box
			# Skip the listbox if there is no flow already in it
			# This module is used by delete_from_flow_button,
			# and delete_whole_flow_button, which
			# deletes the whole flow completely
			# e.g., when deleting the last item in a flow
			# or deleting the whole flow at once
			# This option is also used for moving item up or down a flow

			if ( @{ $L_SU_gui->{_occupied_listbox_aref} }[0] == $true ) {

				# flow already exists
				# bind flow parameters to the opening files
				$grey_flow->set_hash_ref($L_SU_href);
				$grey_flow->set_occupied_listbox_aref(
					$L_SU_gui->{_occupied_listbox_aref} );
				$grey_flow->set_vacant_listbox_aref(
					$L_SU_gui->{_vacant_listbox_aref} );

				if ( $method eq 'flow_select' ) {

					my $prior_flow_color =
					  ( $L_SU_href->{_flow_select_color_href} )->{_prior};
					my $most_recent_flow_color =
					  ( $L_SU_href->{_flow_select_color_href} )->{_most_recent};

					if ( $prior_flow_color eq $most_recent_flow_color ) {

						# CASE 1 if selecting the same flow color more than once
						$grey_flow->$method;

					}
					elsif ( $prior_flow_color ne $most_recent_flow_color ) {

					# CASE 2 if selecting  a different color flow than last time
						$grey_flow->flow_select2save_most_recent_param_flow();

					}
					else {
						print("2. L_SU, user_built_flows, bad value\n");
					}

					$L_SU_href = $grey_flow->get_hash_ref();
					$L_SU_gui->{_occupied_listbox_aref} =
					  $color_listbox->get_flow_listbox_occupancy_aref();
					$L_SU_gui->{_vacant_listbox_aref} =
					  $color_listbox->get_flow_listbox_vacancy_aref();

#					print("1. L_SU, user_built_flows, flow_select  grey, L_SU_gui->{_occupied_listbox_aref}: @{$L_SU_gui->{_occupied_listbox_aref}}\n ");

				}
				elsif ( $method ne 'flow_select' ) {

					$grey_flow->$method;

#				print("2. L_SU, user_built_flows, NOT flow_select grey, occupied listboxes are: @{$L_SU_gui->{_occupied_listbox_aref}}\n ");

				}
				else {
					print("NADA L_SU,user_built_flows, skip this method\n");
				}

				$L_SU_href = $grey_flow->get_hash_ref();

				# transfer any updates from color_flows to the private hash on
				# the state of occupancy of vacancy of color flow listboxes
				$color_listbox
				  ->set_flow_listbox_next_available_occupancyNvacancy_aref(
					$L_SU_href->{_occupied_listbox_aref} );
				$L_SU_gui->{_occupied_listbox_aref} =
				  $color_listbox->get_flow_listbox_occupancy_aref();
				$L_SU_gui->{_vacant_listbox_aref} =
				  $color_listbox->get_flow_listbox_vacancy_aref();

lib/App/SeismicUnixGui/misc/L_SU.pm  view on Meta::CPAN

					$grey_flow->set_hash_ref($L_SU_href);
					$grey_flow->set_occupied_listbox_aref(
						$L_SU_gui->{_occupied_listbox_aref} );
					$grey_flow->set_vacant_listbox_aref(
						$L_SU_gui->{_vacant_listbox_aref} );

					# must precede add2flow	method
					$gui_history->set_flow_select_color($color);

	#					print("first time add2flow : L_SU,user_built_flows,method=$method\n");
					$grey_flow->$method;
					$grey_flow->flow_select2save_most_recent_param_flow();

					#  updates flow_select color
					$L_SU_href = $grey_flow->get_hash_ref();
					$color_listbox->set_flow_listbox_color( _get_flow_color() );
					$L_SU_gui->{_occupied_listbox_aref} =
					  $color_listbox->get_flow_listbox_occupancy_aref();
					$L_SU_gui->{_vacant_listbox_aref} =
					  $color_listbox->get_flow_listbox_vacancy_aref();

#					print("2. L_SU, user_built_flows, occupied listboxes are: @{$L_SU_gui->{_occupied_listbox_aref}}\n ");

				}
				elsif ( $method eq 'flow_select' ) {

			# indicate preferred next_available occupation of this listbox color
					$color_listbox->set_next_available_flow_listbox_color(
						'grey');

				}
				else {
					print(
						" L_SU,user_built_flows, grey, unexpected:--$method--\n"
					);
				}
			}
			else {
				print(
" L_SU,user_built_flows, grey, unexpected occupation status\n"
				);
			}

		}
		elsif ( $color eq 'pink' ) {

			# A flow has been started
			# Used by delete_from_flow_button,
			# and delete_whole_flow_button
			# Used to delete the flow completely
			# e.g., when deleting the last item in a flow
			# or deleting the whole flow at once
			# Also used for moving item up or down a flow
			# Dealing with the pink flow
			# Is pink flow listbox occupied ?
			# Skip the listbox if there is a flow already in it

			if ( @{ $L_SU_gui->{_occupied_listbox_aref} }[1] == $true ) {

				# flow already exists
				#  bind flow parameters to the opening files
				# This flow listbox color is available

				$pink_flow->set_hash_ref($L_SU_href);
				$pink_flow->set_occupied_listbox_aref(
					$L_SU_gui->{_occupied_listbox_aref} );
				$pink_flow->set_vacant_listbox_aref(
					$L_SU_gui->{_vacant_listbox_aref} );

#				print("L_SU, user_built_flows, pink, occupied listboxes are: @{$L_SU_gui->{_occupied_listbox_aref}}\n ");

				if ( $method eq 'flow_select' ) {

					my $prior_flow_color =
					  ( $L_SU_href->{_flow_select_color_href} )->{_prior};
					my $most_recent_flow_color =
					  ( $L_SU_href->{_flow_select_color_href} )->{_most_recent};

					if ( $prior_flow_color eq $most_recent_flow_color ) {

						#CASE 1 if selecting the same flow color more than once
						$pink_flow->$method;

					}
					elsif ( $prior_flow_color ne $most_recent_flow_color ) {

					 #CASE 2 if selecting  a different color flow than last time
						$pink_flow->flow_select2save_most_recent_param_flow();

					}
					else {
						print("2. L_SU,user_built_flows, bad value\n");
					}

					$L_SU_href = $pink_flow->get_hash_ref();
					$color_listbox->set_flow_listbox_color( _get_flow_color() );
					$L_SU_gui->{_occupied_listbox_aref} =
					  $color_listbox->get_flow_listbox_occupancy_aref();
					$L_SU_gui->{_vacant_listbox_aref} =
					  $color_listbox->get_flow_listbox_vacancy_aref();

#					print("1. L_SU, user_built_flows, flow_select  pink, L_SU_gui->{_occupied_listbox_aref}: @{$L_SU_gui->{_occupied_listbox_aref}}\n ");

				}
				elsif ( $method ne 'flow_select' ) {

					$pink_flow->$method;

				}
				else {
					print("NADA L_SU,user_built_flows, skip thismethod\n");
				}

				$L_SU_href = $pink_flow->get_hash_ref();

				# transfer any updates from color_flows to the private hash on
				# the state of occupancy of vacancy of color flow listboxes
				$color_listbox
				  ->set_flow_listbox_next_available_occupancyNvacancy_aref(
					$L_SU_href->{_occupied_listbox_aref} );
				$L_SU_gui->{_occupied_listbox_aref} =



( run in 0.555 second using v1.01-cache-2.11-cpan-2398b32b56e )