mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-01 13:30:47 +02:00
Improved Debug - Evaluate (Ctrl+F4)
This commit is contained in:
parent
54afa37d4d
commit
38e53727f0
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
Copyright (c) 1997-2008 by the Daniel Mantione
|
Copyright (c) 1997-2008 by the Daniel Mantione
|
||||||
|
|
||||||
Debug expression evaluator dialog ?
|
Debug expression evaluator dialog
|
||||||
|
|
||||||
See the file COPYING.FPC, included in this distribution,
|
See the file COPYING.FPC, included in this distribution,
|
||||||
for details about the copyright.
|
for details about the copyright.
|
||||||
@ -19,31 +19,32 @@ unit fpevalw;
|
|||||||
interface
|
interface
|
||||||
{****************************************************************************}
|
{****************************************************************************}
|
||||||
|
|
||||||
uses fpdebug,dialogs,views,objects,fpconst,drivers;
|
uses fpdebug,dialogs,WViews,objects,fpconst,drivers,WEditor;
|
||||||
|
|
||||||
type Pevaluate_dialog=^Tevaluate_dialog;
|
type Pevaluate_dialog=^Tevaluate_dialog;
|
||||||
Tevaluate_dialog=object(Tdialog)
|
Tevaluate_dialog=object(TCenterDialog)
|
||||||
watch:Pwatch;
|
watch : PWatch;
|
||||||
expr_input,expr_output:Pinputline;
|
expr_input : PEditorInputLine;
|
||||||
|
expr_output : PEditorInputLine;
|
||||||
constructor init(var bounds:Trect);
|
constructor init(var bounds:Trect);
|
||||||
procedure evaluate;
|
procedure evaluate;
|
||||||
procedure handleevent(var event:Tevent);virtual;
|
procedure HandleEvent(var Event:TEvent);virtual;
|
||||||
destructor done;
|
destructor done;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{****************************************************************************}
|
{****************************************************************************}
|
||||||
implementation
|
implementation
|
||||||
{****************************************************************************}
|
{****************************************************************************}
|
||||||
|
uses FPViews;
|
||||||
|
|
||||||
constructor Tevaluate_dialog.init(var bounds:Trect);
|
constructor Tevaluate_dialog.init(var bounds:Trect);
|
||||||
|
|
||||||
var r:Trect;
|
var r:Trect;
|
||||||
l:Plabel;
|
l:Plabel;
|
||||||
b:Pbutton;
|
b:Pbutton;
|
||||||
|
EditorWindow : PSourceWindow;
|
||||||
|
S : String;
|
||||||
begin
|
begin
|
||||||
inherited init(bounds,'Evaluate expression');
|
inherited init(bounds,'Evaluate expression');
|
||||||
options:=options or ofcentered;
|
|
||||||
{watch is auto initialized to nil.}
|
{watch is auto initialized to nil.}
|
||||||
|
|
||||||
r.assign(2,3,size.x-20,4);
|
r.assign(2,3,size.x-20,4);
|
||||||
@ -72,12 +73,22 @@ begin
|
|||||||
//r.assign(size.x-14,6,size.x-3,8);
|
//r.assign(size.x-14,6,size.x-3,8);
|
||||||
//new(b,init(r,'Help',cmHelp,bfNormal));
|
//new(b,init(r,'Help',cmHelp,bfNormal));
|
||||||
//insert(b);
|
//insert(b);
|
||||||
|
EditorWindow:=FirstEditorWindow;
|
||||||
|
If assigned(EditorWindow) then
|
||||||
|
S:=EditorWindow^.Editor^.GetCurrentWord
|
||||||
|
else
|
||||||
|
S:='';
|
||||||
|
expr_input^.SetData(S);
|
||||||
|
expr_input^.Select;
|
||||||
|
if s <>'' then
|
||||||
|
evaluate;
|
||||||
|
{ for right arrow to give a char from EditorWindow }
|
||||||
|
if assigned(EditorWindow) then
|
||||||
|
FindReplaceEditor:=EditorWindow^.Editor;
|
||||||
|
|
||||||
expr_input^.select;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure Tevaluate_dialog.evaluate;
|
procedure Tevaluate_dialog.Evaluate;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if watch<>nil then
|
if watch<>nil then
|
||||||
dispose(watch,done);
|
dispose(watch,done);
|
||||||
@ -86,20 +97,19 @@ begin
|
|||||||
expr_output^.drawview;
|
expr_output^.drawview;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure Tevaluate_dialog.handleevent(var event:Tevent);
|
procedure Tevaluate_dialog.HandleEvent(var Event:TEvent);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
inherited handleevent(event);
|
inherited HandleEvent(Event);
|
||||||
if event.what=evCommand then
|
if Event.what=evCommand then
|
||||||
case event.command of
|
case Event.command of
|
||||||
cmEvaluate:
|
cmEvaluate:
|
||||||
evaluate;
|
evaluate;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor Tevaluate_dialog.done;
|
destructor Tevaluate_dialog.done;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
FindReplaceEditor:=nil;
|
||||||
if watch<>nil then
|
if watch<>nil then
|
||||||
dispose(watch,done);
|
dispose(watch,done);
|
||||||
end;
|
end;
|
||||||
|
@ -241,19 +241,16 @@ end;
|
|||||||
|
|
||||||
{$ifdef NODEBUG}
|
{$ifdef NODEBUG}
|
||||||
procedure TIDEapp.do_evaluate;
|
procedure TIDEapp.do_evaluate;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
nodebugger;
|
nodebugger;
|
||||||
end;
|
end;
|
||||||
{$else}
|
{$else}
|
||||||
procedure TIDEapp.do_evaluate;
|
procedure TIDEapp.do_evaluate;
|
||||||
|
|
||||||
var d:Pevaluate_dialog;
|
var d:Pevaluate_dialog;
|
||||||
r:Trect;
|
r:Trect;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
desktop^.getextent(r);
|
desktop^.getextent(r);
|
||||||
r.b.x:=r.b.x*3 div 4;
|
r.b.x:=min(max(30,r.b.x*3 div 4),60);
|
||||||
r.b.y:=12;
|
r.b.y:=12;
|
||||||
new(d,init(r));
|
new(d,init(r));
|
||||||
desktop^.execview(d);
|
desktop^.execview(d);
|
||||||
|
Loading…
Reference in New Issue
Block a user