Changeset 10792


Ignore:
Timestamp:
02/14/10 01:03:47 (2 years ago)
Author:
adamk
Message:

Changed all for loops to foreach that should have been foreaches.

Converting more direct refresh calls to lock statements, which should improve startup speed a bit more and

Location:
trunk/Padre
Files:
37 edited

Legend:

Unmodified
Added
Removed
  • trunk/Padre/lib/Padre.pm

    r10583 r10792  
    227227    # Process the action queue 
    228228    if ( defined $self->opts->{actionqueue} ) { 
    229         for my $action ( split( /\,/, $self->opts->{actionqueue} ) ) { 
     229        foreach my $action ( split( /\,/, $self->opts->{actionqueue} ) ) { 
    230230            next if $action eq ''; # Skip empty action names 
    231231            unless ( defined $self->actions->{$action} ) { 
  • trunk/Padre/lib/Padre/Action.pm

    r10777 r10792  
    196196        &{ $self->{event} }(@args); 
    197197    } elsif ( ref( $self->{event} ) eq 'ARRAY' ) { 
    198         for my $item ( @{ $self->{event} } ) { 
     198        foreach my $item ( @{ $self->{event} } ) { 
    199199            next if ref($item) ne 'CODE'; # TO DO: Catch error and source (Ticket #666) 
    200200            &{$item}(@args); 
  • trunk/Padre/lib/Padre/Action/Edit.pm

    r10470 r10792  
    280280                    my $text = $event->GetText; 
    281281                    my $selection; 
    282                     for my $item (@items) { 
     282                    foreach my $item (@items) { 
    283283                        if ( $item->{text} eq $text ) { 
    284284                            $selection = $item; 
  • trunk/Padre/lib/Padre/Action/File.pm

    r10764 r10792  
    400400        comment    => Wx::gettext('Remove the entries from the recent files list'), 
    401401        menu_event => sub { 
     402            my $lock = Padre::Current->main->lock('UPDATE', 'DB', 'refresh_recent'); 
    402403            Padre::DB::History->delete( 'where type = ?', 'files' ); 
    403             $self->update_recentfiles; 
    404404        }, 
    405405    ); 
  • trunk/Padre/lib/Padre/Config/Upgrade.pm

    r10436 r10792  
    3838    my $self = shift; 
    3939 
    40     for my $storage ( 'human', 'host' ) { 
     40    foreach my $storage ( 'human', 'host' ) { 
    4141 
    4242        if ( !defined( $self->$storage->{Version} ) ) { 
  • trunk/Padre/lib/Padre/Document.pm

    r10732 r10792  
    939939 
    940940    # TO DO this is strange, do we really need to do it with all? 
    941     for my $i ( 0 .. 31 ) { 
     941    foreach my $i ( 0 .. 31 ) { 
    942942        $editor->StartStyling( 0, $i ); 
    943943        $editor->SetStyling( $editor->GetLength, 0 ); 
  • trunk/Padre/lib/Padre/Document/Perl.pm

    r10782 r10792  
    722722 
    723723    #print "Name '$name'\n"; 
    724     for my $i ( 0 .. @lines - 1 ) { 
     724    foreach my $i ( 0 .. @lines - 1 ) { 
    725725 
    726726        #print "L: $lines[$i]\n"; 
     
    933933    { 
    934934 
    935         for my $candidate ( 
     935        foreach my $candidate ( 
    936936            $self->project_tagsfile, $config->perl_tags_file, 
    937937            File::Spec->catfile( $ENV{PADRE_HOME}, 'perltags' ) 
  • trunk/Padre/lib/Padre/Document/Perl/Help.pm

    r10561 r10792  
    153153    my %seen; 
    154154    require File::Find::Rule; 
    155     for my $path (@INC) { 
    156         for my $file ( File::Find::Rule->name('*.pm')->in($path) ) { 
     155    foreach my $path (@INC) { 
     156        foreach my $file ( File::Find::Rule->name('*.pm')->in($path) ) { 
    157157            my $module = substr( $file, length($path) + 1 ); 
    158158            $module =~ s/.pm$//; 
  • trunk/Padre/lib/Padre/Document/Perl/Lexer.pm

    r10436 r10792  
    361361    my $editor = $doc->editor; 
    362362 
    363     for my $i ( 0 .. 31 ) { 
     363    foreach my $i ( 0 .. 31 ) { 
    364364        $editor->StartStyling( $styling_start_pos, $i ); 
    365365        $editor->SetStyling( $styling_end_pos - $styling_start_pos, 0 ); 
  • trunk/Padre/lib/Padre/MimeTypes.pm

    r10767 r10792  
    760760sub menu_view_mimes { 
    761761    my %menu_view_mimes = (); 
    762     for my $mime_type ( keys %MIME_TYPES ) { 
     762    foreach my $mime_type ( keys %MIME_TYPES ) { 
    763763        my $mime_type_name = $MIME_TYPES{$mime_type}{name}; 
    764764        if ($mime_type_name) { 
  • trunk/Padre/lib/Padre/PluginManager.pm

    r10681 r10792  
    741741    my $event = shift; 
    742742 
    743     for my $module ( keys %{ $self->{plugins} } ) { 
     743    foreach my $module ( keys %{ $self->{plugins} } ) { 
    744744 
    745745        # TODO: Re-enable the commented out error messages when the failing modules 
  • trunk/Padre/lib/Padre/Task/HTTPClient/LWP.pm

    r10436 r10792  
    6060    # content (POST data) and query (GET data) may be passed as hash ref's 
    6161    # and they're converted automatically: 
    62     for my $var ( 'query', 'content' ) { 
     62    foreach my $var ( 'query', 'content' ) { 
    6363        next unless ref( $self->{$var} ) eq 'HASH'; 
    6464        $self->{$var} = join( 
  • trunk/Padre/lib/Padre/Util.pm

    r10615 r10792  
    416416    my $dir    = $olddir; 
    417417    while (1) { 
    418         for my $testfilename ( 'Makefile.PL', 'Build.PL', 'dist.ini', 'padre.yml' ) { 
     418        foreach my $testfilename ( 'Makefile.PL', 'Build.PL', 'dist.ini', 'padre.yml' ) { 
    419419            next unless -e File::Spec->catfile( $dir, $testfilename ); 
    420420 
  • trunk/Padre/lib/Padre/Wx/Ack.pm

    r10436 r10792  
    227227        my $is_regex = 1; 
    228228        my $wanted = ( $file_types =~ s/^no// ) ? 0 : 1; 
    229         for my $i ( App::Ack::filetypes_supported() ) { 
     229        foreach my $i ( App::Ack::filetypes_supported() ) { 
    230230            if ( $i eq $file_types ) { 
    231231                $App::Ack::type_wanted{$i} = $wanted; 
     
    525525# see t/module.t in ack distro 
    526526sub fill_type_wanted { 
    527     for my $i ( App::Ack::filetypes_supported() ) { 
     527    foreach my $i ( App::Ack::filetypes_supported() ) { 
    528528        $App::Ack::type_wanted{$i} = undef; 
    529529    } 
  • trunk/Padre/lib/Padre/Wx/Debugger.pm

    r10776 r10792  
    163163    my $debugger = $main->debugger; 
    164164    my $count    = $debugger->GetItemCount; 
    165     for my $c ( 0 .. $count - 1 ) { 
     165    foreach my $c ( 0 .. $count - 1 ) { 
    166166        my $variable = $debugger->GetItemText($c); 
    167167 
  • trunk/Padre/lib/Padre/Wx/Debugger/View.pm

    r10436 r10792  
    110110    my $self = shift; 
    111111 
    112     for my $i ( 0 .. 1 ) { 
     112    foreach my $i ( 0 .. 1 ) { 
    113113        my $col = $self->GetColumn($i); 
    114114        $col->SetText( _get_title($i) ); 
  • trunk/Padre/lib/Padre/Wx/Dialog/Preferences.pm

    r10681 r10792  
    797797    # TO DO: Convert the internal panels to use this 
    798798 
    799     for my $module ( sort { Wx::gettext( $PANELS{$a} ) cmp Wx::gettext( $PANELS{$b} ); } ( keys(%PANELS) ) ) { 
     799    foreach my $module ( sort { Wx::gettext( $PANELS{$a} ) cmp Wx::gettext( $PANELS{$b} ); } ( keys(%PANELS) ) ) { 
    800800 
    801801        # A plugin or panel should not crash Padre on error 
     
    11341134    if ( $config->feature_config ) { 
    11351135 
    1136         for my $feature (@Func_List) { 
     1136        foreach my $feature (@Func_List) { 
    11371137            $config->set( 
    11381138                'feature_' . $feature->[0], 
     
    11721172    ); 
    11731173 
    1174     for my $module ( keys(%PANELS) ) { 
     1174    foreach my $module ( keys(%PANELS) ) { 
    11751175        my $preferences_page = $module->new(); 
    11761176        $preferences_page->save($data); 
  • trunk/Padre/lib/Padre/Wx/Dialog/RegexEditor.pm

    r10621 r10792  
    395395    $level = 0  unless $level; 
    396396    my @children = $parent->isa('PPIx::Regexp::Node') ? $parent->children : (); 
    397     for my $child (@children) { 
     397    foreach my $child (@children) { 
    398398        next if $child->content eq ''; 
    399399        my $class_name = $child->class; 
     
    413413    @array    = () unless @array; 
    414414    my @elements = $parent->isa('PPIx::Regexp::Node') ? $parent->elements : (); 
    415     for my $element (@elements) { 
     415    foreach my $element (@elements) { 
    416416        my $content = $element->content; 
    417417        next if $content eq ''; 
     
    492492        my @chars = split( //, $original_text ); 
    493493        my $pos = 0; 
    494         for my $char (@chars) { 
     494        foreach my $char (@chars) { 
    495495            if ( $pos == $match_start ) { 
    496496                $self->{matched_text}->BeginTextColour(Wx::wxRED); 
     
    527527    #   $self->{regex}->Clear; 
    528528    #   my @elements = _parse_regex_elements; 
    529     #   for my $element (@elements) { 
     529    #   foreach my $element (@elements) { 
    530530    #       my $class_name = $element->element->class; 
    531531    #       if ($class_name eq 'PPIx::Regexp::Token::CharClass::Simple') { 
  • trunk/Padre/lib/Padre/Wx/Dialog/WindowList.pm

    r10744 r10792  
    9191    my @pages; 
    9292 
    93     for my $listitem ( 0 .. ( $self->_list->GetItemCount - 1 ) ) { 
     93    foreach my $listitem ( 0 .. ( $self->_list->GetItemCount - 1 ) ) { 
    9494        my $item = $self->{items}->[ $self->_list->GetItem($listitem)->GetData ]; 
    9595        next unless $item->{selected}; 
     
    273273    Wx::Event::EVT_BUTTON( $self, $bc, \&_on_butclose_clicked ); 
    274274 
    275     for my $button_no ( 0 .. $#{ $self->{buttons} || [] } ) { 
     275    foreach my $button_no ( 0 .. $#{ $self->{buttons} || [] } ) { 
    276276        if ( !defined( $self->{button_clicks}->[$button_no] ) ) { 
    277277            warn 'Too many buttons defined!'; 
     
    389389 
    390390    my $count; 
    391     for my $item ( @{ $self->{items} } ) { 
     391    foreach my $item ( @{ $self->{items} } ) { 
    392392        ++$count if $item->{selected}; 
    393393    } 
     
    395395    my $method = $count ? 'Enable' : 'Disable'; 
    396396 
    397     for my $button ( @{ $self->{buttons} || [] } ) { 
     397    foreach my $button ( @{ $self->{buttons} || [] } ) { 
    398398        $button->[2]->$method if defined( $button->[2] ); 
    399399    } 
  • trunk/Padre/lib/Padre/Wx/Directory/TreeCtrl.pm

    r10589 r10792  
    351351 
    352352    # Loops thought the node's total children 
    353     for my $item ( 1 .. $self->GetChildrenCount($root) ) { 
     353    foreach my $item ( 1 .. $self->GetChildrenCount($root) ) { 
    354354 
    355355        ( my $node, $cookie ) = $item == 1 ? $self->GetFirstChild($root) : $self->GetNextChild( $root, $cookie ); 
  • trunk/Padre/lib/Padre/Wx/Editor.pm

    r10681 r10792  
    749749} 
    750750 
    751 # when the focus is received by the editor 
     751# When the focus is received by the editor 
    752752sub on_focus { 
    753     my ( $self, $event ) = @_; 
    754     my $doc = Padre::Current->document; 
    755  
    756     TRACE( "Focus received file: " . ( $doc->filename || '' ) ) if DEBUG; 
    757  
    758     my $main = $self->main; 
    759  
    760     # to show/hide the document specific Perl menu 
     753    my $self     = shift; 
     754    my $event    = shift; 
     755    my $main     = $self->main; 
     756    my $document = $main->current->document; 
     757    TRACE( "Focus received file: " . ( $document->filename || '' ) ) if DEBUG; 
     758 
     759    # To show/hide the document specific Perl menu 
    761760    # don't refresh on each focus event 
    762     $main->refresh_menu 
    763         if ( !defined( $main->{last_refresh_editor} ) ) 
    764         or ( $main->{last_refresh_editor} ne $self ); 
    765     $main->{last_refresh_editor} = $self; 
    766  
    767     $main->update_directory; 
     761    my $lock = $main->lock('UPDATE', 'refresh_menu', 'refresh_directory'); 
    768762 
    769763    # TO DO 
     
    771765    # we should restrict some of the updates to cases when we switch from one file to 
    772766    # another 
    773  
    774767    if ( $self->needs_manual_colorize ) { 
    775768        TRACE("needs_manual_colorize") if DEBUG; 
    776769        my $lexer = $self->GetLexer; 
    777770        if ( $lexer == Wx::wxSTC_LEX_CONTAINER ) { 
    778             $doc->colorize; 
     771            $document->colorize; 
    779772        } else { 
    780             $doc->remove_color; 
     773            $document->remove_color; 
    781774            $self->Colourise( 0, $self->GetLength ); 
    782775        } 
     
    12121205            $end--; 
    12131206        } 
    1214         for my $line ( $begin .. $end ) { 
     1207        foreach my $line ( $begin .. $end ) { 
    12151208 
    12161209            # insert $str (# or //) 
     
    12531246            $end--; 
    12541247        } 
    1255         for my $line ( $begin .. $end ) { 
     1248        foreach my $line ( $begin .. $end ) { 
    12561249            my $first = $self->PositionFromLine($line); 
    12571250            my $last  = $first + $length; 
  • trunk/Padre/lib/Padre/Wx/FindResult.pm

    r10436 r10792  
    195195    my $self = shift; 
    196196 
    197     for my $i ( 0 .. 1 ) { 
     197    foreach my $i ( 0 .. 1 ) { 
    198198        my $col = $self->GetColumn($i); 
    199199        $col->SetText( _get_title($i) ); 
  • trunk/Padre/lib/Padre/Wx/Main.pm

    r10767 r10792  
    114114    ); 
    115115 
     116    # Start with a simple placeholder title 
     117    $self->SetTitle('Padre'); 
     118 
    116119    # Save a reference back to the parent IDE 
    117120    $self->{ide} = $ide; 
     
    124127    # so that we can do locking operations during startup. 
    125128    $self->{locker} = Padre::Locker->new($self); 
    126  
    127     # Determine the window title (needs ide & config) 
    128     $self->refresh_title; 
    129129 
    130130    # Remember where the editor started from, 
     
    246246        Padre::Wx::ID_TIMER_POSTINIT, 
    247247        sub { 
    248             $_[0]->_timer_post_init; 
     248            $_[0]->timer_post_init; 
    249249        }, 
    250250    ); 
     
    656656} 
    657657 
    658 sub _timer_post_init { 
     658sub timer_post_init { 
    659659    my $self    = shift; 
    660660    my $config  = $self->config; 
     
    11591159sub add_refresh_listener { 
    11601160    my ( $self, @listeners ) = @_; 
    1161     for my $l (@listeners) { 
     1161    foreach my $l (@listeners) { 
    11621162        if ( !grep { $_ eq $l } @{ $self->{refresh_listeners} } ) { 
    11631163            Scalar::Util::weaken($l); 
     
    12671267=pod 
    12681268 
     1269=head2 C<refresh_outline> 
     1270 
     1271    $main->refresh_outline; 
     1272 
     1273Force a refresh of the outline panel. 
     1274 
     1275=cut 
     1276 
     1277sub refresh_outline { 
     1278    my $self = shift; 
     1279    return unless $self->has_outline; 
     1280    return if $self->locked('REFRESH'); 
     1281    return unless $self->menu->view->{show_outline}->IsChecked; 
     1282    $self->outline->refresh; 
     1283    return; 
     1284} 
     1285 
     1286=pod 
     1287 
    12691288=head3 C<refresh_menu> 
    12701289 
     
    13371356    my $self = shift; 
    13381357    return if $self->locked('REFRESH'); 
    1339     $self->menu->file->update_recentfiles; 
     1358    $self->menu->file->refresh_recent; 
    13401359} 
    13411360 
     
    26162635} 
    26172636 
    2618  
    2619  
    2620 sub update_directory { 
    2621     my $self = shift; 
    2622  
    2623     # update the directory listing 
    2624     if ( $self->has_directory ) { 
    2625         if ( $self->menu->view->{directory}->IsChecked ) { 
    2626             $self->directory->refresh; 
    2627         } 
    2628     } 
    2629  
    2630 } 
    2631  
    2632  
    26332637=pod 
    26342638 
     
    33153319    } 
    33163320 
    3317     my $lock = $self->lock('REFRESH'); 
     3321    my $lock     = $self->lock('REFRESH'); 
    33183322    my $document = Padre::Document->new( filename => $file, ); 
    33193323 
     
    33983402 
    33993403sub create_tab { 
    3400     my ( $self, $editor, $title ) = @_; 
     3404    my $self   = shift; 
     3405    my $editor = shift; 
     3406    my $title  = shift; 
    34013407    $title ||= '(' . Wx::gettext('Unknown') . ')'; 
     3408 
     3409    my $lock = $self->lock('refresh'); 
    34023410    $self->notebook->AddPage( $editor, $title, 1 ); 
    34033411    $editor->SetFocus; 
    3404     my $id = $self->notebook->GetSelection; 
    3405     $self->refresh; 
    3406     return $id; 
     3412    return $self->notebook->GetSelection; 
    34073413} 
    34083414 
     
    36413647 
    36423648    my @files; 
    3643     for my $filename (@filenames) { 
     3649    foreach my $filename (@filenames) { 
    36443650 
    36453651        if ( $filename =~ /[\*\?]/ ) { 
     
    38103816    SCOPE: { 
    38113817        my $lock = $self->lock('refresh'); 
    3812         for my $reload_page_no ( 0 .. $#reload_pages ) { 
     3818        foreach my $reload_page_no ( 0 .. $#reload_pages ) { 
    38133819            $progress->update( $reload_page_no, ( $reload_page_no + 1 ) . '/' . scalar(@reload_pages) ); 
    38143820 
     
    44444450    SCOPE: { 
    44454451        my $lock = $self->lock('refresh'); 
    4446         for my $close_page_no ( 0 .. $#close_pages ) { 
     4452        foreach my $close_page_no ( 0 .. $#close_pages ) { 
    44474453            $progress->update( $close_page_no, ( $close_page_no + 1 ) . '/' . scalar(@close_pages) ); 
    44484454 
  • trunk/Padre/lib/Padre/Wx/Menu/File.pm

    r10772 r10792  
    257257    $self->{recentfiles}->AppendSeparator; 
    258258 
    259     $self->update_recentfiles; 
     259    # NOTE: Do NOT do an initial fill during the constructor 
     260    # We'll do one later anyway, and the list is premature at this point. 
     261    # $self->refresh_recent; 
    260262 
    261263    $self->AppendSeparator; 
     
    279281 
    280282sub title { 
    281     my $self = shift; 
    282  
    283     return Wx::gettext('&File'); 
     283    Wx::gettext('&File'); 
    284284} 
    285285 
    286  
    287  
    288286sub refresh { 
    289     my $self    = shift; 
    290     my $current = _CURRENT(@_); 
    291     my $doc    = $current->document ? 1 : 0; 
    292  
    293     $self->{open_in_file_browser}->Enable($doc); 
     287    my $self     = shift; 
     288    my $current  = _CURRENT(@_); 
     289    my $document = $current->document ? 1 : 0; 
     290 
     291    $self->{open_in_file_browser}->Enable($document); 
    294292    if (Padre::Constant::WIN32) { 
    295293 
    296294        #Win32 
    297         $self->{open_with_default_system_editor}->Enable($doc); 
    298         $self->{open_in_command_line}->Enable($doc); 
     295        $self->{open_with_default_system_editor}->Enable($document); 
     296        $self->{open_in_command_line}->Enable($document); 
    299297    } else { 
    300298 
     
    304302        $self->{open_in_command_line}->Enable(0); 
    305303    } 
    306     $self->{close}->Enable($doc); 
    307     $self->{close_all}->Enable($doc); 
    308     $self->{close_all_but_current}->Enable($doc); 
    309     $self->{reload_file}->Enable($doc); 
    310     $self->{reload_all}->Enable($doc); 
    311     $self->{save}->Enable($doc); 
    312     $self->{save_as}->Enable($doc); 
    313     $self->{save_all}->Enable($doc); 
    314     $self->{print}->Enable($doc); 
    315     defined( $self->{open_session} ) and $self->{open_selection}->Enable($doc); 
    316     defined( $self->{save_session} ) and $self->{save_session}->Enable($doc); 
    317     $self->{docstat}->Enable($doc); 
     304    $self->{close}->Enable($document); 
     305    $self->{close_all}->Enable($document); 
     306    $self->{close_all_but_current}->Enable($document); 
     307    $self->{reload_file}->Enable($document); 
     308    $self->{reload_all}->Enable($document); 
     309    $self->{save}->Enable($document); 
     310    $self->{save_as}->Enable($document); 
     311    $self->{save_all}->Enable($document); 
     312    $self->{print}->Enable($document); 
     313    defined( $self->{open_session} ) and $self->{open_selection}->Enable($document); 
     314    defined( $self->{save_session} ) and $self->{save_session}->Enable($document); 
     315    $self->{docstat}->Enable($document); 
    318316 
    319317    return 1; 
    320318} 
    321319 
    322 sub update_recentfiles { 
     320sub refresh_recent { 
    323321    my $self = shift; 
    324322 
     
    345343 
    346344                    # Handle "File not found" situation 
    347                     Padre::DB::History->delete( 'where name = ? and type = ?', $file, 'files' ); 
    348                     $self->update_recentfiles; 
     345                    Padre::Current->main->lock('UPDATE', 'DB', 'refresh_recent'); 
     346                    Padre::DB::History->delete( 
     347                        'where name = ? and type = ?', 
     348                        $file, 'files', 
     349                    ); 
    349350                    Wx::MessageBox( 
    350351                        sprintf( Wx::gettext("File %s not found."), $file ), 
  • trunk/Padre/lib/Padre/Wx/Menu/Run.pm

    r10436 r10792  
    88use Padre::Wx       (); 
    99use Padre::Wx::Menu (); 
    10 use Padre::Current qw{_CURRENT}; 
     10use Padre::Current  ('_CURRENT'); 
    1111 
    1212our $VERSION = '0.56'; 
     
    127127    $self->{run_command}->Enable(1); 
    128128    $self->{stop}->Enable(0); 
    129     $self->{main}->refresh_toolbar(_CURRENT); 
    130129    return; 
    131130} 
     
    137136    $self->{run_command}->Enable(0); 
    138137    $self->{stop}->Enable(1); 
    139     $self->{main}->refresh_toolbar(_CURRENT); 
    140138    return; 
    141139} 
  • trunk/Padre/lib/Padre/Wx/Menu/View.pm

    r10778 r10792  
    5151 
    5252    # Show or hide GUI elements 
    53     for my $element (@GUI_ELEMENTS) { 
     53    foreach my $element (@GUI_ELEMENTS) { 
    5454 
    5555        next unless defined($element); 
  • trunk/Padre/lib/Padre/Wx/Menubar.pm

    r10670 r10792  
    117117    my @items; 
    118118 
    119     for my $item ( split( /\;/, $config->main_menubar_items ) ) { 
     119    foreach my $item ( split( /\;/, $config->main_menubar_items ) ) { 
    120120        if ( $item eq 'menu._document' ) { 
    121121            next unless defined( $main->current ); 
     
    145145 
    146146    my $count = -1; 
    147     for my $item (@items) { 
     147    foreach my $item (@items) { 
    148148        if ( $item =~ /^menu\.(.+)$/ ) { 
    149149            my $menu = $1; 
     
    198198                # is a collision 
    199199                $title =~ s/\&//g; 
    200                 for my $pos ( 0 .. ( length($title) - 1 ) ) { 
     200                foreach my $pos ( 0 .. ( length($title) - 1 ) ) { 
    201201                    my $char = lc( substr( $title, $pos, 1 ) ); 
    202202 
  • trunk/Padre/lib/Padre/Wx/Notebook.pm

    r10659 r10792  
    7272} 
    7373 
     74 
     75 
     76 
     77 
    7478###################################################################### 
    7579# Main Methods 
     
    9296} 
    9397 
     98 
     99 
     100 
     101 
    94102###################################################################### 
    95103# Event Handlers 
     
    98106    my $self   = shift; 
    99107    my $main   = $self->main; 
     108    my $lock   = $main->lock('UPDATE', 'refresh', 'refresh_outline'); 
    100109    my $editor = $self->current->editor; 
    101     if ($editor) { 
     110 
     111    if ( $editor ) { 
    102112        my $history = $main->{page_history}; 
    103113        my $current = Scalar::Util::refaddr($editor); 
     
    108118        # TO DO: Violates encapsulation 
    109119        $editor->{Document}->set_indentation_style; 
     120    } 
    110121 
    111         # make sure the outline is refreshed for the new doc 
    112         # TO DO: Violates encapsulation 
    113         if ( $main->has_outline ) { 
    114             $main->outline->clear; 
    115             $main->outline->force_next(1); 
    116         } 
    117     } 
    118     $main->refresh; 
    119122    $main->{ide}->plugin_manager->plugin_event('editor_changed'); 
    120123} 
  • trunk/Padre/lib/Padre/Wx/Outline.pm

    r10436 r10792  
    115115} 
    116116 
     117sub refresh { 
     118    my $self = shift; 
     119    $self->clear; 
     120    $self->force_next(1); 
     121} 
     122 
    117123sub running { 
    118124    !!( $_[0]->{timer} and $_[0]->{timer}->IsRunning ); 
  • trunk/Padre/lib/Padre/Wx/Syntax.pm

    r10692 r10792  
    302302    my $self = shift; 
    303303 
    304     for my $i ( 0 .. 2 ) { 
     304    foreach my $i ( 0 .. 2 ) { 
    305305        my $col = $self->GetColumn($i); 
    306306        $col->SetText( _get_title($i) ); 
  • trunk/Padre/lib/Padre/Wx/ToolBar.pm

    r10436 r10792  
    5353    # within config.yml. 
    5454 
    55     for my $item ( split( /\;/, $config->main_toolbar_items ) ) { 
     55    foreach my $item ( split( /\;/, $config->main_toolbar_items ) ) { 
    5656 
    5757        if ( $item eq '|' ) { 
     
    139139    my $selection = ( defined $text and $text ne '' ) ? 1 : 0; 
    140140 
    141     for my $item ( keys( %{ $self->{item_list} } ) ) { 
     141    foreach my $item ( keys( %{ $self->{item_list} } ) ) { 
    142142 
    143143        my $action = $self->{item_list}->{$item}; 
  • trunk/Padre/script/padre

    r10615 r10792  
    131131 
    132132if ($PRELOAD) { 
    133  
    134133    # Load the entire application into memory immediately 
    135134    Padre->import(':everything'); 
     135#   use Aspect; 
     136#   aspect( 'NYTProf', 
     137#       call qr/^Padre::/ & 
     138#       call qr/\b(?:refresh|update)\w*\z/ & ! 
     139#       call qr/^Padre::(?:Locker|Wx::Progress)::/ 
     140#   ); 
    136141} 
    137142 
  • trunk/Padre/share/examples/absolute_beginner/05_do_it_again.pl

    r8739 r10792  
    7272# Perl could also be used for cooking: 
    7373 
    74 for my $fruit ( "Orange", "Apple", "Strawberry", "Melon", "Lemon" ) { 
     74foreach my $fruit ( "Orange", "Apple", "Strawberry", "Melon", "Lemon" ) { 
    7575    print "1 $fruit\n"; 
    7676} 
  • trunk/Padre/share/examples/absolute_beginner/07_short_salat.pl

    r8739 r10792  
    5151    # Sounds like a job for a loop and I'll start with a for try 
    5252 
    53     for my $argument_number ( 0 .. 2 ) { 
     53    foreach my $argument_number ( 0 .. 2 ) { 
    5454        print $_[$argument_number] . "\n"; 
    5555    } 
     
    8181    # variables until now, but this can't wait any longer 
    8282 
    83     for my $argument_number ( 0 .. $number_of_items ) { 
     83    foreach my $argument_number ( 0 .. $number_of_items ) { 
    8484 
    8585        # The number of the first argument is fixed, so there is no need to push it 
     
    105105    my $number_of_items = $_[0]; 
    106106 
    107     for my $argument_number ( 1 .. $number_of_items ) { 
     107    foreach my $argument_number ( 1 .. $number_of_items ) { 
    108108        print "Cut " . $_[$argument_number] . " in stripes\n"; 
    109109    } 
     
    114114    my $number_of_items = $_[0]; 
    115115 
    116     for my $argument_number ( 1 .. $number_of_items ) { 
     116    foreach my $argument_number ( 1 .. $number_of_items ) { 
    117117        print "Cut " . $_[$argument_number] . " in pieces\n"; 
    118118    } 
  • trunk/Padre/t/94-padre-file-remote.t

    r10438 r10792  
    4747); 
    4848 
    49 for my $url ( keys(%HTTP_Tests) ) { 
     49foreach my $url ( keys(%HTTP_Tests) ) { 
    5050    $file = Padre::File->new($url); 
    5151    ok( defined($file), 'HTTP ' . $url . ': Create Padre::File object' ); 
     
    9494 
    9595# Test some FTP servers 
    96 for my $url ( 
     96foreach my $url ( 
    9797    'ftp://ftp.ubuntu.com/ubuntu/project/ubuntu-archive-keyring.gpg', 
    9898    'ftp://ftp.proftpd.org/README.MIRRORS',                        # Proftpd 
  • trunk/Padre/xt/actions.t

    r10498 r10792  
    6868 
    6969# Run the action checks... 
    70 for my $action (sort(keys(%{$VAR1->{actions}}))) { 
     70foreach my $action (sort(keys(%{$VAR1->{actions}}))) { 
    7171 
    7272 if ($action =~ /^run\./) { 
  • trunk/Padre/xt/mimetype.t

    r10751 r10792  
    5454 
    5555# Some fixed test texts 
    56 for my $text (sort(keys(%test_texts))) { 
     56foreach my $text (sort(keys(%test_texts))) { 
    5757    is(Padre::MimeTypes->guess_mimetype($text,''),$test_texts{$text},$test_texts{$text}); 
    5858} 
    5959 
    6060# Some fixed test filenames 
    61 for my $file (sort(keys(%test_files))) { 
     61foreach my $file (sort(keys(%test_files))) { 
    6262    is(Padre::MimeTypes->guess_mimetype('',$file),$test_files{$file},$file); 
    6363} 
Note: See TracChangeset for help on using the changeset viewer.