Changeset 5381
- Timestamp:
- 06/19/09 22:45:11 (3 years ago)
- Location:
- trunk/Padre-Plugin-Perl6/lib/Padre/Plugin
- Files:
-
- 2 edited
-
Perl6.pm (modified) (3 diffs)
-
Perl6/Preferences.pm (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Padre-Plugin-Perl6/lib/Padre/Plugin/Perl6.pm
r5380 r5381 74 74 } 75 75 if(not defined $config->{p6_highlight}) { 76 $config->{p6_highlight} = 0;76 $config->{p6_highlight} = 1; 77 77 } 78 78 … … 135 135 sub { $self->_create_from_template('p6_inline_in_p5', 'p5') }, 136 136 ); 137 138 # Toggle Auto Perl6 syntax highlighting139 $self->{p6_highlight} =140 $self->{menu}->AppendCheckItem( -1, Wx::gettext("Enable Auto Coloring"),);141 Wx::Event::EVT_MENU(142 $main,143 $self->{p6_highlight},144 sub { $self->toggle_highlight; }145 );146 $self->{p6_highlight}->Check($config->{p6_highlight} ? 1 : 0);147 137 148 138 # Export into HTML … … 434 424 } 435 425 436 sub toggle_highlight {437 my $self = shift;438 if(! defined $self->{p6_highlight}) {439 return;440 }441 $config->{p6_highlight} = $self->{p6_highlight}->IsChecked ? 1 : 0;442 $self->config_write($config);443 if($config->{p6_highlight}) {444 $self->highlight;445 }446 }447 448 426 sub highlight { 449 427 my $self = shift; -
trunk/Padre-Plugin-Perl6/lib/Padre/Plugin/Perl6/Preferences.pm
r5378 r5381 5 5 6 6 use Class::XSAccessor accessors => { 7 _plugin => '_plugin', # plugin to be configured 8 _sizer => '_sizer', # window sizer 9 _colorizer_list => '_colorizer_list' # colorizer list box 7 _plugin => '_plugin', # plugin to be configured 8 _sizer => '_sizer', # window sizer 9 _colorizer_cb => '_colorizer_cb', # colorizer on/off checkbox 10 _colorizer_list => '_colorizer_list', # colorizer list box 10 11 }; 11 12 … … 58 59 59 60 # update configuration 60 my $selection = $self->_colorizer_list->GetSelection(); 61 $prefs->{colorizer} = ($selection == 0) ? 'STD' : 'PGE'; 61 my $old_p6_highlight = $prefs->{p6_highlight}; 62 $prefs->{p6_highlight} = $self->_colorizer_cb->GetValue(); 63 $prefs->{colorizer} = ($self->_colorizer_list->GetSelection() == 0) ? 64 'STD' : 'PGE'; 62 65 63 66 # store plugin preferences 64 67 $plugin->config_write($prefs); 68 69 if($old_p6_highlight != $prefs->{p6_highlight}) { 70 $plugin->highlight; 71 } 65 72 66 73 $self->Destroy; … … 107 114 my $self = shift; 108 115 116 $self->_colorizer_cb( 117 Wx::CheckBox->new( $self, -1, Wx::gettext('Enable coloring')) 118 ); 119 109 120 my @choices = [ 110 121 'S:H:P6/STD', … … 112 123 ]; 113 124 # syntax highligher selection 114 my $ selector_label = Wx::StaticText->new( $self, -1, Wx::gettext('Syntax Highlighter:') );125 my $colorizer_list_label = Wx::StaticText->new( $self, -1, Wx::gettext('Colorizer:') ); 115 126 $self->_colorizer_list( 116 127 Wx::ListBox->new( … … 123 134 ); 124 135 125 # Select based on configuration variable 126 $self->_colorizer_list->Select( ($self->_plugin->config->{colorizer} eq 'STD') ? 0 : 1); 136 # Select based on configuration parameters 137 my $config = $self->_plugin->config; 138 $self->_colorizer_cb->SetValue( $config->{p6_highlight} ); 139 $self->_colorizer_list->Select( $config->{colorizer} eq 'STD' ? 0 : 1); 127 140 128 141 # pack the controls in a box 129 142 my $box; 130 143 $box = Wx::BoxSizer->new(Wx::wxHORIZONTAL); 131 $box->Add( $selector_label, 0, Wx::wxALL|Wx::wxEXPAND|Wx::wxALIGN_CENTER, 5 ); 144 $box->Add( $self->_colorizer_cb, 1, Wx::wxALL|Wx::wxEXPAND|Wx::wxALIGN_CENTER, 5 ); 145 $self->_sizer->Add( $box, 0, Wx::wxALL|Wx::wxEXPAND|Wx::wxALIGN_CENTER, 5 ); 146 147 $box = Wx::BoxSizer->new(Wx::wxHORIZONTAL); 148 $box->Add( $colorizer_list_label, 0, Wx::wxALL|Wx::wxEXPAND|Wx::wxALIGN_CENTER, 5 ); 132 149 $box->Add( $self->_colorizer_list, 1, Wx::wxALL|Wx::wxEXPAND|Wx::wxALIGN_CENTER, 5 ); 133 150 $self->_sizer->Add( $box, 0, Wx::wxALL|Wx::wxEXPAND|Wx::wxALIGN_CENTER, 5 );
Note: See TracChangeset
for help on using the changeset viewer.
