mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-31 04:42:11 +02:00
ide: debugger:
- setup source menu debugger shortcuts - make Ctrl+F5 (add watch) shortcut work git-svn-id: trunk@21972 -
This commit is contained in:
parent
db943efa6f
commit
9d6f86eeb2
@ -84,6 +84,7 @@ type
|
||||
procedure ConnectMainBarEvents; virtual; abstract;
|
||||
procedure ConnectSourceNotebookEvents; virtual; abstract;
|
||||
procedure SetupMainBarShortCuts; virtual; abstract;
|
||||
procedure SetupSourceMenuShortCuts; virtual; abstract;
|
||||
procedure UpdateButtonsAndMenuItems; virtual; abstract;
|
||||
|
||||
procedure LoadProjectSpecificInfo(XMLConfig: TXMLConfig;
|
||||
|
@ -79,9 +79,7 @@ type
|
||||
// Menu events
|
||||
procedure mnuViewDebugDialogClick(Sender: TObject);
|
||||
procedure mnuResetDebuggerClicked(Sender: TObject);
|
||||
|
||||
// SrcNotebook events
|
||||
function OnSrcNotebookAddWatchesAtCursor(Sender: TObject): boolean;
|
||||
procedure mnuAddWatchClicked(Sender: TObject);
|
||||
|
||||
// Debugger events
|
||||
procedure DebuggerBreakPointHit(ADebugger: TDebugger; ABreakPoint: TBaseBreakPoint; var ACanContinue: Boolean);
|
||||
@ -146,6 +144,7 @@ type
|
||||
procedure ConnectMainBarEvents; override;
|
||||
procedure ConnectSourceNotebookEvents; override;
|
||||
procedure SetupMainBarShortCuts; override;
|
||||
procedure SetupSourceMenuShortCuts; override;
|
||||
procedure UpdateButtonsAndMenuItems; override;
|
||||
|
||||
procedure LoadProjectSpecificInfo(XMLConfig: TXMLConfig;
|
||||
@ -1321,30 +1320,22 @@ begin
|
||||
ResetDebugger;
|
||||
end;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// ScrNoteBook events
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function TDebugManager.OnSrcNotebookAddWatchesAtCursor(Sender : TObject
|
||||
): boolean;
|
||||
procedure TDebugManager.mnuAddWatchClicked(Sender: TObject);
|
||||
var
|
||||
SE: TSourceEditor;
|
||||
WatchVar: String;
|
||||
begin
|
||||
Result:=false;
|
||||
SE := SourceNotebook.GetActiveSE;
|
||||
|
||||
// get the sourceEditor.
|
||||
SE := TSourceNotebook(Sender).GetActiveSE;
|
||||
if not Assigned(SE) then Exit;
|
||||
WatchVar := SE.GetOperandAtCurrentCaret;
|
||||
if WatchVar = '' then Exit;
|
||||
if Assigned(SE) then
|
||||
begin
|
||||
WatchVar := SE.GetOperandAtCurrentCaret;
|
||||
if (WatchVar <> '') and (SE.EditorComponent.Focused) and (Watches.Find(WatchVar) = nil) and (Watches.Add(WatchVar) = nil) then
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if (Watches.Find(WatchVar) = nil)
|
||||
and (Watches.Add(WatchVar) = nil)
|
||||
then Exit;
|
||||
|
||||
Result:=true;
|
||||
// watch was not added automatically => show a dialog
|
||||
// todo: dialog
|
||||
end;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -1685,7 +1676,7 @@ begin
|
||||
TBreakPointsDlg(CurDialog).BaseDirectory:=Project1.ProjectDirectory;
|
||||
end;
|
||||
end;
|
||||
if (CurDialog is tEvaluateDlg) and (sourceNotebook<>nil)
|
||||
if (CurDialog is TEvaluateDlg) and (sourceNotebook<>nil)
|
||||
then begin
|
||||
if SourceNotebook.GetActiveSE.SelectionAvailable then
|
||||
TEvaluateDlg(CurDialog).FindText := SourceNotebook.GetActiveSE.Selection
|
||||
@ -1868,14 +1859,14 @@ begin
|
||||
// itmRunMenuInspect.OnClick := @mnuViewDebugDialogClick;
|
||||
itmRunMenuEvaluate.OnClick := @mnuViewDebugDialogClick;
|
||||
itmRunMenuEvaluate.Tag := Ord(ddtEvaluate);
|
||||
// itmRunMenuAddWatch.OnClick := @;
|
||||
itmRunMenuAddWatch.OnClick := @mnuAddWatchClicked;
|
||||
// itmRunMenuAddBpSource.OnClick := @;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDebugManager.ConnectSourceNotebookEvents;
|
||||
begin
|
||||
SourceNotebook.OnAddWatchAtCursor := @OnSrcNotebookAddWatchesAtCursor;
|
||||
SrcEditMenuAddWatchAtCursor.OnClick:=@mnuAddWatchClicked;
|
||||
end;
|
||||
|
||||
procedure TDebugManager.SetupMainBarShortCuts;
|
||||
@ -1903,6 +1894,20 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDebugManager.SetupSourceMenuShortCuts;
|
||||
|
||||
function GetCommand(ACommand: word): TIDECommand;
|
||||
begin
|
||||
Result:=IDECommandList.FindIDECommand(ACommand);
|
||||
end;
|
||||
|
||||
begin
|
||||
SrcEditMenuToggleBreakpoint.Command:=GetCommand(ecToggleBreakPoint);
|
||||
SrcEditMenuRunToCursor.Command:=GetCommand(ecRunToCursor);
|
||||
SrcEditMenuAddWatchAtCursor.Command:=GetCommand(ecAddWatch);
|
||||
SrcEditMenuViewCallStack.Command:=GetCommand(ecToggleCallStack);
|
||||
end;
|
||||
|
||||
procedure TDebugManager.UpdateButtonsAndMenuItems;
|
||||
var
|
||||
DebuggerInvalid: boolean;
|
||||
|
@ -1848,6 +1848,7 @@ begin
|
||||
SourceNotebook.OnShowSearchResultsView := @OnSrcNotebookShowSearchResultsView;
|
||||
SourceNotebook.OnPopupMenu := @OnSrcNoteBookPopupMenu;
|
||||
DebugBoss.ConnectSourceNotebookEvents;
|
||||
DebugBoss.SetupSourceMenuShortCuts;
|
||||
|
||||
// connect search menu to sourcenotebook
|
||||
MainIDEBar.itmSearchFind.OnClick := @SourceNotebook.FindClicked;
|
||||
|
@ -71,8 +71,6 @@ type
|
||||
|
||||
TNotifyFileEvent = procedure(Sender: TObject; Filename : AnsiString) of object;
|
||||
|
||||
TOnAddWatch = function(Sender: TObject): boolean of object;
|
||||
|
||||
TOnProcessUserCommand = procedure(Sender: TObject;
|
||||
Command: word; var Handled: boolean) of object;
|
||||
TOnUserCommandProcessed = procedure(Sender: TObject;
|
||||
@ -230,7 +228,7 @@ type
|
||||
public
|
||||
constructor Create(AOwner: TComponent; AParent: TWinControl);
|
||||
destructor Destroy; override;
|
||||
Function Close: Boolean;
|
||||
function Close: Boolean;
|
||||
|
||||
// codebuffer
|
||||
procedure BeginUndoBlock; override;
|
||||
@ -507,7 +505,6 @@ type
|
||||
FKeyStrokes: TSynEditKeyStrokes;
|
||||
FLastCodeBuffer: TCodeBuffer;
|
||||
FOnAddJumpPoint: TOnAddJumpPoint;
|
||||
FOnAddWatchAtCursor: TOnAddWatch;
|
||||
FOnCloseClicked: TOnCloseSrcEditor;
|
||||
FOnClickLink: TMouseEvent;
|
||||
FOnMouseLink: TSynMouseLinkEvent;
|
||||
@ -842,8 +839,6 @@ type
|
||||
read FOnUserCommandProcessed write FOnUserCommandProcessed;
|
||||
property OnViewJumpHistory: TNotifyEvent
|
||||
read FOnViewJumpHistory write FOnViewJumpHistory;
|
||||
property OnAddWatchAtCursor: TOnAddWatch
|
||||
read FOnAddWatchAtCursor write FOnAddWatchAtCursor;
|
||||
property OnShowSearchResultsView: TNotifyEvent
|
||||
read FOnShowSearchResultsView write FOnShowSearchResultsView;
|
||||
property OnPopupMenu: TSrcEditPopupMenuEvent read FOnPopupMenu write FOnPopupMenu;
|
||||
@ -4616,7 +4611,6 @@ begin
|
||||
SrcEditMenuPrevBookmark.OnClick:=@BookMarkPrevClicked;
|
||||
|
||||
SrcEditMenuToggleBreakpoint.OnClick:=@ToggleBreakpointClicked;
|
||||
SrcEditMenuAddWatchAtCursor.OnClick:=@AddWatchAtCursor;
|
||||
SrcEditMenuRunToCursor.OnClick:=@RunToClicked;
|
||||
SrcEditMenuViewCallStack.OnClick:=@ViewCallStackClick;
|
||||
|
||||
@ -6794,10 +6788,9 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
Procedure TSourceNotebook.AddWatchAtCursor(Sender: TObject);
|
||||
procedure TSourceNotebook.AddWatchAtCursor(Sender: TObject);
|
||||
begin
|
||||
if Assigned(OnAddWatchAtCursor) then
|
||||
OnAddWatchAtCursor(Self);
|
||||
//
|
||||
end;
|
||||
|
||||
procedure TSourceNotebook.SetIncrementalSearchStr(const AValue: string);
|
||||
|
Loading…
Reference in New Issue
Block a user