Goto dialog added

Shane

git-svn-id: trunk@171 -
This commit is contained in:
lazarus 2001-02-04 19:23:26 +00:00
parent 5eb3c3af49
commit 67fe309404
3 changed files with 104 additions and 4 deletions

View File

@ -545,7 +545,7 @@ begin
VK_UP,[ssShift,SSCtrl],VK_UNKNOWN,[]);
Add('Find procedure method',ecFindProcedureMethod,
VK_DOWN,[ssShift,SSCtrl],VK_UNKNOWN,[]);
Add('Go to line number',ecGotoLineNumber,VK_G,[ssAlt],VK_UNKNOWN,[]);
Add('Go to line number',ecGotoLineNumber,VK_G,[ssCtrl],VK_UNKNOWN,[]);
Add('Go to next editor',ecNextEditor, VK_S, [ssShift,ssCtrl], VK_UNKNOWN, []);
Add('Go to prior editor',ecPrevEditor, VK_A, [ssShift,ssCtrl], VK_UNKNOWN, []);

View File

@ -31,7 +31,7 @@ unit UnitEditor;
interface
uses
classes, Controls, forms,buttons,comctrls,sysutils,Dialogs,FormEditor,Find_Dlg,EditorOPtions,CustomFormEditor,keymapping,
classes, Controls, forms,buttons,comctrls,sysutils,Dialogs,FormEditor,Find_Dlg,EditorOPtions,CustomFormEditor,keymapping,stdctrls,
{$ifdef NEW_EDITOR_SYNEDIT}
SynEdit, SynEditHighlighter, SynHighlighterPas,SynEditAutoComplete,
SynEditKeyCmds,SynCompletion,
@ -109,6 +109,7 @@ type
Function GotoMethod(Value : String) : Integer;
Function GotoMethodDeclaration(Value : String) : Integer;
Function GotoLine(Value : Integer) : Integer;
Procedure CreateEditor(AOwner : TComponent; AParent: TWinControl);
Procedure CreateFormFromUnit;
@ -246,6 +247,18 @@ type
property MainIDE : TComponent read FMainIDE;
end;
{Goto dialog}
TfrmGoto = class(TForm)
Label1 : TLabel;
Edit1 : TEdit;
btnOK : TBitbtn;
btnCancel : TBitBtn;
Procedure GotoDialogActivate(sender : TObject);
private
public
constructor Create(AOwner : TCOmponent); override;
end;
implementation
uses
@ -272,13 +285,14 @@ Editor_Num : Integer;
aHighlighter: TSynPasSyn;
aCompletion : TSynCompletion;
scompl : TSynBaseCompletion; //used in ccexecute and cccomplete
GotoDialog : TfrmGoto;
{ TSourceEditor }
{The constructor for @link(TSourceEditor). AOwner is the @link(TSOurceNotebook) and
the AParent is usually a page of a @link(TNotebook)
}
constructor TSourceEditor.create(AOwner : TComponent; AParent : TWinControl);
Begin
inherited Create;
@ -386,6 +400,13 @@ Begin
end;
{------------------------------G O T O L I N E ---------------------------------}
Function TSOurceEditor.GotoLine(Value : Integer) : Integer;
Begin
CurrentCursorYLine := Value;
CurrentCursorXLine := 0;
end;
{------------------------------G O T O M E T H O D ---------------------------------}
Function TSourceEditor.GotoMethod(Value : String) : Integer;
@ -781,6 +802,15 @@ if Command >= ecFirstParent then
TSourceNotebook(FaOwner).PrevEditor;
End;
ecGotoLineNumber : if (GotoDialog.ShowModal = mrOK) then
Begin
try
GotoLine(Strtoint(GotoDialog.Edit1.Text));
except
GotoLine(0);
end;
end;
end; //case
end;
@ -1431,7 +1461,9 @@ begin
SimplePanel := False;
end;
GotoDialog := TfrmGoto.Create(self);
Writeln('TSOurceNotebook create exiting');
end;
destructor TSourceNotebook.Destroy;
@ -1439,6 +1471,7 @@ begin
FSourceEditorList.Free;
aHighlighter.Free;
Gotodialog.free;
inherited Destroy;
end;
@ -1964,6 +1997,69 @@ Begin
TSOurceEditor(FSourceEditorList.Items[i]).RefreshEditorSettings;
end;
{ GOTO DIALOG}
Constructor TfrmGoto.Create(AOWner : TComponent);
begin
inherited;
position := poScreenCenter;
Width := 250;
Height := 150;
Caption := 'Goto';
Label1 := TLabel.Create(self);
with Label1 do
Begin
Parent := self;
Top := 10;
Left := 5;
Caption := 'Goto line :';
Visible := True;
end;
Edit1 := TEdit.Create(self);
with Edit1 do
Begin
Parent := self;
Top := 30;
Width := self.width-40;
Left := 5;
Visible := True;
Caption := '';
end;
btnOK := TBitbtn.Create(self);
with btnOK do
Begin
Parent := self;
Top := 110;
Left := 100;
Visible := True;
kind := bkOK
end;
btnCancel := TBitbtn.Create(self);
with btnCancel do
Begin
Parent := self;
Top := 110;
Left := 180;
Visible := True;
kind := bkCancel
end;
OnActivate := @GotoDialogActivate;
end;
Procedure TfrmGoto.GotoDialogActivate(sender : TObject);
Begin
Edit1.Text := '';
Edit1.SetFocus;
End;
initialization
Editor_Num := 0;

View File

@ -476,7 +476,7 @@ type
procedure CreateHandle; override;
public
constructor Create(ABitMap : TBitmap);
destructor Destroy; override;
destructor Destroy; //overriding causes a crash with flat speedbuttons
// TODO: replace this by property BitmapHandle;
// MWE: Not needed
//property Bitmap: TBitmap read FBitmap;
@ -512,6 +512,10 @@ end.
{ =============================================================================
$Log$
Revision 1.5 2001/02/04 19:23:26 lazarus
Goto dialog added
Shane
Revision 1.4 2001/02/04 18:24:41 lazarus
Code cleanup
Shane