diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2012-10-19 16:46:20 +0100 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2012-10-19 16:46:20 +0100 |
commit | 2718209f911ce0137b446b4b5a32c97626d61a29 (patch) | |
tree | 58d1e8b5512af7d9602fe50718282b6081313d3c | |
parent | 2f248c58e78afa78f831c62acb65edc81226a7ff (diff) | |
download | fpGUI-2718209f911ce0137b446b4b5a32c97626d61a29.tar.xz |
Refactored editor setup code into a single SetupEditorPreference method.
-rw-r--r-- | examples/apps/ide/src/frm_main.pas | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/examples/apps/ide/src/frm_main.pas b/examples/apps/ide/src/frm_main.pas index 76d90565..f7bcbe00 100644 --- a/examples/apps/ide/src/frm_main.pas +++ b/examples/apps/ide/src/frm_main.pas @@ -104,6 +104,7 @@ type function GetUnitsNode: TfpgTreeNode; procedure UpdateWindowTitle; procedure TextEditDrawLine(Sender: TObject; ALineText: TfpgString; ALineIndex: Integer; ACanvas: TfpgCanvas; ATextRect: TfpgRect; var AllowSelfDraw: Boolean); + procedure SetupEditorPreference; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; @@ -317,15 +318,9 @@ begin end; procedure TMainForm.miConfigureIDE(Sender: TObject); -var - i: integer; begin DisplayConfigureIDE; - pcEditor.TabPosition := TfpgTabPosition(gINI.ReadInteger(cEditor, 'TabPosition', 0)); - FKeywordFont.Free; - FKeywordFont := nil; - for i := 0 to pcEditor.PageCount-1 do - TfpgTextEdit(pcEditor.Pages[i].Components[0]).FontDesc := gINI.ReadString(cEditor, 'Font', '#Edit2'); + SetupEditorPreference; end; procedure TMainForm.miViewDebug(Sender: TObject); @@ -810,6 +805,17 @@ begin // writeln('------'); end; +procedure TMainForm.SetupEditorPreference; +var + i: integer; +begin + pcEditor.TabPosition := TfpgTabPosition(gINI.ReadInteger(cEditor, 'TabPosition', 0)); + FKeywordFont.Free; + FKeywordFont := nil; + for i := 0 to pcEditor.PageCount-1 do + TfpgTextEdit(pcEditor.Pages[i].Components[0]).FontDesc := gINI.ReadString(cEditor, 'Font', '#Edit2'); +end; + procedure TMainForm.MonitoredFileChanged(Sender: TObject; AData: TFileMonitorEventData); begin OpenEditorPage(AData.FileName); @@ -828,9 +834,8 @@ begin SetupProjectTree; SetupFilesGrid; + SetupEditorPreference; - // apply editor settings - pcEditor.TabPosition := TfpgTabPosition(gINI.ReadInteger(cEditor, 'TabPosition', 0)); FRegex := TRegExpr.Create; TextEditor.Clear; |