mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-01 23:49:45 +02:00
educationlaz: show/hide all components buttons
git-svn-id: trunk@22233 -
This commit is contained in:
parent
97c17bf8a9
commit
85342206e2
@ -3,29 +3,30 @@ inherited EduCompPaletteFrame: TEduCompPaletteFrame
|
||||
Width = 480
|
||||
ClientHeight = 380
|
||||
ClientWidth = 480
|
||||
OnClick = FrameClick
|
||||
TabOrder = 0
|
||||
DesignLeft = 395
|
||||
DesignTop = 160
|
||||
object ComponentsGroupBox: TGroupBox[0]
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = Owner
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 6
|
||||
Left = 135
|
||||
Height = 368
|
||||
Top = 6
|
||||
Width = 290
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
Width = 339
|
||||
Align = alClient
|
||||
Anchors = [akTop, akBottom]
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'ComponentsGroupBox'
|
||||
ClientHeight = 346
|
||||
ClientWidth = 282
|
||||
ClientWidth = 331
|
||||
TabOrder = 0
|
||||
object ComponentsTreeView: TTreeView
|
||||
Left = 0
|
||||
Height = 346
|
||||
Top = 0
|
||||
Width = 282
|
||||
Width = 331
|
||||
Align = alClient
|
||||
DefaultItemHeight = 19
|
||||
ReadOnly = True
|
||||
@ -34,4 +35,41 @@ inherited EduCompPaletteFrame: TEduCompPaletteFrame
|
||||
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips]
|
||||
end
|
||||
end
|
||||
object LeftPanel: TPanel[1]
|
||||
Left = 0
|
||||
Height = 380
|
||||
Top = 0
|
||||
Width = 129
|
||||
Align = alLeft
|
||||
AutoSize = True
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
ChildSizing.HorizontalSpacing = 6
|
||||
ChildSizing.VerticalSpacing = 6
|
||||
ClientHeight = 380
|
||||
ClientWidth = 129
|
||||
TabOrder = 1
|
||||
object ShowAllButton: TButton
|
||||
Left = 7
|
||||
Height = 20
|
||||
Top = 7
|
||||
Width = 115
|
||||
Align = alTop
|
||||
AutoSize = True
|
||||
Caption = 'ShowAllButton'
|
||||
OnClick = ShowAllButtonClick
|
||||
TabOrder = 0
|
||||
end
|
||||
object HideAllButton: TButton
|
||||
Left = 7
|
||||
Height = 20
|
||||
Top = 33
|
||||
Width = 115
|
||||
Align = alTop
|
||||
AutoSize = True
|
||||
Caption = 'HideAllButton'
|
||||
OnClick = HideAllButtonClick
|
||||
TabOrder = 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2,17 +2,27 @@
|
||||
|
||||
LazarusResources.Add('TEduCompPaletteFrame','FORMDATA',[
|
||||
'TPF0'#241#20'TEduCompPaletteFrame'#19'EduCompPaletteFrame'#6'Height'#3'|'#1#5
|
||||
+'Width'#3#224#1#12'ClientHeight'#3'|'#1#11'ClientWidth'#3#224#1#8'TabOrder'#2
|
||||
+#0#10'DesignLeft'#3#139#1#9'DesignTop'#3#160#0#0#242#2#0#9'TGroupBox'#18'Com'
|
||||
+'ponentsGroupBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Con'
|
||||
+'trol'#7#5'Owner'#24'AnchorSideBottom.Control'#7#5'Owner'#21'AnchorSideBotto'
|
||||
+'m.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#3'p'#1#3'Top'#2#6#5'Width'#3'"'
|
||||
+#1#7'Anchors'#11#5'akTop'#6'akLeft'#8'akBottom'#0#20'BorderSpacing.Around'#2
|
||||
+#6#7'Caption'#6#18'ComponentsGroupBox'#12'ClientHeight'#3'Z'#1#11'ClientWidt'
|
||||
+'h'#3#26#1#8'TabOrder'#2#0#0#9'TTreeView'#18'ComponentsTreeView'#4'Left'#2#0
|
||||
+#6'Height'#3'Z'#1#3'Top'#2#0#5'Width'#3#26#1#5'Align'#7#8'alClient'#17'Defau'
|
||||
+'ltItemHeight'#2#19#8'ReadOnly'#9#8'TabOrder'#2#0#11'OnMouseDown'#7#27'Compo'
|
||||
+'nentsTreeViewMouseDown'#7'Options'#11#17'tvoAutoItemHeight'#16'tvoHideSelec'
|
||||
+'tion'#21'tvoKeepCollapsedNodes'#11'tvoReadOnly'#14'tvoShowButtons'#12'tvoSh'
|
||||
+'owLines'#11'tvoShowRoot'#11'tvoToolTips'#0#0#0#0#0
|
||||
+'Width'#3#224#1#12'ClientHeight'#3'|'#1#11'ClientWidth'#3#224#1#7'OnClick'#7
|
||||
+#10'FrameClick'#8'TabOrder'#2#0#10'DesignLeft'#3#139#1#9'DesignTop'#3#160#0#0
|
||||
+#242#2#0#9'TGroupBox'#18'ComponentsGroupBox'#21'AnchorSideTop.Control'#7#5'O'
|
||||
+'wner'#24'AnchorSideBottom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9
|
||||
+'asrBottom'#4'Left'#3#135#0#6'Height'#3'p'#1#3'Top'#2#6#5'Width'#3'S'#1#5'Al'
|
||||
+'ign'#7#8'alClient'#7'Anchors'#11#5'akTop'#8'akBottom'#0#20'BorderSpacing.Ar'
|
||||
+'ound'#2#6#7'Caption'#6#18'ComponentsGroupBox'#12'ClientHeight'#3'Z'#1#11'Cl'
|
||||
+'ientWidth'#3'K'#1#8'TabOrder'#2#0#0#9'TTreeView'#18'ComponentsTreeView'#4'L'
|
||||
+'eft'#2#0#6'Height'#3'Z'#1#3'Top'#2#0#5'Width'#3'K'#1#5'Align'#7#8'alClient'
|
||||
+#17'DefaultItemHeight'#2#19#8'ReadOnly'#9#8'TabOrder'#2#0#11'OnMouseDown'#7
|
||||
+#27'ComponentsTreeViewMouseDown'#7'Options'#11#17'tvoAutoItemHeight'#16'tvoH'
|
||||
+'ideSelection'#21'tvoKeepCollapsedNodes'#11'tvoReadOnly'#14'tvoShowButtons'
|
||||
+#12'tvoShowLines'#11'tvoShowRoot'#11'tvoToolTips'#0#0#0#0#242#2#1#6'TPanel'#9
|
||||
+'LeftPanel'#4'Left'#2#0#6'Height'#3'|'#1#3'Top'#2#0#5'Width'#3#129#0#5'Align'
|
||||
+#7#6'alLeft'#8'AutoSize'#9#28'ChildSizing.LeftRightSpacing'#2#6#28'ChildSizi'
|
||||
+'ng.TopBottomSpacing'#2#6#29'ChildSizing.HorizontalSpacing'#2#6#27'ChildSizi'
|
||||
+'ng.VerticalSpacing'#2#6#12'ClientHeight'#3'|'#1#11'ClientWidth'#3#129#0#8'T'
|
||||
+'abOrder'#2#1#0#7'TButton'#13'ShowAllButton'#4'Left'#2#7#6'Height'#2#20#3'To'
|
||||
+'p'#2#7#5'Width'#2's'#5'Align'#7#5'alTop'#8'AutoSize'#9#7'Caption'#6#13'Show'
|
||||
+'AllButton'#7'OnClick'#7#18'ShowAllButtonClick'#8'TabOrder'#2#0#0#0#7'TButto'
|
||||
+'n'#13'HideAllButton'#4'Left'#2#7#6'Height'#2#20#3'Top'#2'!'#5'Width'#2's'#5
|
||||
+'Align'#7#5'alTop'#8'AutoSize'#9#7'Caption'#6#13'HideAllButton'#7'OnClick'#7
|
||||
+#18'HideAllButtonClick'#8'TabOrder'#2#1#0#0#0#0
|
||||
]);
|
||||
|
@ -52,13 +52,20 @@ type
|
||||
TEduCompPaletteFrame = class(TAbstractIDEOptionsEditor)
|
||||
ComponentsGroupBox: TGroupBox;
|
||||
ComponentsTreeView: TTreeView;
|
||||
HideAllButton: TButton;
|
||||
LeftPanel: TPanel;
|
||||
ShowAllButton: TButton;
|
||||
procedure ComponentsTreeViewMouseDown(Sender: TObject;
|
||||
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
procedure FrameClick(Sender: TObject);
|
||||
procedure HideAllButtonClick(Sender: TObject);
|
||||
procedure ShowAllButtonClick(Sender: TObject);
|
||||
private
|
||||
HideImgID: LongInt;
|
||||
ShowImgID: LongInt;
|
||||
procedure FillComponentTreeView;
|
||||
procedure SaveFillComponentTreeView;
|
||||
procedure ShowHideAll(aShow: boolean);
|
||||
public
|
||||
function GetTitle: String; override;
|
||||
procedure ReadSettings(AOptions: TAbstractIDEOptions); override;
|
||||
@ -94,7 +101,7 @@ begin
|
||||
if (Node=nil) then exit;
|
||||
if Node.Parent=nil then exit;
|
||||
Hit:=ComponentsTreeView.GetHitTestInfoAt(X,Y);
|
||||
if htOnStateIcon in Hit then begin
|
||||
if [htOnIcon,htOnStateIcon]*Hit<>[] then begin
|
||||
if Node.StateIndex=ShowImgID then
|
||||
Node.StateIndex:=HideImgID
|
||||
else
|
||||
@ -102,6 +109,21 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TEduCompPaletteFrame.FrameClick(Sender: TObject);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
procedure TEduCompPaletteFrame.HideAllButtonClick(Sender: TObject);
|
||||
begin
|
||||
ShowHideAll(false);
|
||||
end;
|
||||
|
||||
procedure TEduCompPaletteFrame.ShowAllButtonClick(Sender: TObject);
|
||||
begin
|
||||
ShowHideAll(true);
|
||||
end;
|
||||
|
||||
procedure TEduCompPaletteFrame.FillComponentTreeView;
|
||||
var
|
||||
i: Integer;
|
||||
@ -171,6 +193,27 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TEduCompPaletteFrame.ShowHideAll(aShow: boolean);
|
||||
var
|
||||
Node: TTreeNode;
|
||||
CompName: String;
|
||||
begin
|
||||
Node:=ComponentsTreeView.Items.GetFirstNode;
|
||||
while Node<>nil do begin
|
||||
if Node.Parent<>nil then begin
|
||||
CompName:=Node.Text;
|
||||
EduComponentPaletteOptions.ComponentVisible[CompName]:=aShow;
|
||||
if aShow then
|
||||
Node.StateIndex:=ShowImgID
|
||||
else
|
||||
Node.StateIndex:=HideImgID;
|
||||
end else begin
|
||||
|
||||
end;
|
||||
Node:=Node.GetNext;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TEduCompPaletteFrame.GetTitle: String;
|
||||
begin
|
||||
Result:='Component palette';
|
||||
@ -178,13 +221,14 @@ end;
|
||||
|
||||
procedure TEduCompPaletteFrame.ReadSettings(AOptions: TAbstractIDEOptions);
|
||||
begin
|
||||
|
||||
FillComponentTreeView;
|
||||
end;
|
||||
|
||||
procedure TEduCompPaletteFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
|
||||
begin
|
||||
ComponentsGroupBox.Caption:='Visible components';
|
||||
FillComponentTreeView;
|
||||
ShowAllButton.Caption:=ersShowAll;
|
||||
HideAllButton.Caption:=ersHideAll;
|
||||
ComponentsGroupBox.Caption:=ersVisibleComponents;
|
||||
end;
|
||||
|
||||
class function TEduCompPaletteFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
|
||||
|
@ -26,8 +26,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, FileUtil, LResources, Forms, Controls, Graphics,
|
||||
Dialogs, ComCtrls, ExtCtrls, StdCtrls, AvgLvlTree,
|
||||
FormEditingIntf, LazConfigStorage, IDEOptionsIntf, ComponentReg,
|
||||
IDEImagesIntf, LazIDEIntf,
|
||||
LazConfigStorage, IDEOptionsIntf, ComponentReg, IDEImagesIntf, LazIDEIntf,
|
||||
EduOptions, EduCompPalette;
|
||||
|
||||
const
|
||||
|
@ -29,6 +29,9 @@ uses
|
||||
|
||||
resourcestring
|
||||
EduRSEducation = 'Education';
|
||||
ersShowAll = 'Show all';
|
||||
ersHideAll = 'Hide all';
|
||||
ersVisibleComponents = 'Visible components';
|
||||
|
||||
const
|
||||
DefaultEduOptionsFilename = 'education.xml';
|
||||
|
Loading…
Reference in New Issue
Block a user