App-SeismicUnixGui

 view release on metacpan or  search on metacpan

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


#	print("10 color_flow,add2flow_button, after stack flow AND after update, view param_flow data:\n");
#	$param_flow_color_pkg->view_data();

	_flow_select_director('add2flow_button');

	# the following is also carried out in flow_select when  pre_ok=true
	# $color_flow_href->{_last_flow_color} = $flow_color;
	return ();
}

=head2 sub delete_from_flow_button

if flow_select was last clicked then 
$gui_history has already recorded the chosen flow color

my $flow_color = $gui_history->get_flow_color();
 	 	
=cut

sub delete_from_flow_button {

	my ($self) = @_;

	my $flow_color =
	  ( $color_flow_href->{_flow_select_color_href} )->{_most_recent};

	if ($flow_color) {

		_set_flow_color($flow_color);

		my $message = $message_director->null_button(0);
		$message_w->delete( "1.0", 'end' );
		$message_w->insert( 'end', $message );

		my $_flow_listbox_color_w = _get_flow_listbox_color_w();

		$gui_history->set_hash_ref($color_flow_href);
		$gui_history->set_defaults4start_of_delete_from_flow_button(
			$flow_color);
		$color_flow_href = $gui_history->get_hash_ref();

		$decisions->set4delete_from_flow_button($color_flow_href);
		my $pre_req_ok = $decisions->get4delete_from_flow_button();

		# confirm listboxes are active
		if ($pre_req_ok) {

			# location within GUI on first clicking delete button
			#			$gui_history->set_hash_ref($color_flow_href);

			# flow_color is in 'color'_flow namespace
			my $index =
			  $flow_widgets->get_flow_selection($_flow_listbox_color_w);

			if (    $index == 0
				and $param_flow_color_pkg->get_num_items() == 1 )
			{

				# CASE: LAST ITEM in listbox is deleted
				# extra checking includes verifying number of items

				# For Run and Save button
				$flow_widgets->delete_selection($_flow_listbox_color_w);

				# Blank out the names of the programs in the GUI
				_set_flow_name_color_w($flow_color);
				$flow_name_color_w->configure( -text => $var->{_clear_text} );
				$color_flow_href->{_flowNsuperflow_name_w}
				  ->configure( -text => $var->{_clear_text} );

				# delete stored programs and their parameters
				my $index2delete = $flow_widgets->get_index2delete();

				# delete_from_stored_flows();
				$param_flow_color_pkg->delete_selection($index2delete);

				# collect and store latest program versions from changed list
				# clear all the versions from the changed list
				_clear_stack_versions();

				$gui_history->set_hash_ref($color_flow_href);
				$gui_history->set_defaults4last_delete_from_flow_button();
				$color_flow_href = $gui_history->get_hash_ref();

		 # Blank out all the stored parameter values and names within param_flow
				$param_flow_color_pkg->clear();

				# clear the parameter values and labels from the gui
				# strange memory leak inside param_widgets
				my $save =
				  clone( $color_flow_href->{_check_buttons_settings_aref} );
				$param_widgets->gui_full_clear();
				@{ $color_flow_href->{_check_buttons_settings_aref} } = @$save;

				# reinitialize flow_select_count
				$gui_history->set_clear('delete_from_flow_button');
				@{ $color_flow_href->{_occupied_listbox_aref} }
				  [$_number_from_color] = $false;
				@{ $color_flow_href->{_vacant_listbox_aref} }
				  [$_number_from_color] = $true;

#				print("1.color_flow, delete_from_flow_button, \n
#				 	color_flow_href->{_occupied_listbox_aref}[_number_from_color]= $color_flow_href->{_occupied_listbox_aref}[$_number_from_color]
#				 \n");
#				print("1.color_flow, delete_from_flow_button, \n
#				 	color_flow_href->{_vacant_listbox_aref}[_number_from_color]= $color_flow_href->{_vacant_listbox_aref}[$_number_from_color]
#				 \n");
#				print("1. last item deleted Shut down delete button\n");

			}
			elsif ( $index > 0 ) {

				# CASE more more than one item remains in a listbox (implied)
				# but selected index is not the first
				$flow_widgets->delete_selection($_flow_listbox_color_w);

				# delete stored programs and their parameters
				# delete_from_stored_flows();
				my $index2delete = $flow_widgets->get_index2delete();

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


	}
	else {    # if flow_color
		print("color_flow, delete_from_flow_button, flow color missing: \n");
	}

	#	print("color_flow, END delete_from_flow_button, print gui_history.txt\n");
	#    $gui_history->view();
}

=head2 sub delete_whole_flow_button

If flow_select was last clicked then 
$gui_history has already recorded the chosen flow color
 	 	
=cut

sub delete_whole_flow_button {

	my ($self) = @_;

	my $flow_color =
	  ( $color_flow_href->{_flow_select_color_href} )->{_most_recent};

	#	print(" START color_flow, delete_whole_flow_button, \n");
	# print("color_flow, delete_whole_flow_button, print gui_history.txt\n");
	# $gui_history->view();

	if ($flow_color) {

		_set_flow_color($flow_color);

		my $message = $message_director->null_button(0);
		$message_w->delete( "1.0", 'end' );
		$message_w->insert( 'end', $message );

		my $_flow_listbox_color_w = _get_flow_listbox_color_w();

		$gui_history->set_hash_ref($color_flow_href);
		$gui_history->set_defaults4start_of_delete_whole_flow_button(
			$flow_color);
		$color_flow_href = $gui_history->get_hash_ref();
		$decisions->set4delete_whole_flow_button($color_flow_href);
		my $pre_req_ok = $decisions->get4delete_whole_flow_button();

		# confirm listboxes are active
		if ($pre_req_ok) {

			# flow_color is in 'color'_flow namespace
			# index is the currently selected
			my $index =
			  $flow_widgets->get_flow_selection($_flow_listbox_color_w);

			# print("color_flow, delete_whole_flow_button index=$index\n");

			if (    $index >= 0
				and $param_flow_color_pkg->get_num_items() >= 1 )
			{

				# CASE: DELETE ALL ITEMS in listbox
				# extra checking includes verifying number of items
				# For Run and Save button
				$flow_widgets->clear($_flow_listbox_color_w);

				# Blank out the names of the programs in the GUI
				_set_flow_name_color_w($flow_color);
				$flow_name_color_w->configure( -text => $var->{_clear_text} );
				$color_flow_href->{_flowNsuperflow_name_w}
				  ->configure( -text => $var->{_clear_text} );

				# delete stored programs and all the stored flow parameters
				my $index2delete = 'all';
				$param_flow_color_pkg->delete_selection($index2delete);

		 # Blank out all the stored parameter values and names within param_flow
				$param_flow_color_pkg->clear();

				$gui_history->set_hash_ref($color_flow_href);
				$gui_history->set_defaults4end_of_delete_whole_flow_button();
				$color_flow_href = $gui_history->get_hash_ref();

		 # Blank out all the stored parameter values and names within param_flow
				$param_flow_color_pkg->clear();

				# print("5. whole flow deleted Shut down delete button\n");
				# clear the parameter values and labels from the gui
				# strange memory leak inside param_widgets
				my $save =
				  clone( $color_flow_href->{_check_buttons_settings_aref} );
				$param_widgets->gui_full_clear();
				@{ $color_flow_href->{_check_buttons_settings_aref} } = @$save;

				# reinitialize flow_select_count
				$gui_history->set_clear('delete_whole_flow_button');

			}
			else {
				print(
					"color_flow, delete_whole_flow_button unexpected result\n");
			}    # index is >= 0

		}    # if pre_req_ok

	}
	else {    # if flow_color
		print("color_flow, delete_whole_flow_button, flow color missing: \n");
	}

}

=head2 sub flow_item_down_arrow_button

 	move items down in a flow listbox
    
=cut

sub flow_item_down_arrow_button {

	my ($self) = @_;
	my $prog_name;



( run in 0.484 second using v1.01-cache-2.11-cpan-39bf76dae61 )