Changeset 5378


Ignore:
Timestamp:
06/19/09 13:55:04 (3 years ago)
Author:
azawawi
Message:

[Perl 6] an initial fix to ticket:393

Location:
trunk/Padre-Plugin-Perl6/lib/Padre/Plugin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Padre-Plugin-Perl6/lib/Padre/Plugin/Perl6.pm

    r5367 r5378  
    1717my $SNIPPET_HTML = 'snippet_html'; 
    1818 
     19use Class::XSAccessor accessors => { 
     20    config         => 'config',           # plugin configuration object 
     21}; 
     22 
    1923# static field to contain reference to current plugin configuration 
    2024my $config; 
     
    7680    $self->config_write($config); 
    7781 
     82    # update configuration attribute 
     83    $self->config( $config ); 
     84     
    7885    # let us parse some S29-functions.pod documentation (safely) 
    7986    eval { 
  • trunk/Padre-Plugin-Perl6/lib/Padre/Plugin/Perl6/Preferences.pm

    r5350 r5378  
    55 
    66use Class::XSAccessor accessors => { 
    7     _plugin      => '_plugin',       # plugin to be configured 
    8     _sizer       => '_sizer',        # window sizer 
     7    _plugin         => '_plugin',           # plugin to be configured 
     8    _sizer          => '_sizer',            # window sizer 
     9    _colorizer_list => '_colorizer_list'    # colorizer list box 
    910}; 
    1011 
     
    4950#  
    5051sub _on_ok_button_clicked { 
    51     my ($self) = @_; 
     52    my $self = shift; 
     53     
    5254    my $plugin = $self->_plugin; 
    5355 
    5456    # read plugin preferences 
    55     #my $prefs = $plugin->config; 
     57    my $prefs = $plugin->config; 
    5658 
    57     # overwrite dictionary preference 
    58     #my $dic = $self->_dict_combo->GetValue; 
    59     #$prefs->{dictionary} = $dic; 
     59    # update configuration 
     60    my $selection = $self->_colorizer_list->GetSelection(); 
     61    $prefs->{colorizer} = ($selection == 0) ? 'STD' : 'PGE'; 
    6062 
    6163    # store plugin preferences 
    62     #$plugin->config_write($prefs); 
     64    $plugin->config_write($prefs); 
    6365     
    6466    $self->Destroy; 
     
    6971 
    7072# 
    71 # $self->_create; 
    72 # 
    7373# create the dialog itself. 
    7474# 
    75 # no params, no return values. 
    76 # 
    7775sub _create { 
    78     my ($self) = @_; 
     76    my $self = shift; 
    7977 
    8078    # create sizer that will host all controls 
     
    9290 
    9391# 
    94 # $dialog->_create_buttons; 
    95 # 
    9692# create the buttons pane. 
    9793# 
    98 # no params. no return values. 
    99 # 
    10094sub _create_buttons { 
    101     my ($self) = @_; 
     95    my $self = shift; 
    10296    my $sizer  = $self->_sizer; 
    10397 
     
    108102 
    109103# 
    110 # $dialog->_create_controls; 
    111 # 
    112104# create the pane to choose the various configuration parameters. 
    113105# 
    114 # no params. no return values. 
    115 # 
    116106sub _create_controls { 
    117     my ($self) = @_; 
     107    my $self = shift; 
    118108 
    119     my @choices = ['S:H:P6/STD','Rakudo/PGE']; 
     109    my @choices = [ 
     110        'S:H:P6/STD', 
     111        'Rakudo/PGE' 
     112    ]; 
    120113    # syntax highligher selection 
    121114    my $selector_label = Wx::StaticText->new( $self, -1, Wx::gettext('Syntax Highlighter:') ); 
    122     my $selector_list = Wx::ListBox->new( 
    123         $self, 
    124         -1, 
    125         Wx::wxDefaultPosition, 
    126         Wx::wxDefaultSize, 
    127         @choices, 
     115    $self->_colorizer_list(  
     116        Wx::ListBox->new( 
     117            $self, 
     118            -1, 
     119            Wx::wxDefaultPosition, 
     120            Wx::wxDefaultSize, 
     121            @choices, 
     122        ) 
    128123    ); 
    129124     
    130     # XXX - Select based on configuration variable 
    131     $selector_list->Select(0); 
     125    # Select based on configuration variable 
     126    $self->_colorizer_list->Select( ($self->_plugin->config->{colorizer} eq 'STD') ? 0 : 1); 
    132127     
    133128    # pack the controls in a box 
     
    135130    $box = Wx::BoxSizer->new(Wx::wxHORIZONTAL); 
    136131    $box->Add( $selector_label, 0, Wx::wxALL|Wx::wxEXPAND|Wx::wxALIGN_CENTER, 5 ); 
    137     $box->Add( $selector_list, 1, Wx::wxALL|Wx::wxEXPAND|Wx::wxALIGN_CENTER, 5 ); 
     132    $box->Add( $self->_colorizer_list, 1, Wx::wxALL|Wx::wxEXPAND|Wx::wxALIGN_CENTER, 5 ); 
    138133    $self->_sizer->Add( $box, 0, Wx::wxALL|Wx::wxEXPAND|Wx::wxALIGN_CENTER, 5 ); 
    139134 
Note: See TracChangeset for help on using the changeset viewer.