FIX: Controls alignment

(cherry picked from commit f54be93165)
(cherry picked from commit 24ffc65d16)
(cherry picked from commit beb65d5fa6)
This commit is contained in:
Alexander Koblov 2026-03-07 13:57:40 +03:00
commit 5ee528e9dd
8 changed files with 44 additions and 8 deletions

View file

@ -60,7 +60,9 @@ inherited frmOptionsBriefView: TfrmOptionsBriefView
AutoSize = True
Caption = 'Columns size'
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 2
ChildSizing.TopBottomSpacing = 6
ChildSizing.VerticalSpacing = 6
ChildSizing.EnlargeVertical = crsSameSize
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 2
ClientHeight = 69

View file

@ -21,7 +21,7 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
Caption = 'Sorting'
ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 8
ChildSizing.HorizontalSpacing = 6
ChildSizing.HorizontalSpacing = 4
ChildSizing.VerticalSpacing = 12
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ClientHeight = 143
@ -189,7 +189,7 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
Caption = 'Formatting'
ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 8
ChildSizing.HorizontalSpacing = 6
ChildSizing.HorizontalSpacing = 4
ChildSizing.VerticalSpacing = 12
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ClientHeight = 116

View file

@ -154,6 +154,8 @@ begin
begin
cbDateTimeFormat.Items.Insert(0, DefaultDateTimeFormat);
end;
AlignControlsEx(gbSorting, cbCaseSensitivity, lblCaseSensitivity);
AlignControlsEx(gbFormatting, cbFileSizeFormat, lblFileSizeFormat);
end;
procedure TfrmOptionsFilesViews.Load;

View file

@ -57,7 +57,7 @@ implementation
{$R *.lfm}
uses
DCStrUtils, uGlobs, uLng;
DCStrUtils, uGlobs, uLng, uDCUtils;
const
KeyAction_None = 0;
@ -73,6 +73,7 @@ begin
ParseLineToList(rsOptLetters, cbNoModifier.Items);
cbAlt.Items.Assign(cbNoModifier.Items);
cbCtrlAlt.Items.Assign(cbNoModifier.Items);
AlignControlsEx(gbTyping, cbNoModifier, lblNoModifier);
end;
procedure TfrmOptionsKeyboard.Load;

View file

@ -23,7 +23,8 @@ inherited frmOptionsTerminal: TfrmOptionsTerminal
ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 8
ChildSizing.HorizontalSpacing = 4
ChildSizing.VerticalSpacing = 12
ChildSizing.VerticalSpacing = 6
ChildSizing.EnlargeVertical = crsSameSize
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ClientHeight = 62
ClientWidth = 503
@ -36,6 +37,7 @@ inherited frmOptionsTerminal: TfrmOptionsTerminal
Width = 62
Alignment = taRightJustify
Caption = 'Command:'
Layout = tlCenter
ParentColor = False
end
object edRunInTermStayOpenCmd: TEdit
@ -60,6 +62,7 @@ inherited frmOptionsTerminal: TfrmOptionsTerminal
Width = 62
Alignment = taRightJustify
Caption = 'Parameters:'
Layout = tlCenter
ParentColor = False
end
object edRunInTermStayOpenParams: TEdit
@ -95,7 +98,8 @@ inherited frmOptionsTerminal: TfrmOptionsTerminal
ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 8
ChildSizing.HorizontalSpacing = 4
ChildSizing.VerticalSpacing = 12
ChildSizing.VerticalSpacing = 6
ChildSizing.EnlargeVertical = crsSameSize
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ClientHeight = 62
ClientWidth = 503
@ -137,6 +141,7 @@ inherited frmOptionsTerminal: TfrmOptionsTerminal
Width = 62
Alignment = taRightJustify
Caption = 'Command:'
Layout = tlCenter
ParentColor = False
end
object lbRunInTermCloseParams: TLabel
@ -147,6 +152,7 @@ inherited frmOptionsTerminal: TfrmOptionsTerminal
Width = 62
Alignment = taRightJustify
Caption = 'Parameters:'
Layout = tlCenter
ParentColor = False
end
end
@ -167,7 +173,8 @@ inherited frmOptionsTerminal: TfrmOptionsTerminal
ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 8
ChildSizing.HorizontalSpacing = 4
ChildSizing.VerticalSpacing = 12
ChildSizing.VerticalSpacing = 6
ChildSizing.EnlargeVertical = crsSameSize
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ClientHeight = 62
ClientWidth = 503
@ -180,6 +187,7 @@ inherited frmOptionsTerminal: TfrmOptionsTerminal
Width = 62
Alignment = taRightJustify
Caption = 'Command:'
Layout = tlCenter
ParentColor = False
end
object edRunTermCmd: TEdit
@ -204,6 +212,7 @@ inherited frmOptionsTerminal: TfrmOptionsTerminal
Width = 62
Alignment = taRightJustify
Caption = 'Parameters:'
Layout = tlCenter
ParentColor = False
end
object edRunTermParams: TEdit

