mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 08:19:29 +02:00
IDE: Improve the palette tab in ComponentList window. Issue #27527, patch from Balazs Szekely.
git-svn-id: trunk@47971 -
This commit is contained in:
parent
00bdf8baca
commit
0dbef17a88
@ -1,7 +1,7 @@
|
||||
object ComponentListForm: TComponentListForm
|
||||
Left = 368
|
||||
Left = 667
|
||||
Height = 467
|
||||
Top = 94
|
||||
Top = 292
|
||||
Width = 300
|
||||
Caption = 'Components'
|
||||
ClientHeight = 467
|
||||
@ -12,7 +12,7 @@ object ComponentListForm: TComponentListForm
|
||||
OnKeyDown = FormKeyDown
|
||||
OnShow = FormShow
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.3'
|
||||
LCLVersion = '1.5'
|
||||
object PageControl: TPageControl
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = FilterPanel
|
||||
@ -21,8 +21,8 @@ object ComponentListForm: TComponentListForm
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = ButtonPanel
|
||||
Left = 0
|
||||
Height = 404
|
||||
Top = 25
|
||||
Height = 400
|
||||
Top = 27
|
||||
Width = 300
|
||||
ActivePage = TabSheetList
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
@ -31,26 +31,26 @@ object ComponentListForm: TComponentListForm
|
||||
OnChange = PageControlChange
|
||||
object TabSheetList: TTabSheet
|
||||
Caption = 'List'
|
||||
ClientHeight = 378
|
||||
ClientWidth = 292
|
||||
ClientHeight = 375
|
||||
ClientWidth = 296
|
||||
object Panel7: TPanel
|
||||
Left = 0
|
||||
Height = 378
|
||||
Height = 375
|
||||
Top = 0
|
||||
Width = 292
|
||||
Width = 296
|
||||
Align = alClient
|
||||
BevelOuter = bvNone
|
||||
BorderWidth = 2
|
||||
ClientHeight = 378
|
||||
ClientWidth = 292
|
||||
ClientHeight = 375
|
||||
ClientWidth = 296
|
||||
TabOrder = 0
|
||||
object ListTree: TTreeView
|
||||
Left = 2
|
||||
Height = 374
|
||||
Height = 371
|
||||
Top = 2
|
||||
Width = 288
|
||||
Width = 292
|
||||
Align = alClient
|
||||
DefaultItemHeight = 16
|
||||
DefaultItemHeight = 18
|
||||
ReadOnly = True
|
||||
TabOrder = 0
|
||||
OnClick = ComponentsClick
|
||||
@ -63,56 +63,60 @@ object ComponentListForm: TComponentListForm
|
||||
end
|
||||
object TabSheetPaletteTree: TTabSheet
|
||||
Caption = 'Palette'
|
||||
ClientHeight = 373
|
||||
ClientWidth = 294
|
||||
object Panel5: TPanel
|
||||
ClientHeight = 374
|
||||
ClientWidth = 292
|
||||
object pnPaletteTree: TPanel
|
||||
Left = 0
|
||||
Height = 366
|
||||
Height = 374
|
||||
Top = 0
|
||||
Width = 294
|
||||
Width = 292
|
||||
Align = alClient
|
||||
BevelOuter = bvNone
|
||||
BorderWidth = 5
|
||||
ClientHeight = 366
|
||||
ClientWidth = 294
|
||||
ClientHeight = 374
|
||||
ClientWidth = 292
|
||||
TabOrder = 0
|
||||
object PalletteTree: TTreeView
|
||||
Left = 5
|
||||
Height = 356
|
||||
Height = 364
|
||||
Top = 5
|
||||
Width = 284
|
||||
Width = 282
|
||||
Align = alClient
|
||||
DefaultItemHeight = 27
|
||||
Images = imPalette
|
||||
PopupMenu = pmPalette
|
||||
ReadOnly = True
|
||||
RightClickSelect = True
|
||||
RowSelect = True
|
||||
ShowLines = False
|
||||
TabOrder = 0
|
||||
OnClick = ComponentsClick
|
||||
OnCustomDrawItem = TreeCustomDrawItem
|
||||
OnDblClick = ComponentsDblClick
|
||||
OnKeyPress = TreeKeyPress
|
||||
Options = [tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowRoot, tvoToolTips, tvoNoDoubleClickExpand, tvoThemedDraw]
|
||||
Options = [tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoRightClickSelect, tvoRowSelect, tvoShowButtons, tvoShowRoot, tvoToolTips]
|
||||
end
|
||||
end
|
||||
end
|
||||
object TabSheetInheritance: TTabSheet
|
||||
Caption = 'Inheritance'
|
||||
ClientHeight = 373
|
||||
ClientWidth = 294
|
||||
ClientHeight = 374
|
||||
ClientWidth = 292
|
||||
object Panel6: TPanel
|
||||
Left = 0
|
||||
Height = 366
|
||||
Height = 374
|
||||
Top = 0
|
||||
Width = 294
|
||||
Width = 292
|
||||
Align = alClient
|
||||
BevelOuter = bvNone
|
||||
BorderWidth = 5
|
||||
ClientHeight = 366
|
||||
ClientWidth = 294
|
||||
ClientHeight = 374
|
||||
ClientWidth = 292
|
||||
TabOrder = 0
|
||||
object InheritanceTree: TTreeView
|
||||
Left = 5
|
||||
Height = 356
|
||||
Height = 364
|
||||
Top = 5
|
||||
Width = 284
|
||||
Width = 282
|
||||
Align = alClient
|
||||
ReadOnly = True
|
||||
TabOrder = 0
|
||||
@ -128,22 +132,22 @@ object ComponentListForm: TComponentListForm
|
||||
object FilterPanel: TPanel
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 1
|
||||
Height = 25
|
||||
Height = 27
|
||||
Top = 0
|
||||
Width = 300
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 25
|
||||
ClientHeight = 27
|
||||
ClientWidth = 300
|
||||
TabOrder = 0
|
||||
object LabelSearch: TLabel
|
||||
AnchorSideLeft.Control = FilterPanel
|
||||
AnchorSideTop.Control = FilterPanel
|
||||
Left = 6
|
||||
Height = 13
|
||||
Height = 15
|
||||
Top = 6
|
||||
Width = 58
|
||||
Width = 74
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'LabelSearch'
|
||||
ParentColor = False
|
||||
@ -153,10 +157,10 @@ object ComponentListForm: TComponentListForm
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = LabelSearch
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 92
|
||||
Height = 28
|
||||
Top = 2
|
||||
Width = 204
|
||||
Left = 86
|
||||
Height = 21
|
||||
Top = 3
|
||||
Width = 210
|
||||
OnAfterFilter = TreeFilterEdAfterFilter
|
||||
ButtonWidth = 23
|
||||
NumGlyphs = 1
|
||||
@ -169,8 +173,8 @@ object ComponentListForm: TComponentListForm
|
||||
end
|
||||
object ButtonPanel: TButtonPanel
|
||||
Left = 6
|
||||
Height = 26
|
||||
Top = 435
|
||||
Height = 28
|
||||
Top = 433
|
||||
Width = 288
|
||||
OKButton.Name = 'OKButton'
|
||||
OKButton.DefaultCaption = True
|
||||
@ -185,4 +189,33 @@ object ComponentListForm: TComponentListForm
|
||||
ShowButtons = [pbOK]
|
||||
ShowBevel = False
|
||||
end
|
||||
object imPalette: TImageList
|
||||
Height = 25
|
||||
Width = 25
|
||||
left = 84
|
||||
top = 124
|
||||
end
|
||||
object pmPalette: TPopupMenu
|
||||
left = 148
|
||||
top = 124
|
||||
object miExpand: TMenuItem
|
||||
Caption = 'Expand'
|
||||
OnClick = miExpandClick
|
||||
end
|
||||
object miExpandAll: TMenuItem
|
||||
Caption = 'Expand All'
|
||||
OnClick = miExpandAllClick
|
||||
end
|
||||
object MenuItem1: TMenuItem
|
||||
Caption = '-'
|
||||
end
|
||||
object miCollapse: TMenuItem
|
||||
Caption = 'Collapse'
|
||||
OnClick = miCollapseClick
|
||||
end
|
||||
object miCollapseAll: TMenuItem
|
||||
Caption = 'Collapse All'
|
||||
OnClick = miCollapseAllClick
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -19,7 +19,7 @@
|
||||
***************************************************************************
|
||||
|
||||
Author: Marius
|
||||
Modified by Juha Manninen
|
||||
Modified by Juha Manninen, Balazs Szekely
|
||||
|
||||
Abstract:
|
||||
A dialog to quickly find components and to add the found component
|
||||
@ -33,7 +33,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LCLType, Forms, Controls, Graphics, StdCtrls, ExtCtrls,
|
||||
ComCtrls, ButtonPanel, LazarusIDEStrConsts, ComponentReg,
|
||||
ComCtrls, ButtonPanel, Menus, LazarusIDEStrConsts, ComponentReg,
|
||||
PackageDefs, IDEImagesIntf, TreeFilterEdit, fgl;
|
||||
|
||||
type
|
||||
@ -43,23 +43,34 @@ type
|
||||
{ TComponentListForm }
|
||||
|
||||
TComponentListForm = class(TForm)
|
||||
imPalette: TImageList;
|
||||
ListTree: TTreeView;
|
||||
ButtonPanel: TButtonPanel;
|
||||
MenuItem1: TMenuItem;
|
||||
miCollapse: TMenuItem;
|
||||
miCollapseAll: TMenuItem;
|
||||
miExpand: TMenuItem;
|
||||
miExpandAll: TMenuItem;
|
||||
OKButton: TPanelBitBtn;
|
||||
LabelSearch: TLabel;
|
||||
PageControl: TPageControl;
|
||||
FilterPanel: TPanel;
|
||||
Panel5: TPanel;
|
||||
PalletteTree: TTreeView;
|
||||
pnPaletteTree: TPanel;
|
||||
Panel6: TPanel;
|
||||
Panel7: TPanel;
|
||||
pmPalette: TPopupMenu;
|
||||
TabSheetPaletteTree: TTabSheet;
|
||||
TabSheetInheritance: TTabSheet;
|
||||
TabSheetList: TTabSheet;
|
||||
TabSheetPaletteTree: TTabSheet;
|
||||
InheritanceTree: TTreeView;
|
||||
PalletteTree: TTreeView;
|
||||
TreeFilterEd: TTreeFilterEdit;
|
||||
procedure FormActivate(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure miCollapseAllClick(Sender: TObject);
|
||||
procedure miCollapseClick(Sender: TObject);
|
||||
procedure miExpandAllClick(Sender: TObject);
|
||||
procedure miExpandClick(Sender: TObject);
|
||||
procedure OKButtonClick(Sender: TObject);
|
||||
procedure ComponentsDblClick(Sender: TObject);
|
||||
procedure ComponentsClick(Sender: TObject);
|
||||
@ -113,7 +124,7 @@ begin
|
||||
|
||||
ListTree.Images:=IDEImages.Images_24;
|
||||
InheritanceTree.Images:=ListTree.Images;
|
||||
PalletteTree.Images:=ListTree.Images;
|
||||
PalletteTree.Images:= imPalette;
|
||||
PrevPageIndex := -1;
|
||||
PageControl.ActivePage := TabSheetList;
|
||||
if Assigned(IDEComponentPalette) then
|
||||
@ -253,7 +264,9 @@ var
|
||||
Comps: TStringList;
|
||||
Comp: TRegisteredComponent;
|
||||
ParentNode: TTreeNode;
|
||||
ANode: TTreeNode;
|
||||
i, j: Integer;
|
||||
CurIcon: TCustomBitmap;
|
||||
begin
|
||||
if [csDestroying,csLoading]*ComponentState<>[] then exit;
|
||||
Screen.Cursor := crHourGlass;
|
||||
@ -281,7 +294,15 @@ begin
|
||||
// Flat list item
|
||||
ListTree.Items.AddChildObject(Nil, Comps[j], Comp);
|
||||
// Palette layout item
|
||||
PalletteTree.Items.AddChildObject(ParentNode, Comps[j], Comp);
|
||||
ANode := PalletteTree.Items.AddChildObject(ParentNode, Comps[j], Comp);
|
||||
CurIcon := nil;
|
||||
if (Comp is TPkgComponent) then
|
||||
CurIcon := TPkgComponent(Comp).Icon;
|
||||
if CurIcon <> nil then
|
||||
begin
|
||||
ANode.ImageIndex := imPalette.Add(CurIcon, nil);
|
||||
ANode.SelectedIndex := ANode.ImageIndex;
|
||||
end;
|
||||
// Component inheritence item
|
||||
DoComponentInheritence(Comp);
|
||||
end;
|
||||
@ -432,5 +453,39 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TComponentListForm.miCollapseAllClick(Sender: TObject);
|
||||
begin
|
||||
PalletteTree.FullCollapse;
|
||||
end;
|
||||
|
||||
procedure TComponentListForm.miCollapseClick(Sender: TObject);
|
||||
var
|
||||
Node: TTreeNode;
|
||||
begin
|
||||
Node := PalletteTree.Selected;
|
||||
if Node = nil then
|
||||
Exit;
|
||||
if Node.Level > 0 then
|
||||
Node := Node.Parent;
|
||||
Node.Collapse(True);
|
||||
end;
|
||||
|
||||
procedure TComponentListForm.miExpandAllClick(Sender: TObject);
|
||||
begin
|
||||
PalletteTree.FullExpand;
|
||||
end;
|
||||
|
||||
procedure TComponentListForm.miExpandClick(Sender: TObject);
|
||||
var
|
||||
Node: TTreeNode;
|
||||
begin
|
||||
Node := PalletteTree.Selected;
|
||||
if Node = nil then
|
||||
Exit;
|
||||
if Node.Level > 0 then
|
||||
Node := Node.Parent;
|
||||
Node.Expand(True);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user