Changeset 2257
- Timestamp:
- 12/29/08 21:18:05 (3 years ago)
- Location:
- trunk/Padre/lib/Padre/Wx
- Files:
-
- 1 added
- 1 edited
-
MainWindow.pm (modified) (8 diffs)
-
StatusBar.pm (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Padre/lib/Padre/Wx/MainWindow.pm
r2256 r2257 33 33 use Padre::Wx (); 34 34 use Padre::Wx::Editor (); 35 use Padre::Wx::Output (); 35 36 use Padre::Wx::ToolBar (); 36 use Padre::Wx:: Output();37 use Padre::Wx::StatusBar (); 37 38 use Padre::Wx::ErrorList (); 38 39 use Padre::wx::AuiManager (); … … 106 107 $self->{locale} = Padre::Locale::object(); 107 108 109 # Drag and drop support 108 110 $self->SetDropTarget( 109 111 Padre::Wx::FileDropTarget->new($self) … … 114 116 $self->{_methods} = []; 115 117 118 # Temporary store for the notebook tab history 119 # TODO: Storing this here (might) violate encapsulation. 120 # It should probably be in the notebook object. 121 $self->{page_history} = []; 122 116 123 # Set the window manager 117 124 $self->{manager} = Padre::Wx::AuiManager->new($self); … … 120 127 $self->{marker} = {}; 121 128 122 $self->{page_history} = []; 129 # Create the status bar 130 $self->{gui}->{statusbar} = Padre::Wx::StatusBar->new($self); 123 131 124 132 # create basic window components … … 153 161 my $mod = $event->GetModifiers || 0; 154 162 my $code = $event->GetKeyCode; 155 163 156 164 # remove the bit ( Wx::wxMOD_META) set by Num Lock being pressed on Linux 157 165 $mod = $mod & (Wx::wxMOD_ALT() + Wx::wxMOD_CMD() + Wx::wxMOD_SHIFT()); … … 215 223 $self->GetToolBar->Realize; 216 224 217 # Create the status bar 218 unless ( defined $self->{gui}->{statusbar} ) { 219 $self->{gui}->{statusbar} = $self->CreateStatusBar( 1, Wx::wxST_SIZEGRIP|Wx::wxFULL_REPAINT_ON_RESIZE ); 220 $self->{gui}->{statusbar}->SetFieldsCount(4); 221 $self->{gui}->{statusbar}->SetStatusWidths(-1, 100, 50, 100); 222 } 223 224 return; 225 } 226 225 return; 226 } 227 227 228 228 sub create_editor_pane { … … 562 562 563 563 sub refresh_status { 564 my ($self) = @_;564 my $self = shift; 565 565 return if $self->no_refresh; 566 567 my $pageid = $self->nb->GetSelection(); 568 if (not defined $pageid or $pageid == -1) { 569 $self->SetStatusText("", $_) for (0..3); 570 return; 571 } 572 my $editor = $self->nb->GetPage($pageid); 573 my $doc = Padre::Documents->current or return; 574 my $line = $editor->GetCurrentLine; 575 my $filename = $doc->filename || ''; 576 my $newline_type = $doc->get_newline_type || Padre::Util::NEWLINE; 577 my $modified = $editor->GetModify ? '*' : ' '; 578 579 if ($filename) { 580 $self->nb->SetPageText($pageid, $modified . File::Basename::basename $filename); 581 } else { 582 my $text = substr($self->nb->GetPageText($pageid), 1); 583 $self->nb->SetPageText($pageid, $modified . $text); 584 } 585 586 my $pos = $editor->GetCurrentPos; 587 my $start = $editor->PositionFromLine($line); 588 my $char = $pos-$start; 589 590 $self->SetStatusText("$modified $filename", 0); 591 592 my $charWidth = $self->{gui}->{statusbar}->GetCharWidth; 593 my $mt = $doc->get_mimetype; 594 my $curPos = Wx::gettext('L:') . ($line + 1) . ' ' . Wx::gettext('Ch:') . $char; 595 596 $self->SetStatusText($mt, 1); 597 $self->SetStatusText($newline_type, 2); 598 $self->SetStatusText($curPos, 3); 599 600 # since charWidth is an average we adjust the values a little 601 $self->{gui}->{statusbar}->SetStatusWidths( 602 -1, 603 (length($mt) - 1) * $charWidth, 604 (length($newline_type) + 2) * $charWidth, 605 (length($curPos) + 1) * $charWidth 606 ); 607 608 return; 566 $self->GetStatusBar->refresh; 609 567 } 610 568 … … 1983 1941 1984 1942 my $editor = $self->selected_editor; 1985 #$editor->SetEOLMode( $mode{$newline_type} );1986 1943 $editor->ConvertEOLs( $Padre::Wx::Editor::mode{$newline_type} ); 1987 1944
Note: See TracChangeset
for help on using the changeset viewer.