View file

@ -51,6 +51,7 @@ type
lbRunTermParams: TLabel;
edRunTermParams: TEdit;
protected
procedure Init; override;
procedure Load; override;
function Save: TOptionsEditorSaveFlags; override;
public
@ -63,10 +64,18 @@ implementation
{$R *.lfm}
uses
uGlobs, uLng;
uGlobs, uLng, uDCUtils;
{ TfrmOptionsTerminal }
procedure TfrmOptionsTerminal.Init;
begin
inherited Init;
AlignControlsEx(gbJustRunTerminal, edRunTermCmd, lbRunTermCmd);
AlignControlsEx(gbRunInTerminalClose, edRunInTermCloseCmd, lbRunInTermCloseCmd);
AlignControlsEx(gbRunInTerminalStayOpen, edRunInTermStayOpenCmd, lbRunInTermStayOpenCmd);
end;
procedure TfrmOptionsTerminal.Load;
begin
edRunInTermStayOpenCmd.Text := gRunInTermStayOpenCmd;

View file

@ -392,6 +392,7 @@ begin
miImportTCINI.free;
miImportTCBAR.free;
{$ENDIF}
AlignControlsEx(pnlEditControls, cbInternalCommand, lblInternalCommand);
end;
procedure TfrmOptionsToolbarBase.LoadCurrentButton;

View file

@ -238,6 +238,7 @@ procedure UpdateColor(Control: TControl; Checked: Boolean);
function findScaleFactorByFirstForm: Double;
function findScaleFactorByControl( control: TControl ): Double;
procedure EnableControl(Control: TControl; Enabled: Boolean);
procedure AlignControlsEx(AContainer: TWinControl; AComboBox: TWinControl; ALabel: TLabel);
procedure SetComboWidthToLargestElement(AComboBox: TCustomComboBox; iExtraWidthToAdd: integer = 0);
procedure SplitCmdLineToCmdParams(sCmdLine : String; var sCmd, sParams : String);
@ -1304,6 +1305,17 @@ begin
{$ENDIF}
end;
procedure AlignControlsEx(AContainer: TWinControl; AComboBox: TWinControl; ALabel: TLabel);
var
Delta: Integer;
begin
Delta:= AComboBox.Height - ALabel.Height;
if (Delta > 0) then begin
AContainer.ChildSizing.VerticalSpacing:= AContainer.ChildSizing.VerticalSpacing + Delta;
AContainer.ChildSizing.TopBottomSpacing:= AContainer.ChildSizing.TopBottomSpacing + Delta;
end;
end;
{ SetComboWidthToLargestElement }
// Set the width of a TComboBox to fit to the largest element in it.
procedure SetComboWidthToLargestElement(AComboBox: TCustomComboBox; iExtraWidthToAdd: integer = 0);