Changeset 486
- Timestamp:
- 10/26/08 06:29:16 (3 years ago)
- Location:
- trunk/lib/Padre/Wx
- Files:
-
- 2 edited
-
Editor.pm (modified) (1 diff)
-
MainWindow.pm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Padre/Wx/Editor.pm
r479 r486 179 179 } 180 180 181 # currently if there are 9 lines we set the margin to 1 width and then 182 # if another line is added it is not seen well. 183 # actually I added some improvement allowing a 50% growth in the file 184 # and requireing a min of 2 width 185 sub _toggle_numbers { 186 my ($editor, $on) = @_; 187 188 $editor->SetMarginWidth(1, 0); 189 $editor->SetMarginWidth(2, 0); 190 if ($on) { 191 my $n = 1 + List::Util::max (2, length ($editor->GetLineCount * 2)); 192 my $width = $n * $editor->TextWidth(Wx::wxSTC_STYLE_LINENUMBER, "9"); # width of a single character 193 $editor->SetMarginWidth(0, $width); 194 $editor->SetMarginType(0, Wx::wxSTC_MARGIN_NUMBER); 195 } else { 196 $editor->SetMarginWidth(0, 0); 197 $editor->SetMarginType(0, Wx::wxSTC_MARGIN_NUMBER); 198 } 199 200 return; 201 } 202 203 181 204 1; -
trunk/lib/Padre/Wx/MainWindow.pm
r485 r486 745 745 my $title = $editor->{Document}->get_title; 746 746 747 $ self->_toggle_numbers($editor,$config->{editor_linenumbers});747 $editor->_toggle_numbers($config->{editor_linenumbers}); 748 748 $editor->SetViewEOL($config->{editor_eol}); 749 749 $self->set_preferences($editor, $config); … … 1100 1100 1101 1101 foreach my $page ( $self->pages ) { 1102 $ self->_toggle_numbers( $page,$config->{editor_linenumbers} );1102 $page->_toggle_numbers( $config->{editor_linenumbers} ); 1103 1103 } 1104 1104 … … 1180 1180 } 1181 1181 1182 1183 # currently if there are 9 lines we set the margin to 1 width and then1184 # if another line is added it is not seen well.1185 # actually I added some improvement allowing a 50% growth in the file1186 # and requireing a min of 2 width1187 sub _toggle_numbers {1188 my ($self, $editor, $on) = @_;1189 1190 $editor->SetMarginWidth(1, 0);1191 $editor->SetMarginWidth(2, 0);1192 if ($on) {1193 my $n = 1 + List::Util::max (2, length ($editor->GetLineCount * 2));1194 my $width = $n * $editor->TextWidth(Wx::wxSTC_STYLE_LINENUMBER, "9"); # width of a single character1195 $editor->SetMarginWidth(0, $width);1196 $editor->SetMarginType(0, Wx::wxSTC_MARGIN_NUMBER);1197 } else {1198 $editor->SetMarginWidth(0, 0);1199 $editor->SetMarginType(0, Wx::wxSTC_MARGIN_NUMBER);1200 }1201 1202 return;1203 }1204 1182 1205 1183 sub convert_to {
Note: See TracChangeset
for help on using the changeset viewer.
