mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 16:20:22 +02:00
Added a watch dialog.
Shane git-svn-id: trunk@488 -
This commit is contained in:
parent
7f0e94c70e
commit
8747750b3d
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -143,6 +143,7 @@ ide/viewforms1.lrs svneol=native#text/pascal
|
|||||||
ide/viewunit_dlg.lfm svneol=native#text/plain
|
ide/viewunit_dlg.lfm svneol=native#text/plain
|
||||||
ide/viewunit_dlg.pp svneol=native#text/pascal
|
ide/viewunit_dlg.pp svneol=native#text/pascal
|
||||||
ide/viewunits1.lrs svneol=native#text/pascal
|
ide/viewunits1.lrs svneol=native#text/pascal
|
||||||
|
ide/watchesdlg.pp svneol=native#text/pascal
|
||||||
ide/wordcompletion.pp svneol=native#text/pascal
|
ide/wordcompletion.pp svneol=native#text/pascal
|
||||||
images/bookmark.lrs svneol=native#text/pascal
|
images/bookmark.lrs svneol=native#text/pascal
|
||||||
images/btn_downarrow.ico -text svneol=unset#image/x-icon
|
images/btn_downarrow.ico -text svneol=unset#image/x-icon
|
||||||
|
@ -39,7 +39,8 @@ uses
|
|||||||
Main,
|
Main,
|
||||||
MsgView,
|
MsgView,
|
||||||
FindReplaceDialog,
|
FindReplaceDialog,
|
||||||
FindInFilesDlg;
|
FindInFilesDlg,
|
||||||
|
WatchesDlg;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Application.Initialize;
|
Application.Initialize;
|
||||||
@ -57,6 +58,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;
|
||||||
@ -69,6 +71,10 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.25 2001/12/07 20:12:13 lazarus
|
||||||
|
Added a watch dialog.
|
||||||
|
Shane
|
||||||
|
|
||||||
Revision 1.24 2001/11/06 16:42:23 lazarus
|
Revision 1.24 2001/11/06 16:42:23 lazarus
|
||||||
MG: added facade for find in files
|
MG: added facade for find in files
|
||||||
|
|
||||||
|
32
ide/main.pp
32
ide/main.pp
@ -40,7 +40,7 @@ uses
|
|||||||
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, RunParamsOpts, ExtToolDialog, MacroPromptDlg,
|
||||||
LMessages, ProjectDefs;
|
LMessages, ProjectDefs,Watchesdlg;
|
||||||
|
|
||||||
const
|
const
|
||||||
Version_String = '0.8.1 alpha';
|
Version_String = '0.8.1 alpha';
|
||||||
@ -121,6 +121,7 @@ type
|
|||||||
itmViewForms : TMenuItem;
|
itmViewForms : TMenuItem;
|
||||||
itmViewFile : TMenuItem;
|
itmViewFile : TMenuItem;
|
||||||
itmViewMessage : TMenuItem;
|
itmViewMessage : TMenuItem;
|
||||||
|
itmViewwatches : TMenuItem;
|
||||||
|
|
||||||
itmProjectNew: TMenuItem;
|
itmProjectNew: TMenuItem;
|
||||||
itmProjectOpen: TMenuItem;
|
itmProjectOpen: TMenuItem;
|
||||||
@ -176,6 +177,7 @@ type
|
|||||||
Procedure mnuViewFormsClicked(Sender : TObject);
|
Procedure mnuViewFormsClicked(Sender : TObject);
|
||||||
procedure mnuViewCodeExplorerClick(Sender : TObject);
|
procedure mnuViewCodeExplorerClick(Sender : TObject);
|
||||||
procedure mnuViewMessagesClick(Sender : TObject);
|
procedure mnuViewMessagesClick(Sender : TObject);
|
||||||
|
procedure mnuViewWatchesClick(Sender : TObject);
|
||||||
procedure MessageViewDblClick(Sender : TObject);
|
procedure MessageViewDblClick(Sender : TObject);
|
||||||
|
|
||||||
procedure mnuToggleFormUnitClicked(Sender : TObject);
|
procedure mnuToggleFormUnitClicked(Sender : TObject);
|
||||||
@ -231,6 +233,7 @@ type
|
|||||||
procedure OnSrcNoteBookShowUnitInfo(Sender: TObject);
|
procedure OnSrcNoteBookShowUnitInfo(Sender: TObject);
|
||||||
Procedure OnSrcNotebookToggleFormUnit(Sender : TObject);
|
Procedure OnSrcNotebookToggleFormUnit(Sender : TObject);
|
||||||
Procedure OnSrcNotebookViewJumpHistory(Sender : TObject);
|
Procedure OnSrcNotebookViewJumpHistory(Sender : TObject);
|
||||||
|
Procedure OnSrcNotebookAddWatchesAtCursor(Sender : TObject);
|
||||||
|
|
||||||
// ObjectInspector events
|
// ObjectInspector events
|
||||||
procedure OIOnAddAvailableComponent(AComponent:TComponent;
|
procedure OIOnAddAvailableComponent(AComponent:TComponent;
|
||||||
@ -635,7 +638,7 @@ begin
|
|||||||
SourceNotebook.OnShowUnitInfo := @OnSrcNoteBookShowUnitInfo;
|
SourceNotebook.OnShowUnitInfo := @OnSrcNoteBookShowUnitInfo;
|
||||||
SourceNotebook.OnToggleFormUnitClicked := @OnSrcNotebookToggleFormUnit;
|
SourceNotebook.OnToggleFormUnitClicked := @OnSrcNotebookToggleFormUnit;
|
||||||
SourceNotebook.OnViewJumpHistory := @OnSrcNotebookViewJumpHistory;
|
SourceNotebook.OnViewJumpHistory := @OnSrcNotebookViewJumpHistory;
|
||||||
|
SourceNotebook.OnAddWatchAtCursor := @OnSrcNotebookAddWatchesAtCursor;
|
||||||
// search menus
|
// search menus
|
||||||
itmSearchFind.OnClick := @SourceNotebook.FindClicked;
|
itmSearchFind.OnClick := @SourceNotebook.FindClicked;
|
||||||
itmSearchFindNext.OnClick := @SourceNotebook.FindNextClicked;
|
itmSearchFindNext.OnClick := @SourceNotebook.FindNextClicked;
|
||||||
@ -1182,6 +1185,11 @@ begin
|
|||||||
itmViewMessage.OnClick := @mnuViewMessagesClick;
|
itmViewMessage.OnClick := @mnuViewMessagesClick;
|
||||||
mnuView.Add(itmViewMessage);
|
mnuView.Add(itmViewMessage);
|
||||||
|
|
||||||
|
itmViewWatches := TMenuItem.Create(Self);
|
||||||
|
itmViewWatches.Name:='itmViewWatches';
|
||||||
|
itmViewWatches.Caption := 'Watches';
|
||||||
|
itmViewWatches.OnClick := @mnuViewWatchesClick;
|
||||||
|
mnuView.Add(itmViewWatches);
|
||||||
//--------------
|
//--------------
|
||||||
// Project
|
// Project
|
||||||
//--------------
|
//--------------
|
||||||
@ -5050,6 +5058,22 @@ begin
|
|||||||
FHintSender := Sender;
|
FHintSender := Sender;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Procedure TMainIDE.OnSrcNotebookAddWatchesAtCursor(Sender : TObject);
|
||||||
|
var
|
||||||
|
SE : TSourceEditor;
|
||||||
|
begin
|
||||||
|
Writeln('in MAIN.pp ADD WATCHES');
|
||||||
|
//get the sourceEditor.
|
||||||
|
Se := TSourceNotebook(sender).GetActiveSE;
|
||||||
|
if not Assigned(se) then Exit;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainIDE.mnuViewWatchesClick(Sender : TObject);
|
||||||
|
begin
|
||||||
|
Watches_dlg.Show;
|
||||||
|
end;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
@ -5064,6 +5088,10 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.165 2001/12/07 20:12:13 lazarus
|
||||||
|
Added a watch dialog.
|
||||||
|
Shane
|
||||||
|
|
||||||
Revision 1.164 2001/12/05 18:19:10 lazarus
|
Revision 1.164 2001/12/05 18:19:10 lazarus
|
||||||
MG: added calendar to allunits and removed unused vars
|
MG: added calendar to allunits and removed unused vars
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ type
|
|||||||
Shift: TShiftState; X,Y: Integer);
|
Shift: TShiftState; X,Y: Integer);
|
||||||
Procedure EditorKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
Procedure EditorKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||||
Function FindFile(const Value: String) : String;
|
Function FindFile(const Value: String) : String;
|
||||||
|
Function GetWordFromCaret(CaretPos : TPoint) : String;
|
||||||
procedure SetCodeBuffer(NewCodeBuffer: TCodeBuffer);
|
procedure SetCodeBuffer(NewCodeBuffer: TCodeBuffer);
|
||||||
Function GetSource : TStrings;
|
Function GetSource : TStrings;
|
||||||
Procedure SetSource(Value : TStrings);
|
Procedure SetSource(Value : TStrings);
|
||||||
@ -176,6 +176,8 @@ type
|
|||||||
//used to get the word at the mouse cursor
|
//used to get the word at the mouse cursor
|
||||||
Function GetWordAtPosition(Position : TPoint) : String;
|
Function GetWordAtPosition(Position : TPoint) : String;
|
||||||
|
|
||||||
|
Function GetWordAtCurrentCaret: String;
|
||||||
|
|
||||||
//used to get the x,y of the caret if the caret was where the mouse is
|
//used to get the x,y of the caret if the caret was where the mouse is
|
||||||
//used in
|
//used in
|
||||||
//GetWordAtPosition
|
//GetWordAtPosition
|
||||||
@ -254,6 +256,7 @@ type
|
|||||||
FOnToggleFormUnitClicked : TNotifyEvent;
|
FOnToggleFormUnitClicked : TNotifyEvent;
|
||||||
FOnUserCommandProcessed: TOnProcessUserCommand;
|
FOnUserCommandProcessed: TOnProcessUserCommand;
|
||||||
FOnViewJumpHistory: TNotifyEvent;
|
FOnViewJumpHistory: TNotifyEvent;
|
||||||
|
FOnAddWatchAtCursor: TNotifyEvent;
|
||||||
|
|
||||||
// PopupMenu
|
// PopupMenu
|
||||||
Procedure BuildPopupMenu;
|
Procedure BuildPopupMenu;
|
||||||
@ -263,6 +266,7 @@ type
|
|||||||
Procedure ReadOnlyClicked(Sender : TObject);
|
Procedure ReadOnlyClicked(Sender : TObject);
|
||||||
Procedure ShowUnitInfo(Sender : TObject);
|
Procedure ShowUnitInfo(Sender : TObject);
|
||||||
Procedure ToggleBreakpointClicked(Sender : TObject);
|
Procedure ToggleBreakpointClicked(Sender : TObject);
|
||||||
|
Procedure AddWatchAtCursor(Sender : TObject);
|
||||||
Procedure ToggleLineNumbersClicked(Sender : TObject);
|
Procedure ToggleLineNumbersClicked(Sender : TObject);
|
||||||
Procedure OpenAtCursorClicked(Sender : TObject);
|
Procedure OpenAtCursorClicked(Sender : TObject);
|
||||||
Procedure BookmarkGoTo(Value: Integer);
|
Procedure BookmarkGoTo(Value: Integer);
|
||||||
@ -398,6 +402,8 @@ type
|
|||||||
read FOnUserCommandProcessed write FOnUserCommandProcessed;
|
read FOnUserCommandProcessed write FOnUserCommandProcessed;
|
||||||
property OnViewJumpHistory: TNotifyEvent
|
property OnViewJumpHistory: TNotifyEvent
|
||||||
read FOnViewJumpHistory write FOnViewJumpHistory;
|
read FOnViewJumpHistory write FOnViewJumpHistory;
|
||||||
|
property OnAddWatchAtCursor: TNotifyEvent
|
||||||
|
read FOnAddWatchAtCursor write FOnAddWatchAtCursor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{Goto dialog}
|
{Goto dialog}
|
||||||
@ -1429,57 +1435,11 @@ end;
|
|||||||
|
|
||||||
Function TSourceEditor.GetWordAtPosition(Position : TPoint) : String;
|
Function TSourceEditor.GetWordAtPosition(Position : TPoint) : String;
|
||||||
var
|
var
|
||||||
//TopLine : Integer;
|
|
||||||
//LineHeight : Integer;
|
|
||||||
LineNum : Integer;
|
|
||||||
XLine : Integer;
|
|
||||||
EditorLine: string;
|
|
||||||
Texts : String;
|
|
||||||
CaretPos : TPoint;
|
CaretPos : TPoint;
|
||||||
begin
|
begin
|
||||||
Result := '';
|
Result := '';
|
||||||
Caretpos := GetCaretPosfromCursorPos(Position);
|
Caretpos := GetCaretPosfromCursorPos(Position);
|
||||||
LineNum := CaretPos.Y-1;
|
Result := GetWordFromCaret(CaretPos);
|
||||||
XLine := CaretPos.X;
|
|
||||||
EditorLine := FEditor.Lines[LineNum];
|
|
||||||
// Writeln('XLine and LineNum = ',XLine,',',LineNum);
|
|
||||||
if Length(trim(EditorLine)) = 0 then Exit;
|
|
||||||
if XLine > Length(EditorLine) then Exit;
|
|
||||||
|
|
||||||
//walk backwards to a space or non-standard character.
|
|
||||||
while (
|
|
||||||
(upcase(EditorLine[XLine]) in (['A'..'Z'])) or
|
|
||||||
(upcase(EditorLine[XLine]) in (['0'..'9']))
|
|
||||||
) and
|
|
||||||
(XLine>1) do
|
|
||||||
dec(xLine);
|
|
||||||
|
|
||||||
if ( (XLine > 1) and (XLine < Length(EditorLine))) then Inc(xLine);
|
|
||||||
|
|
||||||
Texts := Copy(EditorLine,XLine,length(EditorLine)); //chop off the beginning
|
|
||||||
|
|
||||||
XLine := 1;
|
|
||||||
|
|
||||||
while (
|
|
||||||
(upcase(Texts[XLine]) in (['A'..'Z'])) or
|
|
||||||
(upcase(Texts[XLine]) in (['0'..'9']))
|
|
||||||
) and
|
|
||||||
(XLine< Length(Texts)) do
|
|
||||||
|
|
||||||
inc(xLine);
|
|
||||||
|
|
||||||
if (XLine < Length(Texts) ) and (XLine >1) then dec(xLine);
|
|
||||||
|
|
||||||
if not(
|
|
||||||
(upcase(Texts[XLine]) in (['A'..'Z'])) or
|
|
||||||
(upcase(Texts[XLine]) in (['0'..'9']))
|
|
||||||
) then
|
|
||||||
dec(xLine);
|
|
||||||
|
|
||||||
Texts := Copy(Texts,1,XLine);
|
|
||||||
|
|
||||||
Result := Texts;
|
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure TSourceEditor.EditorMouseDown(Sender : TObject; Button : TMouseButton;
|
Procedure TSourceEditor.EditorMouseDown(Sender : TObject; Button : TMouseButton;
|
||||||
@ -1520,6 +1480,63 @@ begin
|
|||||||
Result.Y := LineNum;
|
Result.Y := LineNum;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Function TSourceEditor.GetWordAtCurrentCaret: String;
|
||||||
|
var
|
||||||
|
CaretPos : TPoint;
|
||||||
|
begin
|
||||||
|
Result := '';
|
||||||
|
CaretPos.Y := CurrentCursorYLine;
|
||||||
|
CaretPos.X := CurrentCursorXLine;
|
||||||
|
Result := GetWordFromCaret(CaretPos);
|
||||||
|
end;
|
||||||
|
|
||||||
|
Function TSourceEditor.GetWordFromCaret(CaretPos : TPoint) : String;
|
||||||
|
var
|
||||||
|
XLine,YLine : Integer;
|
||||||
|
EditorLine,Texts : String;
|
||||||
|
begin
|
||||||
|
YLine := CaretPos.Y;
|
||||||
|
XLine := CaretPos.X;
|
||||||
|
EditorLine := FEditor.Lines[YLine-1];
|
||||||
|
|
||||||
|
if Length(trim(EditorLine)) = 0 then Exit;
|
||||||
|
if XLine > Length(EditorLine) then Exit;
|
||||||
|
|
||||||
|
//walk backwards to a space or non-standard character.
|
||||||
|
while (
|
||||||
|
(upcase(EditorLine[XLine]) in (['A'..'Z'])) or
|
||||||
|
(upcase(EditorLine[XLine]) in (['0'..'9']))
|
||||||
|
) and
|
||||||
|
(XLine>1) do
|
||||||
|
dec(xLine);
|
||||||
|
|
||||||
|
if ( (XLine > 1) and (XLine < Length(EditorLine))) then Inc(xLine);
|
||||||
|
|
||||||
|
Texts := Copy(EditorLine,XLine,length(EditorLine)); //chop off the beginning
|
||||||
|
|
||||||
|
XLine := 1;
|
||||||
|
|
||||||
|
while (
|
||||||
|
(upcase(Texts[XLine]) in (['A'..'Z'])) or
|
||||||
|
(upcase(Texts[XLine]) in (['0'..'9']))
|
||||||
|
) and
|
||||||
|
(XLine< Length(Texts)) do
|
||||||
|
|
||||||
|
inc(xLine);
|
||||||
|
|
||||||
|
if (XLine < Length(Texts) ) and (XLine >1) then dec(xLine);
|
||||||
|
|
||||||
|
if not(
|
||||||
|
(upcase(Texts[XLine]) in (['A'..'Z'])) or
|
||||||
|
(upcase(Texts[XLine]) in (['0'..'9']))
|
||||||
|
) then
|
||||||
|
dec(xLine);
|
||||||
|
|
||||||
|
Texts := Copy(Texts,1,XLine);
|
||||||
|
|
||||||
|
Result := Texts;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------}
|
{------------------------------------------------------------------------}
|
||||||
{ TSourceNotebook }
|
{ TSourceNotebook }
|
||||||
|
|
||||||
@ -2204,6 +2221,13 @@ Begin
|
|||||||
SubMenuItem.OnClick := @ToggleBreakpointClicked;
|
SubMenuItem.OnClick := @ToggleBreakpointClicked;
|
||||||
MenuItem.Add(SubMenuItem);
|
MenuItem.Add(SubMenuItem);
|
||||||
|
|
||||||
|
|
||||||
|
SubMenuItem := TMenuItem.Create(Self);
|
||||||
|
SubMenuItem.Name := 'AddWatchAtCursorMenuItem';
|
||||||
|
SubMenuItem.Caption := '&Add Watch At Cursor';
|
||||||
|
SubMenuItem.OnClick := @AddWatchAtCursor;
|
||||||
|
MenuItem.Add(SubMenuItem);
|
||||||
|
|
||||||
SubMenuItem := TMenuItem.Create(Self);
|
SubMenuItem := TMenuItem.Create(Self);
|
||||||
SubMenuItem.Name := 'RunToCursorMenuItem';
|
SubMenuItem.Name := 'RunToCursorMenuItem';
|
||||||
SubMenuItem.Caption := '&Run to Cursor';
|
SubMenuItem.Caption := '&Run to Cursor';
|
||||||
@ -3109,6 +3133,12 @@ begin
|
|||||||
FHintTimer.Enabled := False;
|
FHintTimer.Enabled := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Procedure TSourceNotebook.AddWatchAtCursor(Sender : TObject);
|
||||||
|
begin
|
||||||
|
if Assigned(OnAddWatchAtCursor) then
|
||||||
|
OnAddWatchAtCursor(Self);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{ GOTO DIALOG}
|
{ GOTO DIALOG}
|
||||||
|
296
ide/watchesdlg.pp
Normal file
296
ide/watchesdlg.pp
Normal file
@ -0,0 +1,296 @@
|
|||||||
|
unit watchesdlg;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, LResources, StdCtrls,Buttons,Extctrls;
|
||||||
|
|
||||||
|
type
|
||||||
|
TWatchesdlg = class(TForm)
|
||||||
|
Listbox1: TLISTBOX;
|
||||||
|
private
|
||||||
|
{ private declarations }
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
TInsertWatch = class(TForm)
|
||||||
|
lblExpression : TLabel;
|
||||||
|
lblRepCount : TLabel;
|
||||||
|
lblDigits : TLabel;
|
||||||
|
cbEnabled : TCHeckbox;
|
||||||
|
cbAllowFunc : TCheckbox;
|
||||||
|
Style : TRadioGroup;
|
||||||
|
btnOK : TButton;
|
||||||
|
btnCancel : TButton;
|
||||||
|
btnHelp : TButton;
|
||||||
|
edtExpression: TEdit;
|
||||||
|
edtRepCount : TEdit;
|
||||||
|
edtDigits : TEdit;
|
||||||
|
private
|
||||||
|
|
||||||
|
public
|
||||||
|
constructor Create(AOWner : TCOmponent); override;
|
||||||
|
destructor Destroy; override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
Watches_Dlg : TWatchesDlg;
|
||||||
|
InsertWatch : TInsertWatch;
|
||||||
|
implementation
|
||||||
|
|
||||||
|
constructor TWatchesdlg.Create(AOwner : TComponent);
|
||||||
|
Begin
|
||||||
|
inherited;
|
||||||
|
Listbox1 := TListbox.Create(self);
|
||||||
|
with Listbox1 do
|
||||||
|
Begin
|
||||||
|
Parent := self;
|
||||||
|
Align := alClient;
|
||||||
|
Visible := True;
|
||||||
|
Name := 'ListBox1';
|
||||||
|
OnKeyPress := @Listbox1KeyPress;
|
||||||
|
OnKeyDown := @Listbox1KeyDown;
|
||||||
|
|
||||||
|
end;
|
||||||
|
Caption := 'Watches';
|
||||||
|
Name := 'WatchesDlg';
|
||||||
|
Width := 250;
|
||||||
|
Height := 100;
|
||||||
|
|
||||||
|
//TListBox currently does NOT fire keypress, keyDown, KeyUp events. This is a fix for now.
|
||||||
|
OnKeyDown := @ListBox1KeyDown;
|
||||||
|
Position := poScreenCenter;
|
||||||
|
|
||||||
|
InsertWatch := TInsertWatch.Create(nil);
|
||||||
|
End;
|
||||||
|
|
||||||
|
destructor TWatchesDlg.Destroy;
|
||||||
|
Begin
|
||||||
|
InsertWatch.Free;
|
||||||
|
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
|
||||||
|
Count : Integer;
|
||||||
|
Begin
|
||||||
|
|
||||||
|
Writeln('Key is ',Key);
|
||||||
|
case Key of
|
||||||
|
45 : begin //insert
|
||||||
|
if InsertWatch.ShowMOdal = mrOK then
|
||||||
|
Begin
|
||||||
|
//just for now...
|
||||||
|
if InsertWatch.edtExpression.Text <> '' then
|
||||||
|
ListBox1.Items.Add(InsertWatch.edtExpression.Text);
|
||||||
|
end;
|
||||||
|
|
||||||
|
end;
|
||||||
|
46 : begin //delete
|
||||||
|
if Listbox1.SelCount > 0 then
|
||||||
|
Begin
|
||||||
|
Count := 0;
|
||||||
|
while Count <= Listbox1.Items.Count-1 do
|
||||||
|
if Listbox1.Selected[Count] then
|
||||||
|
Listbox1.Items.Delete(Count)
|
||||||
|
else
|
||||||
|
Inc(Count);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end; //case
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TInsertWatch }
|
||||||
|
constructor TInsertWatch.Create(AOwner : TComponent);
|
||||||
|
Begin
|
||||||
|
inherited;
|
||||||
|
Width := 420;
|
||||||
|
Height := 200;
|
||||||
|
Position := poScreenCenter;
|
||||||
|
Caption := 'Watch Properties';
|
||||||
|
lblExpression := TLabel.Create(self);
|
||||||
|
with lblExpression do
|
||||||
|
Begin
|
||||||
|
Parent := self;
|
||||||
|
Caption := 'Expression:';
|
||||||
|
Name := 'lblExpression';
|
||||||
|
Left := 15;
|
||||||
|
Top := 20;
|
||||||
|
Visible := TRue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
edtExpression := TEdit.Create(self);
|
||||||
|
with edtExpression do
|
||||||
|
Begin
|
||||||
|
Parent := Self;
|
||||||
|
Name := 'edtExpression';
|
||||||
|
Left := lblExpression.Left+lblExpression.Width+25;
|
||||||
|
top := lblExpression.top-3;
|
||||||
|
Width := self.width-left-15;
|
||||||
|
Visible := TRue;
|
||||||
|
Text := '';
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
lblRepCount := TLabel.Create(self);
|
||||||
|
with lblRepCount do
|
||||||
|
Begin
|
||||||
|
Parent := self;
|
||||||
|
Caption := 'Repeat Count:';
|
||||||
|
Name := 'lblRepCount';
|
||||||
|
Left := 15;
|
||||||
|
Top := 45;
|
||||||
|
Width := 80;
|
||||||
|
Visible := TRue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
edtRepCount := TEdit.Create(self);
|
||||||
|
with edtRepCount do
|
||||||
|
Begin
|
||||||
|
Parent := Self;
|
||||||
|
Text := '0';
|
||||||
|
NAme := 'edtRepCount';
|
||||||
|
Left := lblExpression.Left+lblExpression.Width+25;
|
||||||
|
Top := lblRepCount.Top -3;
|
||||||
|
Width := 60;
|
||||||
|
Visible := TRue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
lblDigits := TLAbel.Create(self);
|
||||||
|
with lblDigits do
|
||||||
|
Begin
|
||||||
|
Parent := self;
|
||||||
|
Caption := 'Digits:';
|
||||||
|
Name := 'lblDigits';
|
||||||
|
Left := edtRepCount.left+edtRepCount.Width+10;
|
||||||
|
Width := 40;
|
||||||
|
Top := lblRepCount.Top;
|
||||||
|
Visible := TRue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
edtDigits := TEdit.Create(self);
|
||||||
|
with edtDigits do
|
||||||
|
Begin
|
||||||
|
Parent := self;
|
||||||
|
Text := '0';
|
||||||
|
Name := 'edtDigits';
|
||||||
|
Left := lblDigits.Left+lblDigits.Width+10;
|
||||||
|
Top := lblRepCount.Top;
|
||||||
|
Width := self.width-left-15;
|
||||||
|
Visible := TRue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
cbEnabled := TCheckbox.Create(self);
|
||||||
|
with cbEnabled do
|
||||||
|
Begin
|
||||||
|
Parent := self;
|
||||||
|
Left := 15;
|
||||||
|
Top := lblDigits.Top+20;
|
||||||
|
|
||||||
|
Name := 'cbEnabled';
|
||||||
|
Text := 'Enabled';
|
||||||
|
Width := 60;
|
||||||
|
Checked := True;
|
||||||
|
Visible := TRue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
cbAllowFunc := TCheckBox.Create(self);
|
||||||
|
with cbAllowFunc do
|
||||||
|
Begin
|
||||||
|
Parent := self;
|
||||||
|
Left := edtRepCount.Left;
|
||||||
|
Text := 'Allow Function Calls';
|
||||||
|
Name := 'cbAllowFunc';
|
||||||
|
Checked := False;
|
||||||
|
Top := cbEnabled.Top;
|
||||||
|
Visible := TRue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Style := TRadioGroup.Create(self);
|
||||||
|
with Style do
|
||||||
|
Begin
|
||||||
|
Parent := self;
|
||||||
|
Name := 'Style';
|
||||||
|
Left := 15;
|
||||||
|
Top := cbEnabled.Top + 25;
|
||||||
|
Width := self.width-left-15;
|
||||||
|
Columns := 3;
|
||||||
|
Items.Add('Character');
|
||||||
|
Items.Add('String');
|
||||||
|
Items.Add('Decimal');
|
||||||
|
Items.Add('Hexadecimal');
|
||||||
|
Items.Add('Floating Point');
|
||||||
|
Items.Add('Pointer');
|
||||||
|
Items.Add('Record/Structure');
|
||||||
|
Items.Add('Default');
|
||||||
|
Items.Add('Memory Dump');
|
||||||
|
ItemIndex := 7; //default
|
||||||
|
Height := self.height-top-40;
|
||||||
|
Visible := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
btnOK := TButton.Create(self);
|
||||||
|
with btnOK do
|
||||||
|
Begin
|
||||||
|
Parent := self;
|
||||||
|
caption := 'OK';
|
||||||
|
Left := (self.width div 2) -25;
|
||||||
|
Top := Self.Height-30;
|
||||||
|
ModalResult := mrOK;
|
||||||
|
Visible := TRue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
btnCancel := TButton.Create(self);
|
||||||
|
with btncancel do
|
||||||
|
Begin
|
||||||
|
Parent := self;
|
||||||
|
caption := 'Cancel';
|
||||||
|
Left := (self.width div 2) -25+Width+5;
|
||||||
|
Top := Self.Height-30;
|
||||||
|
ModalResult := mrCancel;
|
||||||
|
Visible := TRue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
btnHelp := TButton.Create(self);
|
||||||
|
with btnHelp do
|
||||||
|
Begin
|
||||||
|
Parent := self;
|
||||||
|
caption := 'Help';
|
||||||
|
Left := (self.width div 2) -25+(2*width)+10;
|
||||||
|
Top := Self.Height-30;
|
||||||
|
// ModalResult := mrHelp;
|
||||||
|
Enabled := FAlse;
|
||||||
|
Visible := TRue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TInsertWatch.destroy;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
@ -804,6 +804,7 @@ var
|
|||||||
F: TCustomForm;
|
F: TCustomForm;
|
||||||
ShiftState: TShiftState;
|
ShiftState: TShiftState;
|
||||||
begin
|
begin
|
||||||
|
Writeln('name is ',self.name);
|
||||||
Result := True;
|
Result := True;
|
||||||
F := GetParentForm(Self);
|
F := GetParentForm(Self);
|
||||||
if (F <> nil)
|
if (F <> nil)
|
||||||
@ -838,7 +839,6 @@ begin
|
|||||||
and (F <> Self)
|
and (F <> Self)
|
||||||
and (F.KeyPreview)
|
and (F.KeyPreview)
|
||||||
and (TWinControl(F).DoKeyPress(Message)) then Exit;
|
and (TWinControl(F).DoKeyPress(Message)) then Exit;
|
||||||
|
|
||||||
if not (csNoStdEvents in ControlStyle)
|
if not (csNoStdEvents in ControlStyle)
|
||||||
then with Message do
|
then with Message do
|
||||||
begin
|
begin
|
||||||
@ -1933,6 +1933,10 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.43 2001/12/07 20:12:15 lazarus
|
||||||
|
Added a watch dialog.
|
||||||
|
Shane
|
||||||
|
|
||||||
Revision 1.42 2001/11/10 10:48:00 lazarus
|
Revision 1.42 2001/11/10 10:48:00 lazarus
|
||||||
MG: fixed set formicon on invisible forms
|
MG: fixed set formicon on invisible forms
|
||||||
|
|
||||||
|
@ -1499,6 +1499,10 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.51 2001/12/07 20:12:15 lazarus
|
||||||
|
Added a watch dialog.
|
||||||
|
Shane
|
||||||
|
|
||||||
Revision 1.50 2001/12/05 18:23:47 lazarus
|
Revision 1.50 2001/12/05 18:23:47 lazarus
|
||||||
Added events to Calendar
|
Added events to Calendar
|
||||||
Shane
|
Shane
|
||||||
|
@ -1632,6 +1632,14 @@ begin
|
|||||||
if (sender is TCustomForm) then Begin
|
if (sender is TCustomForm) then Begin
|
||||||
ConnectSignal(PgtkObject(TCustomForm(sender).handle), 'key-press-event', @GTKKeyUpDown, GDK_KEY_PRESS_MASK);
|
ConnectSignal(PgtkObject(TCustomForm(sender).handle), 'key-press-event', @GTKKeyUpDown, GDK_KEY_PRESS_MASK);
|
||||||
ConnectSignal(PgtkObject(TCustomForm(sender).handle), 'key-release-event', @GTKKeyUpDown, GDK_KEY_RELEASE_MASK);
|
ConnectSignal(PgtkObject(TCustomForm(sender).handle), 'key-release-event', @GTKKeyUpDown, GDK_KEY_RELEASE_MASK);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if (sender is TCustomListBox) then
|
||||||
|
Begin
|
||||||
|
Writeln('------------------------------------------------------------------');
|
||||||
|
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;
|
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);
|
||||||
@ -3463,6 +3471,10 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.82 2001/12/07 20:12:15 lazarus
|
||||||
|
Added a watch dialog.
|
||||||
|
Shane
|
||||||
|
|
||||||
Revision 1.81 2001/12/06 13:39:36 lazarus
|
Revision 1.81 2001/12/06 13:39:36 lazarus
|
||||||
Added TArrow component
|
Added TArrow component
|
||||||
Shane
|
Shane
|
||||||
|
@ -234,6 +234,15 @@ type
|
|||||||
property MultiSelect;
|
property MultiSelect;
|
||||||
property OnClick;
|
property OnClick;
|
||||||
property OnDblClick;
|
property OnDblClick;
|
||||||
|
property OnEnter;
|
||||||
|
property OnExit;
|
||||||
|
property OnKeyPress;
|
||||||
|
property OnKeyDown;
|
||||||
|
property OnKeyUp;
|
||||||
|
property OnMouseMove;
|
||||||
|
property OnMouseDown;
|
||||||
|
property OnMouseUp;
|
||||||
|
property OnResize;
|
||||||
property Sorted;
|
property Sorted;
|
||||||
property Style;
|
property Style;
|
||||||
property Visible;
|
property Visible;
|
||||||
@ -572,6 +581,10 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.17 2001/12/07 20:12:15 lazarus
|
||||||
|
Added a watch dialog.
|
||||||
|
Shane
|
||||||
|
|
||||||
Revision 1.16 2001/10/19 14:27:43 lazarus
|
Revision 1.16 2001/10/19 14:27:43 lazarus
|
||||||
MG: fixed customradiogroup OnClick + ItemIndex
|
MG: fixed customradiogroup OnClick + ItemIndex
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user