view release on metacpan or search on metacpan
lib/App/GUI/Juliagraph/Dialog/About.pm view on Meta::CPAN
use v5.12;
use warnings;
use Wx;
package App::GUI::Juliagraph::Dialog::About;
use base qw/Wx::Dialog/;
use Graphics::Toolkit::Color;
sub new {
my ( $class, $parent) = @_;
my $self = $class->SUPER::new( $parent, -1, 'About Wx::GUI::Juliagraph' );
my @label_property = ( [-1,-1], [-1,-1], &Wx::wxALIGN_CENTRE_HORIZONTAL );
my $version = Wx::StaticText->new( $self, -1, $App::GUI::Juliagraph::NAME . ' version '.$App::GUI::Juliagraph::VERSION , @label_property);
my $author = Wx::StaticText->new( $self, -1, ' by Herbert Breunung ', @label_property);
my $license = Wx::StaticText->new( $self, -1, ' licensed under the GPL 3 ', @label_property);
my $perl = Wx::StaticText->new( $self, -1, 'using Perl '.$^V, @label_property);
my $wx = Wx::StaticText->new( $self, -1, 'WxPerl '. $Wx::VERSION . ' ( '. &Wx::wxVERSION_STRING. ' )', @label_property);
my $gtc = Wx::StaticText->new( $self, -1, 'Graphics::Toolkit::Color '.$Graphics::Toolkit::Color::VERSION, @label_property);
my $hd = Wx::StaticText->new( $self, -1, 'File::HomeDir '.$File::HomeDir::VERSION, @label_property);
my $url_lbl = Wx::StaticText->new( $self, -1, 'latest version on CPAN: ', @label_property);
lib/App/GUI/Juliagraph/Frame.pm view on Meta::CPAN
use App::GUI::Juliagraph::Dialog::About;
use App::GUI::Juliagraph::Frame::Tab::Constraints;
use App::GUI::Juliagraph::Frame::Tab::Polynomial;
use App::GUI::Juliagraph::Frame::Tab::Mapping;
use App::GUI::Juliagraph::Frame::Tab::Color;
use App::GUI::Juliagraph::Frame::Panel::Board;
use App::GUI::Juliagraph::Widget::ProgressBar;
sub new {
my ( $class, $parent, $title ) = @_;
my $self = $class->SUPER::new( $parent, -1, $title );
$self->SetIcon( Wx::GetWxPerlIcon() );
$self->CreateStatusBar( 2 );
$self->SetStatusWidths( 2, 600, 500 );
$self->SetStatusText( "no file loaded", 1 );
$self->{'config'} = App::GUI::Juliagraph::Config->new();
$self->{'title'} = $title;
Wx::ToolTip::Enable( $self->{'config'}->get_value('tips') );
Wx::InitAllImageHandlers();
# create GUI parts
lib/App/GUI/Juliagraph/Frame/Panel/Board.pm view on Meta::CPAN
package App::GUI::Juliagraph::Frame::Panel::Board;
use v5.12;
use warnings;
use Wx;
use base qw/Wx::Panel/;
use App::GUI::Juliagraph::Compute::Image;
sub new {
my ( $class, $parent, $x, $y ) = @_;
my $self = $class->SUPER::new( $parent, -1, [-1,-1], [$x, $y] );
$self->{'menu_size'} = 28;
$self->{'size'}{'x'} = $x;
$self->{'size'}{'y'} = $y;
$self->{'center'}{'x'} = $x / 2;
$self->{'center'}{'y'} = $y / 2;
$self->{'dc'} = Wx::MemoryDC->new( );
$self->{'bmp'} = Wx::Bitmap->new( $self->{'size'}{'x'} + 10, $self->{'size'}{'y'} +10 + $self->{'menu_size'}, 24);
$self->{'dc'}->SelectObject( $self->{'bmp'} );
$self->{'tab'}{'constraint'} = '';
lib/App/GUI/Juliagraph/Frame/Panel/ColorBrowser.pm view on Meta::CPAN
use Graphics::Toolkit::Color qw/color/;
my $RGB = Graphics::Toolkit::Color::Space::Hub::get_space('RGB');
my $HSL = Graphics::Toolkit::Color::Space::Hub::get_space('HSL');
sub new {
my ( $class, $parent, $type, $init_color ) = @_;
$init_color = color( $init_color );
return unless ref $init_color;
my $self = $class->SUPER::new( $parent, -1);
$self->{'init_color'} = $init_color->values( as => 'hash' );
$self->{'call_back'} = sub {};
my @rgb = $init_color->values('RGB');
my @hsl = $init_color->values('HSL');
$self->{'widget'}{'red'} = App::GUI::Juliagraph::Widget::SliderCombo->new( $self, 350, ' R ', "red part of $type color", 0, 255, $rgb[0]);
$self->{'widget'}{'green'} = App::GUI::Juliagraph::Widget::SliderCombo->new( $self, 350, ' G ', "green part of $type color", 0, 255, $rgb[1]);
$self->{'widget'}{'blue'} = App::GUI::Juliagraph::Widget::SliderCombo->new( $self, 350, ' B ', "blue part of $type color", 0, 255, $rgb[2]);
$self->{'widget'}{'hue'} = App::GUI::Juliagraph::Widget::SliderCombo->new( $self, 350, ' H ', "hue of $type color", 0, 359, $hsl[0]);
lib/App/GUI/Juliagraph/Frame/Panel/ColorPicker.pm view on Meta::CPAN
use Wx;
package App::GUI::Juliagraph::Frame::Panel::ColorPicker;
use base qw/Wx::Panel/;
use App::GUI::Juliagraph::Widget::ColorDisplay;
sub new {
my ( $class, $parent, $colors ) = @_;
return unless ref $parent and ref $colors eq 'HASH';
my $self = $class->SUPER::new( $parent, -1 );
$self->{'colors'} = { %$colors }; # $frame->{'config'}->get_value('color')
$self->{'color_names'} = [ sort keys %{$self->{'colors'}} ];
$self->{'color_index'} = 0;
my $btnw = 46; my $btnh = 17;# button width and height
$self->{'select'} = Wx::ComboBox->new( $self, -1, $self->current_color_name, [-1,-1], [170, -1], $self->{'color_names'});
$self->{'<'} = Wx::Button->new( $self, -1, '<', [-1,-1], [ 30, 17] );
$self->{'>'} = Wx::Button->new( $self, -1, '>', [-1,-1], [ 30, 17] );
$self->{'load'} = Wx::Button->new( $self, -1, 'Load', [-1,-1], [$btnw, $btnh] );
lib/App/GUI/Juliagraph/Frame/Panel/ColorSetPicker.pm view on Meta::CPAN
use App::GUI::Juliagraph::Widget::ColorDisplay;
use Graphics::Toolkit::Color qw/color/;
our $default_color = {red => 225, green => 225, blue => 225};
sub new {
my ( $class, $parent, $color_sets, $max_display_count ) = @_;
return unless ref $parent and ref $color_sets eq 'HASH';
my $self = $class->SUPER::new( $parent, -1 );
$self->{'sets'} = { %$color_sets };
$self->{'set_names'} = [ sort keys %{$self->{'sets'}} ];
$self->{'set_index'} = 1;
$self->{'max_display_count'} = $max_display_count;
my $btnw = 46; my $btnh = 17;# button width and height
$self->{'select'} = Wx::ComboBox->new( $self, -1, $self->current_set_name, [-1,-1], [170, -1], $self->{'set_names'});
$self->{'<'} = Wx::Button->new( $self, -1, '<', [-1,-1], [ 27, $btnh] );
$self->{'>'} = Wx::Button->new( $self, -1, '>', [-1,-1], [ 27, $btnh] );
lib/App/GUI/Juliagraph/Frame/Panel/Monomial.pm view on Meta::CPAN
package App::GUI::Juliagraph::Frame::Panel::Monomial;
use v5.12;
use warnings;
use Wx;
use base qw/Wx::Panel/;
use App::GUI::Juliagraph::Widget::SliderStep;
sub new {
my ( $class, $parent, $initial_exp, $std_margin ) = @_;
my $self = $class->SUPER::new( $parent, -1 );
$self->{'init_exp'} = $initial_exp // 0;
$self->{'callback'} = sub {};
$self->{'active'} = Wx::CheckBox->new( $self, -1, ' On', [-1,-1], [ 60, -1]);
$self->{'active'}->SetToolTip("switch usage of this polynome on or off");
$self->{'use_minus'} = Wx::CheckBox->new( $self, -1, ' -', [-1,-1], [ 50, -1]);
$self->{'use_minus'}->SetToolTip('if on, this monomial will be subtracted instead of added');
$self->{'use_log'} = Wx::CheckBox->new( $self, -1, ' log', [-1,-1], [ 60, -1]);
$self->{'use_log'}->SetToolTip(' if on, you put a logarithm in front of this monomial term as in: z_n+1 = log( factor * z_n**exponent )');
$self->{'use_factor'} = Wx::CheckBox->new( $self, -1, ' Factor', [-1,-1], [ 70, -1]);
lib/App/GUI/Juliagraph/Frame/Tab/Color.pm view on Meta::CPAN
use App::GUI::Juliagraph::Widget::ColorDisplay;
use App::GUI::Juliagraph::Widget::PositionMarker;
use Graphics::Toolkit::Color qw/color/;
our $default_color_def = $App::GUI::Juliagraph::Frame::Panel::ColorSetPicker::default_color;
my $default_settings = { 1=> 'black', 2=> 'red', 3=> 'orange', 4 => 'blue',
dynamic => 0, delta_S => 0, delta_L => 0 };
sub new {
my ( $class, $parent, $config ) = @_;
my $self = $class->SUPER::new( $parent, -1);
$self->{'call_back'} = sub {};
$self->{'config'} = $config;
$self->{'color_count'} = 11; # number of displayed colors
$self->{'active_color_count'} = 4; # nr of currently used colors, overwritten on init
$self->{'current_color_nr'} = 0; # index starts from 0
$self->{'display_size'} = 30;
$self->{'used_colors'} = [ color('blue')->gradient( to => 'red', steps => $self->{'active_color_count'}) ];
$self->{'used_colors'}[$_] = color( $default_color_def ) for $self->{'active_color_count'} .. $self->{'color_count'}-1;
lib/App/GUI/Juliagraph/Frame/Tab/Constraints.pm view on Meta::CPAN
my $default_settings = {
type => 'Mandelbrot', coordinates_use => 'constant',
zoom => 1, center_x => 0, center_y => 0,
const_a => 0, const_b => 0, start_a => 0, start_b => 0,
stop_nr => 6, stop_value => 3, stop_metric => '|var|'
};
sub new {
my ( $class, $parent) = @_;
my $self = $class->SUPER::new( $parent, -1);
$self->{'callback'} = sub {};
$self->{'tab'}{'polynome'} = '';
$self->{'tab'}{'mapping'} = '';
my $coor_lbl = Wx::StaticText->new($self, -1, 'P i x e l C o o r d i n a t e s : ' );
my $zoom_lbl = Wx::StaticText->new($self, -1, 'Z o o m : ' );
my $pos_lbl = Wx::StaticText->new($self, -1, 'P o s i t i o n : ' );
my $x_lbl = Wx::StaticText->new($self, -1, 'X : ' );
my $y_lbl = Wx::StaticText->new($self, -1, 'Y : ' );
$self->{'lbl_const'} = Wx::StaticText->new($self, -1, 'C o n s t a n t :' );
lib/App/GUI/Juliagraph/Frame/Tab/Mapping.pm view on Meta::CPAN
custom_partition => 0, scale_steps => 20, scale_distro => 'square',
user_colors => 1, begin_color => 'color 2', end_color => 'color 4', background_color => 'black',
gradient_dynamic => 0, gradient_space => 'HSL',
use_subgradient => 0, subgradient_size => 500, subgradient_steps => 5,
subgradient_dynamic => 0, subgradient_space => 'HSL', subgradient_distro => 'sqrt',
};
sub new {
my ( $class, $parent, $config ) = @_;
my $self = $class->SUPER::new( $parent, -1);
$self->{'config'} = $config;
$self->{'callback'} = sub {};
$self->{'tab'}{'color'} = '';
my $map_lbl = Wx::StaticText->new($self, -1, 'C o l o r G r a d i e n t : ' );
my $color_lbl = Wx::StaticText->new($self, -1, 'User Colors : ' );
$self->{'lbl_backg'} = Wx::StaticText->new($self, -1, 'Background : ' );
$self->{'lbl_begin'} = Wx::StaticText->new($self, -1, 'Begin : ' );
$self->{'lbl_end'} = Wx::StaticText->new($self, -1, 'End : ' );
my $map_dyn_lbl = Wx::StaticText->new($self, -1, 'Dynamic : ' );
lib/App/GUI/Juliagraph/Frame/Tab/Polynomial.pm view on Meta::CPAN
use warnings;
use Wx;
package App::GUI::Juliagraph::Frame::Tab::Polynomial;
use base qw/Wx::Panel/;
use App::GUI::Juliagraph::Frame::Panel::Monomial;
sub new {
my ( $class, $parent) = @_;
my $self = $class->SUPER::new( $parent, -1);
$self->{'monomial_count'} = 4;
$self->{$_} = App::GUI::Juliagraph::Frame::Panel::Monomial->new( $self, $_) for 1 .. $self->{'monomial_count'};
my $std = &Wx::wxALIGN_LEFT | &Wx::wxALIGN_CENTER_VERTICAL | &Wx::wxGROW;
my $box = $std | &Wx::wxTOP | &Wx::wxBOTTOM;
my $item = $std | &Wx::wxLEFT | &Wx::wxRIGHT;
my $sizer = Wx::BoxSizer->new(&Wx::wxVERTICAL);
$sizer->AddSpacer( 10 );
lib/App/GUI/Juliagraph/Widget/ColorDisplay.pm view on Meta::CPAN
use warnings;
use Wx;
package App::GUI::Juliagraph::Widget::ColorDisplay;
use base qw/Wx::Panel/;
sub new {
my ( $class, $parent, $x, $y, $nr, $init ) = @_;
return unless ref $init eq 'HASH' and exists $init->{'red'} and exists $init->{'green'}and exists $init->{'blue'};
my $self = $class->SUPER::new( $parent, -1, [-1,-1], [$x, $y]);
Wx::Event::EVT_PAINT( $self, sub {
my( $cpanel, $event ) = @_;
return unless exists $self->{'blue'} and exists $self->{'red'} and exists $self->{'green'};
my $dc = Wx::PaintDC->new( $cpanel );
my $bg_color = Wx::Colour->new( $self->{'red'}, $self->{'green'}, $self->{'blue'} );
$dc->SetBackground( Wx::Brush->new( $bg_color, &Wx::wxBRUSHSTYLE_SOLID ) );
$dc->Clear();
} );
$self->{'init'} = $init;
lib/App/GUI/Juliagraph/Widget/PositionMarker.pm view on Meta::CPAN
use warnings;
use Wx;
package App::GUI::Juliagraph::Widget::PositionMarker;
use base qw/Wx::Panel/;
sub new {
my ( $class, $parent, $x, $y, $nr, $state, $color ) = @_;
return unless ref $color eq 'HASH' and exists $color->{'red'} and exists $color->{'green'}and exists $color->{'blue'};
my $self = $class->SUPER::new( $parent, -1, [-1,-1], [$x, $y]);
$self->{'nr'} = $nr;
Wx::Event::EVT_PAINT( $self, sub {
my( $cpanel, $event ) = @_;
return unless exists $self->{'blue'} and exists $self->{'red'} and exists $self->{'green'};
my $dc = Wx::PaintDC->new( $cpanel );
my $bg_color = Wx::Colour->new( $self->{'red'}, $self->{'green'}, $self->{'blue'} );
$dc->SetBackground( Wx::Brush->new( $bg_color, &Wx::wxBRUSHSTYLE_SOLID ) );
$dc->Clear();
my $black = Wx::Colour->new( 0, 0, 0 );
lib/App/GUI/Juliagraph/Widget/ProgressBar.pm view on Meta::CPAN
use warnings;
use Wx;
package App::GUI::Juliagraph::Widget::ProgressBar;
use base qw/Wx::Panel/;
sub new {
my ( $class, $parent, $x, $y, $color ) = @_;
return unless ref $color eq 'ARRAY' and @{$color} == 3;
my $self = $class->SUPER::new( $parent, -1, [-1,-1], [$x, $y]);
$self->{'x'} = $x;
$self->{'y'} = $y;
$self->{'color'} = $color;
$self->{'rainbow'} = [];
Wx::Event::EVT_PAINT( $self, sub {
my( $cpanel, $event ) = @_;
my $dc = Wx::PaintDC->new( $cpanel );
my $bg_color = Wx::Colour->new( 255, 255, 255 );
lib/App/GUI/Juliagraph/Widget/SliderCombo.pm view on Meta::CPAN
package App::GUI::Juliagraph::Widget::SliderCombo;
use v5.12;
use warnings;
use Wx;
use base qw/Wx::Panel/;
sub new {
my ( $class, $parent, $slider_size, $label, $help, $min, $max, $init_value, $delta, $value_name ) = @_;
return unless defined $max;
my $self = $class->SUPER::new( $parent, -1);
my $lbl = Wx::StaticText->new($self, -1, $label);
$self->{'min_value'} = $min;
$self->{'max_value'} = $max;
$self->{'init_value'} = $init_value;
$self->{'name'} = $label;
$self->{'help'} = $help;
$self->{'value'} = $init_value // $min;
$self->{'value_delta'} = $delta // 1;
$self->{'callback'} = sub {};
return unless $self->{'value_delta'} != 0;
lib/App/GUI/Juliagraph/Widget/SliderStep.pm view on Meta::CPAN
$slider_length //= 50;
$slider_pos //= 2;
$slider_pos = int $slider_pos;
$slider_pos = 2 if $slider_pos < 1 and $slider_pos > 3;
$minus_label //= '-';
$plus_label //= '+';
$init_value //= 0.5;
$max_value //= 1;
return if $init_value > $max_value;
my $self = $class->SUPER::new( $parent, -1);
$self->{'init_value'} = $init_value;
$self->{'max_value'} = $max_value;
$self->{'exponent'} = $exponent;
$self->{'callback'} = sub {};
$self->{'btn'}{'-'} = Wx::Button->new( $self, -1, $minus_label, [-1,-1],[40, 30] );
$self->{'btn'}{'+'} = Wx::Button->new( $self, -1, $plus_label, [-1,-1],[40, 30] );
$self->{'slider'} = Wx::Slider->new( $self, -1, $self->{'init_value'} * $resolution,
0, $self->{'max_value'} * $resolution,
[-1,-1], [$slider_length, -1], &Wx::wxSL_HORIZONTAL | &Wx::wxSL_BOTTOM );