* small improvements on componentlist form by Marius

git-svn-id: trunk@13135 -
This commit is contained in:
marc 2007-12-03 23:57:17 +00:00
parent aab042f968
commit f0c0d91fca
3 changed files with 133 additions and 130 deletions

View File

@ -1,36 +1,37 @@
object ComponentListForm: TComponentListForm
Left = 288
Left = 37
Height = 555
Top = 221
Width = 232
HorzScrollBar.Page = 231
Top = 172
Width = 231
HorzScrollBar.Page = 230
VertScrollBar.Page = 554
ActiveControl = CloseButton
ActiveControl = PatternEdit
Caption = 'Components'
ClientHeight = 555
ClientWidth = 232
ClientWidth = 231
KeyPreview = True
OnKeyDown = FormKeyDown
OnShow = FormShow
object Panel1: TPanel
Height = 555
Width = 232
Width = 231
Align = alClient
BevelOuter = bvLowered
Caption = 'Panel1'
ClientHeight = 555
ClientWidth = 232
ClientWidth = 231
TabOrder = 0
object Panel2: TPanel
Left = 1
Height = 36
Top = 518
Width = 230
Width = 229
Align = alBottom
ClientHeight = 36
ClientWidth = 230
ClientWidth = 229
TabOrder = 0
object CloseButton: TButton
Left = 145
Left = 144
Height = 26
Top = 4
Width = 73
@ -45,11 +46,11 @@ object ComponentListForm: TComponentListForm
Left = 1
Height = 38
Top = 1
Width = 230
Width = 229
Align = alTop
BorderWidth = 8
ClientHeight = 38
ClientWidth = 230
ClientWidth = 229
TabOrder = 1
object LabelSearch: TLabel
Left = 5
@ -63,7 +64,7 @@ object ComponentListForm: TComponentListForm
Left = 71
Height = 23
Top = 8
Width = 118
Width = 117
Anchors = [akTop, akLeft, akRight]
OnChange = UpdateComponentSelection
TabOrder = 0
@ -73,38 +74,38 @@ object ComponentListForm: TComponentListForm
Left = 1
Height = 479
Top = 39
Width = 230
Width = 229
Align = alClient
ClientHeight = 479
ClientWidth = 230
ClientWidth = 229
TabOrder = 2
object PageControl: TPageControl
Left = 1
Height = 477
Top = 1
Width = 228
ActivePage = TabSheetInheritance
Width = 227
ActivePage = TabSheetListBox
Align = alClient
TabIndex = 2
TabIndex = 0
TabOrder = 0
object TabSheetListBox: TTabSheet
Caption = 'List'
ClientHeight = 477
ClientWidth = 228
ClientHeight = 447
ClientWidth = 223
object Panel7: TPanel
Height = 477
Width = 228
Height = 447
Width = 223
Align = alClient
BevelOuter = bvNone
BorderWidth = 5
ClientHeight = 477
ClientWidth = 228
ClientHeight = 447
ClientWidth = 223
TabOrder = 0
object ListboxComponents: TListBox
Left = 5
Height = 467
Height = 437
Top = 5
Width = 218
Width = 213
Align = alClient
OnDblClick = ListboxComponentsDblClick
Sorted = True
@ -115,57 +116,56 @@ object ComponentListForm: TComponentListForm
end
object TabSheetPaletteTree: TTabSheet
Caption = 'Palette'
ClientHeight = 447
ClientWidth = 224
ClientHeight = 477
ClientWidth = 227
object Panel5: TPanel
Height = 447
Width = 224
Height = 477
Width = 227
Align = alClient
BevelOuter = bvNone
BorderWidth = 5
ClientHeight = 447
ClientWidth = 224
ClientHeight = 477
ClientWidth = 227
TabOrder = 0
object TreePallette: TTreeView
Left = 5
Height = 437
Height = 467
Top = 5
Width = 214
Width = 217
Align = alClient
DefaultItemHeight = 14
ReadOnly = True
ShowLines = False
TabOrder = 0
OnCollapsing = TreePalletteCollapsing
OnDblClick = TreePalletteDblClick
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips]
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowRoot, tvoToolTips, tvoNoDoubleClickExpand]
end
end
end
object TabSheetInheritance: TTabSheet
Caption = 'Inheritance'
ClientHeight = 447
ClientWidth = 224
ClientWidth = 223
object Panel6: TPanel
Height = 447
Width = 224
Width = 223
Align = alClient
BevelOuter = bvNone
BorderWidth = 5
ClientHeight = 447
ClientWidth = 224
ClientWidth = 223
TabOrder = 0
object TreeInheritance: TTreeView
Left = 5
Height = 437
Top = 5
Width = 214
Width = 213
Align = alClient
DefaultItemHeight = 14
ReadOnly = True
TabOrder = 0
OnCollapsing = TreePalletteCollapsing
OnDblClick = TreeInheritanceDblClick
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips]
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips, tvoNoDoubleClickExpand]
end
end
end

