summaryrefslogtreecommitdiff
path: root/examples/apps/ide/src
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2013-03-13 17:10:42 +0000
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2013-03-13 17:10:42 +0000
commit03bd6f043e2a6cda9ddc94e56fd1d39eccb348d7 (patch)
tree8c6cbbd6ff4e5613f8a9b7d5bc24d339821ad01a /examples/apps/ide/src
parent0971cad935fa6ce9058f76b63b28264abb1a54f5 (diff)
downloadfpGUI-03bd6f043e2a6cda9ddc94e56fd1d39eccb348d7.tar.xz
ide: Implements a "Go to line" search option.
Finally the IDE is starting to become useful now. :)
Diffstat (limited to 'examples/apps/ide/src')
-rw-r--r--examples/apps/ide/src/frm_main.pas23
1 files changed, 23 insertions, 0 deletions
diff --git a/examples/apps/ide/src/frm_main.pas b/examples/apps/ide/src/frm_main.pas
index 6d4e81b7..6dd31a31 100644
--- a/examples/apps/ide/src/frm_main.pas
+++ b/examples/apps/ide/src/frm_main.pas
@@ -76,6 +76,7 @@ type
procedure miFindClicked(Sender: TObject);
procedure miFindNextClicked(Sender: TObject);
procedure miFindPrevClicked(Sender: TObject);
+ procedure miGoToLineClick(Sender: TObject);
procedure miSearchProcedureList(Sender: TObject);
procedure miAboutFPGuiClicked(Sender: TObject);
procedure miAboutIDE(Sender: TObject);
@@ -262,6 +263,27 @@ begin
edt.SetFocus;
end;
+procedure TMainForm.miGoToLineClick(Sender: TObject);
+var
+ sValue: string;
+ i: integer;
+ edt: TfpgTextEdit;
+begin
+ edt := TfpgTextEdit(pcEditor.ActivePage.Components[0]);
+ if not Assigned(edt) then
+ Exit;
+ if fpgInputQuery('Go to line', 'Go to line number?', sValue) then
+ begin
+ try
+ i := StrToInt(sValue);
+ edt.GotoLine(i);
+ except
+ on E: Exception do
+ ShowMessage('Invalid line number.' + LineEnding + E.Message);
+ end;
+ end;
+end;
+
procedure TMainForm.miSearchProcedureList(Sender: TObject);
var
s: TfpgString;
@@ -1493,6 +1515,7 @@ begin
AddMenuItem('Replace...', rsKeyCtrl+'R', nil).Enabled := False;
AddMenuItem('-', '', nil);
AddMenuItem('Procedure List...', rsKeyCtrl+'G', @miSearchProcedureList);
+ AddMenuItem('Go to line...', rsKeyAlt+'G', @miGoToLineClick);
end;
mnuView := TfpgPopupMenu.Create(self);