1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
|
{ $Id: debugoutputform.pp 58392 2018-06-24 12:40:43Z martin $ }
{ ------------------------------------------
debugoutputform.pp - Shows target output
------------------------------------------
@created(Wed Feb 25st WET 2001)
@lastmod($Date: 2018-06-24 14:40:43 +0200 (So, 24 Jun 2018) $)
@author(Marc Weustink <marc@@dommelstein.net>)
***************************************************************************
* *
* This source is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This code is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* A copy of the GNU General Public License is available on the World *
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
* obtain it by writing to the Free Software Foundation, *
* Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1335, USA. *
* *
***************************************************************************
}
unit DebugOutputForm;
(* DBG_WITH_DEBUGGER_DEBUG:
This enables direct access to the debugger.
WARNING:
- This bypasses some of the internals of the debugger.
- It does intentionally no check or validation
- Using this feature without full knowledge of all internals of the debugger,
can *HANG* or *CRASH* the debugger or the entire IDE.
*)
{$mode objfpc}
{$H+}
interface
uses
Classes, Controls, Forms, Clipbrd,
IDEWindowIntf,
BaseDebugManager, StdCtrls, Menus, ExtCtrls, DebuggerDlg
{$IFDEF DBG_WITH_DEBUGGER_DEBUG}
, CmdLineDebugger
{$ENDIF}
;
type
{ TDbgOutputForm }
TDbgOutputForm = class(TDebuggerDlg)
popCopyAll: TMenuItem;
txtOutput: TMemo;
mnuPopup: TPopupMenu;
popClear: TMenuItem;
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure popClearClick(Sender: TObject);
procedure popCopyAllClick(Sender: TObject);
private
{$IFDEF DBG_WITH_DEBUGGER_DEBUG}
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
{$ENDIF}
protected
procedure Loaded; override;
public
{$IFDEF DBG_WITH_DEBUGGER_DEBUG}
constructor Create(TheOwner: TComponent); override;
{$ENDIF}
procedure AddText(const AText: String);
procedure Clear;
procedure SetLogText(Lines: TStrings);
procedure GetLogText(Lines: TStrings);
end;
implementation
{$R *.lfm}
uses
LazarusIDEStrConsts;
var
DbgOutputDlgWindowCreator: TIDEWindowCreator;
procedure TDbgOutputForm.AddText(const AText: String);
begin
txtOutput.Lines.Add(AText);
end;
procedure TDbgOutputForm.Clear;
begin
txtOutput.Lines.Clear;
end;
procedure TDbgOutputForm.SetLogText(Lines: TStrings);
begin
txtOutput.Lines.Assign(Lines);
end;
procedure TDbgOutputForm.GetLogText(Lines: TStrings);
begin
Lines.Assign(txtOutput.Lines);
end;
{$IFDEF DBG_WITH_DEBUGGER_DEBUG}
constructor TDbgOutputForm.Create(TheOwner: TComponent);
var
p: TPanel;
b: TButton;
begin
inherited;
p := TPanel.Create(Self);
p.Parent := Self;
p.Align := alBottom;
p.AutoSize := True;
p.Caption := '';
Edit1 := TEdit.Create(Self);
Edit1.Parent := p;
Edit1.Align := alClient;
b := TButton.Create(Self);
b.Parent := p;
b.Align := alRight;
b.OnClick := @Button1Click;
b.Caption := 'Execute';
b.AutoSize := True;
end;
{$ENDIF}
procedure TDbgOutputForm.FormClose(Sender: TObject;
var CloseAction: TCloseAction);
begin
CloseAction := caFree;
end;
{$IFDEF DBG_WITH_DEBUGGER_DEBUG}
procedure TDbgOutputForm.Button1Click(Sender: TObject);
begin
DebugBoss.Debugger.TestCmd(Edit1.Text);
end;
{$ENDIF}
procedure TDbgOutputForm.FormCreate(Sender: TObject);
begin
txtOutput.Lines.Clear;
Caption:= lisMenuViewDebugOutput;
popClear.Caption:=lisClear;
popCopyAll.Caption:=lisCopyAllOutputClipboard;
end;
procedure TDbgOutputForm.Loaded;
begin
inherited Loaded;
// Not yet through resources
txtOutput.Scrollbars := ssBoth;
end;
procedure TDbgOutputForm.popClearClick(Sender: TObject);
begin
Clear;
end;
procedure TDbgOutputForm.popCopyAllClick(Sender: TObject);
begin
Clipboard.AsText := txtOutput.Text;
end;
initialization
DbgOutputDlgWindowCreator := IDEWindowCreators.Add(DebugDialogNames[ddtOutput]);
DbgOutputDlgWindowCreator.OnCreateFormProc := @CreateDebugDialog;
DbgOutputDlgWindowCreator.CreateSimpleLayout;
end.
|