Ticket #195: padre.diff

File padre.diff, 2.7 KB (added by richardh, 5 years ago)

Diff file for changes to Padre directory

  • PluginManager.pm

    Common subdirectories: /home/richard/development/Sandbox/padre/DB and /usr/local/share/perl/5.10.0/Padre/DB
    Common subdirectories: /home/richard/development/Sandbox/padre/Document and /usr/local/share/perl/5.10.0/Padre/Document
    Only in /home/richard/development/Sandbox/padre: padre.diff
    Common subdirectories: /home/richard/development/Sandbox/padre/Plugin and /usr/local/share/perl/5.10.0/Padre/Plugin
    diff -u /home/richard/development/Sandbox/padre/PluginManager.pm /usr/local/share/perl/5.10.0/Padre/PluginManager.pm
    old new  
    407407    my $name   = shift; 
    408408    my $plugin = $self->plugins->{$name}->{object}; 
    409409 
     410    # Provide the plugin with access to the output panel 
     411    # Patch by Richard Hainsworth 
     412    my $panel = $self->parent->wx->main_window->{gui}->{output_panel}; 
     413    $plugin->{_say} = sub { $panel->AppendText($_[0]."\n")}; 
     414    $plugin->{_clear} = sub {$panel->clear()}; 
     415 
    410416    # Call the plugin's own enable method 
    411417    $plugin->plugin_enable; 
    412418 
  • Plugin.pm

    diff -u /home/richard/development/Sandbox/padre/Plugin.pm /usr/local/share/perl/5.10.0/Padre/Plugin.pm
    old new  
    432432    return 1; 
    433433} 
    434434 
     435 
     436=pod 
     437 
     438=head2 Access to results panel 
     439  Call two methods added to plugin object. 
     440  $self->say($string); # prints a string to the output_panel appending a \n 
     441  $self->clear; # clears the results panel. 
     442  These subs just tidy up the normal method calling syntax, calling code references 
     443  in the plugin object. 
     444  The idea of providing code references to the plugin object is to prevent the  
     445  plugin from obtaining direct access to the Wx tree, 
     446  Patch by Richard Hainsworth 
     447   
     448  sub say { 
     449    my ($self, $string) = @_; 
     450    &{$self->{_say}}($string); 
     451  }; 
     452   
     453  sub clear { 
     454    my $self = shift; 
     455    &{$self->{_clear}}; 
     456  }; 
     457 
     458=cut 
     459 
     460  sub say { 
     461    my ($self, $string) = @_; 
     462    &{$self->{_say}}($string); 
     463  }; 
     464   
     465  sub clear { 
     466    my $self = shift; 
     467    &{$self->{_clear}}; 
     468  }; 
     469 
    4354701; 
    436471 
    437472=pod