mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-25 11:19:40 +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/synhighlighterperl.pas svneol=native#text/pascal
|
||||||
components/synedit/synhighlighterxml.pas svneol=native#text/pascal
|
components/synedit/synhighlighterxml.pas svneol=native#text/pascal
|
||||||
components/synedit/syntextdrawer.pp 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/cmdlinedebugger.pp svneol=native#text/pascal
|
||||||
debugger/dbgbreakpoint.pp svneol=native#text/pascal
|
debugger/dbgbreakpoint.pp svneol=native#text/pascal
|
||||||
debugger/dbgoutputform.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/debugger.pp svneol=native#text/pascal
|
||||||
debugger/gdbdebugger.pp svneol=native#text/pascal
|
debugger/gdbdebugger.pp svneol=native#text/pascal
|
||||||
debugger/gdbmidebugger.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/tdbgoutputform.lfm svneol=native#text/plain
|
||||||
debugger/test/debugtest.pp svneol=native#text/pascal
|
debugger/test/debugtest.pp svneol=native#text/pascal
|
||||||
debugger/test/debugtestform.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/testtools.inc svneol=native#text/pascal
|
||||||
examples/toolbar.pp svneol=native#text/pascal
|
examples/toolbar.pp svneol=native#text/pascal
|
||||||
examples/trackbar.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/buildlazdialog.pas svneol=native#text/pascal
|
||||||
ide/codetemplatedialog.pp svneol=native#text/pascal
|
ide/codetemplatedialog.pp svneol=native#text/pascal
|
||||||
ide/codetoolsoptions.pas 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/imglist.inc svneol=native#text/pascal
|
||||||
lcl/include/inputdialog.inc svneol=native#text/pascal
|
lcl/include/inputdialog.inc svneol=native#text/pascal
|
||||||
lcl/include/interfacebase.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/listitem.inc svneol=native#text/pascal
|
||||||
lcl/include/listitems.inc svneol=native#text/pascal
|
lcl/include/listitems.inc svneol=native#text/pascal
|
||||||
lcl/include/mainmenu.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/toolwindow.inc svneol=native#text/pascal
|
||||||
lcl/include/trackbar.inc svneol=native#text/pascal
|
lcl/include/trackbar.inc svneol=native#text/pascal
|
||||||
lcl/include/treeview.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/winapi.inc svneol=native#text/pascal
|
||||||
lcl/include/winapih.inc svneol=native#text/pascal
|
lcl/include/winapih.inc svneol=native#text/pascal
|
||||||
lcl/include/wincontrol.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
|
uses
|
||||||
Classes, Forms, DebugTestForm;
|
Classes, Forms, DebugTestForm, BreakpointsDlg;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Application.Initialize;
|
Application.Initialize;
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
unit TestWait;
|
unit TestWait;
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
interface
|
interface
|
||||||
|
|
||||||
procedure Wait(const ATime: Integer);
|
type
|
||||||
|
TWait = class
|
||||||
|
constructor Create(const ATime: Integer);
|
||||||
|
procedure Wait(const ATime: Integer);
|
||||||
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -16,7 +20,21 @@ begin
|
|||||||
time := now;
|
time := now;
|
||||||
while (now - time) * SecsPerDay < ATime do;
|
while (now - time) * SecsPerDay < ATime do;
|
||||||
end;
|
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
|
var
|
||||||
n: Integer;
|
n: Integer;
|
||||||
|
@ -9,6 +9,7 @@ uses
|
|||||||
StdCtrls, Buttons, ExtCtrls;
|
StdCtrls, Buttons, ExtCtrls;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
// TODO create more generic collection editor.
|
||||||
TColumnDlg = class(TForm)
|
TColumnDlg = class(TForm)
|
||||||
Listbox1: TLISTBOX;
|
Listbox1: TLISTBOX;
|
||||||
Label1: TLABEL;
|
Label1: TLABEL;
|
||||||
@ -26,11 +27,10 @@ type
|
|||||||
cbAutoSize : TCheckBox;
|
cbAutoSize : TCheckBox;
|
||||||
private
|
private
|
||||||
{ private declarations }
|
{ private declarations }
|
||||||
FItems : TList;
|
FColumns: TListColumns;
|
||||||
FSelectedIndex : Integer;
|
FSelectedIndex : Integer;
|
||||||
function GetCount: Integer;
|
procedure DisplayColumn(Value : Integer);
|
||||||
function GetItem(Index : Integer): TViewColumn;
|
procedure SetColumns(const AValue: TListColumns);
|
||||||
Procedure DisplayColumn(Value : Integer);
|
|
||||||
protected
|
protected
|
||||||
procedure Button1OnClick(sender : TObject);
|
procedure Button1OnClick(sender : TObject);
|
||||||
procedure Button2OnClick(sender : TObject);
|
procedure Button2OnClick(sender : TObject);
|
||||||
@ -46,11 +46,7 @@ type
|
|||||||
public
|
public
|
||||||
{ public declarations }
|
{ public declarations }
|
||||||
constructor Create(AOwner : TComponent); override;
|
constructor Create(AOwner : TComponent); override;
|
||||||
procedure Clear;
|
property Columns: TListColumns read FColumns write SetColumns;
|
||||||
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;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -234,21 +230,20 @@ Begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
FItems := TList.Create;
|
FColumns := TListColumns.Create(nil);
|
||||||
FSelectedIndex:= -1;
|
FSelectedIndex:= -1;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TColumnDlg.Button1OnClick(sender : TObject);
|
procedure TColumnDlg.Button1OnClick(sender : TObject);
|
||||||
var
|
var
|
||||||
ViewColumn : TViewColumn;
|
Column : TListColumn;
|
||||||
Begin
|
Begin
|
||||||
//add
|
//add
|
||||||
ViewColumn := TViewColumn.Create;
|
Column := FColumns.Add;
|
||||||
ViewColumn.Caption := 'Caption';
|
Column.Caption := 'Caption';
|
||||||
FSelectedIndex := FItems.Add(ViewColumn);
|
FSelectedIndex := Column.Index;
|
||||||
Listbox1.Items.Add(ViewColumn.Caption);
|
Listbox1.Items.Add(Column.Caption);
|
||||||
Listbox1.Selected[FSelectedIndex] := True;
|
Listbox1.Selected[FSelectedIndex] := True;
|
||||||
DisplayColumn(FSelectedIndex);
|
DisplayColumn(FSelectedIndex);
|
||||||
end;
|
end;
|
||||||
@ -270,26 +265,26 @@ end;
|
|||||||
|
|
||||||
Procedure TColumnDlg.Edit1OnChange(Sender : TObject);
|
Procedure TColumnDlg.Edit1OnChange(Sender : TObject);
|
||||||
Var
|
Var
|
||||||
ViewColumn : TViewColumn;
|
ListColumn : TListColumn;
|
||||||
begin
|
begin
|
||||||
if FSelectedIndex = -1 then Exit;
|
if FSelectedIndex = -1 then Exit;
|
||||||
ViewColumn := TViewColumn(FItems.Items[FSelectedIndex]);
|
ListColumn := FColumns[FSelectedIndex];
|
||||||
ViewColumn.Caption := Edit1.Caption;
|
ListColumn.Caption := Edit1.Caption;
|
||||||
Listbox1.Items[FSelectedIndex] := Edit1.Caption;
|
Listbox1.Items[FSelectedIndex] := Edit1.Caption;
|
||||||
Listbox1.Selected[FSelectedIndex] := True;
|
Listbox1.Selected[FSelectedIndex] := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure TColumnDlg.Edit2OnChange(Sender : TObject);
|
Procedure TColumnDlg.Edit2OnChange(Sender : TObject);
|
||||||
Var
|
Var
|
||||||
ViewColumn : TViewColumn;
|
ListColumn : TListColumn;
|
||||||
begin
|
begin
|
||||||
if FSelectedIndex = -1 then Exit;
|
if FSelectedIndex = -1 then Exit;
|
||||||
ViewColumn := TViewColumn(FItems.Items[FSelectedIndex]);
|
ListColumn := FColumns[FSelectedIndex];
|
||||||
if Edit2.Caption = '' then
|
if Edit2.Caption = '' then
|
||||||
ViewColumn.Width := 0
|
ListColumn.Width := 0
|
||||||
else
|
else
|
||||||
try
|
try
|
||||||
ViewColumn.Width := StrtoInt(Edit2.Caption);
|
ListColumn.Width := StrtoInt(Edit2.Caption);
|
||||||
except
|
except
|
||||||
raise Exception.Create('Invalid numeric Value');
|
raise Exception.Create('Invalid numeric Value');
|
||||||
Edit2.Caption := '0';
|
Edit2.Caption := '0';
|
||||||
@ -302,39 +297,37 @@ var
|
|||||||
begin
|
begin
|
||||||
//delete
|
//delete
|
||||||
if FSelectedIndex = -1 then Exit;
|
if FSelectedIndex = -1 then Exit;
|
||||||
|
|
||||||
Index := FSelectedIndex;
|
Index := FSelectedIndex;
|
||||||
FSelectedIndex := -1;
|
FSelectedIndex := -1;
|
||||||
FItems.Delete(Index);
|
FColumns[Index].Free;
|
||||||
Listbox1.Items.Delete(Index);
|
Listbox1.Items.Delete(Index);
|
||||||
if Index > 0 then
|
if Index > 0 then
|
||||||
Listbox1.Selected[Index-1] := True;
|
Listbox1.Selected[Index-1] := True;
|
||||||
DisplayColumn(Index-1);
|
DisplayColumn(Index-1);
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TColumnDlg.Button3OnClick(sender : TObject);
|
procedure TColumnDlg.Button3OnClick(sender : TObject);
|
||||||
Var
|
Var
|
||||||
ViewColumn : TViewColumn;
|
ListColumn : TListColumn;
|
||||||
Index : Integer;
|
Index : Integer;
|
||||||
begin
|
begin
|
||||||
//move up
|
//move up
|
||||||
if FSelectedIndex <= 0 then Exit;
|
if FSelectedIndex <= 0 then Exit;
|
||||||
Index := FSelectedIndex;
|
Index := FSelectedIndex;
|
||||||
FSelectedIndex := -1;
|
FSelectedIndex := -1;
|
||||||
ViewColumn := TViewColumn(FItems.Items[Index]);
|
ListColumn := FColumns[Index];
|
||||||
|
ListColumn.Index := Index - 1;
|
||||||
|
|
||||||
FItems.Insert(Index-1,ViewColumn);
|
Listbox1.Items.Insert(Index-1,ListColumn.Caption);
|
||||||
FItems.Delete(Index+1);
|
|
||||||
Listbox1.Items.Insert(Index-1,ViewColumn.Caption);
|
|
||||||
Listbox1.Items.Delete(Index+1);
|
Listbox1.Items.Delete(Index+1);
|
||||||
Listbox1.Selected[Index-1] := True;
|
Listbox1.Selected[Index-1] := True;
|
||||||
DisplayColumn(Index-1);
|
DisplayColumn(Index-1);
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TColumnDlg.Button4OnClick(sender : TObject);
|
procedure TColumnDlg.Button4OnClick(sender : TObject);
|
||||||
Var
|
Var
|
||||||
ViewColumn : TViewColumn;
|
ListColumn : TListColumn;
|
||||||
Index : Integer;
|
Index : Integer;
|
||||||
begin
|
begin
|
||||||
//move down
|
//move down
|
||||||
@ -344,11 +337,10 @@ begin
|
|||||||
Index := FSelectedIndex;
|
Index := FSelectedIndex;
|
||||||
FSelectedIndex := -1;
|
FSelectedIndex := -1;
|
||||||
|
|
||||||
ViewColumn := TViewColumn(FItems.Items[Index]);
|
ListColumn := FColumns[Index];
|
||||||
|
ListColumn.Index := Index + 1;
|
||||||
|
|
||||||
FItems.Insert(Index+2,ViewColumn);
|
Listbox1.Items.Insert(Index+2,ListColumn.Caption);
|
||||||
FItems.Delete(Index);
|
|
||||||
Listbox1.Items.Insert(Index+2,ViewColumn.Caption);
|
|
||||||
Listbox1.Items.Delete(Index);
|
Listbox1.Items.Delete(Index);
|
||||||
Listbox1.Selected[Index+1] := True;
|
Listbox1.Selected[Index+1] := True;
|
||||||
DisplayColumn(Index+1);
|
DisplayColumn(Index+1);
|
||||||
@ -356,107 +348,71 @@ end;
|
|||||||
|
|
||||||
Procedure TColumnDlg.DisplayColumn(Value : Integer);
|
Procedure TColumnDlg.DisplayColumn(Value : Integer);
|
||||||
Var
|
Var
|
||||||
ViewColumn : TViewColumn;
|
ListColumn : TListColumn;
|
||||||
begin
|
begin
|
||||||
FSelectedIndex := -1;
|
FSelectedIndex := -1;
|
||||||
if Value = -1 then exit;
|
if Value = -1 then exit;
|
||||||
|
|
||||||
ViewColumn := TViewColumn(FItems.Items[Value]);
|
ListColumn := FColumns[Value];
|
||||||
Edit1.Caption := ViewColumn.Caption;
|
Edit1.Caption := ListColumn.Caption;
|
||||||
Edit2.Caption := Inttostr(ViewColumn.Width);
|
Edit2.Caption := Inttostr(Integer(ListColumn.Width));
|
||||||
|
|
||||||
case ViewColumn.Alignment of
|
case ListColumn.Alignment of
|
||||||
caLEft : RadioGroup1.ItemIndex := 0;
|
taLeftJustify : RadioGroup1.ItemIndex := 0;
|
||||||
caCenter:RadioGroup1.ItemIndex := 1;
|
taCenter: RadioGroup1.ItemIndex := 1;
|
||||||
caRight : RadioGroup1.ItemIndex := 2;
|
taRightJustify : RadioGroup1.ItemIndex := 2;
|
||||||
end; //case
|
end; //case
|
||||||
|
|
||||||
cbVisible.Checked := ViewColumn.Visible;
|
cbVisible.Checked := ListColumn.Visible;
|
||||||
cbAutoSize.Checked := ViewColumn.AutoSize;
|
cbAutoSize.Checked := ListColumn.AutoSize;
|
||||||
|
|
||||||
|
|
||||||
FSelectedIndex := Value;
|
FSelectedIndex := Value;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TColumnDlg.SetColumns(const AValue: TListColumns);
|
||||||
|
begin
|
||||||
|
FColumns.Assign(AValue);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TColumnDlg.RadioGroup1OnClick(sender : TObject);
|
procedure TColumnDlg.RadioGroup1OnClick(sender : TObject);
|
||||||
Var
|
Var
|
||||||
ViewColumn : TViewColumn;
|
ListColumn : TListColumn;
|
||||||
begin
|
begin
|
||||||
if FSelectedIndex = -1 then Exit;
|
if FSelectedIndex = -1 then Exit;
|
||||||
ViewColumn := TViewColumn(FItems.Items[FSelectedIndex]);
|
ListColumn := FColumns[FSelectedIndex];
|
||||||
case RadioGroup1.ItemIndex of
|
case RadioGroup1.ItemIndex of
|
||||||
0 : ViewColumn.Alignment := caLeft;
|
0 : ListColumn.Alignment := taLeftJustify;
|
||||||
1 : ViewColumn.Alignment := caCenter;
|
1 : ListColumn.Alignment := taCenter;
|
||||||
2 : ViewColumn.Alignment := caRight;
|
2 : ListColumn.Alignment := taRightJustify;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure TColumnDlg.FormOnShow(Sender : TObject);
|
Procedure TColumnDlg.FormOnShow(Sender : TObject);
|
||||||
var
|
var
|
||||||
I : Integer;
|
I : Integer;
|
||||||
ViewColumn : TViewColumn;
|
|
||||||
begin
|
begin
|
||||||
//clear the listbox and display the items if any...
|
//clear the listbox and display the items if any...
|
||||||
Listbox1.Items.Clear;
|
Listbox1.Items.Clear;
|
||||||
for I := 0 to FItems.Count-1 do
|
for I := 0 to FColumns.Count-1 do
|
||||||
Begin
|
Listbox1.Items.Add(FColumns[i].Caption);
|
||||||
ViewColumn := TViewColumn(FItems.Items[I]);
|
|
||||||
Listbox1.Items.Add(ViewColumn.Caption);
|
|
||||||
end;
|
|
||||||
if Listbox1.Items.Count > 0 then
|
if Listbox1.Items.Count > 0 then
|
||||||
begin
|
begin
|
||||||
Listbox1.Selected[0] := True;
|
Listbox1.Selected[0] := True;
|
||||||
DisplayColumn(0);
|
DisplayColumn(0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TColumnDlg.Clear;
|
procedure TColumnDlg.cbVisibleOnClick(Sender : TObject);
|
||||||
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;
|
|
||||||
begin
|
begin
|
||||||
if FSelectedIndex = -1 then Exit;
|
if FSelectedIndex = -1 then Exit;
|
||||||
ViewColumn := TViewColumn(FItems.Items[FSelectedIndex]);
|
FColumns[FSelectedIndex].Visible := cbVisible.Checked;
|
||||||
|
|
||||||
ViewColumn.Visible := cbVisible.Checked;
|
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure TColumnDlg.cbAutoSizeOnClick(Sender : TObject);
|
procedure TColumnDlg.cbAutoSizeOnClick(Sender : TObject);
|
||||||
Var
|
|
||||||
ViewColumn : TViewColumn;
|
|
||||||
begin
|
begin
|
||||||
if FSelectedIndex = -1 then Exit;
|
if FSelectedIndex = -1 then Exit;
|
||||||
ViewColumn := TViewColumn(FItems.Items[FSelectedIndex]);
|
FColumns[FSelectedIndex].AutoSize := cbAutoSize.Checked;
|
||||||
|
|
||||||
ViewColumn.AutoSize := cbAutoSize.Checked;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
@ -583,11 +583,11 @@ type
|
|||||||
function GetAttributes: TPropertyAttributes; override;
|
function GetAttributes: TPropertyAttributes; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TViewColumnsPropertyEditor
|
{ TListColumnsPropertyEditor
|
||||||
PropertyEditor editor for the TViewColumns properties.
|
PropertyEditor editor for the TListColumns properties.
|
||||||
Brings up the dialog for entering test. }
|
Brings up the dialog for entering test. }
|
||||||
|
|
||||||
TViewColumnsPropertyEditor = class(TClassPropertyEditor)
|
TListColumnsPropertyEditor = class(TClassPropertyEditor)
|
||||||
public
|
public
|
||||||
procedure Edit; override;
|
procedure Edit; override;
|
||||||
function GetAttributes: TPropertyAttributes; override;
|
function GetAttributes: TPropertyAttributes; override;
|
||||||
@ -817,7 +817,7 @@ type
|
|||||||
FTabOrder:integer;
|
FTabOrder:integer;
|
||||||
FCaption:TCaption;
|
FCaption:TCaption;
|
||||||
FLines:TStrings;
|
FLines:TStrings;
|
||||||
FColumns: TViewColumns;
|
FColumns: TListColumns;
|
||||||
FModalResult:TModalResult;
|
FModalResult:TModalResult;
|
||||||
function PTypeInfos(const PropName:shortstring):PTypeInfo;
|
function PTypeInfos(const PropName:shortstring):PTypeInfo;
|
||||||
constructor Create;
|
constructor Create;
|
||||||
@ -832,7 +832,7 @@ type
|
|||||||
property TabOrder:integer read FTabOrder;
|
property TabOrder:integer read FTabOrder;
|
||||||
property Caption:TCaption read FCaption;
|
property Caption:TCaption read FCaption;
|
||||||
property Lines:TStrings read FLines;
|
property Lines:TStrings read FLines;
|
||||||
property Columns:TViewColumns;
|
property Columns:TListColumns;
|
||||||
property ModalResult:TModalResult read FModalResult write FModalResult;
|
property ModalResult:TModalResult read FModalResult write FModalResult;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2688,48 +2688,29 @@ begin
|
|||||||
Result := [paMultiSelect, paDialog, paRevertable, paReadOnly];
|
Result := [paMultiSelect, paDialog, paRevertable, paReadOnly];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TViewColumnsPropertyEditor }
|
{ TListColumnsPropertyEditor }
|
||||||
|
|
||||||
procedure TViewColumnsPropertyEditor.Edit;
|
procedure TListColumnsPropertyEditor.Edit;
|
||||||
var
|
var
|
||||||
|
|
||||||
ViewColumns : TViewColumns;
|
ListColumns : TListColumns;
|
||||||
Column : TViewColumn;
|
Column : TListColumn;
|
||||||
ColumnDlg: TColumnDlg;
|
ColumnDlg: TColumnDlg;
|
||||||
I,X : Integer;
|
I,X : Integer;
|
||||||
begin
|
begin
|
||||||
ColumnDlg:=TColumnDlg.Create(Application);
|
ColumnDlg:=TColumnDlg.Create(Application);
|
||||||
try
|
try
|
||||||
ViewColumns := TViewColumns(GetOrdValue);
|
ListColumns := TListColumns(GetOrdValue);
|
||||||
ColumnDlg.Clear;
|
ColumnDlg.Columns.Assign(ListColumns);
|
||||||
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;
|
|
||||||
|
|
||||||
if ColumnDlg.ShowModal = mrOK then
|
if ColumnDlg.ShowModal = mrOK
|
||||||
Begin
|
then ListColumns.Assign(ColumnDlg.Columns);
|
||||||
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;
|
|
||||||
finally
|
finally
|
||||||
ColumnDlg.Free;
|
ColumnDlg.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TViewColumnsPropertyEditor.GetAttributes: TPropertyAttributes;
|
function TListColumnsPropertyEditor.GetAttributes: TPropertyAttributes;
|
||||||
begin
|
begin
|
||||||
Result := [paMultiSelect, paDialog, paRevertable, paReadOnly];
|
Result := [paMultiSelect, paDialog, paRevertable, paReadOnly];
|
||||||
end;
|
end;
|
||||||
@ -3067,8 +3048,8 @@ begin
|
|||||||
nil,'',TCaptionPropertyEditor);
|
nil,'',TCaptionPropertyEditor);
|
||||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TStrings'),
|
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TStrings'),
|
||||||
nil,'',TStringsPropertyEditor);
|
nil,'',TStringsPropertyEditor);
|
||||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TViewColumns'),
|
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TListColumns'),
|
||||||
nil,'',TViewColumnsPropertyEditor);
|
nil,'',TListColumnsPropertyEditor);
|
||||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TModalResult'),
|
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TModalResult'),
|
||||||
nil,'ModalResult',TModalResultPropertyEditor);
|
nil,'ModalResult',TModalResultPropertyEditor);
|
||||||
end;
|
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