Changeset 875
- Timestamp:
- 11/10/08 20:14:52 (3 years ago)
- File:
-
- 1 edited
-
trunk/lib/Padre/Wx/ToolBar.pm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Padre/Wx/ToolBar.pm
r858 r875 20 20 21 21 # 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 ); 30 52 $self->AddSeparator; 31 53 … … 34 56 #Wx::Event::EVT_TOOL($parent, 1000, sub { Padre::Wx::Dialog::Bookmarks->set_bookmark($_[0]) } ); 35 57 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; } );38 58 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 ); 39 73 $self->AddSeparator; 40 74 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') );43 75 44 $self->AddSeparator;45 76 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') );51 77 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 ); 56 120 57 121 return $self; 58 } ## end sub new122 } 59 123 60 124 sub refresh { 61 my $self = shift; 62 my $doc = shift; 63 125 my $self = shift; 126 my $doc = shift; 64 127 my $enabled = !!( $doc and $doc->is_modified ); 65 128 $self->EnableTool( Wx::wxID_SAVE, $enabled ); 66 67 129 $self->EnableTool( Wx::wxID_CLOSE, ( defined Padre::Documents->current ? 1 : 0 ) ); 68 130 return 1;
Note: See TracChangeset
for help on using the changeset viewer.