View File

@ -1,54 +1,54 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TComponentListForm','FORMDATA',[
'TPF0'#18'TComponentListForm'#17'ComponentListForm'#4'Left'#3' '#1#6'Height'#3
+'+'#2#3'Top'#3#221#0#5'Width'#3#232#0#18'HorzScrollBar.Page'#3#231#0#18'Vert'
+'ScrollBar.Page'#3'*'#2#13'ActiveControl'#7#11'CloseButton'#7'Caption'#6#10
+'Components'#12'ClientHeight'#3'+'#2#11'ClientWidth'#3#232#0#10'KeyPreview'#9
+#9'OnKeyDown'#7#11'FormKeyDown'#0#6'TPanel'#6'Panel1'#6'Height'#3'+'#2#5'Wid'
+'th'#3#232#0#5'Align'#7#8'alClient'#10'BevelOuter'#7#9'bvLowered'#7'Caption'
+#6#6'Panel1'#12'ClientHeight'#3'+'#2#11'ClientWidth'#3#232#0#8'TabOrder'#2#0
+#0#6'TPanel'#6'Panel2'#4'Left'#2#1#6'Height'#2'$'#3'Top'#3#6#2#5'Width'#3#230
+#0#5'Align'#7#8'alBottom'#12'ClientHeight'#2'$'#11'ClientWidth'#3#230#0#8'Ta'
+'bOrder'#2#0#0#7'TButton'#11'CloseButton'#4'Left'#3#145#0#6'Height'#2#26#3'T'
+'op'#2#4#5'Width'#2'I'#7'Anchors'#11#7'akRight'#8'akBottom'#0#8'AutoSize'#9#7
+'Caption'#6#11'CloseButton'#7'OnClick'#7#16'CloseButtonClick'#8'TabOrder'#2#0
+#0#0#0#6'TPanel'#6'Panel3'#4'Left'#2#1#6'Height'#2'&'#3'Top'#2#1#5'Width'#3
+#230#0#5'Align'#7#5'alTop'#11'BorderWidth'#2#8#12'ClientHeight'#2'&'#11'Clie'
+'ntWidth'#3#230#0#8'TabOrder'#2#1#0#6'TLabel'#11'LabelSearch'#4'Left'#2#5#6
+'Height'#2#14#3'Top'#2#12#5'Width'#2';'#7'Caption'#6#11'LabelSearch'#11'Pare'
+'ntColor'#8#0#0#5'TEdit'#11'PatternEdit'#4'Left'#2'G'#6'Height'#2#23#3'Top'#2
+#8#5'Width'#2'v'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'OnChange'#7
+#24'UpdateComponentSelection'#8'TabOrder'#2#0#0#0#0#6'TPanel'#6'Panel4'#4'Le'
+'ft'#2#1#6'Height'#3#223#1#3'Top'#2''''#5'Width'#3#230#0#5'Align'#7#8'alClie'
+'nt'#12'ClientHeight'#3#223#1#11'ClientWidth'#3#230#0#8'TabOrder'#2#2#0#12'T'
+'PageControl'#11'PageControl'#4'Left'#2#1#6'Height'#3#221#1#3'Top'#2#1#5'Wid'
+'th'#3#228#0#10'ActivePage'#7#19'TabSheetInheritance'#5'Align'#7#8'alClient'
+#8'TabIndex'#2#2#8'TabOrder'#2#0#0#9'TTabSheet'#15'TabSheetListBox'#7'Captio'
+'n'#6#4'List'#12'ClientHeight'#3#221#1#11'ClientWidth'#3#228#0#0#6'TPanel'#6
+'Panel7'#6'Height'#3#221#1#5'Width'#3#228#0#5'Align'#7#8'alClient'#10'BevelO'
+'uter'#7#6'bvNone'#11'BorderWidth'#2#5#12'ClientHeight'#3#221#1#11'ClientWid'
+'th'#3#228#0#8'TabOrder'#2#0#0#8'TListBox'#17'ListboxComponents'#4'Left'#2#5
+#6'Height'#3#211#1#3'Top'#2#5#5'Width'#3#218#0#5'Align'#7#8'alClient'#10'OnD'
+'blClick'#7#25'ListboxComponentsDblClick'#6'Sorted'#9#8'TabOrder'#2#0#8'TopI'
+'ndex'#2#255#0#0#0#0#9'TTabSheet'#19'TabSheetPaletteTree'#7'Caption'#6#7'Pal'
+'ette'#12'ClientHeight'#3#191#1#11'ClientWidth'#3#224#0#0#6'TPanel'#6'Panel5'
+#6'Height'#3#191#1#5'Width'#3#224#0#5'Align'#7#8'alClient'#10'BevelOuter'#7#6
+'bvNone'#11'BorderWidth'#2#5#12'ClientHeight'#3#191#1#11'ClientWidth'#3#224#0
+#8'TabOrder'#2#0#0#9'TTreeView'#12'TreePallette'#4'Left'#2#5#6'Height'#3#181
+#1#3'Top'#2#5#5'Width'#3#214#0#5'Align'#7#8'alClient'#17'DefaultItemHeight'#2
+#14#8'ReadOnly'#9#8'TabOrder'#2#0#12'OnCollapsing'#7#22'TreePalletteCollapsi'
+'ng'#10'OnDblClick'#7#20'TreePalletteDblClick'#7'Options'#11#17'tvoAutoItemH'
+'eight'#16'tvoHideSelection'#21'tvoKeepCollapsedNodes'#11'tvoReadOnly'#14'tv'
+'oShowButtons'#12'tvoShowLines'#11'tvoShowRoot'#11'tvoToolTips'#0#0#0#0#0#9
'TPF0'#18'TComponentListForm'#17'ComponentListForm'#4'Left'#2'%'#6'Height'#3
+'+'#2#3'Top'#3#172#0#5'Width'#3#231#0#18'HorzScrollBar.Page'#3#230#0#18'Vert'
+'ScrollBar.Page'#3'*'#2#13'ActiveControl'#7#11'PatternEdit'#7'Caption'#6#10
+'Components'#12'ClientHeight'#3'+'#2#11'ClientWidth'#3#231#0#10'KeyPreview'#9
+#9'OnKeyDown'#7#11'FormKeyDown'#6'OnShow'#7#8'FormShow'#0#6'TPanel'#6'Panel1'
+#6'Height'#3'+'#2#5'Width'#3#231#0#5'Align'#7#8'alClient'#10'BevelOuter'#7#9
+'bvLowered'#7'Caption'#6#6'Panel1'#12'ClientHeight'#3'+'#2#11'ClientWidth'#3
+#231#0#8'TabOrder'#2#0#0#6'TPanel'#6'Panel2'#4'Left'#2#1#6'Height'#2'$'#3'To'
+'p'#3#6#2#5'Width'#3#229#0#5'Align'#7#8'alBottom'#12'ClientHeight'#2'$'#11'C'
+'lientWidth'#3#229#0#8'TabOrder'#2#0#0#7'TButton'#11'CloseButton'#4'Left'#3
+#144#0#6'Height'#2#26#3'Top'#2#4#5'Width'#2'I'#7'Anchors'#11#7'akRight'#8'ak'
+'Bottom'#0#8'AutoSize'#9#7'Caption'#6#11'CloseButton'#7'OnClick'#7#16'CloseB'
+'uttonClick'#8'TabOrder'#2#0#0#0#0#6'TPanel'#6'Panel3'#4'Left'#2#1#6'Height'
+#2'&'#3'Top'#2#1#5'Width'#3#229#0#5'Align'#7#5'alTop'#11'BorderWidth'#2#8#12
+'ClientHeight'#2'&'#11'ClientWidth'#3#229#0#8'TabOrder'#2#1#0#6'TLabel'#11'L'
+'abelSearch'#4'Left'#2#5#6'Height'#2#14#3'Top'#2#12#5'Width'#2';'#7'Caption'
+#6#11'LabelSearch'#11'ParentColor'#8#0#0#5'TEdit'#11'PatternEdit'#4'Left'#2
+'G'#6'Height'#2#23#3'Top'#2#8#5'Width'#2'u'#7'Anchors'#11#5'akTop'#6'akLeft'
+#7'akRight'#0#8'OnChange'#7#24'UpdateComponentSelection'#8'TabOrder'#2#0#0#0
+#0#6'TPanel'#6'Panel4'#4'Left'#2#1#6'Height'#3#223#1#3'Top'#2''''#5'Width'#3
+#229#0#5'Align'#7#8'alClient'#12'ClientHeight'#3#223#1#11'ClientWidth'#3#229
+#0#8'TabOrder'#2#2#0#12'TPageControl'#11'PageControl'#4'Left'#2#1#6'Height'#3
+#221#1#3'Top'#2#1#5'Width'#3#227#0#10'ActivePage'#7#15'TabSheetListBox'#5'Al'
+'ign'#7#8'alClient'#8'TabIndex'#2#0#8'TabOrder'#2#0#0#9'TTabSheet'#15'TabShe'
+'etListBox'#7'Caption'#6#4'List'#12'ClientHeight'#3#191#1#11'ClientWidth'#3
+#223#0#0#6'TPanel'#6'Panel7'#6'Height'#3#191#1#5'Width'#3#223#0#5'Align'#7#8
+'alClient'#10'BevelOuter'#7#6'bvNone'#11'BorderWidth'#2#5#12'ClientHeight'#3
+#191#1#11'ClientWidth'#3#223#0#8'TabOrder'#2#0#0#8'TListBox'#17'ListboxCompo'
+'nents'#4'Left'#2#5#6'Height'#3#181#1#3'Top'#2#5#5'Width'#3#213#0#5'Align'#7
+#8'alClient'#10'OnDblClick'#7#25'ListboxComponentsDblClick'#6'Sorted'#9#8'Ta'
+'bOrder'#2#0#8'TopIndex'#2#255#0#0#0#0#9'TTabSheet'#19'TabSheetPaletteTree'#7
+'Caption'#6#7'Palette'#12'ClientHeight'#3#221#1#11'ClientWidth'#3#227#0#0#6
+'TPanel'#6'Panel5'#6'Height'#3#221#1#5'Width'#3#227#0#5'Align'#7#8'alClient'
+#10'BevelOuter'#7#6'bvNone'#11'BorderWidth'#2#5#12'ClientHeight'#3#221#1#11
+'ClientWidth'#3#227#0#8'TabOrder'#2#0#0#9'TTreeView'#12'TreePallette'#4'Left'
+#2#5#6'Height'#3#211#1#3'Top'#2#5#5'Width'#3#217#0#5'Align'#7#8'alClient'#17
+'DefaultItemHeight'#2#14#8'ReadOnly'#9#9'ShowLines'#8#8'TabOrder'#2#0#10'OnD'
+'blClick'#7#20'TreePalletteDblClick'#7'Options'#11#17'tvoAutoItemHeight'#16
+'tvoHideSelection'#21'tvoKeepCollapsedNodes'#11'tvoReadOnly'#14'tvoShowButto'
+'ns'#11'tvoShowRoot'#11'tvoToolTips'#22'tvoNoDoubleClickExpand'#0#0#0#0#0#9
+'TTabSheet'#19'TabSheetInheritance'#7'Caption'#6#11'Inheritance'#12'ClientHe'
+'ight'#3#191#1#11'ClientWidth'#3#224#0#0#6'TPanel'#6'Panel6'#6'Height'#3#191
+#1#5'Width'#3#224#0#5'Align'#7#8'alClient'#10'BevelOuter'#7#6'bvNone'#11'Bor'
+'derWidth'#2#5#12'ClientHeight'#3#191#1#11'ClientWidth'#3#224#0#8'TabOrder'#2
+'ight'#3#191#1#11'ClientWidth'#3#223#0#0#6'TPanel'#6'Panel6'#6'Height'#3#191
+#1#5'Width'#3#223#0#5'Align'#7#8'alClient'#10'BevelOuter'#7#6'bvNone'#11'Bor'
+'derWidth'#2#5#12'ClientHeight'#3#191#1#11'ClientWidth'#3#223#0#8'TabOrder'#2
+#0#0#9'TTreeView'#15'TreeInheritance'#4'Left'#2#5#6'Height'#3#181#1#3'Top'#2
+#5#5'Width'#3#214#0#5'Align'#7#8'alClient'#17'DefaultItemHeight'#2#14#8'Read'
+'Only'#9#8'TabOrder'#2#0#12'OnCollapsing'#7#22'TreePalletteCollapsing'#10'On'
+'DblClick'#7#23'TreeInheritanceDblClick'#7'Options'#11#17'tvoAutoItemHeight'
+#16'tvoHideSelection'#21'tvoKeepCollapsedNodes'#11'tvoReadOnly'#14'tvoShowBu'
+'ttons'#12'tvoShowLines'#11'tvoShowRoot'#11'tvoToolTips'#0#0#0#0#0#0#0#0#0
+#5#5'Width'#3#213#0#5'Align'#7#8'alClient'#17'DefaultItemHeight'#2#14#8'Read'
+'Only'#9#8'TabOrder'#2#0#10'OnDblClick'#7#23'TreeInheritanceDblClick'#7'Opti'
+'ons'#11#17'tvoAutoItemHeight'#16'tvoHideSelection'#21'tvoKeepCollapsedNodes'
+#11'tvoReadOnly'#14'tvoShowButtons'#12'tvoShowLines'#11'tvoShowRoot'#11'tvoT'
+'oolTips'#22'tvoNoDoubleClickExpand'#0#0#0#0#0#0#0#0#0
]);

