mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-01 07:29:16 +01:00
started showing code context
git-svn-id: trunk@7565 -
This commit is contained in:
parent
4cc22e9844
commit
0c8bf07ec3
@ -302,6 +302,10 @@ type
|
|||||||
var NewCode: TCodeBuffer;
|
var NewCode: TCodeBuffer;
|
||||||
var NewX, NewY, NewTopLine: integer): boolean;
|
var NewX, NewY, NewTopLine: integer): boolean;
|
||||||
|
|
||||||
|
// get code context
|
||||||
|
//function FindCodeContext(Code: TCodeBuffer; X,Y: integer;
|
||||||
|
// out CodeContext: TCodeContext): boolean;
|
||||||
|
|
||||||
// gather identifiers (i.e. all visible)
|
// gather identifiers (i.e. all visible)
|
||||||
function GatherIdentifiers(Code: TCodeBuffer; X,Y: integer): boolean;
|
function GatherIdentifiers(Code: TCodeBuffer; X,Y: integer): boolean;
|
||||||
function GetIdentifierAt(Code: TCodeBuffer; X,Y: integer;
|
function GetIdentifierAt(Code: TCodeBuffer; X,Y: integer;
|
||||||
|
|||||||
30
ide/main.pp
30
ide/main.pp
@ -315,6 +315,8 @@ type
|
|||||||
procedure OnSrcNotebookFindDeclaration(Sender: TObject);
|
procedure OnSrcNotebookFindDeclaration(Sender: TObject);
|
||||||
procedure OnSrcNotebookInitIdentCompletion(Sender: TObject;
|
procedure OnSrcNotebookInitIdentCompletion(Sender: TObject;
|
||||||
JumpToError: boolean; out Handled, Abort: boolean);
|
JumpToError: boolean; out Handled, Abort: boolean);
|
||||||
|
procedure OnSrcNotebookShowCodeContext(JumpToError: boolean;
|
||||||
|
out Abort: boolean);
|
||||||
procedure OnSrcNotebookJumpToHistoryPoint(var NewCaretXY: TPoint;
|
procedure OnSrcNotebookJumpToHistoryPoint(var NewCaretXY: TPoint;
|
||||||
var NewTopLine, NewPageIndex: integer; JumpAction: TJumpHistoryAction);
|
var NewTopLine, NewPageIndex: integer; JumpAction: TJumpHistoryAction);
|
||||||
procedure OnSrcNotebookMovingPage(Sender: TObject;
|
procedure OnSrcNotebookMovingPage(Sender: TObject;
|
||||||
@ -734,6 +736,7 @@ type
|
|||||||
procedure DoFindDeclarationAtCaret(const LogCaretXY: TPoint);
|
procedure DoFindDeclarationAtCaret(const LogCaretXY: TPoint);
|
||||||
function DoFindRenameIdentifier(Rename: boolean): TModalResult;
|
function DoFindRenameIdentifier(Rename: boolean): TModalResult;
|
||||||
function DoInitIdentCompletion(JumpToError: boolean): boolean;
|
function DoInitIdentCompletion(JumpToError: boolean): boolean;
|
||||||
|
function DoShowCodeContext(JumpToError: boolean): boolean;
|
||||||
procedure DoCompleteCodeAtCursor;
|
procedure DoCompleteCodeAtCursor;
|
||||||
procedure DoExtractProcFromSelection;
|
procedure DoExtractProcFromSelection;
|
||||||
function DoCheckSyntax: TModalResult;
|
function DoCheckSyntax: TModalResult;
|
||||||
@ -1428,6 +1431,7 @@ begin
|
|||||||
SourceNotebook.OnEditorPropertiesClicked := @mnuEnvEditorOptionsClicked;
|
SourceNotebook.OnEditorPropertiesClicked := @mnuEnvEditorOptionsClicked;
|
||||||
SourceNotebook.OnFindDeclarationClicked := @OnSrcNotebookFindDeclaration;
|
SourceNotebook.OnFindDeclarationClicked := @OnSrcNotebookFindDeclaration;
|
||||||
SourceNotebook.OnInitIdentCompletion :=@OnSrcNotebookInitIdentCompletion;
|
SourceNotebook.OnInitIdentCompletion :=@OnSrcNotebookInitIdentCompletion;
|
||||||
|
SourceNotebook.OnShowCodeContext :=@OnSrcNotebookShowCodeContext;
|
||||||
SourceNotebook.OnJumpToHistoryPoint := @OnSrcNotebookJumpToHistoryPoint;
|
SourceNotebook.OnJumpToHistoryPoint := @OnSrcNotebookJumpToHistoryPoint;
|
||||||
SourceNotebook.OnMovingPage := @OnSrcNotebookMovingPage;
|
SourceNotebook.OnMovingPage := @OnSrcNotebookMovingPage;
|
||||||
SourceNotebook.OnOpenFileAtCursorClicked := @OnSrcNotebookFileOpenAtCursor;
|
SourceNotebook.OnOpenFileAtCursorClicked := @OnSrcNotebookFileOpenAtCursor;
|
||||||
@ -2161,6 +2165,12 @@ begin
|
|||||||
Abort:=not DoInitIdentCompletion(JumpToError);
|
Abort:=not DoInitIdentCompletion(JumpToError);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainIDE.OnSrcNotebookShowCodeContext(
|
||||||
|
JumpToError: boolean; out Abort: boolean);
|
||||||
|
begin
|
||||||
|
Abort:=not DoShowCodeContext(JumpToError);
|
||||||
|
end;
|
||||||
|
|
||||||
Procedure TMainIDE.OnSrcNotebookSaveAll(Sender: TObject);
|
Procedure TMainIDE.OnSrcNotebookSaveAll(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
mnuSaveAllClicked(Sender);
|
mnuSaveAllClicked(Sender);
|
||||||
@ -10377,6 +10387,26 @@ begin
|
|||||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.DoInitIdentCompletion B');{$ENDIF}
|
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.DoInitIdentCompletion B');{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TMainIDE.DoShowCodeContext(JumpToError: boolean): boolean;
|
||||||
|
var
|
||||||
|
ActiveSrcEdit: TSourceEditor;
|
||||||
|
ActiveUnitInfo: TUnitInfo;
|
||||||
|
begin
|
||||||
|
if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[]) then exit;
|
||||||
|
{$IFDEF IDE_DEBUG}
|
||||||
|
writeln('');
|
||||||
|
writeln('[TMainIDE.DoShowCodeContext] ************');
|
||||||
|
{$ENDIF}
|
||||||
|
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.DoShowCodeContext A');{$ENDIF}
|
||||||
|
Result:=false; //ShowCodeContext(ActiveUnitInfo.Source,ActiveSrcEdit.EditorComponent);
|
||||||
|
if not Result then begin
|
||||||
|
if JumpToError then
|
||||||
|
DoJumpToCodeToolBossError;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.DoShowCodeContext B');{$ENDIF}
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.DoGoToPascalBlockOtherEnd;
|
procedure TMainIDE.DoGoToPascalBlockOtherEnd;
|
||||||
var ActiveSrcEdit: TSourceEditor;
|
var ActiveSrcEdit: TSourceEditor;
|
||||||
ActiveUnitInfo: TUnitInfo;
|
ActiveUnitInfo: TUnitInfo;
|
||||||
|
|||||||
@ -192,7 +192,6 @@ type
|
|||||||
procedure OnCodeBufferChanged(Sender: TSourceLog;
|
procedure OnCodeBufferChanged(Sender: TSourceLog;
|
||||||
SrcLogEntry: TSourceLogEntry);
|
SrcLogEntry: TSourceLogEntry);
|
||||||
procedure StartIdentCompletion(JumpToError: boolean);
|
procedure StartIdentCompletion(JumpToError: boolean);
|
||||||
procedure StartShowCodeContext(JumpToError: boolean);
|
|
||||||
|
|
||||||
procedure LinesInserted(sender: TObject; FirstLine,Count: Integer);
|
procedure LinesInserted(sender: TObject; FirstLine,Count: Integer);
|
||||||
procedure LinesDeleted(sender: TObject; FirstLine,Count: Integer);
|
procedure LinesDeleted(sender: TObject; FirstLine,Count: Integer);
|
||||||
@ -328,6 +327,8 @@ type
|
|||||||
out Handled, Abort: boolean) of object;
|
out Handled, Abort: boolean) of object;
|
||||||
TSrcEditPopupMenuEvent = procedure(AddMenuItemProc: TAddMenuItemProc
|
TSrcEditPopupMenuEvent = procedure(AddMenuItemProc: TAddMenuItemProc
|
||||||
) of object;
|
) of object;
|
||||||
|
TOnShowCodeContext = procedure(JumpToError: boolean;
|
||||||
|
out Abort: boolean) of object;
|
||||||
|
|
||||||
TSourceNotebookState = (snIncrementalFind, snIncrementalSearching);
|
TSourceNotebookState = (snIncrementalFind, snIncrementalSearching);
|
||||||
TSourceNotebookStates = set of TSourceNotebookState;
|
TSourceNotebookStates = set of TSourceNotebookState;
|
||||||
@ -445,6 +446,7 @@ type
|
|||||||
FActiveEditKeyBGColor: TColor;
|
FActiveEditKeyBGColor: TColor;
|
||||||
FActiveEditSymbolFGColor: TColor;
|
FActiveEditSymbolFGColor: TColor;
|
||||||
FActiveEditSymbolBGColor: TColor;
|
FActiveEditSymbolBGColor: TColor;
|
||||||
|
FOnShowCodeContext: TOnShowCodeContext;
|
||||||
|
|
||||||
// PopupMenu
|
// PopupMenu
|
||||||
procedure BuildPopupMenu;
|
procedure BuildPopupMenu;
|
||||||
@ -585,8 +587,10 @@ type
|
|||||||
function FIFCreateSearchForm(ADialog:TLazFindInFilesDialog): TSearchForm;
|
function FIFCreateSearchForm(ADialog:TLazFindInFilesDialog): TSearchForm;
|
||||||
procedure DoFindInFiles(ASearchForm: TSearchForm);
|
procedure DoFindInFiles(ASearchForm: TSearchForm);
|
||||||
|
|
||||||
|
// goto line number
|
||||||
procedure GotoLineClicked(Sender: TObject);
|
procedure GotoLineClicked(Sender: TObject);
|
||||||
|
|
||||||
|
// history jumping
|
||||||
procedure HistoryJump(Sender: TObject; CloseAction: TJumpHistoryAction);
|
procedure HistoryJump(Sender: TObject; CloseAction: TJumpHistoryAction);
|
||||||
procedure JumpBackClicked(Sender: TObject);
|
procedure JumpBackClicked(Sender: TObject);
|
||||||
procedure JumpForwardClicked(Sender: TObject);
|
procedure JumpForwardClicked(Sender: TObject);
|
||||||
@ -594,8 +598,10 @@ type
|
|||||||
procedure DeleteLastJumpPointClicked(Sender: TObject);
|
procedure DeleteLastJumpPointClicked(Sender: TObject);
|
||||||
procedure ViewJumpHistoryClicked(Sender: TObject);
|
procedure ViewJumpHistoryClicked(Sender: TObject);
|
||||||
|
|
||||||
|
// hints
|
||||||
procedure ActivateHint(const ScreenPos: TPoint; const TheHint: string);
|
procedure ActivateHint(const ScreenPos: TPoint; const TheHint: string);
|
||||||
procedure HideHint;
|
procedure HideHint;
|
||||||
|
procedure StartShowCodeContext(JumpToError: boolean);
|
||||||
|
|
||||||
Procedure NewFile(const NewShortName: String; ASource: TCodeBuffer;
|
Procedure NewFile(const NewShortName: String; ASource: TCodeBuffer;
|
||||||
FocusIt: boolean);
|
FocusIt: boolean);
|
||||||
@ -644,6 +650,8 @@ type
|
|||||||
read FOnFindDeclarationClicked write FOnFindDeclarationClicked;
|
read FOnFindDeclarationClicked write FOnFindDeclarationClicked;
|
||||||
property OnInitIdentCompletion: TOnInitIdentCompletion
|
property OnInitIdentCompletion: TOnInitIdentCompletion
|
||||||
read FOnInitIdentCompletion write FOnInitIdentCompletion;
|
read FOnInitIdentCompletion write FOnInitIdentCompletion;
|
||||||
|
property OnShowCodeContext: TOnShowCodeContext
|
||||||
|
read FOnShowCodeContext write FOnShowCodeContext;
|
||||||
property OnJumpToHistoryPoint: TOnJumpToHistoryPoint
|
property OnJumpToHistoryPoint: TOnJumpToHistoryPoint
|
||||||
read FOnJumpToHistoryPoint write FOnJumpToHistoryPoint;
|
read FOnJumpToHistoryPoint write FOnJumpToHistoryPoint;
|
||||||
property OnMovingPage: TOnMovingPage read FOnMovingPage write FOnMovingPage;
|
property OnMovingPage: TOnMovingPage read FOnMovingPage write FOnMovingPage;
|
||||||
@ -1190,7 +1198,7 @@ Begin
|
|||||||
StartIdentCompletion(true);
|
StartIdentCompletion(true);
|
||||||
|
|
||||||
ecShowCodeContext :
|
ecShowCodeContext :
|
||||||
StartShowCodeContext(true);
|
SourceNoteBook.StartShowCodeContext(true);
|
||||||
|
|
||||||
ecWordCompletion :
|
ecWordCompletion :
|
||||||
if not TCustomSynEdit(Sender).ReadOnly then begin
|
if not TCustomSynEdit(Sender).ReadOnly then begin
|
||||||
@ -1950,11 +1958,6 @@ begin
|
|||||||
aCompletion.Execute(TextS2,P.X,P.Y);
|
aCompletion.Execute(TextS2,P.X,P.Y);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceEditor.StartShowCodeContext(JumpToError: boolean);
|
|
||||||
begin
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSourceEditor.IncreaseIgnoreCodeBufferLock;
|
procedure TSourceEditor.IncreaseIgnoreCodeBufferLock;
|
||||||
begin
|
begin
|
||||||
inc(FIgnoreCodeBufferLock);
|
inc(FIgnoreCodeBufferLock);
|
||||||
@ -4309,6 +4312,15 @@ begin
|
|||||||
FHintWindow.Visible:=false;
|
FHintWindow.Visible:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSourceNotebook.StartShowCodeContext(JumpToError: boolean);
|
||||||
|
var
|
||||||
|
Abort: boolean;
|
||||||
|
begin
|
||||||
|
if OnShowCodeContext<>nil then begin
|
||||||
|
OnShowCodeContext(JumpToError,Abort);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
Procedure TSourceNotebook.BookMarkSetClicked(Sender: TObject);
|
Procedure TSourceNotebook.BookMarkSetClicked(Sender: TObject);
|
||||||
// popup menu: set bookmark clicked
|
// popup menu: set bookmark clicked
|
||||||
var
|
var
|
||||||
@ -5026,7 +5038,7 @@ Begin
|
|||||||
|
|
||||||
ecSetMarker0..ecSetMarker9:
|
ecSetMarker0..ecSetMarker9:
|
||||||
begin
|
begin
|
||||||
BookMarkSet(Command - ecSetMarker0);
|
BookMarkSet(Command - ecSetMarker0);
|
||||||
Key:=0;
|
Key:=0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user