mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-02 09:32:36 +02:00
Modified the Watches dialog
Shane git-svn-id: trunk@509 -
This commit is contained in:
parent
fdcdc301ba
commit
c1f7c4e0f7
@ -39,8 +39,7 @@ uses
|
|||||||
Main,
|
Main,
|
||||||
MsgView,
|
MsgView,
|
||||||
FindReplaceDialog,
|
FindReplaceDialog,
|
||||||
FindInFilesDlg,
|
FindInFilesDlg;
|
||||||
WatchesDlg;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Application.Initialize;
|
Application.Initialize;
|
||||||
@ -58,7 +57,7 @@ begin
|
|||||||
CheckHeap('TMainIDE created');
|
CheckHeap('TMainIDE created');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Application.CreateForm(TMessagesView, MessagesView);
|
Application.CreateForm(TMessagesView, MessagesView);
|
||||||
Application.CreateForm(TWatchesDlg, Watches_Dlg);
|
|
||||||
Application.CreateForm(TLazFindReplaceDialog, FindReplaceDlg);
|
Application.CreateForm(TLazFindReplaceDialog, FindReplaceDlg);
|
||||||
Application.CreateForm(TLazFindInFilesDialog, FindInFilesDialog);
|
Application.CreateForm(TLazFindInFilesDialog, FindInFilesDialog);
|
||||||
SplashForm.StartTimer;
|
SplashForm.StartTimer;
|
||||||
@ -71,6 +70,10 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.26 2001/12/11 16:51:36 lazarus
|
||||||
|
Modified the Watches dialog
|
||||||
|
Shane
|
||||||
|
|
||||||
Revision 1.25 2001/12/07 20:12:13 lazarus
|
Revision 1.25 2001/12/07 20:12:13 lazarus
|
||||||
Added a watch dialog.
|
Added a watch dialog.
|
||||||
Shane
|
Shane
|
||||||
|
80
ide/main.pp
80
ide/main.pp
@ -39,7 +39,7 @@ uses
|
|||||||
IDEComp, AbstractFormEditor, FormEditor, CustomFormEditor, ObjectInspector,
|
IDEComp, AbstractFormEditor, FormEditor, CustomFormEditor, ObjectInspector,
|
||||||
PropEdits, ControlSelection, UnitEditor, CompilerOptions, EditorOptions,
|
PropEdits, ControlSelection, UnitEditor, CompilerOptions, EditorOptions,
|
||||||
EnvironmentOpts, TransferMacros, KeyMapping, ProjectOpts, IDEProcs, Process,
|
EnvironmentOpts, TransferMacros, KeyMapping, ProjectOpts, IDEProcs, Process,
|
||||||
UnitInfoDlg, Debugger, RunParamsOpts, ExtToolDialog, MacroPromptDlg,
|
UnitInfoDlg, Debugger, DBGWatch,RunParamsOpts, ExtToolDialog, MacroPromptDlg,
|
||||||
LMessages, ProjectDefs,Watchesdlg;
|
LMessages, ProjectDefs,Watchesdlg;
|
||||||
|
|
||||||
const
|
const
|
||||||
@ -254,13 +254,16 @@ type
|
|||||||
// Debugger Events
|
// Debugger Events
|
||||||
procedure OnDebuggerChangeState(Sender: TObject);
|
procedure OnDebuggerChangeState(Sender: TObject);
|
||||||
procedure OnDebuggerCurrentLine(Sender: TObject; const ALocation: TDBGLocationRec);
|
procedure OnDebuggerCurrentLine(Sender: TObject; const ALocation: TDBGLocationRec);
|
||||||
|
Procedure OnDebuggerWatchChanged(Sender : TObject);
|
||||||
// MessagesView Events
|
// MessagesView Events
|
||||||
procedure MessagesViewSelectionChanged(sender : TObject);
|
procedure MessagesViewSelectionChanged(sender : TObject);
|
||||||
|
|
||||||
//Hint Timer
|
//Hint Timer
|
||||||
Procedure HintTimer1Timer(Sender : TObject);
|
Procedure HintTimer1Timer(Sender : TObject);
|
||||||
|
|
||||||
|
//Watch Dialog
|
||||||
|
Procedure OnWatchAdded(Sender : TObject; _Expression : String);
|
||||||
|
|
||||||
Procedure MainMouseMoved(Sender: TObject; Shift: TShiftState; X,Y: Integer);
|
Procedure MainMouseMoved(Sender: TObject; Shift: TShiftState; X,Y: Integer);
|
||||||
Procedure MainMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X,Y: Integer);
|
Procedure MainMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X,Y: Integer);
|
||||||
Procedure MainKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
Procedure MainKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||||
@ -280,7 +283,7 @@ type
|
|||||||
|
|
||||||
protected
|
protected
|
||||||
procedure ToolButtonClick(Sender : TObject);
|
procedure ToolButtonClick(Sender : TObject);
|
||||||
|
Procedure AddWatch(_Expression : String);
|
||||||
public
|
public
|
||||||
ToolStatus: TIDEToolStatus;
|
ToolStatus: TIDEToolStatus;
|
||||||
|
|
||||||
@ -687,7 +690,12 @@ begin
|
|||||||
MacroList.Add(TTransferMacro.Create('TargetFile','',
|
MacroList.Add(TTransferMacro.Create('TargetFile','',
|
||||||
'Target filename of project',nil));
|
'Target filename of project',nil));
|
||||||
MacroList.OnSubstitution:=@OnMacroSubstitution;
|
MacroList.OnSubstitution:=@OnMacroSubstitution;
|
||||||
|
|
||||||
|
//twatcheslgd
|
||||||
|
Watches_Dlg := TWatchesDlg.Create(Self);
|
||||||
|
Watches_Dlg.OnWatchAddedEvent := @OnWatchAdded;
|
||||||
|
|
||||||
|
TheDebugger := TDebugger.Create;
|
||||||
// control selection (selected components on edited form)
|
// control selection (selected components on edited form)
|
||||||
TheControlSelection:=TControlSelection.Create;
|
TheControlSelection:=TControlSelection.Create;
|
||||||
TheControlSelection.OnChange:=@OnControlSelectionChanged;
|
TheControlSelection.OnChange:=@OnControlSelectionChanged;
|
||||||
@ -748,6 +756,9 @@ CheckHeap(IntToStr(GetMem_Cnt));
|
|||||||
EnvironmentOptions:=nil;
|
EnvironmentOptions:=nil;
|
||||||
HIntTimer1.Free;
|
HIntTimer1.Free;
|
||||||
HintWindow1.Free;
|
HintWindow1.Free;
|
||||||
|
Watches_Dlg.Free;
|
||||||
|
|
||||||
|
TheDebugger.Free;
|
||||||
writeln('[TMainIDE.Destroy] B -> inherited Destroy...');
|
writeln('[TMainIDE.Destroy] B -> inherited Destroy...');
|
||||||
{$IFDEF IDE_MEM_CHECK}
|
{$IFDEF IDE_MEM_CHECK}
|
||||||
CheckHeap(IntToStr(GetMem_Cnt));
|
CheckHeap(IntToStr(GetMem_Cnt));
|
||||||
@ -5158,19 +5169,72 @@ end;
|
|||||||
Procedure TMainIDE.OnSrcNotebookAddWatchesAtCursor(Sender : TObject);
|
Procedure TMainIDE.OnSrcNotebookAddWatchesAtCursor(Sender : TObject);
|
||||||
var
|
var
|
||||||
SE : TSourceEditor;
|
SE : TSourceEditor;
|
||||||
|
WatchVar : String;
|
||||||
begin
|
begin
|
||||||
Writeln('in MAIN.pp ADD WATCHES');
|
|
||||||
//get the sourceEditor.
|
//get the sourceEditor.
|
||||||
Se := TSourceNotebook(sender).GetActiveSE;
|
Se := TSourceNotebook(sender).GetActiveSE;
|
||||||
if not Assigned(se) then Exit;
|
if not Assigned(se) then Exit;
|
||||||
|
WatchVar := SE.GetWordAtCurrentCaret;
|
||||||
|
if WatchVar = '' then Exit;
|
||||||
|
|
||||||
|
AddWatch(WatchVar);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.mnuViewWatchesClick(Sender : TObject);
|
procedure TMainIDE.mnuViewWatchesClick(Sender : TObject);
|
||||||
begin
|
begin
|
||||||
Watches_dlg.Show;
|
Watches_dlg.Show;
|
||||||
// CreateLFM(Watches_Dlg);
|
// CreateLFM(Watches_Dlg);
|
||||||
CreateLFM(Insertwatch);
|
// CreateLFM(Insertwatch);
|
||||||
|
end;
|
||||||
|
|
||||||
|
Procedure TMainIDE.OnDebuggerWatchChanged(Sender : TObject);
|
||||||
|
begin
|
||||||
|
Writeln('OnDebuggerWatchChanged');
|
||||||
|
//watch changed.
|
||||||
|
end;
|
||||||
|
|
||||||
|
//This adds the watch to the TWatches TCollection and to the watches dialog
|
||||||
|
Procedure TMainIDE.AddWatch(_Expression : String);
|
||||||
|
Var
|
||||||
|
NewWatch : TdbgWatch;
|
||||||
|
begin
|
||||||
|
|
||||||
|
if not Watches_Dlg.Visible then Watches_Dlg.Show;
|
||||||
|
NewWatch := TdbgWatch(TheDebugger.watches.Add);
|
||||||
|
with NewWatch do
|
||||||
|
Begin
|
||||||
|
Expression := _Expression;
|
||||||
|
OnChange := @OnDebuggerWatchChanged;
|
||||||
|
Enabled := True;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
Watches_Dlg.AddWatch(NewWatch.Expression+':'+NewWatch.Value);
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Procedure TMainIDE.OnWatchAdded(Sender : TObject; _Expression : String);
|
||||||
|
Var
|
||||||
|
NewWatch : TdbgWatch;
|
||||||
|
begin
|
||||||
|
|
||||||
|
if not Watches_Dlg.Visible then Watches_Dlg.Show;
|
||||||
|
|
||||||
|
if Pos(':',_Expression) > 0 then
|
||||||
|
_Expression := Copy(_Expression,1,pos(':',_Expression)-1);
|
||||||
|
|
||||||
|
NewWatch := TdbgWatch(TheDebugger.watches.Add);
|
||||||
|
with NewWatch do
|
||||||
|
Begin
|
||||||
|
Expression := _Expression;
|
||||||
|
OnChange := @OnDebuggerWatchChanged;
|
||||||
|
Enabled := True;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
Watches_Dlg.UpdateWatch(NewWatch.Expression,NewWatch.Value);
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -5187,6 +5251,10 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.175 2001/12/11 16:51:36 lazarus
|
||||||
|
Modified the Watches dialog
|
||||||
|
Shane
|
||||||
|
|
||||||
Revision 1.174 2001/12/11 15:43:35 lazarus
|
Revision 1.174 2001/12/11 15:43:35 lazarus
|
||||||
MG: TCodeBuffer.LoadFromFile now checks file date
|
MG: TCodeBuffer.LoadFromFile now checks file date
|
||||||
|
|
||||||
|
@ -8,18 +8,22 @@ uses
|
|||||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, LResources, StdCtrls,Buttons,Extctrls;
|
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, LResources, StdCtrls,Buttons,Extctrls;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
TWatchAddedEvent = procedure (sender : TObject; Expression : String) of Object;
|
||||||
TWatchesdlg = class(TForm)
|
TWatchesdlg = class(TForm)
|
||||||
Listbox1: TLISTBOX;
|
Listbox1: TLISTBOX;
|
||||||
private
|
private
|
||||||
{ private declarations }
|
{ private declarations }
|
||||||
|
FOnWatchAddedEvent : TWatchAddedEvent;
|
||||||
protected
|
protected
|
||||||
Procedure Listbox1KeyPress(Sender : TObject; var Key: Char);
|
|
||||||
Procedure Listbox1KeyDown(Sender: TObject; var Key: Word; Shift:TShiftState);
|
Procedure Listbox1KeyDown(Sender: TObject; var Key: Word; Shift:TShiftState);
|
||||||
public
|
public
|
||||||
{ public declarations }
|
{ public declarations }
|
||||||
constructor Create(AOwner : TComponent); override;
|
constructor Create(AOwner : TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
Procedure AddWatch(WatchVar : String);
|
||||||
|
Procedure UpdateWatch(WatchVar, NewDisplay : String);
|
||||||
|
property OnWatchAddedEvent : TWatchAddedEvent read FOnWatchAddedEvent write FOnWatchAddedEvent;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -60,7 +64,6 @@ Begin
|
|||||||
Align := alClient;
|
Align := alClient;
|
||||||
Visible := True;
|
Visible := True;
|
||||||
Name := 'ListBox1';
|
Name := 'ListBox1';
|
||||||
OnKeyPress := @Listbox1KeyPress;
|
|
||||||
OnKeyDown := @Listbox1KeyDown;
|
OnKeyDown := @Listbox1KeyDown;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
@ -75,7 +78,6 @@ Begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
//unitl events are saved in the lfm
|
//unitl events are saved in the lfm
|
||||||
Listbox1.OnKeyPress := @Listbox1KeyPress;
|
|
||||||
Listbox1.OnKeyDown := @Listbox1KeyDown;
|
Listbox1.OnKeyDown := @Listbox1KeyDown;
|
||||||
//until the listbox events actually fire...
|
//until the listbox events actually fire...
|
||||||
OnKeyDown := @ListBox1KeyDown;
|
OnKeyDown := @ListBox1KeyDown;
|
||||||
@ -89,13 +91,6 @@ Begin
|
|||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure TWatchesDlg.Listbox1KeyPress(Sender : TObject; var Key : Char);
|
|
||||||
Begin
|
|
||||||
|
|
||||||
Writeln('Key is ',Key);
|
|
||||||
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
Procedure TWatchesDlg.Listbox1KeyDown(Sender : TObject; var Key : Word; Shift : TShiftState);
|
Procedure TWatchesDlg.Listbox1KeyDown(Sender : TObject; var Key : Word; Shift : TShiftState);
|
||||||
var
|
var
|
||||||
@ -109,7 +104,7 @@ case Key of
|
|||||||
Begin
|
Begin
|
||||||
//just for now...
|
//just for now...
|
||||||
if InsertWatch.edtExpression.Text <> '' then
|
if InsertWatch.edtExpression.Text <> '' then
|
||||||
ListBox1.Items.Add(InsertWatch.edtExpression.Text);
|
AddWatch(InsertWatch.edtExpression.Text);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
@ -127,6 +122,40 @@ case Key of
|
|||||||
end; //case
|
end; //case
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
//This is used by MAIN to add a watch to the list. It should have already been added to TDebugger.
|
||||||
|
//In the future, maybe pass in a TWatch or something similiar
|
||||||
|
Procedure TWatchesDlg.AddWatch(WatchVar : String);
|
||||||
|
Begin
|
||||||
|
if pos(':',WatchVar) = 0 then
|
||||||
|
ListBox1.Items.Add(WatchVar+':')
|
||||||
|
else
|
||||||
|
ListBox1.Items.Add(WatchVar);
|
||||||
|
|
||||||
|
if Assigned(OnWatchAddedEvent) then
|
||||||
|
OnWatchAddedEvent(self,watchVar);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{This is used by MAin.pp. It passed the Watchvar, we look for it in our list and then set that line to display NewDisplay.
|
||||||
|
New display is added to WatchVar so we end up with WatchVar ':'+ NewDisplay.
|
||||||
|
Watchvar is usually sometyhnig like
|
||||||
|
I
|
||||||
|
or
|
||||||
|
Texts
|
||||||
|
a Colon is added, then we search. When found we add Watchvar + ':' + Newdisplay
|
||||||
|
}
|
||||||
|
Procedure TWatchesDlg.UpdateWatch(WatchVar, NewDisplay : String);
|
||||||
|
Var
|
||||||
|
I : Integer;
|
||||||
|
|
||||||
|
Begin
|
||||||
|
//search for watchvar
|
||||||
|
for I := 0 to ListBox1.Items.count-1 do
|
||||||
|
if pos(WatchVar+':',Listbox1.Items[i]) = 1 then
|
||||||
|
Listbox1.Items[i] := WatchVar+':'+NewDisplay;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TInsertWatch }
|
{ TInsertWatch }
|
||||||
constructor TInsertWatch.Create(AOwner : TComponent);
|
constructor TInsertWatch.Create(AOwner : TComponent);
|
||||||
Begin
|
Begin
|
||||||
|
@ -1637,10 +1637,9 @@ begin
|
|||||||
else
|
else
|
||||||
if (sender is TCustomListBox) then
|
if (sender is TCustomListBox) then
|
||||||
Begin
|
Begin
|
||||||
Writeln('------------------------------------------------------------------');
|
//TODO:listbox is STILL not sendig keypress events even wtih these lines.
|
||||||
ConnectSignal(PgtkObject(GetCoreChildWidget(PgtkWidget(TCustomListBox(sender).handle))), 'key-press-event', @GTKKeyUpDown, GDK_KEY_PRESS_MASK);
|
ConnectSignal(PgtkObject(GetCoreChildWidget(PgtkWidget(TCustomListBox(sender).handle))), 'key-press-event', @GTKKeyUpDown, GDK_KEY_PRESS_MASK);
|
||||||
ConnectSignal(PgtkObject(GetCoreChildWidget(PgtkWidget(TCustomListBox(sender).handle))), 'key-release-event', @GTKKeyUpDown, GDK_KEY_RELEASE_MASK);
|
ConnectSignal(PgtkObject(GetCoreChildWidget(PgtkWidget(TCustomListBox(sender).handle))), 'key-release-event', @GTKKeyUpDown, GDK_KEY_RELEASE_MASK);
|
||||||
Writeln('------------------------------------------------------------------');
|
|
||||||
end;
|
end;
|
||||||
ConnectSignal(gFixed, 'key-press-event', @GTKKeyUpDown, GDK_KEY_PRESS_MASK);
|
ConnectSignal(gFixed, 'key-press-event', @GTKKeyUpDown, GDK_KEY_PRESS_MASK);
|
||||||
ConnectSignal(gFixed, 'key-release-event', @GTKKeyUpDown, GDK_KEY_RELEASE_MASK);
|
ConnectSignal(gFixed, 'key-release-event', @GTKKeyUpDown, GDK_KEY_RELEASE_MASK);
|
||||||
@ -3480,6 +3479,10 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.84 2001/12/11 16:51:37 lazarus
|
||||||
|
Modified the Watches dialog
|
||||||
|
Shane
|
||||||
|
|
||||||
Revision 1.83 2001/12/11 14:36:41 lazarus
|
Revision 1.83 2001/12/11 14:36:41 lazarus
|
||||||
MG: started multiselection for TOpenDialog
|
MG: started multiselection for TOpenDialog
|
||||||
|
|
||||||
|
@ -2674,6 +2674,10 @@ begin
|
|||||||
gdkRect.Y := Rect^.Top;
|
gdkRect.Y := Rect^.Top;
|
||||||
gdkRect.Width := (Rect^.Right - Rect^.Left);
|
gdkRect.Width := (Rect^.Right - Rect^.Left);
|
||||||
gdkRect.Height := (Rect^.Bottom - Rect^.Top);
|
gdkRect.Height := (Rect^.Bottom - Rect^.Top);
|
||||||
|
|
||||||
|
if bErase then
|
||||||
|
gdk_window_clear_area(PgtkWidget(aHandle)^.Window,gdkREct.X,gdkRect.y,gdkRect.Width,gdkRect.Height);
|
||||||
|
|
||||||
gtk_widget_draw(PgtkWidget(aHandle), @gdkRect);
|
gtk_widget_draw(PgtkWidget(aHandle), @gdkRect);
|
||||||
except
|
except
|
||||||
Result := False;
|
Result := False;
|
||||||
@ -4068,6 +4072,10 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.50 2001/12/11 16:51:37 lazarus
|
||||||
|
Modified the Watches dialog
|
||||||
|
Shane
|
||||||
|
|
||||||
Revision 1.49 2001/11/14 17:46:59 lazarus
|
Revision 1.49 2001/11/14 17:46:59 lazarus
|
||||||
Changes to make toggling between form and unit work.
|
Changes to make toggling between form and unit work.
|
||||||
Added BringWindowToTop
|
Added BringWindowToTop
|
||||||
|
Loading…
Reference in New Issue
Block a user