App-SeismicUnixGui

 view release on metacpan or  search on metacpan

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

	my ( $self, $index ) = @_;
	my $idx = $index;    # individual parameter line

	my $control = control->new();

	# two cases possible
	# in general L_SU

	# print(" 1. param_widgets_neutral, _changes, entry_in_switch is $entry_in_switch\n");

	if ( $param_widgets_color_href->{_current_program_name} ) {
		my $prog_name = $param_widgets_color_href->{_current_program_name};

		if ( $entry_in_switch eq $off ) {    # =0

			$entry_in_switch = $on;

			# my $ans = $self->get_index_on_exit();
			# my $ans = $param_widgets_color_href->{_parameter_index_on_entry};
			# print(" 2. param_widgets_neutral, _changes, exit index=$ans ENTERED INDEX=$idx\n");
			$param_widgets_color_href->{_parameter_index_on_entry} = $idx;

		}
		elsif ( $entry_in_switch eq $on ) {    # i.e., on and set

			$entry_in_switch = $off;

			# my $ans = $param_widgets_color_href->{_parameter_index_on_exit};
			# print(" 3. param_widgets_neutral, _changes, entry index=$ans LEFT INDEX=$idx \n");
			$param_widgets_color_href->{_parameter_index_on_exit} = $idx;

		}
		else {
			print(" param_widgets_neutral, changes, bad switch \n");
		}

		$self->set_hash_ref($param_widgets_color_href);

		# my $ans= ($self->get_hash_ref())->{_parameter_index_on_exit};
		# print(" param_widgets_neutral, changes, prog_name: $prog_name \n");
		# print(" param_widgets_neutral, _changes, _parameter_index_on_exit: $ans \n");
		# $ans= ($self->get_hash_ref())->{_parameter_index_on_entry};
		# print(" param_widgets_neutral, _changes, _parameter_index_on_entry: $ans \n");

		my $max_idx = $control->get_max_index($prog_name);

		# print(" param_widgets_neutral,max_index, $max_idx \n");
		# cautious, index must be reasonable
		if (   $idx >= 0
			&& $idx <= $control->get_max_index($prog_name) )
		{
			_set_entry_change_status($true);
			my $changed_entry = $param_widgets_color_href->{_changed_entry};    #always

			# print("param_widgets_neutral,changes,changed 1-yes 0 -no? $changed_entry\n");
			_update_check_button_setting($idx);

			_set_index_on_entry($idx);
		}

		return ($true);                                                         # for Entry widget to say there is no error

		# second case is when we are using project_selector
		# project_selector does not yet have a max_index defined in a separate module
	}
	else {
		return ($true);    # for Entry widget to say there is no error
	}

}

=head2 sub error_check

 When entry values are in error 

=cut

sub error_check {
	my ($self) = @_;
	print("param_widgets_neutral,error_check return is $true\n");
	return ($true);
}

=head2 sub get_check_buttons_w_aref


=cut

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

	if ( $param_widgets_color_href->{_check_buttons_w_aref} ) {

		my $check_buttons_w_aref = $param_widgets_color_href->{_check_buttons_w_aref};
		return ($check_buttons_w_aref);

	}
	else {
		print("param_widgets_neutral, get_check_buttons_w_aref, missing check_buttons_w_aref \n");
		return ();
	}
}

=head2 sub 

=cut

sub get_current_program {

	my ( $self, $widget_ref ) = @_;
	my @selection_index = $$widget_ref->curselection();
	my $prog_name       = $$widget_ref->get( $selection_index[0] );

	# print("param_widgets_neutral get_current_program: $prog_name,index:$selection_index[0] \n");
	return ( \$prog_name );
}

=head2 sub get_entry_change_status

=cut

sub get_entry_change_status {
	my @self   = @_;
	my $status = $param_widgets_color_href->{_changed_entry};

	# print("param_widgets_neutral, get_entry_change_status,changed_entry: $param_widgets_color_href->{_changed_entry}\n");
	return ($status);



( run in 0.302 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )