UPD: ExtractDlg - improve the layout (fixes #628)

This commit is contained in:
Alexander Koblov 2022-10-29 15:57:34 +03:00
commit 5fdcad2fec
2 changed files with 123 additions and 108 deletions

View file

@ -1,8 +1,8 @@
inherited frmExtractDlg: TfrmExtractDlg
Left = 552
Height = 222
Top = 162
Width = 516
Left = 462
Height = 293
Top = 174
Width = 496
HelpContext = 160
HorzScrollBar.Page = 446
HorzScrollBar.Range = 437
@ -16,149 +16,133 @@ inherited frmExtractDlg: TfrmExtractDlg
Caption = 'Unpack files'
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ClientHeight = 222
ClientWidth = 516
ClientHeight = 293
ClientWidth = 496
OnCreate = FormCreate
Position = poOwnerFormCenter
inherited pnlContent: TPanel
Left = 6
Height = 148
Top = 5
Width = 500
Height = 218
Top = 0
Width = 481
Align = alNone
ChildSizing.TopBottomSpacing = 4
ClientHeight = 148
ClientWidth = 500
object pnlLabels: TPanel[0]
AnchorSideLeft.Control = pnlContent
ClientHeight = 218
ClientWidth = 481
object lblFileMask: TLabel[0]
AnchorSideLeft.Control = pnlCheckBoxes
AnchorSideTop.Control = cbFileMask
AnchorSideBottom.Control = edtPassword
AnchorSideTop.Side = asrCenter
Left = 0
Height = 22
Top = 15
Width = 211
BorderSpacing.Top = 3
Caption = '&Extract files matching file mask:'
FocusControl = cbFileMask
ParentColor = False
end
object lblExtractTo: TLabel[1]
AnchorSideLeft.Control = pnlCheckBoxes
AnchorSideTop.Control = edtExtractTo
AnchorSideTop.Side = asrCenter
Left = 0
Height = 22
Top = 59
Width = 108
BorderSpacing.Top = 8
Caption = 'To the &directory:'
FocusControl = edtExtractTo
ParentColor = False
end
object lblPassword: TLabel[2]
AnchorSideLeft.Control = pnlContent
AnchorSideTop.Control = edtPassword
AnchorSideTop.Side = asrCenter
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 140
Top = 5
Width = 166
Anchors = [akTop, akLeft, akBottom]
AutoSize = True
BevelOuter = bvNone
ClientHeight = 140
ClientWidth = 166
Color = clForm
Height = 22
Top = 185
Width = 193
BorderSpacing.Bottom = 3
Caption = '&Password for encrypted files:'
FocusControl = edtPassword
ParentColor = False
TabOrder = 4
object lblFileMask: TLabel
AnchorSideLeft.Control = pnlLabels
AnchorSideTop.Control = pnlLabels
Left = 0
Height = 15
Top = 3
Width = 166
BorderSpacing.Top = 3
Caption = '&Extract files matching file mask:'
FocusControl = cbFileMask
ParentColor = False
end
object lblPassword: TLabel
AnchorSideLeft.Control = pnlLabels
AnchorSideBottom.Control = pnlLabels
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 15
Top = 122
Width = 151
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 3
Caption = '&Password for encrypted files:'
FocusControl = edtPassword
ParentColor = False
end
object lblExtractTo: TLabel
AnchorSideTop.Control = lblFileMask
AnchorSideTop.Side = asrBottom
Left = 0
Height = 15
Top = 26
Width = 86
BorderSpacing.Top = 8
Caption = 'To the &directory:'
FocusControl = edtExtractTo
ParentColor = False
end
end
object cbFileMask: TComboBox[1]
AnchorSideLeft.Control = pnlLabels
object cbFileMask: TComboBox[3]
AnchorSideLeft.Control = lblFileMask
AnchorSideLeft.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 171
Height = 23
Top = 5
Left = 221
Height = 36
Top = 8
Width = 260
BorderSpacing.Left = 5
BorderSpacing.Top = 2
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 10
BorderSpacing.Top = 8
Constraints.MinWidth = 260
ItemHeight = 15
ItemHeight = 28
ParentFont = False
TabOrder = 0
Text = '*.*'
end
object edtExtractTo: TDirectoryEdit[2]
object edtExtractTo: TDirectoryEdit[4]
AnchorSideLeft.Control = cbFileMask
AnchorSideTop.Control = cbFileMask
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = cbFileMask
AnchorSideRight.Side = asrBottom
Left = 171
Height = 23
Top = 30
Width = 321
Left = 221
Height = 36
Top = 52
Width = 260
ShowHidden = False
ButtonWidth = 23
NumGlyphs = 1
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4
BorderSpacing.Top = 8
MaxLength = 0
TabOrder = 1
end
object edtPassword: TEdit[3]
object edtPassword: TEdit[5]
AnchorSideLeft.Control = cbFileMask
AnchorSideTop.Control = pnlCheckBoxes
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = edtExtractTo
AnchorSideRight.Side = asrBottom
Left = 171
Height = 23
Top = 122
Width = 321
Left = 221
Height = 36
Top = 178
Width = 260
Anchors = [akTop, akLeft, akRight]
EchoMode = emPassword
Enabled = False
PasswordChar = '*'
TabOrder = 3
end
object pnlCheckBoxes: TPanel[4]
object pnlCheckBoxes: TPanel[6]
AnchorSideLeft.Control = pnlContent
AnchorSideTop.Control = edtExtractTo
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 0
Height = 69
Top = 53
Width = 506
Height = 90
Top = 88
Width = 446
AutoSize = True
BevelOuter = bvNone
ChildSizing.TopBottomSpacing = 6
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ClientHeight = 69
ClientWidth = 506
ClientHeight = 90
ClientWidth = 446
Color = clForm
ParentColor = False
TabOrder = 2
object cbInSeparateFolder: TCheckBox
AnchorSideTop.Side = asrBottom
Left = 0
Height = 19
Height = 26
Top = 6
Width = 351
Width = 446
BorderSpacing.Top = 2
Caption = 'Unpack each archive to a &separate subdir (name of the archive)'
TabOrder = 0
@ -166,9 +150,9 @@ inherited frmExtractDlg: TfrmExtractDlg
object cbExtractPath: TCheckBox
AnchorSideTop.Side = asrBottom
Left = 0
Height = 19
Top = 25
Width = 351
Height = 26
Top = 32
Width = 446
Caption = '&Unpack path names if stored with files'
Checked = True
OnChange = cbExtractPathChange
@ -178,11 +162,12 @@ inherited frmExtractDlg: TfrmExtractDlg
object cbOverwrite: TCheckBox
AnchorSideTop.Side = asrBottom
Left = 0
Height = 19
Top = 44
Width = 351
Height = 26
Top = 58
Width = 446
Caption = 'O&verwrite existing files'
Checked = True
State = cbChecked
TabOrder = 2
end
end
@ -192,17 +177,21 @@ inherited frmExtractDlg: TfrmExtractDlg
AnchorSideTop.Control = DividerBevel
AnchorSideRight.Control = pnlContent
AnchorSideRight.Side = asrBottom
Left = 6
Top = 176
Width = 500
Height = 38
Top = 248
Width = 481
Align = alNone
Anchors = [akTop, akLeft, akRight]
ClientWidth = 500
ClientHeight = 38
ClientWidth = 481
inherited btnCancel: TBitBtn
Left = 318
Left = 282
Height = 38
Width = 91
end
inherited btnOK: TBitBtn
Left = 412
Left = 382
Top = 0
end
end
object DividerBevel: TDividerBevel[2]
@ -211,15 +200,17 @@ inherited frmExtractDlg: TfrmExtractDlg
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = pnlContent
AnchorSideRight.Side = asrBottom
Left = 6
Height = 15
Top = 157
Width = 500
Left = 8
Height = 22
Top = 222
Width = 481
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4
Font.Style = [fsBold]
ParentFont = False
end
inherited pmQueuePopup: TPopupMenu[3]
Left = 232
Top = 224
end
end

View file

@ -3,7 +3,7 @@
-------------------------------------------------------------------------
File unpacking window
Copyright (C) 2007-2019 Alexander Koblov (alexx2000@mail.ru)
Copyright (C) 2007-2022 Alexander Koblov (alexx2000@mail.ru)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -46,7 +46,6 @@ type
cbFileMask: TComboBox;
lblFileMask: TLabel;
pnlCheckBoxes: TPanel;
pnlLabels: TPanel;
procedure cbExtractPathChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
@ -55,6 +54,8 @@ type
procedure SwitchOptions;
procedure ExtractArchive(ArchiveFileSource: IArchiveFileSource; TargetFileSource: IFileSource;
const TargetPath, TargetMask: String; QueueId: TOperationsManagerQueueIdentifier);
protected
procedure DoAutoSize; override;
public
{ public declarations }
end;
@ -314,5 +315,28 @@ begin
end;
end;
procedure TfrmExtractDlg.DoAutoSize;
var
Index: Integer;
AControl: TControl;
AMaxControl: TControl;
AMaxWidth: Integer = 0;
begin
inherited DoAutoSize;
for Index:= 0 to pnlContent.ControlCount - 1 do
begin
AControl:= pnlContent.Controls[Index];
if AControl is TCustomLabel then
begin
if AControl.Width > AMaxWidth then
begin
AMaxControl:= AControl;
AMaxWidth:= AControl.Width;
end;
end;
end;
cbFileMask.AnchorSide[akLeft].Control:= AMaxControl;
end;
end.