App-GUI-Cellgraph
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/App/GUI/Cellgraph/Frame.pm view on Meta::CPAN
$self->SetMaxSize( $window_size );
$self->SetSize( $window_size );
$self->update_recent_settings_menu();
$self->sketch( );
$self->SetStatusText( "settings in init state", 0 );
$self->{'last_file_settings'} = $self->get_settings;
$self;
}
sub update_recent_settings_menu {
my ($self) = @_;
my $recent = $self->{'config'}->get_value('last_settings');
return unless ref $recent eq 'ARRAY';
my $set_menu_ID = 11300;
$self->{'setting_menu'}->Destroy( $set_menu_ID );
my $Recent_ID = $set_menu_ID + 1;
$self->{'recent_menu'} = Wx::Menu->new();
for (reverse @$recent){
my $path = $_;
$self->{'recent_menu'}->Append($Recent_ID, $path);
lib/App/GUI/Cellgraph/Frame/Panel/ColorPicker.pm view on Meta::CPAN
}
sub current_color_name { $_[0]->{'color_names'}->[ $_[0]->{'color_index'} ] }
sub get_current_color {
my ( $self ) = @_;
my $color = $self->{'colors'}->{ $self->current_color_name };
{red=> $color->[0], green=> $color->[1], blue=> $color->[2] };
}
sub update_select {
my ( $self ) = @_;
$self->{'color_names'} = [ sort keys %{$self->{'colors'}} ];
$self->{'select'}->Clear ();
$self->{'select'}->Append( $_) for @{$self->{'color_names'}};
$self->update_display();
}
sub update_display {
my ( $self ) = @_;
$self->{'color_index'} = $#{$self->{'color_names'}} if $self->{'color_index'} < 0;
$self->{'color_index'} = 0 if $self->{'color_index'} > $#{$self->{'color_names'}};
$self->{'select'}->SetSelection( $self->{'color_index'} );
$self->{'display'}->set_color( $self->get_current_color );
}
sub get_config { $_[0]->{'colors'} }
lib/App/GUI/Cellgraph/Frame/Panel/ColorSetPicker.pm view on Meta::CPAN
$self->SetSizer($sizer);
$self->update_display;
$self;
}
sub current_set_name { $_[0]->{'set_names'}->[ $_[0]->{'set_index'} ] }
sub get_current_color_set { @{$_[0]->{'set_content'}} }
sub update_select {
my ( $self ) = @_;
$self->{'set_names'} = [ sort keys %{$self->{'sets'}} ];
$self->{'select'}->Clear ();
$self->{'select'}->Append( $_) for @{$self->{'set_names'}};
$self->update_display();
}
sub update_display {
my ($self) = @_;
$self->{'set_index'} = $#{$self->{'set_names'}} if $self->{'set_index'} < 0;
$self->{'set_index'} = 0 if $self->{'set_index'} > $#{$self->{'set_names'}};
$self->{'select'}->SetSelection( $self->{'set_index'} );
my $set_name = $self->{'set_names'}[ $self->{'set_index'} ];
my $set_length = @{ $self->{'sets'}{$set_name} };
$self->{'set_content'} = [ map { color( $self->{'sets'}{$set_name}[ $_ ] ) } 0 .. $set_length - 1 ];
$self->{'set_content'}[$_] = color( $default_color ) for $set_length .. 8;
$self->{'display'}[$_]->set_color( $self->{'set_content'}[ $_ ]->rgb_hash ) for 0 .. 8;
}
lib/App/GUI/Cellgraph/Frame/Tab/Action.pm view on Meta::CPAN
sub get_result_values { map { $_[0]->{'action_result'}[$_]->GetValue } $_[0]->{'subrules'}->index_iterator }
sub get_spread_values { map { $_[0]->{'action_spread'}[$_]->GetValue } $_[0]->{'subrules'}->index_iterator }
sub set_result_values {
my ($self, @values) = @_;
return unless @values == $self->{'subrules'}->independent_count;
$self->{'action_result'}[$_]->SetValue( $values[$_], 'silent' ) for $self->{'subrules'}->index_iterator;
$self->update_result_history( );
}
sub update_result_history {
my ($self, $nr) = @_;
return if defined $nr and not exists $self->{'action_result'}[$nr];
$self->{'result_history'}->add_value( summary_from_list( $self->get_result_values ), (defined $nr) ? ($nr, time) : () );
$self->update_button_state;
}
sub set_spread_values {
my ($self, @values) = @_;
return unless @values == $self->{'subrules'}->independent_count;
$self->{'action_spread'}[$_]->SetValue( $values[$_], 'silent' ) for $self->{'subrules'}->index_iterator;
$self->update_spread_history( );
}
sub update_spread_history {
my ($self, $nr) = @_;
return if defined $nr and not exists $self->{'action_spread'}[$nr];
$self->{'spread_history'}->add_value( summary_from_list( $self->get_spread_values ), (defined $nr) ? ($nr, time) : () );
$self->update_button_state
}
sub update_button_state {
my ($self) = @_;
$self->{'button'}{'result'}{'undo'}->Enable( $self->{'result_history'}->can_undo );
$self->{'button'}{'result'}{'redo'}->Enable( $self->{'result_history'}->can_redo );
$self->{'button'}{'spread'}{'undo'}->Enable( $self->{'spread_history'}->can_undo );
$self->{'button'}{'spread'}{'redo'}->Enable( $self->{'spread_history'}->can_redo );
}
sub list_from_summary { split ',', $_[0] }
lib/App/GUI/Cellgraph/Frame/Tab/Color.pm view on Meta::CPAN
map { return if ref $_ ne 'Graphics::Toolkit::Color' } @color;
$self->{'state_colors'}[$_] = $color[$_] for 0 .. $#color;
$self->{'state_pic'}[$_]->set_color( $self->{'state_colors'}[$_]->values(as => 'hash') ) for 0 .. $self->{'last_state'};
$self->select_state;
$self->{'call_back'}->( 'color' ); # update whole app
}
sub get_all_colors { @{$_[0]->{'state_colors'}} }
sub get_active_colors { @{$_[0]->{'state_colors'}}[ 0 .. $_[0]->{'state_count'} - 1] }
sub update_config {
my ($self) = @_;
$self->{'config'}->set_value('color', $self->{'picker'}->get_config);
$self->{'config'}->set_value('color_set', $self->{'setpicker'}->get_config);
}
1;
lib/App/GUI/Cellgraph/Frame/Tab/Rules.pm view on Meta::CPAN
}
sub get_summary { join '', $_[0]->get_result_values }
sub set_summary {
my ($self, $summary) = @_;
my @values = split '', $summary;
my $return = $self->{'rules'}->set_subrule_results( @values );
$self->set_result_values( @values );
}
sub update_subrule_result {
my ($self, $index, $result) = @_;
my $summary = $self->{'rules'}->set_subrule_result( $index, $result );
$self->update_widgets;
}
sub update_subrule_occurance {
my ($self, @occurance) = @_;
for my $rule_index ($self->{'subrules'}->index_iterator){
$self->{'rule_occur'}[$rule_index]->SetValue( $occurance[$rule_index] );
}
}
sub update_widgets {
my ($self) = shift;
$self->{'rule_nr'}->SetValue( $self->{'rules'}->get_rule_nr );
$self->{'button'}{'undo'}->Enable( $self->{'rules'}->can_undo );
$self->{'button'}{'redo'}->Enable( $self->{'rules'}->can_redo );
}
1;
lib/App/GUI/Cellgraph/Frame/Tab/Start.pm view on Meta::CPAN
return unless @list <= $self->{'cells_in_row'};
map {return unless is_action_nr($_) } @list;
$self->set_action_summary( join '', @list );
push @list, 0 until @list == $self->{'cells_in_row'};
map { $self->{'action_switches'}[$_]->SetValue( $list[$_] )
if exists $list[$_] and $list[$_] ne $self->{'action_switches'}[$_]->GetValue } @{$self->{'cells_iterator'}};
@list;
}
sub update_cell_colors {
my ($self, @colors) = @_;
return if @colors < 2;
my $do_recolor = @colors == $self->{'state_count'} ? 0 : 1;
for my $i (0 .. $#colors) {
return unless ref $colors[$i] eq 'Graphics::Toolkit::Color';
if (exists $self->{'state_colors'}[$i]) {
my @rgb = $colors[$i]->rgb;
$do_recolor += !( $rgb[$_] == $self->{'state_colors'}[$i][$_]) for 0 .. 2;
} else { $do_recolor++ }
}
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.866 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )