mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-13 10:09:25 +02:00
MWE:
* More delphi compatibility added/updated to TListView * Introduced TDebugger.locals * Moved breakpoints dialog to debugger dir * Changed breakpoints dialog to read from resource git-svn-id: trunk@1395 -
This commit is contained in:
parent
ee6f0e9333
commit
d6ea930f45
7
.gitattributes
vendored
7
.gitattributes
vendored
@ -55,6 +55,7 @@ components/synedit/synhighlighterpas.pp svneol=native#text/pascal
|
||||
components/synedit/synhighlighterperl.pas svneol=native#text/pascal
|
||||
components/synedit/synhighlighterxml.pas svneol=native#text/pascal
|
||||
components/synedit/syntextdrawer.pp svneol=native#text/pascal
|
||||
debugger/breakpointsdlg.pp svneol=native#text/pascal
|
||||
debugger/cmdlinedebugger.pp svneol=native#text/pascal
|
||||
debugger/dbgbreakpoint.pp svneol=native#text/pascal
|
||||
debugger/dbgoutputform.pp svneol=native#text/pascal
|
||||
@ -62,6 +63,7 @@ debugger/dbgwatch.pp svneol=native#text/pascal
|
||||
debugger/debugger.pp svneol=native#text/pascal
|
||||
debugger/gdbdebugger.pp svneol=native#text/pascal
|
||||
debugger/gdbmidebugger.pp svneol=native#text/pascal
|
||||
debugger/tbreakpointsdlg.lfm svneol=native#text/plain
|
||||
debugger/tdbgoutputform.lfm svneol=native#text/plain
|
||||
debugger/test/debugtest.pp svneol=native#text/pascal
|
||||
debugger/test/debugtestform.pp svneol=native#text/pascal
|
||||
@ -110,7 +112,6 @@ examples/testallform.pp svneol=native#text/pascal
|
||||
examples/testtools.inc svneol=native#text/pascal
|
||||
examples/toolbar.pp svneol=native#text/pascal
|
||||
examples/trackbar.pp svneol=native#text/pascal
|
||||
ide/breakpointsdlg.pp svneol=native#text/pascal
|
||||
ide/buildlazdialog.pas svneol=native#text/pascal
|
||||
ide/codetemplatedialog.pp svneol=native#text/pascal
|
||||
ide/codetoolsoptions.pas svneol=native#text/pascal
|
||||
@ -418,6 +419,8 @@ lcl/include/image.inc svneol=native#text/pascal
|
||||
lcl/include/imglist.inc svneol=native#text/pascal
|
||||
lcl/include/inputdialog.inc svneol=native#text/pascal
|
||||
lcl/include/interfacebase.inc svneol=native#text/pascal
|
||||
lcl/include/listcolumn.inc svneol=native#text/pascal
|
||||
lcl/include/listcolumns.inc svneol=native#text/pascal
|
||||
lcl/include/listitem.inc svneol=native#text/pascal
|
||||
lcl/include/listitems.inc svneol=native#text/pascal
|
||||
lcl/include/mainmenu.inc svneol=native#text/pascal
|
||||
@ -459,8 +462,6 @@ lcl/include/toolbutton.inc svneol=native#text/pascal
|
||||
lcl/include/toolwindow.inc svneol=native#text/pascal
|
||||
lcl/include/trackbar.inc svneol=native#text/pascal
|
||||
lcl/include/treeview.inc svneol=native#text/pascal
|
||||
lcl/include/viewcolumn.inc svneol=native#text/pascal
|
||||
lcl/include/viewcolumns.inc svneol=native#text/pascal
|
||||
lcl/include/winapi.inc svneol=native#text/pascal
|
||||
lcl/include/winapih.inc svneol=native#text/pascal
|
||||
lcl/include/wincontrol.inc svneol=native#text/pascal
|
||||
|
10
debugger/breakpointsdlg.lrc
Normal file
10
debugger/breakpointsdlg.lrc
Normal file
@ -0,0 +1,10 @@
|
||||
LazarusResources.Add('TBreakpointsDlg','FORMDATA',
|
||||
'TPF0'#15'TBreakpointsDlg'#14'BreakpointsDlg'#4'Left'#3'T'#1#3'Top'#2'u'#5
|
||||
+'Width'#3'*'#2#6'Height'#3#200#0#7'Caption'#6#11'Breakpoints'#0#9'TListVi'
|
||||
+'ew'#9'ListView1'#4'Left'#2#0#3'Top'#2#0#5'Width'#3'"'#2#6'Height'#3#171#0
|
||||
+#5'Align'#7#8'alClient'#7'Columns'#14#1#7'Caption'#6#16'Filename/Address'
|
||||
+#5'Width'#3#150#0#0#1#7'Caption'#6#11'Line/Length'#5'Width'#2'd'#0#1#7'Ca'
|
||||
+'ption'#6#9'Condition'#5'Width'#2'K'#0#1#7'Caption'#6#6'Action'#0#1#7'Cap'
|
||||
+'tion'#6#10'Pass Count'#5'Width'#2'd'#0#1#7'Caption'#6#5'Group'#0#0#11'Mu'
|
||||
+'ltiSelect'#9#9'ViewStyle'#7#8'vsReport'#0#0#0
|
||||
);
|
143
debugger/breakpointsdlg.pp
Normal file
143
debugger/breakpointsdlg.pp
Normal file
@ -0,0 +1,143 @@
|
||||
unit breakpointsdlg;
|
||||
{ $Id$ }
|
||||
{ ----------------------------------------------
|
||||
breakpointsdlg.pp - Overview of breeakponts
|
||||
----------------------------------------------
|
||||
|
||||
@created(Fri Dec 14st WET 2001)
|
||||
@lastmod($Date$)
|
||||
@author(Shane Miller)
|
||||
@author(Marc Weustink <marc@@dommelstein.net>)
|
||||
|
||||
This unit contains the Breakpoint dialog.
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program 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. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
}
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, LResources, StdCtrls,Buttons,Extctrls,ComCtrls;
|
||||
|
||||
type
|
||||
TBreakPointsDlg = class(TForm)
|
||||
lvBreakPoints: TListView;
|
||||
private
|
||||
procedure AddBreakPoint(UnitName : String; Line : Integer);
|
||||
procedure DeleteBreakPoint(UnitName : String; Line : Integer);
|
||||
protected
|
||||
public
|
||||
constructor Create(AOwner : TComponent); override;
|
||||
destructor Destroy; override;
|
||||
end;
|
||||
|
||||
var
|
||||
BREAKPOINTS_DLG: TBreakPointsDlg;
|
||||
|
||||
implementation
|
||||
|
||||
constructor TBreakPointsdlg.Create(AOwner : TComponent);
|
||||
begin
|
||||
inherited;
|
||||
(*
|
||||
if LazarusResources.Find(Classname)=nil then
|
||||
begin
|
||||
lvBreakPoints := TListView.Create(self);
|
||||
with lvBreakPoints do
|
||||
Begin
|
||||
Parent := self;
|
||||
Align := alClient;
|
||||
Visible := True;
|
||||
Name := 'lvBreakPoints';
|
||||
Columns.Clear;
|
||||
Columns.Updating := TRue;
|
||||
Columns.Add('Filename/Address');
|
||||
Columns.Add('Line/Length');
|
||||
Columns.Add('Condition');
|
||||
Columns.Add('Action');
|
||||
Columns.Add('Pass Count');
|
||||
Columns.Add('Group');
|
||||
Columns.Updating := False;
|
||||
//Example alignment of columns.
|
||||
// Columns.Item[1].Alignment := caRight;
|
||||
ViewStyle := vsReport;
|
||||
Sorted := True;
|
||||
OnKeyDown := @lvBreakPointsKeyDown;
|
||||
MultiSelect := True;
|
||||
end;
|
||||
//ListView does not accpet keys unless the mouse is held down over it
|
||||
//so temporarily I do this:
|
||||
OnKeyDown := @lvBreakPointsKeyDown;
|
||||
|
||||
Caption := 'Breakpoints';
|
||||
Name := 'BreakPointsDlg';
|
||||
Width := 350;
|
||||
Height := 100;
|
||||
|
||||
end;
|
||||
*)
|
||||
|
||||
end;
|
||||
|
||||
destructor TBreakPointsDlg.Destroy;
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TBreakPointsDlg.AddBreakPoint(UnitName : String; Line : Integer);
|
||||
var
|
||||
LI : TListItem;
|
||||
begin
|
||||
LI := lvBreakPoints.Items.Add;
|
||||
LI.Caption := UnitName;
|
||||
LI.SubItems.Add(Inttostr(line));
|
||||
LI.SubItems.Add('');
|
||||
LI.SubItems.Add('Break');
|
||||
LI.SubItems.Add('0');
|
||||
LI.SubItems.Add('');
|
||||
end;
|
||||
|
||||
|
||||
procedure TBreakPointsDlg.DeleteBreakPoint(UnitName : String; Line : Integer);
|
||||
var
|
||||
LI : TListItem;
|
||||
I : Integer;
|
||||
begin
|
||||
for I := 0 to lvBreakPoints.Items.Count-1 do
|
||||
Begin
|
||||
LI := lvBreakPoints.Items[i];
|
||||
if LI.Caption <> UnitName then Continue;
|
||||
if LI.SubItems.Strings[0] = inttostr(line) then
|
||||
begin
|
||||
lvBreakPoints.Items.Delete(i);
|
||||
Break;
|
||||
end;
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$I breakpointsdlg.lrc}
|
||||
|
||||
end.
|
||||
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.1 2002/03/12 23:55:36 lazarus
|
||||
MWE:
|
||||
* More delphi compatibility added/updated to TListView
|
||||
* Introduced TDebugger.locals
|
||||
* Moved breakpoints dialog to debugger dir
|
||||
* Changed breakpoints dialog to read from resource
|
||||
|
||||
}
|
39
debugger/tbreakpointsdlg.lfm
Normal file
39
debugger/tbreakpointsdlg.lfm
Normal file
@ -0,0 +1,39 @@
|
||||
object BreakpointsDlg: TBreakpointsDlg
|
||||
Left = 340
|
||||
Top = 117
|
||||
Width = 554
|
||||
Height = 200
|
||||
Caption = 'Breakpoints'
|
||||
object ListView1: TListView
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 546
|
||||
Height = 171
|
||||
Align = alClient
|
||||
Columns = <
|
||||
item
|
||||
Caption = 'Filename/Address'
|
||||
Width = 150
|
||||
end
|
||||
item
|
||||
Caption = 'Line/Length'
|
||||
Width = 100
|
||||
end
|
||||
item
|
||||
Caption = 'Condition'
|
||||
Width = 75
|
||||
end
|
||||
item
|
||||
Caption = 'Action'
|
||||
end
|
||||
item
|
||||
Caption = 'Pass Count'
|
||||
Width = 100
|
||||
end
|
||||
item
|
||||
Caption = 'Group'
|
||||
end>
|
||||
MultiSelect = True
|
||||
ViewStyle = vsReport
|
||||
end
|
||||
end
|
@ -5,7 +5,7 @@ program debugtest;
|
||||
|
||||
|
||||
uses
|
||||
Classes, Forms, DebugTestForm;
|
||||
Classes, Forms, DebugTestForm, BreakpointsDlg;
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
|
@ -1,8 +1,12 @@
|
||||
unit TestWait;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
interface
|
||||
|
||||
procedure Wait(const ATime: Integer);
|
||||
type
|
||||
TWait = class
|
||||
constructor Create(const ATime: Integer);
|
||||
procedure Wait(const ATime: Integer);
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
@ -16,7 +20,21 @@ begin
|
||||
time := now;
|
||||
while (now - time) * SecsPerDay < ATime do;
|
||||
end;
|
||||
|
||||
|
||||
constructor TWait.Create(const ATime: Integer);
|
||||
var
|
||||
n: Integer;
|
||||
begin
|
||||
inherited Create;
|
||||
n := 0;
|
||||
while n < ATime do Inc(n); //something useles
|
||||
end;
|
||||
|
||||
procedure TWait.Wait(const ATime: Integer);
|
||||
begin
|
||||
TestWait.Wait(ATime);
|
||||
end;
|
||||
|
||||
|
||||
var
|
||||
n: Integer;
|
||||
|
@ -9,6 +9,7 @@ uses
|
||||
StdCtrls, Buttons, ExtCtrls;
|
||||
|
||||
type
|
||||
// TODO create more generic collection editor.
|
||||
TColumnDlg = class(TForm)
|
||||
Listbox1: TLISTBOX;
|
||||
Label1: TLABEL;
|
||||
@ -26,11 +27,10 @@ type
|
||||
cbAutoSize : TCheckBox;
|
||||
private
|
||||
{ private declarations }
|
||||
FItems : TList;
|
||||
FColumns: TListColumns;
|
||||
FSelectedIndex : Integer;
|
||||
function GetCount: Integer;
|
||||
function GetItem(Index : Integer): TViewColumn;
|
||||
Procedure DisplayColumn(Value : Integer);
|
||||
procedure DisplayColumn(Value : Integer);
|
||||
procedure SetColumns(const AValue: TListColumns);
|
||||
protected
|
||||
procedure Button1OnClick(sender : TObject);
|
||||
procedure Button2OnClick(sender : TObject);
|
||||
@ -46,11 +46,7 @@ type
|
||||
public
|
||||
{ public declarations }
|
||||
constructor Create(AOwner : TComponent); override;
|
||||
procedure Clear;
|
||||
Function Add(S : String) : Integer;
|
||||
property Count : Integer read GetCount;
|
||||
property Item[Index : Integer]: TViewColumn read GetItem; default;
|
||||
// property Items : TList read FItems write FItems;
|
||||
property Columns: TListColumns read FColumns write SetColumns;
|
||||
end;
|
||||
|
||||
|
||||
@ -234,21 +230,20 @@ Begin
|
||||
end;
|
||||
|
||||
end;
|
||||
FItems := TList.Create;
|
||||
FColumns := TListColumns.Create(nil);
|
||||
FSelectedIndex:= -1;
|
||||
|
||||
end;
|
||||
|
||||
|
||||
procedure TColumnDlg.Button1OnClick(sender : TObject);
|
||||
var
|
||||
ViewColumn : TViewColumn;
|
||||
Column : TListColumn;
|
||||
Begin
|
||||
//add
|
||||
ViewColumn := TViewColumn.Create;
|
||||
ViewColumn.Caption := 'Caption';
|
||||
FSelectedIndex := FItems.Add(ViewColumn);
|
||||
Listbox1.Items.Add(ViewColumn.Caption);
|
||||
Column := FColumns.Add;
|
||||
Column.Caption := 'Caption';
|
||||
FSelectedIndex := Column.Index;
|
||||
Listbox1.Items.Add(Column.Caption);
|
||||
Listbox1.Selected[FSelectedIndex] := True;
|
||||
DisplayColumn(FSelectedIndex);
|
||||
end;
|
||||
@ -270,26 +265,26 @@ end;
|
||||
|
||||
Procedure TColumnDlg.Edit1OnChange(Sender : TObject);
|
||||
Var
|
||||
ViewColumn : TViewColumn;
|
||||
ListColumn : TListColumn;
|
||||
begin
|
||||
if FSelectedIndex = -1 then Exit;
|
||||
ViewColumn := TViewColumn(FItems.Items[FSelectedIndex]);
|
||||
ViewColumn.Caption := Edit1.Caption;
|
||||
ListColumn := FColumns[FSelectedIndex];
|
||||
ListColumn.Caption := Edit1.Caption;
|
||||
Listbox1.Items[FSelectedIndex] := Edit1.Caption;
|
||||
Listbox1.Selected[FSelectedIndex] := True;
|
||||
end;
|
||||
|
||||
Procedure TColumnDlg.Edit2OnChange(Sender : TObject);
|
||||
Var
|
||||
ViewColumn : TViewColumn;
|
||||
ListColumn : TListColumn;
|
||||
begin
|
||||
if FSelectedIndex = -1 then Exit;
|
||||
ViewColumn := TViewColumn(FItems.Items[FSelectedIndex]);
|
||||
ListColumn := FColumns[FSelectedIndex];
|
||||
if Edit2.Caption = '' then
|
||||
ViewColumn.Width := 0
|
||||
ListColumn.Width := 0
|
||||
else
|
||||
try
|
||||
ViewColumn.Width := StrtoInt(Edit2.Caption);
|
||||
ListColumn.Width := StrtoInt(Edit2.Caption);
|
||||
except
|
||||
raise Exception.Create('Invalid numeric Value');
|
||||
Edit2.Caption := '0';
|
||||
@ -302,39 +297,37 @@ var
|
||||
begin
|
||||
//delete
|
||||
if FSelectedIndex = -1 then Exit;
|
||||
|
||||
Index := FSelectedIndex;
|
||||
FSelectedIndex := -1;
|
||||
FItems.Delete(Index);
|
||||
FColumns[Index].Free;
|
||||
Listbox1.Items.Delete(Index);
|
||||
if Index > 0 then
|
||||
Listbox1.Selected[Index-1] := True;
|
||||
DisplayColumn(Index-1);
|
||||
|
||||
end;
|
||||
|
||||
procedure TColumnDlg.Button3OnClick(sender : TObject);
|
||||
Var
|
||||
ViewColumn : TViewColumn;
|
||||
ListColumn : TListColumn;
|
||||
Index : Integer;
|
||||
begin
|
||||
//move up
|
||||
if FSelectedIndex <= 0 then Exit;
|
||||
Index := FSelectedIndex;
|
||||
FSelectedIndex := -1;
|
||||
ViewColumn := TViewColumn(FItems.Items[Index]);
|
||||
ListColumn := FColumns[Index];
|
||||
ListColumn.Index := Index - 1;
|
||||
|
||||
FItems.Insert(Index-1,ViewColumn);
|
||||
FItems.Delete(Index+1);
|
||||
Listbox1.Items.Insert(Index-1,ViewColumn.Caption);
|
||||
Listbox1.Items.Insert(Index-1,ListColumn.Caption);
|
||||
Listbox1.Items.Delete(Index+1);
|
||||
Listbox1.Selected[Index-1] := True;
|
||||
DisplayColumn(Index-1);
|
||||
|
||||
end;
|
||||
|
||||
procedure TColumnDlg.Button4OnClick(sender : TObject);
|
||||
Var
|
||||
ViewColumn : TViewColumn;
|
||||
ListColumn : TListColumn;
|
||||
Index : Integer;
|
||||
begin
|
||||
//move down
|
||||
@ -344,11 +337,10 @@ begin
|
||||
Index := FSelectedIndex;
|
||||
FSelectedIndex := -1;
|
||||
|
||||
ViewColumn := TViewColumn(FItems.Items[Index]);
|
||||
ListColumn := FColumns[Index];
|
||||
ListColumn.Index := Index + 1;
|
||||
|
||||
FItems.Insert(Index+2,ViewColumn);
|
||||
FItems.Delete(Index);
|
||||
Listbox1.Items.Insert(Index+2,ViewColumn.Caption);
|
||||
Listbox1.Items.Insert(Index+2,ListColumn.Caption);
|
||||
Listbox1.Items.Delete(Index);
|
||||
Listbox1.Selected[Index+1] := True;
|
||||
DisplayColumn(Index+1);
|
||||
@ -356,107 +348,71 @@ end;
|
||||
|
||||
Procedure TColumnDlg.DisplayColumn(Value : Integer);
|
||||
Var
|
||||
ViewColumn : TViewColumn;
|
||||
ListColumn : TListColumn;
|
||||
begin
|
||||
FSelectedIndex := -1;
|
||||
if Value = -1 then exit;
|
||||
|
||||
ViewColumn := TViewColumn(FItems.Items[Value]);
|
||||
Edit1.Caption := ViewColumn.Caption;
|
||||
Edit2.Caption := Inttostr(ViewColumn.Width);
|
||||
ListColumn := FColumns[Value];
|
||||
Edit1.Caption := ListColumn.Caption;
|
||||
Edit2.Caption := Inttostr(Integer(ListColumn.Width));
|
||||
|
||||
case ViewColumn.Alignment of
|
||||
caLEft : RadioGroup1.ItemIndex := 0;
|
||||
caCenter:RadioGroup1.ItemIndex := 1;
|
||||
caRight : RadioGroup1.ItemIndex := 2;
|
||||
case ListColumn.Alignment of
|
||||
taLeftJustify : RadioGroup1.ItemIndex := 0;
|
||||
taCenter: RadioGroup1.ItemIndex := 1;
|
||||
taRightJustify : RadioGroup1.ItemIndex := 2;
|
||||
end; //case
|
||||
|
||||
cbVisible.Checked := ViewColumn.Visible;
|
||||
cbAutoSize.Checked := ViewColumn.AutoSize;
|
||||
|
||||
cbVisible.Checked := ListColumn.Visible;
|
||||
cbAutoSize.Checked := ListColumn.AutoSize;
|
||||
|
||||
FSelectedIndex := Value;
|
||||
|
||||
end;
|
||||
|
||||
procedure TColumnDlg.SetColumns(const AValue: TListColumns);
|
||||
begin
|
||||
FColumns.Assign(AValue);
|
||||
end;
|
||||
|
||||
procedure TColumnDlg.RadioGroup1OnClick(sender : TObject);
|
||||
Var
|
||||
ViewColumn : TViewColumn;
|
||||
ListColumn : TListColumn;
|
||||
begin
|
||||
if FSelectedIndex = -1 then Exit;
|
||||
ViewColumn := TViewColumn(FItems.Items[FSelectedIndex]);
|
||||
ListColumn := FColumns[FSelectedIndex];
|
||||
case RadioGroup1.ItemIndex of
|
||||
0 : ViewColumn.Alignment := caLeft;
|
||||
1 : ViewColumn.Alignment := caCenter;
|
||||
2 : ViewColumn.Alignment := caRight;
|
||||
0 : ListColumn.Alignment := taLeftJustify;
|
||||
1 : ListColumn.Alignment := taCenter;
|
||||
2 : ListColumn.Alignment := taRightJustify;
|
||||
end;
|
||||
end;
|
||||
|
||||
Procedure TColumnDlg.FormOnShow(Sender : TObject);
|
||||
var
|
||||
I : Integer;
|
||||
ViewColumn : TViewColumn;
|
||||
begin
|
||||
//clear the listbox and display the items if any...
|
||||
Listbox1.Items.Clear;
|
||||
for I := 0 to FItems.Count-1 do
|
||||
Begin
|
||||
ViewColumn := TViewColumn(FItems.Items[I]);
|
||||
Listbox1.Items.Add(ViewColumn.Caption);
|
||||
end;
|
||||
for I := 0 to FColumns.Count-1 do
|
||||
Listbox1.Items.Add(FColumns[i].Caption);
|
||||
|
||||
if Listbox1.Items.Count > 0 then
|
||||
begin
|
||||
Listbox1.Selected[0] := True;
|
||||
DisplayColumn(0);
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure TColumnDlg.Clear;
|
||||
begin
|
||||
FItems.Clear;
|
||||
end;
|
||||
|
||||
function TColumnDlg.GetItem(Index : Integer): TViewColumn;
|
||||
begin
|
||||
Result := nil;
|
||||
if Index > FItems.Count-1 then exit;
|
||||
Result := TViewColumn(FItems.Items[Index]);
|
||||
end;
|
||||
|
||||
function TColumnDlg.GetCount: Integer;
|
||||
begin
|
||||
Result := FItems.Count;
|
||||
end;
|
||||
|
||||
Function TColumnDlg.Add(S : String) : Integer;
|
||||
var
|
||||
ViewColumn : TViewColumn;
|
||||
begin
|
||||
ViewColumn := TViewColumn.Create;
|
||||
ViewColumn.Caption := S;
|
||||
Result := FItems.Add(ViewColumn);
|
||||
end;
|
||||
|
||||
Procedure TColumnDlg.cbVisibleOnClick(Sender : TObject);
|
||||
Var
|
||||
ViewColumn : TViewColumn;
|
||||
procedure TColumnDlg.cbVisibleOnClick(Sender : TObject);
|
||||
begin
|
||||
if FSelectedIndex = -1 then Exit;
|
||||
ViewColumn := TViewColumn(FItems.Items[FSelectedIndex]);
|
||||
|
||||
ViewColumn.Visible := cbVisible.Checked;
|
||||
|
||||
FColumns[FSelectedIndex].Visible := cbVisible.Checked;
|
||||
end;
|
||||
|
||||
Procedure TColumnDlg.cbAutoSizeOnClick(Sender : TObject);
|
||||
Var
|
||||
ViewColumn : TViewColumn;
|
||||
procedure TColumnDlg.cbAutoSizeOnClick(Sender : TObject);
|
||||
begin
|
||||
if FSelectedIndex = -1 then Exit;
|
||||
ViewColumn := TViewColumn(FItems.Items[FSelectedIndex]);
|
||||
|
||||
ViewColumn.AutoSize := cbAutoSize.Checked;
|
||||
FColumns[FSelectedIndex].AutoSize := cbAutoSize.Checked;
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
@ -583,11 +583,11 @@ type
|
||||
function GetAttributes: TPropertyAttributes; override;
|
||||
end;
|
||||
|
||||
{ TViewColumnsPropertyEditor
|
||||
PropertyEditor editor for the TViewColumns properties.
|
||||
{ TListColumnsPropertyEditor
|
||||
PropertyEditor editor for the TListColumns properties.
|
||||
Brings up the dialog for entering test. }
|
||||
|
||||
TViewColumnsPropertyEditor = class(TClassPropertyEditor)
|
||||
TListColumnsPropertyEditor = class(TClassPropertyEditor)
|
||||
public
|
||||
procedure Edit; override;
|
||||
function GetAttributes: TPropertyAttributes; override;
|
||||
@ -817,7 +817,7 @@ type
|
||||
FTabOrder:integer;
|
||||
FCaption:TCaption;
|
||||
FLines:TStrings;
|
||||
FColumns: TViewColumns;
|
||||
FColumns: TListColumns;
|
||||
FModalResult:TModalResult;
|
||||
function PTypeInfos(const PropName:shortstring):PTypeInfo;
|
||||
constructor Create;
|
||||
@ -832,7 +832,7 @@ type
|
||||
property TabOrder:integer read FTabOrder;
|
||||
property Caption:TCaption read FCaption;
|
||||
property Lines:TStrings read FLines;
|
||||
property Columns:TViewColumns;
|
||||
property Columns:TListColumns;
|
||||
property ModalResult:TModalResult read FModalResult write FModalResult;
|
||||
end;
|
||||
|
||||
@ -2688,48 +2688,29 @@ begin
|
||||
Result := [paMultiSelect, paDialog, paRevertable, paReadOnly];
|
||||
end;
|
||||
|
||||
{ TViewColumnsPropertyEditor }
|
||||
{ TListColumnsPropertyEditor }
|
||||
|
||||
procedure TViewColumnsPropertyEditor.Edit;
|
||||
procedure TListColumnsPropertyEditor.Edit;
|
||||
var
|
||||
|
||||
ViewColumns : TViewColumns;
|
||||
Column : TViewColumn;
|
||||
ListColumns : TListColumns;
|
||||
Column : TListColumn;
|
||||
ColumnDlg: TColumnDlg;
|
||||
I,X : Integer;
|
||||
begin
|
||||
ColumnDlg:=TColumnDlg.Create(Application);
|
||||
try
|
||||
ViewColumns := TViewColumns(GetOrdValue);
|
||||
ColumnDlg.Clear;
|
||||
for I := 0 to ViewColumns.Count-1 do
|
||||
Begin
|
||||
X := ColumnDlg.Add(ViewColumns.Item[i].Caption);
|
||||
ColumnDlg.Item[x].Width :=ViewColumns.Item[i].Width;
|
||||
ColumnDlg.Item[x].Alignment :=ViewColumns.Item[i].Alignment;
|
||||
ColumnDlg.Item[x].Visible :=ViewColumns.Item[i].Visible;
|
||||
ColumnDlg.Item[x].AutoSize :=ViewColumns.Item[i].AutoSize;
|
||||
end;
|
||||
ListColumns := TListColumns(GetOrdValue);
|
||||
ColumnDlg.Columns.Assign(ListColumns);
|
||||
|
||||
if ColumnDlg.ShowModal = mrOK then
|
||||
Begin
|
||||
ViewColumns.Clear;
|
||||
for I := 0 to ColumnDlg.Count-1 do
|
||||
Begin
|
||||
Column := TViewColumn(ColumnDlg.Item[i]);
|
||||
X := ViewColumns.Add(Column.Caption);
|
||||
ViewColumns.Item[x].Width := Column.Width;
|
||||
ViewColumns.Item[x].Alignment := Column.Alignment;
|
||||
ViewColumns.Item[x].Visible := Column.Visible;
|
||||
ViewColumns.Item[x].AutoSize := Column.AutoSize;
|
||||
End;
|
||||
end;
|
||||
if ColumnDlg.ShowModal = mrOK
|
||||
then ListColumns.Assign(ColumnDlg.Columns);
|
||||
finally
|
||||
ColumnDlg.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TViewColumnsPropertyEditor.GetAttributes: TPropertyAttributes;
|
||||
function TListColumnsPropertyEditor.GetAttributes: TPropertyAttributes;
|
||||
begin
|
||||
Result := [paMultiSelect, paDialog, paRevertable, paReadOnly];
|
||||
end;
|
||||
@ -3067,8 +3048,8 @@ begin
|
||||
nil,'',TCaptionPropertyEditor);
|
||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TStrings'),
|
||||
nil,'',TStringsPropertyEditor);
|
||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TViewColumns'),
|
||||
nil,'',TViewColumnsPropertyEditor);
|
||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TListColumns'),
|
||||
nil,'',TListColumnsPropertyEditor);
|
||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TModalResult'),
|
||||
nil,'ModalResult',TModalResultPropertyEditor);
|
||||
end;
|
||||
|
@ -1,142 +0,0 @@
|
||||
unit breakpointsdlg;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, LResources, StdCtrls,Buttons,Extctrls,ComCtrls;
|
||||
|
||||
type
|
||||
TbpAction = (bpBreak);
|
||||
TBreakPointAddedEvent = procedure (sender : TObject; Expression : String) of Object;
|
||||
TBreakPointsdlg = class(TForm)
|
||||
ListView1: TListView;
|
||||
private
|
||||
{ private declarations }
|
||||
FOnBreakpointAddedEvent : TBreakPointAddedEvent;
|
||||
|
||||
protected
|
||||
Procedure ListView1KeyDown(Sender: TObject; var Key: Word; Shift:TShiftState);
|
||||
public
|
||||
{ public declarations }
|
||||
constructor Create(AOwner : TComponent); override;
|
||||
destructor Destroy; override;
|
||||
Procedure AddBreakPoint(UnitName : String; Line : Integer);
|
||||
Procedure DeleteBreakPoint(UnitName : String; Line : Integer);
|
||||
property OnBreakpointAddedEvent : TBreakPointAddedEvent read FOnBreakPointAddedEvent write FOnBreakPointAddedEvent;
|
||||
|
||||
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
|
||||
Breakpoints_Dlg : TBreakPointsDlg;
|
||||
// InsertWatch : TInsertWatch;
|
||||
implementation
|
||||
|
||||
constructor TBreakPointsdlg.Create(AOwner : TComponent);
|
||||
Begin
|
||||
inherited;
|
||||
if LazarusResources.Find(Classname)=nil then
|
||||
begin
|
||||
ListView1 := TListView.Create(self);
|
||||
with ListView1 do
|
||||
Begin
|
||||
Parent := self;
|
||||
Align := alClient;
|
||||
Visible := True;
|
||||
Name := 'ListView1';
|
||||
Columns.Clear;
|
||||
Columns.Updating := TRue;
|
||||
Columns.Add('Filename/Address');
|
||||
Columns.Add('Line/Length');
|
||||
Columns.Add('Condition');
|
||||
Columns.Add('Action');
|
||||
Columns.Add('Pass Count');
|
||||
Columns.Add('Group');
|
||||
Columns.Updating := False;
|
||||
//Example alignment of columns.
|
||||
// Columns.Item[1].Alignment := caRight;
|
||||
ViewStyle := vsReport;
|
||||
Sorted := True;
|
||||
OnKeyDown := @ListView1KeyDown;
|
||||
MultiSelect := True;
|
||||
end;
|
||||
//ListView does not accpet keys unless the mouse is held down over it
|
||||
//so temporarily I do this:
|
||||
OnKeyDown := @ListView1KeyDown;
|
||||
|
||||
Caption := 'Breakpoints';
|
||||
Name := 'BreakPointsDlg';
|
||||
Width := 350;
|
||||
Height := 100;
|
||||
|
||||
end;
|
||||
|
||||
|
||||
End;
|
||||
|
||||
destructor TBreakPointsDlg.Destroy;
|
||||
Begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
Procedure TBreakPointsDlg.AddBreakPoint(UnitName : String; Line : Integer);
|
||||
var
|
||||
LI : TListItem;
|
||||
Begin
|
||||
LI := ListView1.Items.Add;
|
||||
LI.Caption := UnitName;
|
||||
LI.SubItems.Add(Inttostr(line));
|
||||
LI.SubItems.Add('');
|
||||
LI.SubItems.Add('Break');
|
||||
LI.SubItems.Add('0');
|
||||
LI.SubItems.Add('');
|
||||
end;
|
||||
|
||||
|
||||
Procedure TBreakPointsDlg.DeleteBreakPoint(UnitName : String; Line : Integer);
|
||||
var
|
||||
LI : TListItem;
|
||||
I : Integer;
|
||||
Begin
|
||||
for I := 0 to ListView1.Items.Count-1 do
|
||||
Begin
|
||||
LI := ListView1.Items[i];
|
||||
if LI.Caption <> UnitName then Continue;
|
||||
if LI.SubItems.Strings[0] = inttostr(line) then
|
||||
begin
|
||||
ListView1.Items.Delete(i);
|
||||
Break;
|
||||
end;
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
Procedure TBreakPointsdlg.ListView1KeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
begin
|
||||
Writeln('ListView1 KeyDown!');
|
||||
end;
|
||||
|
||||
end.
|
||||
|
118
lcl/include/listcolumn.inc
Normal file
118
lcl/include/listcolumn.inc
Normal file
@ -0,0 +1,118 @@
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TListColumn }
|
||||
{------------------------------------------------------------------------------}
|
||||
|
||||
procedure TListColumn.Assign(ASource: TPersistent);
|
||||
var
|
||||
Col: TListColumn;
|
||||
begin
|
||||
if ASource is TListColumn
|
||||
then begin
|
||||
Col := TListColumn(ASource);
|
||||
FAlignment := Col.Alignment;
|
||||
FAutoSize := Col.AutoSize;
|
||||
FCaption := Col.Caption;
|
||||
FMaxWidth := Col.MaxWidth;
|
||||
FMinWidth := Col.MinWidth;
|
||||
FVisible := Col.Visible;
|
||||
FWidth := Col.Width;
|
||||
Changed(False);
|
||||
end
|
||||
else inherited Assign(ASource);
|
||||
end;
|
||||
|
||||
constructor TListColumn.Create(ACollection: TCollection);
|
||||
begin
|
||||
inherited;
|
||||
FAlignment := taLeftJustify;
|
||||
FCaption := '';
|
||||
FWidth := 50;
|
||||
FVisible := True;
|
||||
FMinWidth := 0;
|
||||
FMaxWidth := 0;
|
||||
FAutoSize := False;
|
||||
FTag := 0;
|
||||
Changed(False);
|
||||
end;
|
||||
|
||||
destructor TListColumn.Destroy;
|
||||
begin
|
||||
inherited;
|
||||
Changed(False);
|
||||
end;
|
||||
|
||||
function TListColumn.GetWidth: TWidth;
|
||||
begin
|
||||
// TODO: read actual width
|
||||
Result := FWidth;
|
||||
end;
|
||||
|
||||
procedure TListColumn.SetAlignment(const AValue: TAlignment);
|
||||
begin
|
||||
if FAlignment = AValue then Exit;
|
||||
|
||||
FAlignment := AValue;
|
||||
Changed(False);
|
||||
end;
|
||||
|
||||
procedure TListColumn.SetCaption(const AValue: String);
|
||||
begin
|
||||
if AValue = FCaption then Exit;
|
||||
|
||||
FCaption := AValue;
|
||||
Changed(False);
|
||||
end;
|
||||
|
||||
procedure TListColumn.SetWidth(const AValue: TWidth);
|
||||
begin
|
||||
if FWidth = AValue then Exit;
|
||||
|
||||
FWidth := AValue;
|
||||
Changed(False);
|
||||
end;
|
||||
|
||||
procedure TListColumn.SetMaxWidth(const AValue: TWidth);
|
||||
begin
|
||||
if FMaxWidth = AValue then Exit;
|
||||
|
||||
FMaxWidth := AValue;
|
||||
Changed(False);
|
||||
end;
|
||||
|
||||
procedure TListColumn.SetMinWidth(const AValue: TWidth);
|
||||
begin
|
||||
if FMinWidth = AValue then Exit;
|
||||
|
||||
FMinWidth := AValue;
|
||||
Changed(False);
|
||||
end;
|
||||
|
||||
procedure TListColumn.SetAutoSize(const AValue: Boolean);
|
||||
begin
|
||||
if FAutoSize = AValue then Exit;
|
||||
|
||||
FAutoSize := AValue;
|
||||
Changed(False);
|
||||
end;
|
||||
|
||||
procedure TListColumn.SetVisible(const AValue: Boolean);
|
||||
begin
|
||||
if FVisible = AValue then Exit;
|
||||
|
||||
FVisible := AValue;
|
||||
Changed(False);
|
||||
end;
|
||||
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.1 2002/03/12 23:55:37 lazarus
|
||||
MWE:
|
||||
* More delphi compatibility added/updated to TListView
|
||||
* Introduced TDebugger.locals
|
||||
* Moved breakpoints dialog to debugger dir
|
||||
* Changed breakpoints dialog to read from resource
|
||||
|
||||
}
|
||||
|
44
lcl/include/listcolumns.inc
Normal file
44
lcl/include/listcolumns.inc
Normal file
@ -0,0 +1,44 @@
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TListColumns }
|
||||
{------------------------------------------------------------------------------}
|
||||
function TListColumns.Add: TListColumn;
|
||||
Begin
|
||||
Result := TListColumn(inherited Add);
|
||||
end;
|
||||
|
||||
constructor TListColumns.Create(AOwner: TCustomListView);
|
||||
begin
|
||||
FOwner := AOwner;
|
||||
inherited Create(TListColumn);
|
||||
end;
|
||||
|
||||
function TListColumns.GetItem(const AIndex: Integer): TListColumn;
|
||||
begin
|
||||
Result := TListColumn(inherited GetItem(AIndex));
|
||||
end;
|
||||
|
||||
procedure TListColumns.SetItem(const AIndex: Integer; const AValue: TListColumn);
|
||||
begin
|
||||
inherited SetItem(AIndex, AValue);
|
||||
end;
|
||||
|
||||
procedure TListColumns.Update(AItem: TCollectionItem);
|
||||
begin
|
||||
//TODO: Optimize implementation by invoking individual upadates instead of
|
||||
// recreating window
|
||||
if FOwner <>nil
|
||||
then FOwner.ColumnsChanged;
|
||||
end;
|
||||
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.1 2002/03/12 23:55:37 lazarus
|
||||
MWE:
|
||||
* More delphi compatibility added/updated to TListView
|
||||
* Introduced TDebugger.locals
|
||||
* Moved breakpoints dialog to debugger dir
|
||||
* Changed breakpoints dialog to read from resource
|
||||
|
||||
}
|
||||
|
@ -1,84 +0,0 @@
|
||||
{ TViewColumn }
|
||||
|
||||
constructor TViewColumn.Create;
|
||||
begin
|
||||
inherited;
|
||||
FAlignment :=caLeft;
|
||||
FCaption := '';
|
||||
FWidth := 50;
|
||||
FVisible := True;
|
||||
FMinWidth := 0;
|
||||
FMaxWidth := 0;
|
||||
FAutoSize := False;
|
||||
end;
|
||||
|
||||
destructor TViewColumn.Destroy;
|
||||
begin
|
||||
Inherited;
|
||||
end;
|
||||
|
||||
procedure TViewColumn.SetAlignment(const AValue: TColumnAlignment);
|
||||
begin
|
||||
if FAlignment = AValue then Exit;
|
||||
|
||||
FAlignment := AValue;
|
||||
if Assigned(OnChange) then
|
||||
OnChange(self);
|
||||
end;
|
||||
|
||||
procedure TViewColumn.SetCaption(const AValue: String);
|
||||
begin
|
||||
if AValue = FCaption then Exit;
|
||||
|
||||
FCaption := AValue;
|
||||
if Assigned(OnChange) then
|
||||
OnChange(self);
|
||||
end;
|
||||
|
||||
procedure TViewColumn.SetWidth(const AValue: Integer);
|
||||
begin
|
||||
if FWidth = AValue then Exit;
|
||||
|
||||
FWidth := AValue;
|
||||
if Assigned(OnChange) then
|
||||
OnChange(self);
|
||||
end;
|
||||
|
||||
procedure TViewColumn.SetMaxWidth(const AValue: Integer);
|
||||
begin
|
||||
if FMaxWidth = AValue then Exit;
|
||||
|
||||
FMaxWidth := AValue;
|
||||
if Assigned(OnChange) then
|
||||
OnChange(self);
|
||||
|
||||
end;
|
||||
|
||||
procedure TViewColumn.SetMinWidth(const AValue: Integer);
|
||||
begin
|
||||
if FMinWidth = AValue then Exit;
|
||||
|
||||
FMinWidth := AValue;
|
||||
if Assigned(OnChange) then
|
||||
OnChange(self);
|
||||
|
||||
end;
|
||||
|
||||
procedure TViewColumn.SetAutoSize(const AValue: Boolean);
|
||||
begin
|
||||
if FAutoSize = AValue then Exit;
|
||||
|
||||
FAutoSize := AValue;
|
||||
if Assigned(OnChange) then
|
||||
OnChange(self);
|
||||
end;
|
||||
|
||||
procedure TViewColumn.SetVisible(const AValue: Boolean);
|
||||
begin
|
||||
if FVisible = AValue then Exit;
|
||||
|
||||
FVisible := AValue;
|
||||
if Assigned(OnChange) then
|
||||
OnChange(self);
|
||||
end;
|
||||
|
@ -1,82 +0,0 @@
|
||||
constructor TViewColumns.Create(Aowner : TCustomListView);
|
||||
Begin
|
||||
inherited Create;
|
||||
FItems := TList.Create;
|
||||
ListView := AOwner;
|
||||
FUpdating := False;
|
||||
end;
|
||||
|
||||
Function TViewColumns.Add(const S : String): Integer;
|
||||
var
|
||||
VC : TViewColumn;
|
||||
Begin
|
||||
VC := TViewColumn.Create;
|
||||
VC.Caption := S;
|
||||
VC.OnChange := @ColumnChanged;
|
||||
Result := FItems.Add(VC);
|
||||
if Assigned(OnChange) then
|
||||
OnChange(self);
|
||||
end;
|
||||
|
||||
Procedure TViewColumns.Delete(Index : Integer);
|
||||
Begin
|
||||
if Index > FItems.Count-1 then exit;
|
||||
TViewColumn(FItems.Items[index]).Free;
|
||||
FItems.Delete(Index);
|
||||
if Assigned(OnChange) then
|
||||
OnChange(self);
|
||||
end;
|
||||
|
||||
|
||||
Destructor TViewColumns.Destroy;
|
||||
var i: integer;
|
||||
begin
|
||||
for i:=0 to FItems.Count-1 do
|
||||
TViewColumn(FItems.Items[i]).Free;
|
||||
FItems.Free;
|
||||
Inherited;
|
||||
end;
|
||||
|
||||
function TViewColumns.GetItem(Index : Integer): TViewColumn;
|
||||
begin
|
||||
Result := nil;
|
||||
if Index > FItems.Count-1 then exit;
|
||||
Result := TViewColumn(FItems.Items[Index]);
|
||||
end;
|
||||
|
||||
Procedure TViewColumns.ColumnChanged(Sender : TObject);
|
||||
begin
|
||||
if not FUpdating then
|
||||
if Assigned(OnChange) then
|
||||
OnChange(self);
|
||||
end;
|
||||
|
||||
function TViewColumns.GetCount: Integer;
|
||||
begin
|
||||
result := FItems.Count;
|
||||
end;
|
||||
|
||||
Procedure TViewColumns.Clear;
|
||||
var
|
||||
I : Integer;
|
||||
begin
|
||||
Updating := True;
|
||||
For I := 0 to FItems.Count-1 do
|
||||
TViewColumns(FItems.Items[i]).Free;
|
||||
FItems.Clear;
|
||||
Updating := False;
|
||||
end;
|
||||
|
||||
procedure TViewColumns.SetUpdating(const AValue: Boolean);
|
||||
begin
|
||||
if FUpdating and Not AValue then
|
||||
Begin
|
||||
FUpdating := AValue; //false
|
||||
ColumnChanged(self);
|
||||
end
|
||||
else
|
||||
FUpdating := AValue;
|
||||
end;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user