App-GUI-Harmonograph

 view release on metacpan or  search on metacpan

lib/App/GUI/Harmonograph/Frame.pm  view on Meta::CPAN

    $self->SetSize($size);
    $self->SetMinSize($size);
    $self->SetMaxSize($size);

    $self->update_recent_settings_menu();
    $self->{'btn'}{'draw'}->SetFocus;
    $self->sketch;
    $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/Harmonograph/Frame.pm  view on Meta::CPAN

    $self->SetStatusText( "saved image under: $file", 0 );
    $self->set_settings_save(1);
}

sub set_settings_save {
    my ($self, $status)  = @_;
    $self->{'saved'} = $status;
    $self->SetTitle( $self->{'title'} .($self->{'saved'} ? '': ' *'));
}

sub update_base_name {
    my ($self) = @_;
    my $file = $self->{'txt'}{'file_bname'}->GetValue;
    $self->{'config'}->set_value('file_base_name', $file);
    $self->{'config'}->set_value('file_base_counter', 1);
    $self->inc_base_counter();
}

sub inc_base_counter {
    my ($self, $type) = @_;
    my $dir = $self->{'config'}->get_value('file_base_dir');

lib/App/GUI/Harmonograph/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'} }

1;

lib/App/GUI/Harmonograph/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 .. $self->{'max_display_count'}-1;
    $self->{'display'}[$_]->set_color( $self->{'set_content'}[ $_ ]->rgb_hash ) for 0 .. $self->{'max_display_count'}-1;
}

lib/App/GUI/Harmonograph/Frame/Panel/Pendulum.pm  view on Meta::CPAN

    $self->{ 'offset'}->SetValue( int( $settings->{'offset'} * 400 ), 'passive');
    $self->{ 'radius' }->SetValue( $settings->{'radius'} * 100, 'passive' );
    $self->{ 'radius_damp' }->SetValue( $settings->{'radius_damp'}, 'passive' );
    $self->{ 'radius_damp_acc' }->SetValue( $settings->{'radius_damp_acc'}, 'passive');
    $self->{ 'radius_damp_type'}->SetValue(  $settings->{ 'radius_damp_type'} // '-' );
    $self->{ 'radius_damp_acc_type'}->SetValue(  $settings->{ 'radius_damp_acc_type'} // '+' );
    $self->update_enable;
    1;
}

sub update_enable {
    my ($self) = @_;
    my $val = $self->{ 'on' }->IsChecked;
    $self->{$_}->Enable( $val ) for qw/
        freq_dez freq_factor invert_freq invert_dir neg_freq half_off quarter_off offset
        frequency freq_damp freq_damp_acc freq_damp_type freq_damp_acc_type
        radius radius_factor neg_radius reset_radius
        radius_damp radius_damp_acc radius_damp_type radius_damp_acc_type/;
}

1;

lib/App/GUI/Harmonograph/Frame/Tab/Color.pm  view on Meta::CPAN

    $self->{'used_colors'} = [@colors];
    $self->{'used_colors'}[$_] = color( $default_color_def ) for @colors .. $self->{'color_count'}-1;
    $self->{'color_display'}[$_]->set_color( $self->{'used_colors'}[$_]->values(as => 'hash') ) for 0 .. $self->{'color_count'}-1;
    $self->set_current_color_nr;
    $self->{'call_back'}->( 'color' ); # update whole app
}

sub get_all_colors { @{$_[0]->{'used_colors'}} }
sub get_active_colors { @{$_[0]->{'used_colors'}}[ 0 .. $_[0]->{'active_color_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/Harmonograph/Frame/Tab/Visual.pm  view on Meta::CPAN

    my ( $self ) = @_;
    my $settings = { map { $_ => $self->{'widget'}{$_}->GetValue } @state_widgets};
    $settings->{'duration'} = ($self->{'widget'}{ 'duration_min' }->GetValue * 60)
                             + $self->{'widget'}{ 'duration_s' }->GetValue;
    $settings->{'dot_density'} = ($self->{'widget'}{ '100dots_per_second' }->GetValue * 100)
                                + $self->{'widget'}{ 'dots_per_second' }->GetValue;
    $settings->{'draw'} = $self->{'widget'}{'draw'}->GetString( $self->{'widget'}{ 'draw' }->GetSelection );
    $settings;
}

sub update_enable {
    my ( $self ) = @_;
    my $type = $self->{'widget'}{'color_flow_type'}->GetValue;
    if      ($type eq 'no'){
        $self->{'widget'}{$_}->Enable(0) for qw/color_flow_speed invert_flow_speed colors_used color_flow_dynamic/;
    } elsif ($type eq 'one_time'){
        $self->{'widget'}{$_}->Enable(1) for qw/color_flow_speed invert_flow_speed colors_used color_flow_dynamic/;
        $self->{'widget'}{'color_flow_speed'}->Enable(0);
        $self->{'widget'}{'invert_flow_speed'}->Enable(0);
    } else {
        $self->{'widget'}{$_}->Enable(1) for qw/color_flow_speed invert_flow_speed colors_used color_flow_dynamic/;



( run in 0.261 second using v1.01-cache-2.11-cpan-95122f20152 )