App-GUI-Juliagraph
view release on metacpan or search on metacpan
lib/App/GUI/Juliagraph/Frame/Tab/Constraints.pm view on Meta::CPAN
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 : ' );
$self->{'lbl_consta'} = Wx::StaticText->new($self, -1, 'A : ' );
$self->{'lbl_constb'} = Wx::StaticText->new($self, -1, 'B : ' );
$self->{'lbl_starta'} = Wx::StaticText->new($self, -1, 'A : ' );
$self->{'lbl_startb'} = Wx::StaticText->new($self, -1, 'B : ' );
$self->{'lbl_start'} = Wx::StaticText->new($self, -1, 'S t a r t V a l u e : ' );
my $stop_lbl = Wx::StaticText->new($self, -1, 'I t e r a t i o n S t o p : ' );
my $metric_lbl = Wx::StaticText->new($self, -1, 'M e t r i c : ' );
$coor_lbl->SetToolTip("Which role play pixel coordinates in computation:\n - as start value of the iteration (z_0)\n - added as constant at any iteration \n - as factor of one monomial on next page (numbered from top to bottom)");
$zoom_lbl->SetToolTip('zoom factor: the larger the more you zoom in');
$pos_lbl->SetToolTip('center coordinates of visible sector');
$self->{'lbl_const'}->SetToolTip('complex constant that will be used according settings in first paragraph');
$self->{'lbl_start'}->SetToolTip('value of iteration variable Z before first iteration');
$stop_lbl->SetToolTip('conditions that stop the iteration (computation of pixel color)');
$metric_lbl->SetToolTip('metric for computing stop value (|var| = sqrt(z.re**2 + z.i**2), x = z.real, y = z.im');
$self->{'type'} = Wx::RadioBox->new( $self, -1, ' T y p e ', [-1,-1], [-1, -1], ['Mandelbrot', 'Julia', 'Any'] );
$self->{'type'}->SetToolTip( "Choose fractal type: \njulia uses position as init value of iterator var and constant as such, mandelbrot is vice versa\nany means no such restrictions." );
$self->{'coor_as_start'} = Wx::CheckBox->new( $self, -1, ' Start Value', [-1,-1], [-1, -1]);
$self->{'coor_as_const'} = Wx::CheckBox->new( $self, -1, ' Constant', [-1,-1], [-1, -1]);
$self->{'coor_as_monom'} = Wx::CheckBox->new( $self, -1, ' Monomial', [-1,-1], [-1, -1]);
$self->{'coor_as_start'}->SetToolTip( "Use current pixel coordinates as iteration start value, or add them to it." );
$self->{'coor_as_const'}->SetToolTip( "Use current pixel coordinates as constant added at every iteration." );
$self->{'coor_as_monom'}->SetToolTip( "Use current pixel coordinates as monomial factor in the next tab page." );
$self->{'zoom'} = Wx::TextCtrl->new( $self, -1, 1, [-1,-1], [ 80, -1] );
$self->{'center_x'} = Wx::TextCtrl->new( $self, -1, 0, [-1,-1], [100, -1] );
$self->{'center_y'} = Wx::TextCtrl->new( $self, -1, 0, [-1,-1], [100, -1] );
$self->{'const_a'} = Wx::TextCtrl->new( $self, -1, 0, [-1,-1], [100, -1] );
$self->{'const_b'} = Wx::TextCtrl->new( $self, -1, 0, [-1,-1], [100, -1] );
$self->{'start_a'} = Wx::TextCtrl->new( $self, -1, 0, [-1,-1], [100, -1] );
$self->{'start_b'} = Wx::TextCtrl->new( $self, -1, 0, [-1,-1], [100, -1] );
$self->{'reset_zoom'} = Wx::Button->new( $self, -1, 1, [-1,-1], [ 30, -1] );
$self->{'reset_center_x'} = Wx::Button->new( $self, -1, 0, [-1,-1], [ 30, -1] );
$self->{'reset_center_y'} = Wx::Button->new( $self, -1, 0, [-1,-1], [ 30, -1] );
$self->{'reset_const_a'} = Wx::Button->new( $self, -1, 0, [-1,-1], [ 30, -1] );
$self->{'reset_const_b'} = Wx::Button->new( $self, -1, 0, [-1,-1], [ 30, -1] );
$self->{'reset_start_a'} = Wx::Button->new( $self, -1, 0, [-1,-1], [ 30, -1] );
$self->{'reset_start_b'} = Wx::Button->new( $self, -1, 0, [-1,-1], [ 30, -1] );
$self->{'button_zoom'} = App::GUI::Juliagraph::Widget::SliderStep->new( $self, 150, 3, 0.3, 2, 2);
$self->{'button_x'} = App::GUI::Juliagraph::Widget::SliderStep->new( $self, 150, 3, 1 , 7, 3);
$self->{'button_y'} = App::GUI::Juliagraph::Widget::SliderStep->new( $self, 150, 3, 1 , 7, 3);
$self->{'button_ca'} = App::GUI::Juliagraph::Widget::SliderStep->new( $self, 150, 3, 0.3, 3, 3);
$self->{'button_cb'} = App::GUI::Juliagraph::Widget::SliderStep->new( $self, 150, 3, 0.3, 3, 3);
$self->{'button_sa'} = App::GUI::Juliagraph::Widget::SliderStep->new( $self, 150, 3, 0.3, 3, 3);
$self->{'button_sb'} = App::GUI::Juliagraph::Widget::SliderStep->new( $self, 150, 3, 0.3, 3, 3);
$self->{'button_zoom'}->SetToolTip('zoom factor: the larger the more you zoom in');
$self->{'button_zoom'}->SetCallBack(sub { $self->{'zoom'}->SetValue( $self->{'zoom'}->GetValue + shift ) });
$self->{'button_x'}->SetCallBack( sub { my $value = shift;$self->{'center_x'}->SetValue( $self->{'center_x'}->GetValue + ($value * $self->zoom_size) ) });
$self->{'button_y'}->SetCallBack( sub { my $value = shift;$self->{'center_y'}->SetValue( $self->{'center_y'}->GetValue + ($value * $self->zoom_size) ) });
$self->{'button_ca'}->SetCallBack(sub { $self->{'const_a'}->SetValue( $self->{'const_a'}->GetValue + shift ) });
$self->{'button_cb'}->SetCallBack(sub { $self->{'const_b'}->SetValue( $self->{'const_b'}->GetValue + shift ) });
$self->{'button_sa'}->SetCallBack(sub { $self->{'start_a'}->SetValue( $self->{'start_a'}->GetValue + shift ) });
$self->{'button_sb'}->SetCallBack(sub { $self->{'start_b'}->SetValue( $self->{'start_b'}->GetValue + shift ) });
$self->{'reset_zoom'}->SetToolTip('Reset zoom level to one !');
$self->{'stop_nr'} = App::GUI::Juliagraph::Widget::SliderCombo->new( $self, 365, 'Count:', "Square root of maximal amount of iterations run on one pixel coordinates", 3, 120, 5, 0.25);
$self->{'stop_nr'}->SetCallBack( sub { $self->{'callback'}->() });
$self->{'stop_value'} = App::GUI::Juliagraph::Widget::SliderCombo->new( $self, 200, 'Value:', "Square root of value that triggeres bailout / iteration stop", 1, 120, 5, 0.25);
$self->{'stop_value'}->SetCallBack( sub { $self->{'callback'}->() });
$self->{'stop_metric'} = Wx::ComboBox->new( $self, -1, '|var|', [-1,-1],[95, -1], ['|var|', '|x|+|y|', '|x|', '|y|', '|x+y|', 'x+y', 'x-y', 'y-x', 'x*y', '|x*y|']);
$self->{'stop_metric'}->SetToolTip('metric for computing stop value (|var| = sqrt(z.re**2 + z.i**2), x = z.real, y = z.im');
$self->{'const_widgets'} = [qw/const_a const_b button_ca button_cb lbl_const lbl_consta lbl_constb reset_const_a reset_const_b /];
$self->{'start_widgets'} = [qw/start_a start_b button_sa button_sb lbl_start lbl_starta lbl_startb reset_start_a reset_start_b /];
Wx::Event::EVT_BUTTON( $self, $self->{'reset_zoom'}, sub { $self->{'zoom'}->SetValue(1) });
Wx::Event::EVT_BUTTON( $self, $self->{'reset_center_x'}, sub { $self->{'center_x'}->SetValue(0) });
Wx::Event::EVT_BUTTON( $self, $self->{'reset_center_y'}, sub { $self->{'center_y'}->SetValue(0) });
Wx::Event::EVT_BUTTON( $self, $self->{'reset_const_a'}, sub { $self->{'const_a'}->SetValue(0) });
Wx::Event::EVT_BUTTON( $self, $self->{'reset_const_b'}, sub { $self->{'const_b'}->SetValue(0) });
Wx::Event::EVT_BUTTON( $self, $self->{'reset_start_a'}, sub { $self->{'start_a'}->SetValue(0) });
Wx::Event::EVT_BUTTON( $self, $self->{'reset_start_b'}, sub { $self->{'start_b'}->SetValue(0) });
Wx::Event::EVT_RADIOBOX( $self, $self->{'type'}, sub {
$self->set_type( $self->{'type'}->GetStringSelection ); $self->{'callback'}->();
});
Wx::Event::EVT_CHECKBOX( $self, $self->{'coor_as_monom'}, sub {
$self->set_coordinates_as_factor( $self->{'coor_as_monom'}->GetValue );
$self->freeze_last_coor_option(); $self->{'callback'}->();
});
Wx::Event::EVT_CHECKBOX( $self, $self->{'coor_as_const'}, sub {
$self->freeze_last_coor_option(); $self->{'callback'}->();
});
Wx::Event::EVT_CHECKBOX( $self, $self->{'coor_as_start'}, sub {
$self->freeze_last_coor_option(); $self->{'callback'}->();
});
$self->{'stop_nr'}->SetCallBack( sub { $self->update_iter_count(); $self->{'callback'}->(); });
$self->{'stop_value'}->SetCallBack( sub { $self->{'callback'}->(); });
Wx::Event::EVT_TEXT( $self, $self->{$_}, sub { $self->{'callback'}->() }) for qw/zoom center_x center_y const_a const_b start_a start_b/;
Wx::Event::EVT_COMBOBOX( $self, $self->{$_}, sub { $self->{'callback'}->() }) for qw/stop_metric/;
my $std = &Wx::wxALIGN_LEFT | &Wx::wxALIGN_CENTER_VERTICAL | &Wx::wxGROW;
my $box = $std | &Wx::wxTOP | &Wx::wxBOTTOM;
my $item = $std | &Wx::wxLEFT;
my $row = $std | &Wx::wxTOP;
my $all = $std | &Wx::wxALL;
my $left_margin = 20;
my $coor_sizer = Wx::BoxSizer->new(&Wx::wxVERTICAL);
$coor_sizer->Add( $self->{'coor_as_start'}, 0, $box, 2);
$coor_sizer->Add( $self->{'coor_as_const'}, 0, $box, 2);
$coor_sizer->Add( $self->{'coor_as_monom'}, 0, $box, 2);
my $type_sizer = Wx::BoxSizer->new(&Wx::wxHORIZONTAL);
$type_sizer->AddSpacer( $left_margin );
$type_sizer->Add( $self->{'type'}, 0, $box, 16);
$type_sizer->AddSpacer( 40 );
$type_sizer->Add( $coor_lbl, 0, $row, 32);
$type_sizer->Add( $coor_sizer, 0, $item, 30);
$type_sizer->AddStretchSpacer( );
my $zoom_sizer = Wx::BoxSizer->new(&Wx::wxHORIZONTAL);
$zoom_sizer->AddSpacer( $left_margin );
$zoom_sizer->Add( $self->{'zoom'}, 1, $box, 5);
$zoom_sizer->Add( $self->{'button_zoom'}, 0, $box, 5);
$zoom_sizer->Add( $self->{'reset_zoom'}, 0, $box, 5);
( run in 0.897 second using v1.01-cache-2.11-cpan-71847e10f99 )