View File

@ -43,10 +43,9 @@ uses
Classes, SysUtils, LCLProc, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, FormEditingIntf, LazarusIDEStrConsts, ExtCtrls, ComCtrls,
ComponentPalette, ComponentReg, PackageDefs, ExtDlgs, FormEditor, PropEdits,
LCLType;
LCLType, Menus;
type
{ TComponentListForm }
TComponentListForm = class(TForm)
@ -69,10 +68,9 @@ type
TabSheetInheritance: TTabSheet;
procedure CloseButtonClick(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure FormShow(Sender: TObject);
procedure ListboxComponentsDblClick(Sender: TObject);
procedure TreeInheritanceDblClick ( Sender: TObject ) ;
procedure TreePalletteCollapsing(Sender: TObject; Node: TTreeNode;
var AllowCollapse: Boolean);
procedure TreePalletteDblClick(Sender: TObject);
procedure UpdateComponentSelection(Sender: TObject);
private
@ -106,6 +104,8 @@ begin
TabSheetPaletteTree.Caption := lisCmpLstPalette;
TabSheetInheritance.Caption := lisCmpLstInheritance;
//PLEASE add a defaultpage property in TPagecontrol
PageControl.ActivePage := TabSheetListBox;
FindAllLazarusComponents;
UpdateComponentSelection(nil);
@ -198,6 +198,7 @@ begin
//Third tabsheet (component inheritence)
List := TStringlist.Create;
AClassList:= TStringlist.Create;
TreeInheritance.Items.BeginUpdate;
try
@ -206,50 +207,51 @@ begin
AClassList.CaseSensitive := false;
AClassList.Duplicates := dupIgnore;
List := TStringlist.Create;
for i := 0 to FComponentList.Count-1 do
begin
AComponent := TRegisteredComponent(FComponentList[i]);
if not AComponent.Visible then continue;
AClassName := AComponent.ComponentClass.ClassName;
if (AFilter <> '') and (Pos(AFilter, UpperCase(AClassName)) = 0) then Continue;
// walk down to parent, stop on tcomponent, since components are at least
// a tcomponent descendant
List.Clear;
AClass := AComponent.ComponentClass;
while (AClass.ClassInfo <> nil) and (AClass.ClassType <> TComponent.ClassType) do
if (AFilter='') or (Pos(AFilter, UpperCase(AClassName))>0)then
begin
List.AddObject(AClass.ClassName, TObject(AClass));
AClass := AClass.ClassParent;
end;
//build the tree
for j := List.Count - 1 downto 0 do
begin
AClass := TClass(List.Objects[j]);
AClassName := List[j];
if not AClassList.Find(AClassName, AIndex)
then begin
//find out parent position
if Assigned(AClass.ClassParent) and AClassList.Find(AClass.ClassParent.ClassName, AIndex)
then ANode := TTreeNode(AClassList.Objects[AIndex])
else ANode := nil;
// walk down to parent, stop on tcomponent, since components are at least
// a tcomponent descendant
List.Clear;
AClass := AComponent.ComponentClass;
while (AClass.ClassInfo <> nil) and (AClass.ClassType <> TComponent.ClassType) do
begin
List.AddObject(AClass.ClassName, TObject(AClass));
AClass := AClass.ClassParent;
end;
//add the item
if AClassName <> AComponent.ComponentClass.ClassName
then ANode := TreeInheritance.Items.AddChild(ANode, AClassName)
else ANode := TreeInheritance.Items.AddChildObject(ANode, AClassName, AComponent);
AClassList.AddObject(AClassName, ANode);
//build the tree
for j := List.Count - 1 downto 0 do
begin
AClass := TClass(List.Objects[j]);
AClassName := List[j];
if not AClassList.Find(AClassName, AIndex)
then begin
//find out parent position
if Assigned(AClass.ClassParent) and AClassList.Find(AClass.ClassParent.ClassName, AIndex)
then ANode := TTreeNode(AClassList.Objects[AIndex])
else ANode := nil;
//add the item
if AClassName <> AComponent.ComponentClass.ClassName
then ANode := TreeInheritance.Items.AddChild(ANode, AClassName)
else ANode := TreeInheritance.Items.AddChildObject(ANode, AClassName, AComponent);
AClassList.AddObject(AClassName, ANode);
end;
end;
end;
end;
FreeAndNil(List);
TreeInheritance.AlphaSort;
TreeInheritance.FullExpand;
finally
List.Free;
AClassList.Free;
TreeInheritance.Items.EndUpdate;
end;
@ -267,10 +269,10 @@ var
TypeClass: TComponentClass;
X, Y: integer;
begin
//TComponentPalette(IDEComponentPalette).Selected := AComponent;
if not Assigned(AComponent) then Exit;
if not Assigned(FormEditingHook) then Exit;
//TComponentPalette(IDEComponentPalette).Selected := AComponent;
TypeClass:=AComponent.ComponentClass;
ParentCI:=FormEditingHook.GetDefaultComponentParent(TypeClass);
if ParentCI=nil then exit;
@ -314,21 +316,22 @@ begin
AddSelectedComponent(AComponent);
end;
procedure TComponentListForm.CloseButtonClick(Sender: TObject);
begin
Close;
end;
procedure TComponentListForm.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
//Close form on Esc (Not really needed but nice behaviour)
begin
if Key=VK_ESCAPE
then Close;
end;
procedure TComponentListForm.TreePalletteCollapsing(Sender: TObject; Node: TTreeNode; var AllowCollapse: Boolean);
procedure TComponentListForm.FormShow(Sender: TObject);
begin
AllowCollapse:=false;
if PatternEdit.Canfocus
then PatternEdit.SetFocus;
end;