Changeset 875


Ignore:
Timestamp:
11/10/08 20:14:52 (3 years ago)
Author:
adamk
Message:

Re-ordering toolbar, make more readable/maintainable layout, and removed extra seperator

File:
1 edited

Legend:

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

    r858 r875  
    2020 
    2121    # Automatically populate 
    22     $self->AddTool( Wx::wxID_NEW, '', Padre::Wx::tango( catfile( 'actions', 'document-new.png' ) ), 
    23                     gettext('New File') ); 
    24     $self->AddTool( Wx::wxID_OPEN, '', Padre::Wx::tango( catfile( 'actions', 'document-open.png' ) ), 
    25                     gettext('Open File') ); 
    26     $self->AddTool( Wx::wxID_SAVE, '', Padre::Wx::tango( catfile( 'actions', 'document-save.png' ) ), 
    27                     gettext('Save File') ); 
    28     $self->AddTool( Wx::wxID_CLOSE, '', Padre::Wx::tango( catfile( 'emblems', 'emblem-unreadable.png' ) ), 
    29                     gettext('Close File') ); 
     22    $self->AddTool( 
     23        Wx::wxID_NEW, '', 
     24        Padre::Wx::tango( catfile( 'actions', 'document-new.png' ) ), 
     25        gettext('New File'), 
     26    ); 
     27    Wx::Event::EVT_TOOL( 
     28        $parent, 
     29        Wx::wxID_NEW, 
     30        sub { $_[0]->setup_editor; return; }, 
     31    ); 
     32    $self->AddTool( 
     33        Wx::wxID_OPEN, '', 
     34        Padre::Wx::tango( catfile( 'actions', 'document-open.png' ) ), 
     35        gettext('Open File'), 
     36    ); 
     37    $self->AddTool( 
     38        Wx::wxID_SAVE, '', 
     39        Padre::Wx::tango( catfile( 'actions', 'document-save.png' ) ), 
     40        gettext('Save File'), 
     41    ); 
     42    $self->AddTool( 
     43        Wx::wxID_CLOSE, '', 
     44        Padre::Wx::tango( catfile( 'emblems', 'emblem-unreadable.png' ) ), 
     45        gettext('Close File'), 
     46    ); 
     47    Wx::Event::EVT_TOOL( 
     48        $parent, 
     49        Wx::wxID_CLOSE, 
     50        \&Padre::Wx::MainWindow::on_close, 
     51    ); 
    3052    $self->AddSeparator; 
    3153 
     
    3456    #Wx::Event::EVT_TOOL($parent, 1000, sub { Padre::Wx::Dialog::Bookmarks->set_bookmark($_[0]) } ); 
    3557 
    36     Wx::Event::EVT_TOOL( $parent, Wx::wxID_CLOSE, \&Padre::Wx::MainWindow::on_close ); 
    37     Wx::Event::EVT_TOOL( $parent, Wx::wxID_NEW, sub { $_[0]->setup_editor; return; } ); 
    3858 
     59 
     60 
     61 
     62    # Undo/Redo Support 
     63    $self->AddTool( 
     64        Wx::wxID_UNDO, '', 
     65        Padre::Wx::tango( catfile( 'actions', 'edit-undo.png' ) ), 
     66        gettext('Undo'), 
     67    ); 
     68    $self->AddTool( 
     69        Wx::wxID_REDO, '', 
     70        Padre::Wx::tango( catfile( 'actions', 'edit-redo.png' ) ), 
     71        gettext('Redo'), 
     72    ); 
    3973    $self->AddSeparator; 
    4074 
    41     $self->AddTool( Wx::wxID_UNDO, '', Padre::Wx::tango( catfile( 'actions', 'edit-undo.png' ) ), gettext('Undo') ); 
    42     $self->AddTool( Wx::wxID_REDO, '', Padre::Wx::tango( catfile( 'actions', 'edit-redo.png' ) ), gettext('Redo') ); 
    4375 
    44     $self->AddSeparator; 
    4576 
    46     $self->AddTool( Wx::wxID_SELECTALL, '', Padre::Wx::tango( catfile( 'actions', 'edit-select-all.png' ) ), 
    47                     gettext('Select all') ); 
    48     $self->AddTool( Wx::wxID_COPY,  '', Padre::Wx::tango( catfile( 'actions', 'edit-copy.png' ) ),  gettext('Copy') ); 
    49     $self->AddTool( Wx::wxID_CUT,   '', Padre::Wx::tango( catfile( 'actions', 'edit-cut.png' ) ),   gettext('Cut') ); 
    50     $self->AddTool( Wx::wxID_PASTE, '', Padre::Wx::tango( catfile( 'actions', 'edit-paste.png' ) ), gettext('Paste') ); 
    5177 
    52     Wx::Event::EVT_TOOL( $parent, Wx::wxID_SELECTALL, sub { \&Padre::Wx::Editor::text_select_all(@_) } ); 
    53     Wx::Event::EVT_TOOL( $parent, Wx::wxID_COPY, sub { \&Padre::Wx::Editor::text_copy_to_clipboard(@_) } ); 
    54     Wx::Event::EVT_TOOL( $parent, Wx::wxID_CUT, sub { \&Padre::Wx::Editor::text_cut_to_clipboard(@_) } ); 
    55     Wx::Event::EVT_TOOL( $parent, Wx::wxID_PASTE, sub { \&Padre::Wx::Editor::text_paste_from_clipboard(@_) } ); 
     78 
     79    # Cut/Copy/Paste 
     80    $self->AddTool( 
     81        Wx::wxID_CUT, '', 
     82        Padre::Wx::tango( catfile( 'actions', 'edit-cut.png' ) ), 
     83        gettext('Cut'), 
     84    ); 
     85    Wx::Event::EVT_TOOL( 
     86        $parent, 
     87        Wx::wxID_CUT, 
     88        sub { \&Padre::Wx::Editor::text_cut_to_clipboard(@_) }, 
     89    ); 
     90    $self->AddTool( 
     91        Wx::wxID_COPY,  '', 
     92        Padre::Wx::tango( catfile( 'actions', 'edit-copy.png' ) ), 
     93        gettext('Copy'), 
     94    ); 
     95    Wx::Event::EVT_TOOL( 
     96        $parent, 
     97        Wx::wxID_COPY, 
     98        sub { \&Padre::Wx::Editor::text_copy_to_clipboard(@_) }, 
     99    ); 
     100    $self->AddTool( 
     101        Wx::wxID_PASTE, '', 
     102        Padre::Wx::tango( catfile( 'actions', 'edit-paste.png' ) ), 
     103        gettext('Paste'), 
     104    ); 
     105    Wx::Event::EVT_TOOL( 
     106        $parent, 
     107        Wx::wxID_PASTE, 
     108        sub { \&Padre::Wx::Editor::text_paste_from_clipboard(@_) }, 
     109    ); 
     110    $self->AddTool( 
     111        Wx::wxID_SELECTALL, '', 
     112        Padre::Wx::tango( catfile( 'actions', 'edit-select-all.png' ) ), 
     113        gettext('Select all'), 
     114    ); 
     115    Wx::Event::EVT_TOOL( 
     116        $parent, 
     117        Wx::wxID_SELECTALL, 
     118        sub { \&Padre::Wx::Editor::text_select_all(@_) }, 
     119    ); 
    56120 
    57121    return $self; 
    58 } ## end sub new 
     122} 
    59123 
    60124sub refresh { 
    61     my $self = shift; 
    62     my $doc  = shift; 
    63  
     125    my $self    = shift; 
     126    my $doc     = shift; 
    64127    my $enabled = !!( $doc and $doc->is_modified ); 
    65128    $self->EnableTool( Wx::wxID_SAVE, $enabled ); 
    66  
    67129    $self->EnableTool( Wx::wxID_CLOSE, ( defined Padre::Documents->current ? 1 : 0 ) ); 
    68130    return 1; 
Note: See TracChangeset for help on using the changeset viewer.