mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-23 15:19:36 +01:00
IDE: component palette
git-svn-id: trunk@35063 -
This commit is contained in:
parent
84d84e011f
commit
e384b4c266
@ -19,8 +19,8 @@ object ComponentListForm: TComponentListForm
|
|||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = ButtonPanel
|
AnchorSideBottom.Control = ButtonPanel
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 453
|
Height = 452
|
||||||
Top = 53
|
Top = 52
|
||||||
Width = 326
|
Width = 326
|
||||||
ActivePage = TabSheetListBox
|
ActivePage = TabSheetListBox
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
@ -30,39 +30,41 @@ object ComponentListForm: TComponentListForm
|
|||||||
OnChange = PageControlChange
|
OnChange = PageControlChange
|
||||||
object TabSheetListBox: TTabSheet
|
object TabSheetListBox: TTabSheet
|
||||||
Caption = 'List'
|
Caption = 'List'
|
||||||
ClientHeight = 419
|
ClientHeight = 425
|
||||||
ClientWidth = 322
|
ClientWidth = 324
|
||||||
object Panel7: TPanel
|
object Panel7: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 419
|
Height = 425
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 322
|
Width = 324
|
||||||
Align = alClient
|
Align = alClient
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
BorderWidth = 5
|
BorderWidth = 5
|
||||||
ClientHeight = 419
|
ClientHeight = 425
|
||||||
ClientWidth = 322
|
ClientWidth = 324
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object ComponentsListbox: TListBox
|
object ComponentsListbox: TListBox
|
||||||
Left = 5
|
Left = 5
|
||||||
Height = 409
|
Height = 415
|
||||||
Top = 5
|
Top = 5
|
||||||
Width = 312
|
Width = 314
|
||||||
Align = alClient
|
Align = alClient
|
||||||
ItemHeight = 0
|
ItemHeight = 0
|
||||||
OnDblClick = ComponentsListboxDblClick
|
OnDblClick = ComponentsListboxDblClick
|
||||||
OnDrawItem = ComponentsListboxDrawItem
|
OnDrawItem = ComponentsListboxDrawItem
|
||||||
OnKeyDown = ComponentsListboxKeyDown
|
OnKeyDown = ComponentsListboxKeyDown
|
||||||
|
ScrollWidth = 312
|
||||||
Sorted = True
|
Sorted = True
|
||||||
Style = lbOwnerDrawFixed
|
Style = lbOwnerDrawFixed
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
|
TopIndex = -1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object TabSheetPaletteTree: TTabSheet
|
object TabSheetPaletteTree: TTabSheet
|
||||||
Caption = 'Palette'
|
Caption = 'Palette'
|
||||||
ClientHeight = 419
|
ClientHeight = 425
|
||||||
ClientWidth = 322
|
ClientWidth = 324
|
||||||
object Panel5: TPanel
|
object Panel5: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 419
|
Height = 419
|
||||||
@ -92,8 +94,8 @@ object ComponentListForm: TComponentListForm
|
|||||||
end
|
end
|
||||||
object TabSheetInheritance: TTabSheet
|
object TabSheetInheritance: TTabSheet
|
||||||
Caption = 'Inheritance'
|
Caption = 'Inheritance'
|
||||||
ClientHeight = 410
|
ClientHeight = 425
|
||||||
ClientWidth = 208
|
ClientWidth = 324
|
||||||
object Panel6: TPanel
|
object Panel6: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 410
|
Height = 410
|
||||||
@ -124,23 +126,23 @@ object ComponentListForm: TComponentListForm
|
|||||||
object Panel3: TPanel
|
object Panel3: TPanel
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 47
|
Height = 46
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 338
|
Width = 338
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
BorderWidth = 8
|
BorderWidth = 8
|
||||||
ClientHeight = 47
|
ClientHeight = 46
|
||||||
ClientWidth = 338
|
ClientWidth = 338
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object LabelSearch: TLabel
|
object LabelSearch: TLabel
|
||||||
AnchorSideLeft.Control = Panel3
|
AnchorSideLeft.Control = Panel3
|
||||||
AnchorSideTop.Control = Panel3
|
AnchorSideTop.Control = Panel3
|
||||||
Left = 14
|
Left = 14
|
||||||
Height = 19
|
Height = 18
|
||||||
Top = 14
|
Top = 14
|
||||||
Width = 91
|
Width = 80
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
Caption = 'LabelSearch'
|
Caption = 'LabelSearch'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
@ -150,14 +152,16 @@ object ComponentListForm: TComponentListForm
|
|||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = LabelSearch
|
AnchorSideTop.Control = LabelSearch
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 111
|
Left = 100
|
||||||
Height = 28
|
Height = 27
|
||||||
Top = 9
|
Top = 10
|
||||||
Width = 169
|
Width = 169
|
||||||
ButtonWidth = 23
|
ButtonWidth = 23
|
||||||
NumGlyphs = 0
|
NumGlyphs = 0
|
||||||
BorderSpacing.Left = 5
|
BorderSpacing.Left = 5
|
||||||
|
Font.Color = clBtnShadow
|
||||||
MaxLength = 0
|
MaxLength = 0
|
||||||
|
ParentFont = False
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
FilteredListbox = ComponentsListbox
|
FilteredListbox = ComponentsListbox
|
||||||
end
|
end
|
||||||
@ -166,9 +170,9 @@ object ComponentListForm: TComponentListForm
|
|||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = LabelSearch
|
AnchorSideTop.Control = LabelSearch
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 111
|
Left = 100
|
||||||
Height = 28
|
Height = 27
|
||||||
Top = 9
|
Top = 10
|
||||||
Width = 169
|
Width = 169
|
||||||
ButtonWidth = 23
|
ButtonWidth = 23
|
||||||
NumGlyphs = 0
|
NumGlyphs = 0
|
||||||
@ -179,8 +183,8 @@ object ComponentListForm: TComponentListForm
|
|||||||
end
|
end
|
||||||
object ButtonPanel: TButtonPanel
|
object ButtonPanel: TButtonPanel
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 38
|
Height = 40
|
||||||
Top = 512
|
Top = 510
|
||||||
Width = 326
|
Width = 326
|
||||||
OKButton.Name = 'OKButton'
|
OKButton.Name = 'OKButton'
|
||||||
OKButton.DefaultCaption = True
|
OKButton.DefaultCaption = True
|
||||||
@ -191,6 +195,6 @@ object ComponentListForm: TComponentListForm
|
|||||||
CancelButton.Name = 'CancelButton'
|
CancelButton.Name = 'CancelButton'
|
||||||
CancelButton.DefaultCaption = True
|
CancelButton.DefaultCaption = True
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
ShowButtons = [pbClose]
|
ShowButtons = [pbOK, pbClose]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -58,6 +58,7 @@ type
|
|||||||
InheritanceTree: TTreeView;
|
InheritanceTree: TTreeView;
|
||||||
PalletteTree: TTreeView;
|
PalletteTree: TTreeView;
|
||||||
TreeFilterEd: TTreeFilterEdit;
|
TreeFilterEd: TTreeFilterEdit;
|
||||||
|
procedure ButtonPanelOKButtonClick(Sender: TObject);
|
||||||
procedure ComponentsListboxDblClick(Sender: TObject);
|
procedure ComponentsListboxDblClick(Sender: TObject);
|
||||||
procedure ComponentsListboxDrawItem(Control: TWinControl; Index: Integer;
|
procedure ComponentsListboxDrawItem(Control: TWinControl; Index: Integer;
|
||||||
ARect: TRect; State: TOwnerDrawState);
|
ARect: TRect; State: TOwnerDrawState);
|
||||||
@ -80,6 +81,7 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
function GetSelectedComponent: TRegisteredComponent;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -96,6 +98,8 @@ begin
|
|||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
FComponentList := TRegisteredCompList.Create;
|
FComponentList := TRegisteredCompList.Create;
|
||||||
ButtonPanel.CloseButton.Cancel := True;
|
ButtonPanel.CloseButton.Cancel := True;
|
||||||
|
ButtonPanel.OKButton.OnClick:=@ButtonPanelOKButtonClick;
|
||||||
|
ButtonPanel.OKButton.Caption:=lisMenuSelect;
|
||||||
ComponentsListBox.ItemHeight :=ComponentPaletteImageHeight + 1;
|
ComponentsListBox.ItemHeight :=ComponentPaletteImageHeight + 1;
|
||||||
InheritanceTree.DefaultItemHeight:=ComponentPaletteImageHeight + 1;
|
InheritanceTree.DefaultItemHeight:=ComponentPaletteImageHeight + 1;
|
||||||
PalletteTree.DefaultItemHeight :=ComponentPaletteImageHeight + 1;
|
PalletteTree.DefaultItemHeight :=ComponentPaletteImageHeight + 1;
|
||||||
@ -120,10 +124,31 @@ end;
|
|||||||
destructor TComponentListForm.Destroy;
|
destructor TComponentListForm.Destroy;
|
||||||
begin
|
begin
|
||||||
ComponentListForm := nil;
|
ComponentListForm := nil;
|
||||||
FComponentList.Free;
|
FreeAndNil(FComponentList);
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TComponentListForm.GetSelectedComponent: TRegisteredComponent;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
Result:=nil;
|
||||||
|
if ComponentsListbox.IsVisible then
|
||||||
|
begin
|
||||||
|
i:=ComponentsListbox.ItemIndex;
|
||||||
|
if i<0 then exit;
|
||||||
|
Result:=TRegisteredComponent(ComponentsListbox.Items.Objects[i]);
|
||||||
|
end else if PalletteTree.IsVisible then
|
||||||
|
begin
|
||||||
|
if not Assigned(PalletteTree.Selected) then exit;
|
||||||
|
Result := TRegisteredComponent(PalletteTree.Selected.Data);
|
||||||
|
end else if InheritanceTree.IsVisible then
|
||||||
|
begin
|
||||||
|
if not Assigned(InheritanceTree.Selected) then exit;
|
||||||
|
Result := TRegisteredComponent(InheritanceTree.Selected.Data);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TComponentListForm.FindAllLazarusComponents;
|
procedure TComponentListForm.FindAllLazarusComponents;
|
||||||
//Collect all available components (excluding hidden)
|
//Collect all available components (excluding hidden)
|
||||||
var
|
var
|
||||||
@ -157,7 +182,7 @@ var
|
|||||||
ANode: TTreeNode;
|
ANode: TTreeNode;
|
||||||
AClass: TClass;
|
AClass: TClass;
|
||||||
begin
|
begin
|
||||||
if Processing then exit;
|
if Processing or ([csDestroying,csLoading]*ComponentState<>[]) then exit;
|
||||||
Processing := true;
|
Processing := true;
|
||||||
Screen.Cursor := crHourGlass;
|
Screen.Cursor := crHourGlass;
|
||||||
try
|
try
|
||||||
@ -290,7 +315,18 @@ end;
|
|||||||
|
|
||||||
procedure TComponentListForm.ComponentsListboxDblClick(Sender: TObject);
|
procedure TComponentListForm.ComponentsListboxDblClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
AddSelectedComponent(TRegisteredComponent(ComponentsListbox.Items.Objects[ComponentsListbox.ItemIndex]));
|
AddSelectedComponent(GetSelectedComponent);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TComponentListForm.ButtonPanelOKButtonClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
AComponent: TRegisteredComponent;
|
||||||
|
begin
|
||||||
|
AComponent:=GetSelectedComponent;
|
||||||
|
if AComponent<>nil then begin
|
||||||
|
IDEComponentPalette.Selected:=AComponent;
|
||||||
|
Close;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TComponentListForm.ComponentsListboxDrawItem(Control: TWinControl;
|
procedure TComponentListForm.ComponentsListboxDrawItem(Control: TWinControl;
|
||||||
@ -378,13 +414,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TComponentListForm.PalletteTreeDblClick(Sender: TObject);
|
procedure TComponentListForm.PalletteTreeDblClick(Sender: TObject);
|
||||||
var
|
|
||||||
AComponent: TRegisteredComponent;
|
|
||||||
begin
|
begin
|
||||||
if not Assigned(PalletteTree.Selected) then exit;
|
AddSelectedComponent(GetSelectedComponent);
|
||||||
AComponent := TRegisteredComponent(PalletteTree.Selected.Data);
|
|
||||||
if not Assigned(AComponent) then exit;
|
|
||||||
AddSelectedComponent(AComponent);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TComponentListForm.PalletteTreeKeyDown(Sender: TObject;
|
procedure TComponentListForm.PalletteTreeKeyDown(Sender: TObject;
|
||||||
@ -395,13 +426,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TComponentListForm.InheritanceTreeDblClick(Sender:TObject);
|
procedure TComponentListForm.InheritanceTreeDblClick(Sender:TObject);
|
||||||
var
|
|
||||||
AComponent: TRegisteredComponent;
|
|
||||||
begin
|
begin
|
||||||
if not Assigned(InheritanceTree.Selected) then exit;
|
AddSelectedComponent(GetSelectedComponent);
|
||||||
AComponent := TRegisteredComponent(InheritanceTree.Selected.Data);
|
|
||||||
if not Assigned(AComponent) then exit;
|
|
||||||
AddSelectedComponent(AComponent);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TComponentListForm.InheritanceTreeKeyDown(Sender: TObject;
|
procedure TComponentListForm.InheritanceTreeKeyDown(Sender: TObject;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user