Modified the Watches dialog

Shane

git-svn-id: trunk@509 -
This commit is contained in:
lazarus 2001-12-11 16:51:37 +00:00
parent fdcdc301ba
commit c1f7c4e0f7
5 changed files with 134 additions and 23 deletions

View File

@ -39,8 +39,7 @@ uses
Main,
MsgView,
FindReplaceDialog,
FindInFilesDlg,
WatchesDlg;
FindInFilesDlg;
begin
Application.Initialize;
@ -58,7 +57,7 @@ begin
CheckHeap('TMainIDE created');
{$ENDIF}
Application.CreateForm(TMessagesView, MessagesView);
Application.CreateForm(TWatchesDlg, Watches_Dlg);
Application.CreateForm(TLazFindReplaceDialog, FindReplaceDlg);
Application.CreateForm(TLazFindInFilesDialog, FindInFilesDialog);
SplashForm.StartTimer;
@ -71,6 +70,10 @@ end.
{
$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
Added a watch dialog.
Shane

View File

@ -39,7 +39,7 @@ uses
IDEComp, AbstractFormEditor, FormEditor, CustomFormEditor, ObjectInspector,
PropEdits, ControlSelection, UnitEditor, CompilerOptions, EditorOptions,
EnvironmentOpts, TransferMacros, KeyMapping, ProjectOpts, IDEProcs, Process,
UnitInfoDlg, Debugger, RunParamsOpts, ExtToolDialog, MacroPromptDlg,
UnitInfoDlg, Debugger, DBGWatch,RunParamsOpts, ExtToolDialog, MacroPromptDlg,
LMessages, ProjectDefs,Watchesdlg;
const
@ -254,13 +254,16 @@ type
// Debugger Events
procedure OnDebuggerChangeState(Sender: TObject);
procedure OnDebuggerCurrentLine(Sender: TObject; const ALocation: TDBGLocationRec);
Procedure OnDebuggerWatchChanged(Sender : TObject);
// MessagesView Events
procedure MessagesViewSelectionChanged(sender : TObject);
//Hint Timer
Procedure HintTimer1Timer(Sender : TObject);
//Watch Dialog
Procedure OnWatchAdded(Sender : TObject; _Expression : String);
Procedure MainMouseMoved(Sender: TObject; 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);
@ -280,7 +283,7 @@ type
protected
procedure ToolButtonClick(Sender : TObject);
Procedure AddWatch(_Expression : String);
public
ToolStatus: TIDEToolStatus;
@ -687,7 +690,12 @@ begin
MacroList.Add(TTransferMacro.Create('TargetFile','',
'Target filename of project',nil));
MacroList.OnSubstitution:=@OnMacroSubstitution;
//twatcheslgd
Watches_Dlg := TWatchesDlg.Create(Self);
Watches_Dlg.OnWatchAddedEvent := @OnWatchAdded;
TheDebugger := TDebugger.Create;
// control selection (selected components on edited form)
TheControlSelection:=TControlSelection.Create;
TheControlSelection.OnChange:=@OnControlSelectionChanged;
@ -748,6 +756,9 @@ CheckHeap(IntToStr(GetMem_Cnt));
EnvironmentOptions:=nil;
HIntTimer1.Free;
HintWindow1.Free;
Watches_Dlg.Free;
TheDebugger.Free;
writeln('[TMainIDE.Destroy] B -> inherited Destroy...');
{$IFDEF IDE_MEM_CHECK}
CheckHeap(IntToStr(GetMem_Cnt));
@ -5158,19 +5169,72 @@ end;
Procedure TMainIDE.OnSrcNotebookAddWatchesAtCursor(Sender : TObject);
var
SE : TSourceEditor;
WatchVar : String;
begin
Writeln('in MAIN.pp ADD WATCHES');
//get the sourceEditor.
Se := TSourceNotebook(sender).GetActiveSE;
if not Assigned(se) then Exit;
WatchVar := SE.GetWordAtCurrentCaret;
if WatchVar = '' then Exit;
AddWatch(WatchVar);
end;
procedure TMainIDE.mnuViewWatchesClick(Sender : TObject);
begin
Watches_dlg.Show;
// 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;
//-----------------------------------------------------------------------------
@ -5187,6 +5251,10 @@ end.
{ =============================================================================
$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
MG: TCodeBuffer.LoadFromFile now checks file date

View File

@ -8,18 +8,22 @@ uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, LResources, StdCtrls,Buttons,Extctrls;
type
TWatchAddedEvent = procedure (sender : TObject; Expression : String) of Object;
TWatchesdlg = class(TForm)
Listbox1: TLISTBOX;
private
{ private declarations }
FOnWatchAddedEvent : TWatchAddedEvent;
protected
Procedure Listbox1KeyPress(Sender : TObject; var Key: Char);
Procedure Listbox1KeyDown(Sender: TObject; var Key: Word; Shift:TShiftState);
public
{ public declarations }
constructor Create(AOwner : TComponent); override;
destructor Destroy; override;
Procedure AddWatch(WatchVar : String);
Procedure UpdateWatch(WatchVar, NewDisplay : String);
property OnWatchAddedEvent : TWatchAddedEvent read FOnWatchAddedEvent write FOnWatchAddedEvent;
end;
@ -60,7 +64,6 @@ Begin
Align := alClient;
Visible := True;
Name := 'ListBox1';
OnKeyPress := @Listbox1KeyPress;
OnKeyDown := @Listbox1KeyDown;
end;
@ -75,7 +78,6 @@ Begin
end;
//unitl events are saved in the lfm
Listbox1.OnKeyPress := @Listbox1KeyPress;
Listbox1.OnKeyDown := @Listbox1KeyDown;
//until the listbox events actually fire...
OnKeyDown := @ListBox1KeyDown;
@ -89,13 +91,6 @@ Begin
inherited;
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);
var
@ -109,7 +104,7 @@ case Key of
Begin
//just for now...
if InsertWatch.edtExpression.Text <> '' then
ListBox1.Items.Add(InsertWatch.edtExpression.Text);
AddWatch(InsertWatch.edtExpression.Text);
end;
end;
@ -127,6 +122,40 @@ case Key of
end; //case
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 }
constructor TInsertWatch.Create(AOwner : TComponent);
Begin

View File

@ -1637,10 +1637,9 @@ begin
else
if (sender is TCustomListBox) then
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-release-event', @GTKKeyUpDown, GDK_KEY_RELEASE_MASK);
Writeln('------------------------------------------------------------------');
end;
ConnectSignal(gFixed, 'key-press-event', @GTKKeyUpDown, GDK_KEY_PRESS_MASK);
ConnectSignal(gFixed, 'key-release-event', @GTKKeyUpDown, GDK_KEY_RELEASE_MASK);
@ -3480,6 +3479,10 @@ end;
{ =============================================================================
$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
MG: started multiselection for TOpenDialog

View File

@ -2674,6 +2674,10 @@ begin
gdkRect.Y := Rect^.Top;
gdkRect.Width := (Rect^.Right - Rect^.Left);
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);
except
Result := False;
@ -4068,6 +4072,10 @@ end;
{ =============================================================================
$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
Changes to make toggling between form and unit work.
Added BringWindowToTop