Changeset 4179
- Timestamp:
- 04/28/09 03:08:17 (3 years ago)
- Location:
- trunk/Padre/lib
- Files:
-
- 18 edited
-
Padre.pm (modified) (2 diffs)
-
Padre/Config.pm (modified) (1 diff)
-
Padre/DB/Session.pm (modified) (2 diffs)
-
Padre/Document.pm (modified) (3 diffs)
-
Padre/Document/Perl.pm (modified) (2 diffs)
-
Padre/Plugin.pm (modified) (2 diffs)
-
Padre/PluginHandle.pm (modified) (1 diff)
-
Padre/PluginManager.pm (modified) (6 diffs)
-
Padre/Wx/Dialog/PluginManager.pm (modified) (2 diffs)
-
Padre/Wx/Dialog/Preferences.pm (modified) (7 diffs)
-
Padre/Wx/Dialog/SessionManager.pm (modified) (2 diffs)
-
Padre/Wx/Dialog/SessionSave.pm (modified) (6 diffs)
-
Padre/Wx/Directory.pm (modified) (4 diffs)
-
Padre/Wx/Editor.pm (modified) (1 diff)
-
Padre/Wx/Main.pm (modified) (7 diffs)
-
Padre/Wx/Menu/View.pm (modified) (1 diff)
-
Padre/Wx/Menubar.pm (modified) (1 diff)
-
Padre/Wx/Outline.pm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Padre/lib/Padre.pm
r4178 r4179 120 120 # Create the empty object 121 121 my $self = $SINGLETON = bless { 122 122 123 # parsed command-line options 123 124 opts => \%opts, … … 131 132 # Project Attributes 132 133 project => {}, 133 134 134 135 }, $class; 135 136 -
trunk/Padre/lib/Padre/Config.pm
r4178 r4179 153 153 [ 'logging', $BOOLEAN, 0 ], 154 154 [ 'logging_trace', $BOOLEAN, 0 ], 155 155 156 156 # -- default run parameters 157 157 [ 'run_interpreter_args_default', $ASCII, '' ], 158 158 [ 'run_script_args_default', $ASCII, '' ], 159 159 160 #[ 'run_default_workdir', $ASCII, '' ], 160 161 ], -
trunk/Padre/lib/Padre/DB/Session.pm
r4178 r4179 14 14 15 15 sub last_padre_session { 16 16 17 # find last padre session 17 18 my ($padre) = Padre::DB::Session->select( … … 31 32 return $padre; 32 33 } 33 34 34 35 35 sub files { -
trunk/Padre/lib/Padre/Document.pm
r4178 r4179 339 339 return if not $text; 340 340 return 1 if $text =~ /^=begin\s+pod/msx; 341 return if $text =~ /^=head[12]/msx; # needed for eg/perl5_with_perl6_example.pod341 return if $text =~ /^=head[12]/msx; # needed for eg/perl5_with_perl6_example.pod 342 342 return 1 if $text =~ /^\s*use\s+v6;/msx; 343 343 return 1 if $text =~ /^\s*(?:class|grammar|module|role)\s+\w/msx; … … 562 562 563 563 $self->create_tempfile unless $self->tempfile; 564 564 565 565 open FH, ">", $self->tempfile; 566 566 print FH $self->text_get; … … 572 572 sub create_tempfile { 573 573 use File::Temp; 574 574 575 575 my $tempfile = File::Temp->new( UNLINK => 0 ); 576 576 $_[0]->set_tempfile( $tempfile->filename ); 577 577 close $tempfile; 578 578 579 579 return; 580 580 } -
trunk/Padre/lib/Padre/Document/Perl.pm
r4178 r4179 279 279 280 280 # Use a temporary file if run_save is set to 'unsaved' 281 my $filename = $config->run_save eq 'unsaved' && !$self->is_saved 281 my $filename 282 = $config->run_save eq 'unsaved' && !$self->is_saved 282 283 ? $self->store_in_tempfile 283 284 : $self->filename; … … 290 291 my %run_args = ( 291 292 interpreter => $config->run_interpreter_args_default, 292 script => $config->run_script_args_default,293 script => $config->run_script_args_default, 293 294 ); 294 295 -
trunk/Padre/lib/Padre/Plugin.pm
r4178 r4179 45 45 use strict; 46 46 use warnings; 47 use Carp ();47 use Carp (); 48 48 use File::Spec::Functions qw{ catdir }; 49 use File::ShareDir ();50 use Scalar::Util ();51 use Params::Util ( '_HASH0', '_INSTANCE' );52 use YAML::Tiny ();53 use Padre::DB ();54 use Padre::Wx ();49 use File::ShareDir (); 50 use Scalar::Util (); 51 use Params::Util ( '_HASH0', '_INSTANCE' ); 52 use YAML::Tiny (); 53 use Padre::DB (); 54 use Padre::Wx (); 55 55 56 56 our $VERSION = '0.34'; … … 121 121 my $distdir; 122 122 eval { $distdir = File::ShareDir::dist_dir($pkg); }; 123 return $@ ? undef : catdir( $distdir, 'share', 'locale' ) 124 } 125 123 return $@ ? undef : catdir( $distdir, 'share', 'locale' ); 124 } 126 125 127 126 =head2 padre_interfaces -
trunk/Padre/lib/Padre/PluginHandle.pm
r4178 r4179 157 157 # add the plugin catalog to the locale 158 158 my $locale = Padre::Current->main->{locale}; 159 my $code = Padre::Locale::rfc4646();160 my $name = $self->name;161 $locale->AddCatalog( "$name-$code");159 my $code = Padre::Locale::rfc4646(); 160 my $name = $self->name; 161 $locale->AddCatalog("$name-$code"); 162 162 163 163 # Call the enable method for the object -
trunk/Padre/lib/Padre/PluginManager.pm
r4178 r4179 31 31 use Params::Util qw{_IDENTIFIER _CLASS _INSTANCE}; 32 32 use Padre::Config::Constants qw{ :dirs }; 33 use Padre::Current ();33 use Padre::Current (); 34 34 use Padre::Util (); 35 35 use Padre::PluginHandle (); … … 140 140 141 141 foreach my $plugin ( $self->plugin_objects ) { 142 142 143 # only process enabled plugins 143 144 next unless $plugin->status eq 'enabled'; … … 146 147 my $object = $plugin->{object}; 147 148 my $localedir = $object->plugin_locale_directory 148 if $object->can( 'plugin_locale_directory');149 $locale->AddCatalogLookupPathPrefix( $localedir)149 if $object->can('plugin_locale_directory'); 150 $locale->AddCatalogLookupPathPrefix($localedir) 150 151 if defined $localedir && -d $localedir; 151 152 … … 153 154 my $name = $plugin->name; 154 155 my $code = Padre::Locale::rfc4646(); 155 $locale->AddCatalog( "$name-$code");156 $locale->AddCatalog("$name-$code"); 156 157 } 157 158 } … … 561 562 # add a new directory for locale to search translation catalogs. 562 563 my $localedir = $object->plugin_locale_directory 563 if $object->can( 'plugin_locale_directory');564 if $object->can('plugin_locale_directory'); 564 565 if ( defined $localedir && -d $localedir ) { 565 566 my $locale = Padre::Current->main->{locale}; 566 $locale->AddCatalogLookupPathPrefix( $localedir);567 $locale->AddCatalogLookupPathPrefix($localedir); 567 568 } 568 569 … … 869 870 870 871 # Unload any previously existant plugin with the same name 871 if ($plugins->{$filename}) {872 $self->unload_plugin($filename);873 delete $plugins->{$filename};874 }872 if ( $plugins->{$filename} ) { 873 $self->unload_plugin($filename); 874 delete $plugins->{$filename}; 875 } 875 876 876 877 # Load the selected plugin -
trunk/Padre/lib/Padre/Wx/Dialog/PluginManager.pm
r4178 r4179 488 488 # ... and enabled 489 489 $button->SetLabel( Wx::gettext('Disable') ); 490 $self->_action( '_plugin_disable');490 $self->_action('_plugin_disable'); 491 491 $button->Enable; 492 492 $item->SetText( Wx::gettext('enabled') ); … … 498 498 # ... and disabled 499 499 $button->SetLabel( Wx::gettext('Enable') ); 500 $self->_action( '_plugin_enable');500 $self->_action('_plugin_enable'); 501 501 $button->Enable; 502 502 $item->SetText( Wx::gettext('disabled') ); -
trunk/Padre/lib/Padre/Wx/Dialog/Preferences.pm
r4178 r4179 304 304 my $config = Padre->ide->config; 305 305 my $document = Padre::Current->document; 306 306 307 307 my $intrp_args_text = Wx::gettext(<<'END_TEXT'); 308 308 i.e. … … 316 316 # Default values stored in host configuration 317 317 my $defaults_table = [ 318 [ [ 'Wx::StaticText', undef, Wx::gettext('Interpreter arguments:') ],319 [ 'Wx::TextCtrl', 'run_interpreter_args_default', $config->run_interpreter_args_default ]318 [ [ 'Wx::StaticText', undef, Wx::gettext('Interpreter arguments:') ], 319 [ 'Wx::TextCtrl', 'run_interpreter_args_default', $config->run_interpreter_args_default ] 320 320 ], 321 321 [ [ 'Wx::StaticText', undef, '' ], 322 [ 'Wx::StaticText', undef, $intrp_args_text ]323 ], 324 [ [ 'Wx::StaticText', undef, Wx::gettext('Script arguments:') ],325 [ 'Wx::TextCtrl', 'run_script_args_default', $config->run_script_args_default ]322 [ 'Wx::StaticText', undef, $intrp_args_text ] 323 ], 324 [ [ 'Wx::StaticText', undef, Wx::gettext('Script arguments:') ], 325 [ 'Wx::TextCtrl', 'run_script_args_default', $config->run_script_args_default ] 326 326 ], 327 327 ]; 328 328 329 329 # Per document values (overwrite defaults) stored in history 330 my $doc_flag = 0; # value of 1 means that there is no document currently open330 my $doc_flag = 0; # value of 1 means that there is no document currently open 331 331 my $filename = Wx::gettext('Unsaved'); 332 332 my $path = Wx::gettext('N/A'); 333 333 my %run_args = ( 334 334 interpreter => '', 335 script => '',335 script => '', 336 336 ); 337 337 338 338 # Trap exception if there is no document currently open 339 339 eval { 340 unless ( $document->is_new ) { 341 ($filename, $path) = File::Basename::fileparse( Padre::Current->filename ); 340 unless ( $document->is_new ) 341 { 342 ( $filename, $path ) = File::Basename::fileparse( Padre::Current->filename ); 342 343 foreach my $arg ( keys %run_args ) { 343 344 my $type = "run_${arg}_args_${filename}"; … … 351 352 $doc_flag = 1; 352 353 } 353 354 354 355 my $currentdoc_table = [ 355 356 [ [ 'Wx::StaticText', undef, Wx::gettext('Document name:') ], … … 359 360 [ 'Wx::TextCtrl', undef, $path, Wx::wxTE_READONLY ] 360 361 ], 361 [ [ 'Wx::StaticText', undef, Wx::gettext('Interpreter arguments:') ],362 [ 'Wx::TextCtrl', "run_interpreter_args_$filename", $run_args{interpreter} ]362 [ [ 'Wx::StaticText', undef, Wx::gettext('Interpreter arguments:') ], 363 [ 'Wx::TextCtrl', "run_interpreter_args_$filename", $run_args{interpreter} ] 363 364 ], 364 365 [ [ 'Wx::StaticText', undef, '' ], 365 [ 'Wx::StaticText', undef, $intrp_args_text ]366 ], 367 [ [ 'Wx::StaticText', undef, Wx::gettext('Script arguments:') ],368 [ 'Wx::TextCtrl', "run_script_args_$filename", $run_args{script} ]366 [ 'Wx::StaticText', undef, $intrp_args_text ] 367 ], 368 [ [ 'Wx::StaticText', undef, Wx::gettext('Script arguments:') ], 369 [ 'Wx::TextCtrl', "run_script_args_$filename", $run_args{script} ] 369 370 ], 370 371 ]; … … 392 393 ); 393 394 394 $main_sizer->Add( $notebook, 1, Wx::wxGROW);395 $main_sizer->Add( $notebook, 1, Wx::wxGROW ); 395 396 $panel->SetSizerAndFit($main_sizer); 396 397 … … 434 435 my $appearance = $self->_appearance_panel($tb); 435 436 $tb->AddPage( $appearance, Wx::gettext('Appearance') ); 436 $tb->AddPage( $self->_run_params_panel($tb), 437 Wx::gettext('Run Parameters') ); 437 $tb->AddPage( 438 $self->_run_params_panel($tb), 439 Wx::gettext('Run Parameters') 440 ); 438 441 439 442 #my $plugin_manager = $self->_pluginmanager_panel($tb); … … 622 625 $data->{run_script_args_default} 623 626 ); 624 627 625 628 # Quite like in _run_params_panel, trap exception if there 626 629 # is no document currently open 627 630 eval { 628 unless ( Padre::Current->document->is_new ) { 631 unless ( Padre::Current->document->is_new ) 632 { 633 629 634 # These are a bit different as run_* variable name depends 630 635 # on current document's filename 631 foreach ( grep {/^run_/ && !/_default$/} (keys %$data) ) { 632 next if Padre::DB::History->previous($_) 633 eq $data->{$_}; 636 foreach ( grep { /^run_/ && !/_default$/ } ( keys %$data ) ) { 637 next if Padre::DB::History->previous($_) eq $data->{$_}; 634 638 Padre::DB::History->create( 635 639 type => $_, 636 640 name => $data->{$_}, 637 ) 641 ); 638 642 } 639 643 } -
trunk/Padre/lib/Padre/Wx/Dialog/SessionManager.pm
r4178 r4179 37 37 Wx::wxDefaultPosition, 38 38 Wx::wxDefaultSize, 39 Wx::wxDEFAULT_FRAME_STYLE |Wx::wxTAB_TRAVERSAL,39 Wx::wxDEFAULT_FRAME_STYLE | Wx::wxTAB_TRAVERSAL, 40 40 ); 41 41 $self->SetIcon( Wx::GetWxPerlIcon() ); … … 237 237 238 238 # the buttons 239 my $bo = Wx::Button->new( $self, -1, Wx::gettext('Open') );240 my $bd = Wx::Button->new( $self, -1, Wx::gettext('Delete') );239 my $bo = Wx::Button->new( $self, -1, Wx::gettext('Open') ); 240 my $bd = Wx::Button->new( $self, -1, Wx::gettext('Delete') ); 241 241 my $bc = Wx::Button->new( $self, Wx::wxID_CANCEL, Wx::gettext('Close') ); 242 242 $self->_butopen($bo); -
trunk/Padre/lib/Padre/Wx/Dialog/SessionSave.pm
r4178 r4179 9 9 10 10 use Class::XSAccessor accessors => { 11 _butsave => '_butsave', # save button12 _combo => '_combo', # combo box holding the session names13 _names => '_names', # list of all session names14 _sizer => '_sizer', # the window sizer15 _text => '_text', # text control holding the description11 _butsave => '_butsave', # save button 12 _combo => '_combo', # combo box holding the session names 13 _names => '_names', # list of all session names 14 _sizer => '_sizer', # the window sizer 15 _text => '_text', # text control holding the description 16 16 }; 17 17 use Padre::Wx (); … … 33 33 Wx::wxDefaultPosition, 34 34 Wx::wxDefaultSize, 35 Wx::wxDEFAULT_FRAME_STYLE |Wx::wxTAB_TRAVERSAL,35 Wx::wxDEFAULT_FRAME_STYLE | Wx::wxTAB_TRAVERSAL, 36 36 ); 37 37 $self->SetIcon( Wx::GetWxPerlIcon() ); … … 73 73 my $main = $self->GetParent; 74 74 my $session = $self->_current_session; 75 75 76 76 if ( defined $session ) { 77 77 78 # session exist, remove all files associated to it 78 79 Padre::DB::SessionFile->delete( … … 81 82 ); 82 83 } else { 84 83 85 # session did not exist, create a new one 84 86 $session = Padre::DB::Session->new( … … 89 91 $session->insert; 90 92 } 91 93 92 94 # capture session and save it 93 95 my @session = $main->capture_session; … … 126 128 my ( $self, $event ) = @_; 127 129 128 my $name = $self->_combo->GetValue;130 my $name = $self->_combo->GetValue; 129 131 my $method = $name ? 'Enable' : 'Disable'; 130 132 $self->_butsave->$method; -
trunk/Padre/lib/Padre/Wx/Directory.pm
r4178 r4179 93 93 94 94 sub list_dir { 95 my ( $dir, $depth) = @_;95 my ( $dir, $depth ) = @_; 96 96 my @data; 97 97 $depth ||= 1; … … 99 99 # avoid deep recursion 100 100 # TODO: make this more clever then simply stopping after 10 levels 101 return if $depth > 10; 101 return if $depth > 10; 102 102 if ( opendir my $dh, $dir ) { 103 103 my @items = sort grep { not $SKIP{$_} } readdir $dh; … … 109 109 ); 110 110 if ( -d $path ) { 111 $item{subdir} = list_dir( $path, $depth+1);111 $item{subdir} = list_dir( $path, $depth + 1 ); 112 112 } 113 113 push @data, \%item; … … 205 205 sub _update_treectrl { 206 206 my ( $dir, $data, $root ) = @_; 207 #warn "_update_treectrl @_"; 207 208 #warn "_update_treectrl @_"; 208 209 209 210 foreach my $pkg ( @{$data} ) { -
trunk/Padre/lib/Padre/Wx/Editor.pm
r4178 r4179 769 769 770 770 Padre::Util::debug( "Focus received file: " . ( $doc->filename || '' ) ); 771 771 772 772 # to show/hide the document specific Perl menu 773 773 $self->main->refresh_menu; -
trunk/Padre/lib/Padre/Wx/Main.pm
r4178 r4179 313 313 # explicit session on command line takes precedence 314 314 if ( defined $ide->opts->{session} ) { 315 315 316 # try to find the wanted session... 316 my ($session) = Padre::DB::Session->select( 317 'where name = ?', $ide->opts->{session} 318 ); 317 my ($session) = Padre::DB::Session->select( 'where name = ?', $ide->opts->{session} ); 318 319 319 # ... and open it. 320 320 if ( defined $session ) { 321 321 $self->open_session($session); 322 322 } else { 323 my $error =324 sprintf Wx::gettext('No such session %s'),323 my $error 324 = sprintf Wx::gettext('No such session %s'), 325 325 $ide->opts->{session}; 326 326 $self->error($error); … … 328 328 return; 329 329 } 330 330 331 331 # otherwise, an explicit list on the command line overrides configuration 332 332 my $files = Padre->ide->{ARGV}; … … 464 464 465 465 my $current = $self->current; 466 466 467 #$self->refresh_menu; 467 468 $self->refresh_toolbar($current); … … 1241 1242 return; 1242 1243 } 1244 1243 1245 # if file does not exist, create it so that future access 1244 1246 # (such as size checking) won't warn / blow up padre … … 1379 1381 next unless -f $filename; 1380 1382 my $id = $self->setup_editor($filename); 1381 next unless $id; # documents already opened have undef $id1383 next unless $id; # documents already opened have undef $id 1382 1384 Padre::Util::debug("Setting focus on $filename"); 1383 1385 $focus = $id if $document->focus; … … 1385 1387 } 1386 1388 $self->on_nth_pane($focus) if defined $focus; 1387 1389 1388 1390 # now we can redraw 1389 1391 $self->Thaw; … … 2337 2339 # TODO move this to a more appropriate place (when switching between buffers?) 2338 2340 if ( my $directory = $self->directory ) { 2339 if ( $self->menu->view->{directory}->IsChecked) {2341 if ( $self->menu->view->{directory}->IsChecked ) { 2340 2342 $directory->update_gui; 2341 2343 } -
trunk/Padre/lib/Padre/Wx/Menu/View.pm
r4178 r4179 11 11 use Padre::Wx::Menu (); 12 12 use Padre::Current qw{_CURRENT}; 13 use File::Glob ':glob'; # Fix win32 globbing problem with spaces in paths13 use File::Glob ':glob'; # Fix win32 globbing problem with spaces in paths 14 14 15 15 our $VERSION = '0.34'; -
trunk/Padre/lib/Padre/Wx/Menubar.pm
r4178 r4179 79 79 $self->wx->Append( $self->help->wx, Wx::gettext("&Help") ); 80 80 81 Wx::Event::EVT_MENU_OPEN( $main, sub { 82 Padre->ide->wx->main->menu->refresh(); 83 }); 81 Wx::Event::EVT_MENU_OPEN( 82 $main, 83 sub { 84 Padre->ide->wx->main->menu->refresh(); 85 } 86 ); 84 87 85 88 my $config = Padre->ide->config; -
trunk/Padre/lib/Padre/Wx/Outline.pm
r4178 r4179 129 129 my $page = $self->main->current->editor; 130 130 my $item = $self->GetPlData( $self->GetSelection() ); 131 if (defined $item) {132 $self->select_line_in_editor( $item->{line});131 if ( defined $item ) { 132 $self->select_line_in_editor( $item->{line} ); 133 133 } 134 134 return; … … 138 138 my ( $self, $event ) = @_; 139 139 my $item = $self->GetPlData( $event->GetItem ); 140 if (defined $item) {141 $self->select_line_in_editor( $item->{line});140 if ( defined $item ) { 141 $self->select_line_in_editor( $item->{line} ); 142 142 } 143 143 return; … … 145 145 146 146 sub select_line_in_editor { 147 my ( $self, $line_number) = @_;147 my ( $self, $line_number ) = @_; 148 148 my $page = $self->main->current->editor; 149 if (defined $line_number &&150 ($line_number =~ /^\d+$/o) &&151 (defined $page) &&152 ($line_number <= $page->GetLineCount))149 if ( defined $line_number 150 && ( $line_number =~ /^\d+$/o ) 151 && ( defined $page ) 152 && ( $line_number <= $page->GetLineCount ) ) 153 153 { 154 154 $line_number--;
Note: See TracChangeset
for help on using the changeset viewer.
