Fix some unpretty names of private variables

This commit is contained in:
Ansgar Becker
2018-02-03 20:38:13 +01:00
parent 427078f3f5
commit f0cf55f76a

View File

@ -49,9 +49,9 @@ type
{ Private declarations } { Private declarations }
FModified: Boolean; FModified: Boolean;
FStopping: Boolean; FStopping: Boolean;
DetectedLineBreaks, FDetectedLineBreaks,
SelectedLineBreaks: TLineBreaks; FSelectedLineBreaks: TLineBreaks;
memoText: TLineNormalizingMemo; FmemoText: TLineNormalizingMemo;
procedure SetModified(NewVal: Boolean); procedure SetModified(NewVal: Boolean);
public public
function GetText: String; function GetText: String;
@ -73,10 +73,10 @@ function TfrmTextEditor.GetText: String;
var var
LB: String; LB: String;
begin begin
Result := memoText.Text; Result := FmemoText.Text;
// Convert linebreaks back to selected // Convert linebreaks back to selected
LB := ''; LB := '';
case SelectedLineBreaks of case FSelectedLineBreaks of
lbsUnix: LB := LB_UNIX; lbsUnix: LB := LB_UNIX;
lbsMac: LB := LB_MAC; lbsMac: LB := LB_MAC;
lbsWide: LB := LB_WIDE; lbsWide: LB := LB_WIDE;
@ -90,18 +90,18 @@ procedure TfrmTextEditor.SetText(text: String);
var var
Detected, Item: TMenuItem; Detected, Item: TMenuItem;
begin begin
DetectedLineBreaks := ScanLineBreaks(text); FDetectedLineBreaks := ScanLineBreaks(text);
if DetectedLineBreaks = lbsNone then if FDetectedLineBreaks = lbsNone then
DetectedLineBreaks := TLineBreaks(AppSettings.ReadInt(asLineBreakStyle)); FDetectedLineBreaks := TLineBreaks(AppSettings.ReadInt(asLineBreakStyle));
for Item in popupLinebreaks.Items do begin for Item in popupLinebreaks.Items do begin
if Item.Tag = Integer(DetectedLineBreaks) then begin if Item.Tag = Integer(FDetectedLineBreaks) then begin
Detected := Item; Detected := Item;
end; end;
end; end;
if Assigned(Detected) then if Assigned(Detected) then
SelectLineBreaks(Detected); SelectLineBreaks(Detected);
memoText.Text := text; FmemoText.Text := text;
memoText.SelectAll; FmemoText.SelectAll;
Modified := False; Modified := False;
end; end;
@ -117,7 +117,7 @@ begin
menuWideLB.Caption := _('Unicode linebreaks'); menuWideLB.Caption := _('Unicode linebreaks');
menuMixedLB.Caption := _('Mixed linebreaks'); menuMixedLB.Caption := _('Mixed linebreaks');
for Item in popupLinebreaks.Items do begin for Item in popupLinebreaks.Items do begin
if Item.Tag = Integer(DetectedLineBreaks) then begin if Item.Tag = Integer(FDetectedLineBreaks) then begin
Item.Caption := Item.Caption + ' (' + _('detected') + ')'; Item.Caption := Item.Caption + ' (' + _('detected') + ')';
end; end;
end; end;
@ -125,7 +125,7 @@ begin
Selected.Default := True; Selected.Default := True;
btnLineBreaks.Hint := Selected.Caption; btnLineBreaks.Hint := Selected.Caption;
btnLineBreaks.ImageIndex := Selected.ImageIndex; btnLineBreaks.ImageIndex := Selected.ImageIndex;
SelectedLineBreaks := TLineBreaks(Selected.Tag); FSelectedLineBreaks := TLineBreaks(Selected.Tag);
Modified := True; Modified := True;
end; end;
@ -133,24 +133,24 @@ end;
procedure TfrmTextEditor.SetMaxLength(len: integer); procedure TfrmTextEditor.SetMaxLength(len: integer);
begin begin
// Input: Length in number of bytes. // Input: Length in number of bytes.
memoText.MaxLength := len; FmemoText.MaxLength := len;
end; end;
procedure TfrmTextEditor.SetFont(font: TFont); procedure TfrmTextEditor.SetFont(font: TFont);
begin begin
memoText.Font.Name := font.Name; FmemoText.Font.Name := font.Name;
memoText.Font.Size := font.Size; FmemoText.Font.Size := font.Size;
end; end;
procedure TfrmTextEditor.FormCreate(Sender: TObject); procedure TfrmTextEditor.FormCreate(Sender: TObject);
begin begin
memoText := TLineNormalizingMemo.Create(Self); FmemoText := TLineNormalizingMemo.Create(Self);
memoText.Parent := Self; FmemoText.Parent := Self;
memoText.Align := alClient; FmemoText.Align := alClient;
memoText.ScrollBars := ssBoth; FmemoText.ScrollBars := ssBoth;
memoText.WantTabs := True; FmemoText.WantTabs := True;
memoText.OnChange := memoTextChange; FmemoText.OnChange := memoTextChange;
memoText.OnKeyDown := memoTextKeyDown; FmemoText.OnKeyDown := memoTextKeyDown;
InheritFont(Font); InheritFont(Font);
// Use same text properties as in query/find/replace actions // Use same text properties as in query/find/replace actions
actSearchFind.Caption := MainForm.actQueryFind.Caption; actSearchFind.Caption := MainForm.actQueryFind.Caption;
@ -190,7 +190,7 @@ begin
btnWrap.Click; btnWrap.Click;
// Fix label position: // Fix label position:
lblTextLength.Top := tlbStandard.Top + (tlbStandard.Height-lblTextLength.Height) div 2; lblTextLength.Top := tlbStandard.Top + (tlbStandard.Height-lblTextLength.Height) div 2;
memoText.SetFocus; FmemoText.SetFocus;
end; end;
@ -213,11 +213,11 @@ begin
Screen.Cursor := crHourglass; Screen.Cursor := crHourglass;
// Changing the scrollbars invoke the OnChange event. We avoid thinking the text was really modified. // Changing the scrollbars invoke the OnChange event. We avoid thinking the text was really modified.
WasModified := Modified; WasModified := Modified;
if memoText.ScrollBars = ssBoth then if FmemoText.ScrollBars = ssBoth then
memoText.ScrollBars := ssVertical FmemoText.ScrollBars := ssVertical
else else
memoText.ScrollBars := ssBoth; FmemoText.ScrollBars := ssBoth;
TToolbutton(Sender).Down := memoText.ScrollBars = ssVertical; TToolbutton(Sender).Down := FmemoText.ScrollBars = ssVertical;
Modified := WasModified; Modified := WasModified;
Screen.Cursor := crDefault; Screen.Cursor := crDefault;
end; end;
@ -235,9 +235,9 @@ begin
d.EncodingIndex := AppSettings.ReadInt(asFileDialogEncoding, Self.Name); d.EncodingIndex := AppSettings.ReadInt(asFileDialogEncoding, Self.Name);
if d.Execute then try if d.Execute then try
Screen.Cursor := crHourglass; Screen.Cursor := crHourglass;
memoText.Text := ReadTextFile(d.FileName, MainForm.GetEncodingByName(d.Encodings[d.EncodingIndex])); FmemoText.Text := ReadTextFile(d.FileName, MainForm.GetEncodingByName(d.Encodings[d.EncodingIndex]));
if (memoText.MaxLength > 0) and (Length(memoText.Text) > memoText.MaxLength) then if (FmemoText.MaxLength > 0) and (Length(FmemoText.Text) > FmemoText.MaxLength) then
memoText.Text := copy(memoText.Text, 0, memoText.MaxLength); FmemoText.Text := copy(FmemoText.Text, 0, FmemoText.MaxLength);
AppSettings.WriteInt(asFileDialogEncoding, d.EncodingIndex, Self.Name); AppSettings.WriteInt(asFileDialogEncoding, d.EncodingIndex, Self.Name);
finally finally
Screen.Cursor := crDefault; Screen.Cursor := crDefault;
@ -282,9 +282,9 @@ end;
procedure TfrmTextEditor.memoTextChange(Sender: TObject); procedure TfrmTextEditor.memoTextChange(Sender: TObject);
begin begin
lblTextLength.Caption := FormatNumber(Length(memoText.Text)) + ' characters.'; lblTextLength.Caption := FormatNumber(Length(FmemoText.Text)) + ' characters.';
if memoText.MaxLength > 0 then if FmemoText.MaxLength > 0 then
lblTextLength.Caption := lblTextLength.Caption + ' (Max: '+FormatNumber(memoText.MaxLength)+')'; lblTextLength.Caption := lblTextLength.Caption + ' (Max: '+FormatNumber(FmemoText.MaxLength)+')';
Modified := True; Modified := True;
end; end;