| 1 | |||
| 2 | # visible tab with all visual settings | ||
| 3 | |||
| 4 | package App::GUI::Juliagraph::Frame::Tab::Mapping; | ||
| 5 | 1 | ▶ | use v5.12; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 1 | ▶ | use base qw/Wx::Panel/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | use Graphics::Toolkit::Color qw/color/; | ||
| 9 | use Wx; | ||
| 10 | use App::GUI::Juliagraph::Widget::SliderStep; | ||
| 11 | use App::GUI::Juliagraph::Widget::SliderCombo; | ||
| 12 | use App::GUI::Juliagraph::Widget::ProgressBar; | ||
| 13 | |||
| 14 | my $default_settings = { | ||
| 15 | custom_partition => 0, scale_steps => 20, scale_distro => 'square', | ||
| 16 | user_colors => 1, begin_color => 'color 2', end_color => 'color 4', background_color => 'black', | ||
| 17 | gradient_dynamic => 0, gradient_space => 'HSL', | ||
| 18 | use_subgradient => 0, subgradient_size => 500, subgradient_steps => 5, | ||
| 19 | subgradient_dynamic => 0, subgradient_space => 'HSL', subgradient_distro => 'sqrt', | ||
| 20 | }; | ||
| 21 | |||
| 22 | sub new { | ||
| 23 | my ( $class, $parent ) = @_; | ||
| 24 | |||
| 25 | my $self = $class->SUPER::new( $parent, -1); | ||
| 26 | $self->{'callback'} = sub {}; | ||
| 27 | $self->{'tab'}{'color'} = ''; | ||
| 28 | |||
| 29 | my $map_lbl = Wx::StaticText->new($self, -1, 'C o l o r G r a d i e n t : ' ); | ||
| 30 | my $color_lbl = Wx::StaticText->new($self, -1, 'User Colors : ' ); | ||
| 31 | $self->{'lbl_backg'} = Wx::StaticText->new($self, -1, 'Background : ' ); | ||
| 32 | $self->{'lbl_begin'} = Wx::StaticText->new($self, -1, 'Begin : ' ); | ||
| 33 | $self->{'lbl_end'} = Wx::StaticText->new($self, -1, 'End : ' ); | ||
| 34 | my $map_dyn_lbl = Wx::StaticText->new($self, -1, 'Dynamic : ' ); | ||
| 35 | my $map_space_lbl = Wx::StaticText->new($self, -1, 'Space : ' ); | ||
| 36 | my $scale_lbl = Wx::StaticText->new($self, -1, 'P a r t i t i o n i n g T h e I t e r a t i o n S c a l e : ' ); | ||
| 37 | my $custom_lbl = Wx::StaticText->new($self, -1, 'Custom : ' ); | ||
| 38 | $self->{'lbl_max'} = Wx::StaticText->new($self, -1, 'Iterations (Size) : ' ); | ||
| 39 | $self->{'lbl_distro'} = Wx::StaticText->new($self, -1, 'Distribution : ' ); | ||
| 40 | my $submap_lbl = Wx::StaticText->new($self, -1, 'S u b G r a d i e n t : ' ); | ||
| 41 | $self->{'lbl_sub_use'} = Wx::StaticText->new($self, -1, 'Activate : ' ); | ||
| 42 | $self->{'lbl_sub_dyn'} = Wx::StaticText->new($self, -1, 'Dynamic : ' ); | ||
| 43 | $self->{'lbl_sub_space'} = Wx::StaticText->new($self, -1, 'Space : ' ); | ||
| 44 | $self->{'lbl_sub_distro'} = Wx::StaticText->new($self, -1, 'Distribution : ' ); | ||
| 45 | $map_lbl->SetToolTip('Decide which colors are used to paint the drawing.'); | ||
| 46 | $color_lbl->SetToolTip('Use slected colors (on) or just simple gray scale (off)'); | ||
| 47 | $self->{'lbl_backg'}->SetToolTip('Which color is used to paint areas where computation never exceeds the bailout value.'); | ||
| 48 | $self->{'lbl_begin'}->SetToolTip('Starting color of the rainbow.'); | ||
| 49 | $self->{'lbl_end'}->SetToolTip('Endcolor of the rainbow'); | ||
| 50 | $map_dyn_lbl->SetToolTip('How many big is the slant of a color gradient in one or another direction (between the selected colors in next tab)'); | ||
| 51 | $map_space_lbl->SetToolTip('In which color space will the gradient between chosen colors be computed ?'); | ||
| 52 | $scale_lbl->SetToolTip('Divide the scale of possible iterations into goups (partitions) that can be mapped to colors.'); | ||
| 53 | $custom_lbl->SetToolTip('Divide the scale of possible iterations into goups (partitions) that can be mapped to colors. Use every iteration count gets its own color when off.'); | ||
| 54 | $self->{'lbl_max'}->SetToolTip('Maximal iteration count that gets partitioned.'); | ||
| 55 | $self->{'lbl_distro'}->SetToolTip('How to compute the partitioning of the iteration scale. Linear means evenly sized portions.'); | ||
| 56 | $submap_lbl->SetToolTip('Gradients between areas of iteration counts based on final value.'); | ||
| 57 | $self->{'lbl_sub_use'}->SetToolTip('Make even more fine grained color gradients, my computing gradient between color regions.'); | ||
| 58 | $self->{'lbl_sub_dyn'}->SetToolTip('How big is the slant of a color sub gradient in one or another direction ?'); | ||
| 59 | $self->{'lbl_sub_space'}->SetToolTip('In which color space will the subgradient between chosen colors be computed ?'); | ||
| 60 | |||
| 61 | my @color_names = map { 'color '.$_ } 1 .. 11; | ||
| 62 | $self->{'custom_partition'} = Wx::CheckBox->new( $self, -1, '', [-1,-1],[30, -1]); | ||
| 63 | $self->{'user_colors'} = Wx::CheckBox->new( $self, -1, '', [-1,-1],[30, -1]); | ||
| 64 | $self->{'use_subgradient'} = Wx::CheckBox->new( $self, -1, '', [-1,-1],[30, -1]); | ||
| 65 | $self->{'scale_steps'} = App::GUI::Juliagraph::Widget::SliderCombo->new( $self, 252, 'Steps :', "In how many parts the scale (0 .. max) will be partitioned, meaning: how many different colors/shades we use to paint the fractal", 2, 100, 20); | ||
| 66 | $self->{'scale_max'} = Wx::TextCtrl->new( $self, -1, 0, [-1,-1], [60, -1], &Wx::wxTE_RIGHT | &Wx::wxTE_READONLY); | ||
| 67 | $self->{'scale_distro'} = Wx::ComboBox->new( $self, -1, 'linear', [-1,-1],[100, -1], [qw/log cubert sqrt linear square cube exp/]); | ||
| 68 | $self->{'begin_color'} = Wx::ComboBox->new( $self, -1, 'color 3', [-1,-1],[100, -1], [@color_names]); | ||
| 69 | $self->{'end_color'} = Wx::ComboBox->new( $self, -1, 'color 4', [-1,-1],[100, -1], [@color_names]); | ||
| 70 | $self->{'background_color'} = Wx::ComboBox->new( $self, -1,'black', [-1,-1],[100,-1], [qw/black blue gray white/, 'color 11']); | ||
| 71 | $self->{'gradient_dynamic'} = Wx::ComboBox->new( $self, -1, 0, [-1,-1],[80, -1], [-5, -4, -3, -2.5, -2, -1.6, -1.3, -1, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 1, 1.3, 1.6, 2, 2.5, 3, 4, 5]); | ||
| 72 | $self->{'gradient_space'} = Wx::ComboBox->new( $self, -1, 'RGB', [-1,-1],[80, -1], [qw/RGB HSL/]); | ||
| 73 | $self->{'subgradient_steps'} = App::GUI::Juliagraph::Widget::SliderCombo->new( $self, 249, 'Steps :', "How man shades toes the subgradient have ?", 2, 100, 5, 1); | ||
| 74 | $self->{'subgradient_size'} = App::GUI::Juliagraph::Widget::SliderCombo->new( $self, 249, 'Size :', "Up to which value (Bailout/Stop Value + X) does the scale goes, from which subgradient is computed", 100, 5000, 500, 50); | ||
| 75 | $self->{'subgradient_space'} = Wx::ComboBox->new( $self, -1, 'RGB', [-1,-1],[80, -1], [qw/RGB HSL/]); | ||
| 76 | $self->{'subgradient_dynamic'}= Wx::ComboBox->new($self, -1, 0, [-1,-1],[80, -1], [-5, -4, -3, -2.5, -2, -1.6, -1.3, -1, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 1, 1.3, 1.6, 2, 2.5, 3, 4, 5]); | ||
| 77 | $self->{'subgradient_distro'} = Wx::ComboBox->new( $self, -1, 'linear', [-1,-1],[100, -1], [qw/log cubert sqrt linear square cube exp/]); | ||
| 78 | $self->{'custom_partition'}->SetToolTip('Divide the scale of possible iterations into goups (partitions) that can be mapped to colors. Use every iteration count gets its own color when off.'); | ||
| 79 | $self->{'scale_max'}->SetToolTip('Maximal iteration count.'); | ||
| 80 | $self->{'scale_distro'}->SetToolTip('Relation between partitions size wise, linear means they all equally big.'); | ||
| 81 | $self->{'user_colors'}->SetToolTip('Use chosen color selection to compute color rainbow (on) or just a gray scale (off).'); | ||
| 82 | $self->{'use_subgradient'}->SetToolTip('Make color gradient smoother by computing gradients between colored areas based on final value of iteration.'); | ||
| 83 | $self->{'begin_color'}->SetToolTip('Starting color of the rainbow.'); | ||
| 84 | $self->{'end_color'}->SetToolTip('Endcolor of the rainbow'); | ||
| 85 | $self->{'background_color'}->SetToolTip('Color that is used to paint areas where iteration stays below stop value.'); | ||
| 86 | $self->{'gradient_dynamic'}->SetToolTip('Skew direction of gradient (positive value = left)'); | ||
| 87 | $self->{'subgradient_dynamic'}->SetToolTip('Skew direction of gradient (positive value = left)'); | ||
| 88 | $self->{'subgradient_distro'}->SetToolTip('Relation between parts of subgradient size wise'); | ||
| 89 | $self->{'color_rainbow'} = App::GUI::Juliagraph::Widget::ProgressBar->new( $self, 450, 30, [20, 20, 110]); | ||
| 90 | $self->{'background_rainbow'} = App::GUI::Juliagraph::Widget::ProgressBar->new( $self, 450, 10, [20, 20, 110]); | ||
| 91 | $self->{'color_rainbow'}->SetToolTip('Color gradient display.'); | ||
| 92 | $self->{'background_rainbow'}->SetToolTip('Background color display.'); | ||
| 93 | |||
| 94 | Wx::Event::EVT_CHECKBOX( $self, $self->{'custom_partition'},sub { $self->enable_partition($self->{'custom_partition'}->GetValue); $self->{'callback'}->() }); | ||
| 95 | Wx::Event::EVT_CHECKBOX( $self, $self->{'user_colors'}, sub { $self->enable_user_colors($self->{'user_colors'}->GetValue); $self->{'callback'}->() }); | ||
| 96 | Wx::Event::EVT_CHECKBOX( $self, $self->{'use_subgradient'}, sub { $self->enable_subgradient($self->{'use_subgradient'}->GetValue);$self->{'callback'}->() }); | ||
| 97 | Wx::Event::EVT_COMBOBOX( $self, $self->{$_}, sub { $self->update_max_color; $self->{'callback'}->() }) | ||
| 98 | for qw/begin_color end_color/; | ||
| 99 | Wx::Event::EVT_COMBOBOX( $self, $self->{$_}, sub { $self->{'callback'}->() }) | ||
| 100 | for qw/scale_distro gradient_dynamic gradient_space background_color | ||
| 101 | subgradient_distro subgradient_dynamic subgradient_space/; | ||
| 102 | $self->{$_}->SetCallBack( sub { $self->{'callback'}->(); }) for qw/scale_steps subgradient_size subgradient_steps/; | ||
| 103 | |||
| 104 | my $std_margin = 20; | ||
| 105 | my $std = &Wx::wxALIGN_LEFT | &Wx::wxALIGN_CENTER_VERTICAL | &Wx::wxGROW; | ||
| 106 | my $box = $std | &Wx::wxTOP | &Wx::wxBOTTOM; | ||
| 107 | my $item = $std | &Wx::wxLEFT; | ||
| 108 | my $row = $std | &Wx::wxTOP; | ||
| 109 | |||
| 110 | my $div_sizer = Wx::BoxSizer->new(&Wx::wxHORIZONTAL); | ||
| 111 | $div_sizer->AddSpacer( $std_margin ); | ||
| 112 | $div_sizer->AddSpacer( 10 ); | ||
| 113 | $div_sizer->Add( $custom_lbl, 0, $box, 12); | ||
| 114 | $div_sizer->AddSpacer( 10 ); | ||
| 115 | $div_sizer->Add( $self->{'custom_partition'}, 0, $box, 5); | ||
| 116 | $div_sizer->AddSpacer( 20 ); | ||
| 117 | $div_sizer->Add( $self->{'scale_steps'}, 0, $box, 5); | ||
| 118 | $div_sizer->AddStretchSpacer(); | ||
| 119 | $div_sizer->AddSpacer( $std_margin ); | ||
| 120 | |||
| 121 | my $div2_sizer = Wx::BoxSizer->new(&Wx::wxHORIZONTAL); | ||
| 122 | $div2_sizer->AddSpacer( $std_margin ); | ||
| 123 | $div2_sizer->AddSpacer( 75 ); | ||
| 124 | $div2_sizer->Add( $self->{'lbl_max'}, 0, $box, 12); | ||
| 125 | $div2_sizer->AddSpacer( 10 ); | ||
| 126 | $div2_sizer->Add( $self->{'scale_max'}, 0, $box, 5); | ||
| 127 | $div2_sizer->AddSpacer( 97 ); | ||
| 128 | $div2_sizer->Add( $self->{'lbl_distro'}, 0, $box, 12); | ||
| 129 | $div2_sizer->AddSpacer( 10 ); | ||
| 130 | $div2_sizer->Add( $self->{'scale_distro'}, 0, $box, 5); | ||
| 131 | $div2_sizer->AddStretchSpacer(); | ||
| 132 | $div2_sizer->AddSpacer( $std_margin ); | ||
| 133 | |||
| 134 | my $color_sizer = Wx::BoxSizer->new(&Wx::wxHORIZONTAL); | ||
| 135 | $color_sizer->AddSpacer( $std_margin ); | ||
| 136 | $color_sizer->AddSpacer( 10 ); | ||
| 137 | $color_sizer->Add( $color_lbl, 0, $box, 12); | ||
| 138 | $color_sizer->AddSpacer( 10 ); | ||
| 139 | $color_sizer->Add( $self->{'user_colors'}, 0, $box, 0); | ||
| 140 | $color_sizer->AddSpacer( 80 ); | ||
| 141 | $color_sizer->Add( $self->{'lbl_begin'}, 0, $box, 12); | ||
| 142 | $color_sizer->AddSpacer( 10 ); | ||
| 143 | $color_sizer->Add( $self->{'begin_color'}, 0, $box, 5); | ||
| 144 | $color_sizer->AddSpacer( 28 ); | ||
| 145 | $color_sizer->Add( $self->{'lbl_end'}, 0, $box, 12); | ||
| 146 | $color_sizer->AddSpacer( 10 ); | ||
| 147 | $color_sizer->Add( $self->{'end_color'}, 0, $box, 5); | ||
| 148 | $color_sizer->AddStretchSpacer(); | ||
| 149 | $color_sizer->AddSpacer( $std_margin ); | ||
| 150 | |||
| 151 | my $map_sizer = Wx::BoxSizer->new(&Wx::wxHORIZONTAL); | ||
| 152 | $map_sizer->AddSpacer( $std_margin ); | ||
| 153 | $map_sizer->AddSpacer( 10 ); | ||
| 154 | $map_sizer->Add( $self->{'lbl_backg'}, 0, $box, 12); | ||
| 155 | $map_sizer->AddSpacer( 10 ); | ||
| 156 | $map_sizer->Add( $self->{'background_color'}, 0, $box, 5); | ||
| 157 | $map_sizer->AddSpacer( 23 ); | ||
| 158 | $map_sizer->Add( $map_dyn_lbl, 0, $box, 12); | ||
| 159 | $map_sizer->AddSpacer( 10 ); | ||
| 160 | $map_sizer->Add( $self->{'gradient_dynamic'}, 0, $box, 5); | ||
| 161 | $map_sizer->AddSpacer( 22 ); | ||
| 162 | $map_sizer->Add( $map_space_lbl, 0, $box, 12); | ||
| 163 | $map_sizer->AddSpacer( 10 ); | ||
| 164 | $map_sizer->Add( $self->{'gradient_space'}, 0, $box, 5); | ||
| 165 | $map_sizer->AddStretchSpacer(); | ||
| 166 | $map_sizer->AddSpacer( $std_margin ); | ||
| 167 | |||
| 168 | my $sub_sizer = Wx::BoxSizer->new(&Wx::wxHORIZONTAL); | ||
| 169 | $sub_sizer->AddSpacer( $std_margin ); | ||
| 170 | $sub_sizer->AddSpacer( 10 ); | ||
| 171 | $sub_sizer->Add( $self->{'lbl_sub_use'}, 0, $box, 12); | ||
| 172 | $sub_sizer->AddSpacer( 10 ); | ||
| 173 | $sub_sizer->Add( $self->{'use_subgradient'}, 0, $box, 5); | ||
| 174 | $sub_sizer->AddSpacer( 20 ); | ||
| 175 | $sub_sizer->Add( $self->{'subgradient_steps'}, 1, $box, 5); | ||
| 176 | $sub_sizer->AddSpacer( $std_margin ); | ||
| 177 | |||
| 178 | my $sub2_sizer = Wx::BoxSizer->new(&Wx::wxHORIZONTAL); | ||
| 179 | $sub2_sizer->AddSpacer( $std_margin ); | ||
| 180 | $sub2_sizer->AddSpacer( 140 ); | ||
| 181 | $sub2_sizer->Add( $self->{'subgradient_size'}, 1, $box, 4); | ||
| 182 | $sub2_sizer->AddSpacer( $std_margin ); | ||
| 183 | |||
| 184 | my $sub3_sizer = Wx::BoxSizer->new(&Wx::wxHORIZONTAL); | ||
| 185 | $sub3_sizer->AddSpacer( $std_margin ); | ||
| 186 | $sub3_sizer->AddSpacer( 10 ); | ||
| 187 | $sub3_sizer->Add( $self->{'lbl_sub_distro'}, 0, $box, 12); | ||
| 188 | $sub3_sizer->AddSpacer( 10 ); | ||
| 189 | $sub3_sizer->Add( $self->{'subgradient_distro'}, 0, $box, 4); | ||
| 190 | $sub3_sizer->AddSpacer( 25 ); | ||
| 191 | $sub3_sizer->Add( $self->{'lbl_sub_dyn'}, 0, $box, 12); | ||
| 192 | $sub3_sizer->AddSpacer( 10 ); | ||
| 193 | $sub3_sizer->Add( $self->{'subgradient_dynamic'},0, $box, 4); | ||
| 194 | $sub3_sizer->AddSpacer( 25 ); | ||
| 195 | $sub3_sizer->Add( $self->{'lbl_sub_space'}, 0, $box, 12); | ||
| 196 | $sub3_sizer->AddSpacer( 10 ); | ||
| 197 | $sub3_sizer->Add( $self->{'subgradient_space'}, 0, $box, 4); | ||
| 198 | $sub3_sizer->AddStretchSpacer(); | ||
| 199 | $sub3_sizer->AddSpacer( $std_margin ); | ||
| 200 | |||
| 201 | my $sizer = Wx::BoxSizer->new(&Wx::wxVERTICAL); | ||
| 202 | $sizer->AddSpacer( 10 ); | ||
| 203 | $sizer->Add( $map_lbl, 0, $item, $std_margin); | ||
| 204 | $sizer->Add( $color_sizer, 0, $row, 8); | ||
| 205 | $sizer->Add( $map_sizer, 0, $row, 10); | ||
| 206 | $sizer->AddSpacer( 2 ); | ||
| 207 | $sizer->Add( Wx::StaticLine->new( $self, -1), 0, $box, 10 ); | ||
| 208 | $sizer->AddSpacer( 5 ); | ||
| 209 | $sizer->Add( $self->{'color_rainbow'}, 0, $item | &Wx::wxRIGHT, 20 ); | ||
| 210 | $sizer->AddSpacer( 10 ); | ||
| 211 | $sizer->Add( $self->{'background_rainbow'}, 0, $item | &Wx::wxRIGHT, 20 ); | ||
| 212 | $sizer->AddSpacer( 5 ); | ||
| 213 | $sizer->Add( Wx::StaticLine->new( $self, -1), 0, $box, 10 ); | ||
| 214 | $sizer->Add( $scale_lbl, 0, $item, $std_margin); | ||
| 215 | $sizer->Add( $div_sizer, 0, $row, 8); | ||
| 216 | $sizer->Add( $div2_sizer, 0, $row, 10); | ||
| 217 | $sizer->Add( Wx::StaticLine->new( $self, -1), 0, $box, 10 ); | ||
| 218 | $sizer->Add( $submap_lbl, 0, $item, $std_margin); | ||
| 219 | $sizer->Add( $sub_sizer, 0, $row, 8); | ||
| 220 | $sizer->Add( $sub2_sizer, 0, $row, 10); | ||
| 221 | $sizer->Add( $sub3_sizer, 0, $row, 10); | ||
| 222 | $sizer->Add( Wx::StaticLine->new( $self, -1), 0, $box, 10 ); | ||
| 223 | $sizer->AddStretchSpacer(); | ||
| 224 | $self->SetSizer($sizer); | ||
| 225 | |||
| 226 | $self->init(); | ||
| 227 | $self; | ||
| 228 | } | ||
| 229 | |||
| 230 | sub init { $_[0]->set_settings ( $default_settings ) } | ||
| 231 | sub set_settings { | ||
| 232 | my ( $self, $settings ) = @_; | ||
| 233 | return 0 unless ref $settings eq 'HASH' and exists $settings->{'user_colors'}; | ||
| 234 | $self->PauseCallBack(); | ||
| 235 | for my $key (qw/custom_partition scale_steps user_colors use_subgradient subgradient_size subgradient_steps/){ | ||
| 236 | next unless exists $settings->{$key} and exists $settings->{$key}; | ||
| 237 | $self->{$key}->SetValue( $settings->{$key} ); | ||
| 238 | } | ||
| 239 | for my $key (qw/scale_distro background_color begin_color end_color gradient_dynamic | ||
| 240 | gradient_space subgradient_dynamic subgradient_space subgradient_distro/){ | ||
| 241 | next unless exists $settings->{$key} and exists $self->{$key}; | ||
| 242 | $self->{$key}->SetSelection( $self->{$key}->FindString($settings->{$key}) ); | ||
| 243 | } | ||
| 244 | $self->enable_partition( $settings->{'custom_partition'} ); | ||
| 245 | $self->enable_user_colors( $settings->{'user_colors'} ); | ||
| 246 | $self->enable_subgradient( $settings->{'use_subgradient'} ); | ||
| 247 | $self->update_max_color( ); | ||
| 248 | $self->RestoreCallBack(); | ||
| 249 | 1; | ||
| 250 | } | ||
| 251 | |||
| 252 | sub get_settings { | ||
| 253 | my ( $self ) = @_; | ||
| 254 | return { | ||
| 255 | custom_partition => int $self->{'custom_partition'}->GetValue, | ||
| 256 | user_colors => int $self->{'user_colors'}->GetValue, | ||
| 257 | use_subgradient => int $self->{'use_subgradient'}->GetValue, | ||
| 258 | scale_steps => $self->{'scale_steps'}->GetValue, | ||
| 259 | scale_distro => $self->{'scale_distro'}->GetStringSelection, | ||
| 260 | background_color => $self->{'background_color'}->GetStringSelection, | ||
| 261 | begin_color => $self->{'begin_color'}->GetStringSelection, | ||
| 262 | end_color => $self->{'end_color'}->GetStringSelection, | ||
| 263 | gradient_dynamic => $self->{'gradient_dynamic'}->GetStringSelection, | ||
| 264 | gradient_space => $self->{'gradient_space'}->GetStringSelection, | ||
| 265 | subgradient_size => $self->{'subgradient_size'}->GetValue, | ||
| 266 | subgradient_steps => $self->{'subgradient_steps'}->GetValue, | ||
| 267 | subgradient_dynamic=>$self->{'subgradient_dynamic'}->GetStringSelection, | ||
| 268 | subgradient_space => $self->{'subgradient_space'}->GetStringSelection, | ||
| 269 | subgradient_distro => $self->{'subgradient_distro'}->GetStringSelection, | ||
| 270 | }; | ||
| 271 | } | ||
| 272 | |||
| 273 | sub enable_partition { | ||
| 274 | my ( $self, $on ) = @_; | ||
| 275 | $on //= $self->{'custom_partition'}->GetValue; | ||
| 276 | $self->{'custom_partition'}->SetValue( $on ) unless int($on) == int $self->{'custom_partition'}->GetValue; | ||
| 277 | $self->{$_}->Enable( $on ) for qw/scale_steps scale_distro scale_max lbl_max lbl_distro/; | ||
| 278 | $self->enable_subgradient(0) if $on; | ||
| 279 | $self->{'use_subgradient'}->Enable( not $on ); | ||
| 280 | $self->{'lbl_sub_use'}->Enable( not $on ); | ||
| 281 | } | ||
| 282 | sub enable_user_colors { | ||
| 283 | my ( $self, $on ) = @_; | ||
| 284 | $on //= $self->{'user_colors'}->GetValue; | ||
| 285 | $self->{'user_colors'}->SetValue( $on ) unless int($on) == int $self->{'user_colors'}->GetValue; | ||
| 286 | $self->{ $_ }->Enable( $on ) for qw/background_color begin_color end_color lbl_begin lbl_end lbl_backg/; | ||
| 287 | } | ||
| 288 | sub enable_subgradient { | ||
| 289 | my ( $self, $on ) = @_; | ||
| 290 | $on //= $self->{'use_subgradient'}->GetValue; | ||
| 291 | $self->{'use_subgradient'}->SetValue($on) unless int($on) == int $self->{'use_subgradient'}->GetValue; | ||
| 292 | $self->{$_}->Enable( $on ) for qw/subgradient_steps subgradient_dynamic subgradient_space subgradient_distro | ||
| 293 | lbl_sub_dyn lbl_sub_space lbl_sub_distro subgradient_size/; | ||
| 294 | } | ||
| 295 | |||
| 296 | sub update_max_color { | ||
| 297 | my ( $self ) = @_; | ||
| 298 | my $begin_color = substr $self->{'begin_color'}->GetStringSelection, 6; | ||
| 299 | my $end_color = substr $self->{'end_color'}->GetStringSelection, 6; | ||
| 300 | my $max_color = $begin_color > $end_color ? $begin_color : $end_color; | ||
| 301 | $self->{'tab'}{'color'}->set_active_color_count( $max_color ) if ref $self->{'tab'}{'color'}; | ||
| 302 | } | ||
| 303 | |||
| 304 | sub connect_color_tab { | ||
| 305 | my ($self, $ref) = @_; | ||
| 306 | return unless ref $ref eq 'App::GUI::Juliagraph::Frame::Tab::Color'; | ||
| 307 | $self->{'tab'}{'color'} = $ref; | ||
| 308 | $self->update_max_color; | ||
| 309 | } | ||
| 310 | |||
| 311 | sub SetCallBack { | ||
| 312 | my ($self, $code) = @_; | ||
| 313 | return unless ref $code eq 'CODE'; | ||
| 314 | $self->{'callback'} = $code; | ||
| 315 | } | ||
| 316 | sub PauseCallBack { | ||
| 317 | my ($self) = @_; | ||
| 318 | $self->{'pause'} = $self->{'callback'}; | ||
| 319 | $self->{'callback'} = sub {}; | ||
| 320 | } | ||
| 321 | sub RestoreCallBack { | ||
| 322 | my ($self) = @_; | ||
| 323 | return unless exists $self->{'pause'}; | ||
| 324 | $self->{'callback'} = $self->{'pause'}; | ||
| 325 | delete $self->{'pause'}; | ||
| 326 | } | ||
| 327 | |||
| 328 | |||
| 329 | 1; | ||