mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-11 05:07:56 +02:00
IDE: Allow hiding units with initialization section in unused units dialog.
git-svn-id: trunk@46659 -
This commit is contained in:
parent
992d392a39
commit
a13f510613
@ -5105,6 +5105,9 @@ resourcestring
|
||||
lisResult2 = 'Result:';
|
||||
lisTheIdentifierIsAUnitPleaseUseTheFileSaveAsFunction = 'The identifier is '
|
||||
+'a unit. Please use the File - Save as function to rename a unit.';
|
||||
lisShowUnitsWithInitialization = 'Show units with initialization/finalization sections';
|
||||
lisShowUnitsWithInitializationHint = 'These units may initialize global data '
|
||||
+'used by the program/application. Remove with care.';
|
||||
lisRemoveSelectedUnits = 'Remove selected units';
|
||||
lisRemoveAllUnits = 'Remove all units';
|
||||
lisCEShowCodeObserver = 'Show observations about';
|
||||
|
@ -1,23 +1,23 @@
|
||||
object UnusedUnitsDialog: TUnusedUnitsDialog
|
||||
Left = 375
|
||||
Height = 343
|
||||
Height = 380
|
||||
Top = 236
|
||||
Width = 503
|
||||
ActiveControl = UnitsTreeView
|
||||
Caption = 'UnusedUnitsDialog'
|
||||
ClientHeight = 343
|
||||
ClientHeight = 380
|
||||
ClientWidth = 503
|
||||
OnCreate = FormCreate
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.1'
|
||||
LCLVersion = '1.3'
|
||||
object UnitsTreeView: TTreeView
|
||||
Left = 6
|
||||
Height = 289
|
||||
Height = 292
|
||||
Top = 6
|
||||
Width = 491
|
||||
Align = alClient
|
||||
BorderSpacing.Around = 6
|
||||
DefaultItemHeight = 18
|
||||
DefaultItemHeight = 22
|
||||
MultiSelect = True
|
||||
ReadOnly = True
|
||||
ScrollBars = ssAutoBoth
|
||||
@ -27,23 +27,22 @@ object UnusedUnitsDialog: TUnusedUnitsDialog
|
||||
end
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Height = 42
|
||||
Top = 301
|
||||
Height = 76
|
||||
Top = 304
|
||||
Width = 503
|
||||
Align = alBottom
|
||||
AutoSize = True
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
ChildSizing.HorizontalSpacing = 10
|
||||
ClientHeight = 42
|
||||
ClientHeight = 76
|
||||
ClientWidth = 503
|
||||
TabOrder = 1
|
||||
object CancelBitBtn: TBitBtn
|
||||
Left = 421
|
||||
Height = 28
|
||||
Top = 7
|
||||
Width = 75
|
||||
Align = alRight
|
||||
Left = 406
|
||||
Height = 30
|
||||
Top = 39
|
||||
Width = 90
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
Cancel = True
|
||||
Caption = 'Cancel'
|
||||
@ -54,11 +53,11 @@ object UnusedUnitsDialog: TUnusedUnitsDialog
|
||||
TabOrder = 0
|
||||
end
|
||||
object RemoveSelectedBitBtn: TBitBtn
|
||||
Left = 270
|
||||
Height = 28
|
||||
Top = 7
|
||||
Width = 141
|
||||
Align = alRight
|
||||
Left = 219
|
||||
Height = 30
|
||||
Top = 39
|
||||
Width = 177
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
Caption = 'RemoveSelectedBitBtn'
|
||||
Constraints.MinWidth = 75
|
||||
@ -67,11 +66,11 @@ object UnusedUnitsDialog: TUnusedUnitsDialog
|
||||
TabOrder = 1
|
||||
end
|
||||
object RemoveAllBitBtn: TBitBtn
|
||||
Left = 153
|
||||
Height = 28
|
||||
Top = 7
|
||||
Width = 107
|
||||
Align = alRight
|
||||
Left = 71
|
||||
Height = 30
|
||||
Top = 39
|
||||
Width = 138
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
Caption = 'RemoveAllBitBtn'
|
||||
Constraints.MinWidth = 75
|
||||
@ -79,5 +78,18 @@ object UnusedUnitsDialog: TUnusedUnitsDialog
|
||||
OnClick = RemoveAllBitBtnClick
|
||||
TabOrder = 2
|
||||
end
|
||||
object ShowInitializationCheckBox: TCheckBox
|
||||
Left = 8
|
||||
Height = 24
|
||||
Top = 6
|
||||
Width = 350
|
||||
Caption = 'Show units with initialization/finalization sections'
|
||||
Checked = True
|
||||
OnClick = ShowInitializationCheckBoxClick
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
State = cbChecked
|
||||
TabOrder = 3
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -42,6 +42,7 @@ type
|
||||
|
||||
TUnusedUnitsDialog = class(TForm)
|
||||
CancelBitBtn: TBitBtn;
|
||||
ShowInitializationCheckBox: TCheckBox;
|
||||
RemoveAllBitBtn: TBitBtn;
|
||||
RemoveSelectedBitBtn: TBitBtn;
|
||||
Panel1: TPanel;
|
||||
@ -50,6 +51,7 @@ type
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure RemoveAllBitBtnClick(Sender: TObject);
|
||||
procedure RemoveSelectedBitBtnClick(Sender: TObject);
|
||||
procedure ShowInitializationCheckBoxClick(Sender: TObject);
|
||||
procedure UnitsTreeViewSelectionChanged(Sender: TObject);
|
||||
private
|
||||
FCode: TCodeBuffer;
|
||||
@ -159,6 +161,8 @@ end;
|
||||
|
||||
procedure TUnusedUnitsDialog.FormCreate(Sender: TObject);
|
||||
begin
|
||||
ShowInitializationCheckBox.Caption:=lisShowUnitsWithInitialization;
|
||||
ShowInitializationCheckBox.Hint:=lisShowUnitsWithInitializationHint;
|
||||
RemoveSelectedBitBtn.Caption:=lisRemoveSelectedUnits;
|
||||
RemoveAllBitBtn.Caption:=lisRemoveAllUnits;
|
||||
CancelBitBtn.Caption:=lisCancel;
|
||||
@ -185,6 +189,11 @@ begin
|
||||
ModalResult:=mrOk;
|
||||
end;
|
||||
|
||||
procedure TUnusedUnitsDialog.ShowInitializationCheckBoxClick(Sender: TObject);
|
||||
begin
|
||||
RebuildUnitsTreeView;
|
||||
end;
|
||||
|
||||
procedure TUnusedUnitsDialog.UnitsTreeViewSelectionChanged(Sender: TObject);
|
||||
begin
|
||||
UpdateButtons;
|
||||
@ -212,7 +221,7 @@ var
|
||||
Flags: string;
|
||||
UseInterface: Boolean;
|
||||
InImplUsesSection: Boolean;
|
||||
UseCode: Boolean;
|
||||
UseCode, HideCode: Boolean;
|
||||
IntfTreeNode: TTreeNode;
|
||||
ImplTreeNode: TTreeNode;
|
||||
ParentNode: TTreeNode;
|
||||
@ -233,7 +242,9 @@ begin
|
||||
InImplUsesSection:=System.Pos(',implementation',Flags)>0;
|
||||
UseInterface:=System.Pos(',used',Flags)>0;
|
||||
UseCode:=System.Pos(',code',Flags)>0;
|
||||
if not UseInterface then begin
|
||||
HideCode:=not ShowInitializationCheckBox.Checked;
|
||||
if not (UseInterface or (HideCode and UseCode)) then
|
||||
begin
|
||||
if InImplUsesSection then
|
||||
ParentNode:=ImplTreeNode
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user