UPD: Columns text alignment like values (#841)

This commit is contained in:
Andrey 2023-03-21 08:11:29 +03:00 committed by GitHub
commit 2d04c4b609
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 73 additions and 39 deletions

View file

@ -4215,6 +4215,10 @@ msgstr "Фиксированная ширина колонок"
msgid "Dark mode"
msgstr "Тёмный режим"
#: tfrmoptionscolumnsview.cbcolumnstitlelikevalues.caption
msgid "Column titles alignment &like values"
msgstr "&Выравнивать заголовки как значения"
#: tfrmoptionscolumnsview.cbcuttexttocolwidth.caption
msgctxt "TFRMOPTIONSCOLUMNSVIEW.CBCUTTEXTTOCOLWIDTH.CAPTION"
msgid "Cut &text to column width"

View file

@ -17,7 +17,6 @@ uses
uFileSorting,
DCXmlConfig,
DCBasicTypes,
DCClassesUtf8,
uTypes,
uFileViewWithGrid;
@ -224,7 +223,6 @@ uses
uFileSourceProperty,
uKeyboard,
uFileFunctions,
uFormCommands,
uFileViewNotebook,
fOptionsCustomColumns;
@ -1426,6 +1424,7 @@ procedure TDrawGridEx.DrawColumnText(aCol, aRow: Integer; aRect: TRect;
aState: TGridDrawState);
var
SortingDirection: TSortDirection;
TextStyle: TTextStyle;
begin
SortingDirection := ColumnsView.FColumnsSortDirections[ACol];
@ -1438,6 +1437,13 @@ begin
aRect.Left += gIconsSize;
end;
if gColumnsTitleLikeValues then
begin
TextStyle := Canvas.TextStyle;
TextStyle.Alignment := ColumnsView.GetColumnsClass.GetColumnAlign(ACol);
Canvas.TextStyle := TextStyle;
end;
DrawCellText(aCol, aRow, aRect, aState, GetColumnTitle(aCol));
end;

View file

@ -4,7 +4,8 @@ inherited frmOptionsColumnsView: TfrmOptionsColumnsView
HelpKeyword = '/configuration.html#ConfigViewFull'
ClientHeight = 344
ClientWidth = 659
DesignTop = 20
DesignLeft = 419
DesignTop = 249
object grpAutosizeColumns: TGroupBox[0]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = gbShowGrid
@ -12,8 +13,8 @@ inherited frmOptionsColumnsView: TfrmOptionsColumnsView
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 84
Top = 88
Height = 92
Top = 94
Width = 647
Anchors = [akTop, akLeft, akRight]
AutoSize = True
@ -21,15 +22,15 @@ inherited frmOptionsColumnsView: TfrmOptionsColumnsView
Caption = 'Auto-size columns'
ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 6
ClientHeight = 64
ClientWidth = 643
ClientHeight = 74
ClientWidth = 645
TabOrder = 1
object chkAutoFillColumns: TCheckBox
AnchorSideTop.Side = asrBottom
Left = 12
Height = 19
Height = 23
Top = 6
Width = 111
Width = 138
Caption = 'A&uto fill columns'
TabOrder = 0
end
@ -38,9 +39,9 @@ inherited frmOptionsColumnsView: TfrmOptionsColumnsView
AnchorSideTop.Control = cmbAutoSizeColumn
AnchorSideTop.Side = asrCenter
Left = 12
Height = 15
Top = 39
Width = 95
Height = 17
Top = 45
Width = 118
Caption = 'Auto si&ze column:'
FocusControl = cmbAutoSizeColumn
ParentColor = False
@ -52,15 +53,15 @@ inherited frmOptionsColumnsView: TfrmOptionsColumnsView
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = grpAutosizeColumns
AnchorSideRight.Side = asrBottom
Left = 119
Height = 23
Top = 35
Width = 512
Left = 142
Height = 29
Top = 39
Width = 491
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 12
BorderSpacing.Top = 10
BorderSpacing.Right = 10
ItemHeight = 15
ItemHeight = 0
Items.Strings = (
'First'
'Last'
@ -75,7 +76,7 @@ inherited frmOptionsColumnsView: TfrmOptionsColumnsView
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 76
Height = 82
Top = 6
Width = 647
Anchors = [akTop, akLeft, akRight]
@ -84,16 +85,16 @@ inherited frmOptionsColumnsView: TfrmOptionsColumnsView
Caption = 'Show grid'
ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 6
ClientHeight = 56
ClientWidth = 643
ClientHeight = 64
ClientWidth = 645
TabOrder = 0
object cbGridVertLine: TCheckBox
AnchorSideLeft.Control = gbShowGrid
AnchorSideTop.Control = gbShowGrid
Left = 12
Height = 19
Height = 23
Top = 6
Width = 86
Width = 112
Caption = '&Vertical lines'
OnChange = cbGridVertLineChange
TabOrder = 0
@ -103,9 +104,9 @@ inherited frmOptionsColumnsView: TfrmOptionsColumnsView
AnchorSideTop.Control = cbGridVertLine
AnchorSideTop.Side = asrBottom
Left = 12
Height = 19
Top = 31
Width = 102
Height = 23
Top = 35
Width = 131
BorderSpacing.Top = 6
Caption = '&Horizontal lines'
TabOrder = 1
@ -118,8 +119,8 @@ inherited frmOptionsColumnsView: TfrmOptionsColumnsView
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 76
Top = 178
Height = 95
Top = 192
Width = 647
Anchors = [akTop, akLeft, akRight]
AutoSize = True
@ -128,31 +129,43 @@ inherited frmOptionsColumnsView: TfrmOptionsColumnsView
ChildSizing.TopBottomSpacing = 6
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 56
ClientWidth = 643
ClientHeight = 93
ClientWidth = 645
TabOrder = 2
object cbCutTextToColWidth: TCheckBox
AnchorSideLeft.Control = grpMisc
AnchorSideTop.Control = grpMisc
AnchorSideTop.Control = cbColumnsTitleLikeValues
AnchorSideTop.Side = asrBottom
Left = 12
Height = 19
Top = 6
Width = 152
Height = 23
Top = 35
Width = 190
BorderSpacing.Top = 6
Caption = 'Cut &text to column width'
TabOrder = 0
TabOrder = 1
end
object cbExtendCellWidth: TCheckBox
AnchorSideLeft.Control = grpMisc
AnchorSideTop.Control = cbCutTextToColWidth
AnchorSideTop.Side = asrBottom
Left = 12
Height = 19
Top = 31
Width = 276
Height = 23
Top = 64
Width = 349
BorderSpacing.Top = 6
Caption = '&Extend cell width if text is not fitting into column'
OnChange = cbExtendCellWidthChange
TabOrder = 1
TabOrder = 2
end
object cbColumnsTitleLikeValues: TCheckBox
AnchorSideLeft.Control = grpMisc
AnchorSideTop.Control = grpMisc
Left = 12
Height = 23
Top = 6
Width = 256
Caption = 'Column titles alignment &like values'
TabOrder = 0
end
end
end

View file

@ -6,5 +6,5 @@
{"hash":50869875,"name":"tfrmoptionscolumnsview.cbgridvertline.caption","sourcebytes":[38,86,101,114,116,105,99,97,108,32,108,105,110,101,115],"value":"&Vertical lines"},
{"hash":254961699,"name":"tfrmoptionscolumnsview.cbgridhorzline.caption","sourcebytes":[38,72,111,114,105,122,111,110,116,97,108,32,108,105,110,101,115],"value":"&Horizontal lines"},
{"hash":13344632,"name":"tfrmoptionscolumnsview.cbcuttexttocolwidth.caption","sourcebytes":[67,117,116,32,38,116,101,120,116,32,116,111,32,99,111,108,117,109,110,32,119,105,100,116,104],"value":"Cut &text to column width"},
{"hash":124929006,"name":"tfrmoptionscolumnsview.cbextendcellwidth.caption","sourcebytes":[38,69,120,116,101,110,100,32,99,101,108,108,32,119,105,100,116,104,32,105,102,32,116,101,120,116,32,105,115,32,110,111,116,32,102,105,116,116,105,110,103,32,105,110,116,111,32,99,111,108,117,109,110],"value":"&Extend cell width if text is not fitting into column"}
{"hash":65940035,"name":"tfrmoptionscolumnsview.cbcolumnstitlelikevalues.caption","sourcebytes":[67,111,108,117,109,110,32,116,105,116,108,101,115,32,97,108,105,103,110,109,101,110,116,32,38,108,105,107,101,32,118,97,108,117,101,115],"value":"Column titles alignment &like values"}
]}

View file

@ -39,6 +39,7 @@ type
cbExtendCellWidth: TCheckBox;
cbGridHorzLine: TCheckBox;
cbGridVertLine: TCheckBox;
cbColumnsTitleLikeValues: TCheckBox;
chkAutoFillColumns: TCheckBox;
cmbAutoSizeColumn: TComboBox;
gbShowGrid: TGroupBox;
@ -84,8 +85,11 @@ procedure TfrmOptionsColumnsView.Load;
begin
cbGridVertLine.Checked := gGridVertLine;
cbGridHorzLine.Checked := gGridHorzLine;
chkAutoFillColumns.Checked := gAutoFillColumns;
cmbAutoSizeColumn.ItemIndex := gAutoSizeColumn;
cbColumnsTitleLikeValues.Checked := gColumnsTitleLikeValues;
cbCutTextToColWidth.Checked := gCutTextToColWidth;
cbExtendCellWidth.Checked := gExtendCellWidth;
end;
@ -94,8 +98,11 @@ function TfrmOptionsColumnsView.Save: TOptionsEditorSaveFlags;
begin
gGridVertLine := cbGridVertLine.Checked;
gGridHorzLine := cbGridHorzLine.Checked;
gAutoFillColumns := chkAutoFillColumns.Checked;
gAutoSizeColumn := cmbAutoSizeColumn.ItemIndex;
gColumnsTitleLikeValues := cbColumnsTitleLikeValues.Checked;
gCutTextToColWidth := cbCutTextToColWidth.Checked;
gExtendCellWidth := cbExtendCellWidth.Checked;

View file

@ -357,6 +357,7 @@ var
glsVolumeSizeHistory : TStringListEx;
glsIgnoreList : TStringListEx;
gOnlyOneAppInstance,
gColumnsTitleLikeValues: Boolean;
gCutTextToColWidth : Boolean;
gExtendCellWidth : Boolean;
gSpaceMovesDown: Boolean;
@ -1681,6 +1682,7 @@ begin
gColumnsTitleStyle := tsNative;
gCustomColumnsChangeAllColumns := False;
gDateTimeFormat := DefaultDateTimeFormat;
gColumnsTitleLikeValues := False;
gCutTextToColWidth := True;
gExtendCellWidth := False;
gShowSystemFiles := False;
@ -2709,6 +2711,7 @@ begin
gAutoFillColumns := GetValue(Node, 'AutoFillColumns', gAutoFillColumns);
gAutoSizeColumn := GetValue(Node, 'AutoSizeColumn', gAutoSizeColumn);
gDateTimeFormat := GetValidDateTimeFormat(GetValue(Node, 'DateTimeFormat', gDateTimeFormat), DefaultDateTimeFormat);
gColumnsTitleLikeValues := GetValue(Node, 'ColumnsTitleLikeValues', gColumnsTitleLikeValues);
gCutTextToColWidth := GetValue(Node, 'CutTextToColumnWidth', gCutTextToColWidth);
gExtendCellWidth := GetValue(Node, 'ExtendCellWidth', gExtendCellWidth);
gShowSystemFiles := GetValue(Node, 'ShowSystemFiles', gShowSystemFiles);
@ -3462,6 +3465,7 @@ begin
SetValue(Node, 'CustomColumnsChangeAllColumns', gCustomColumnsChangeAllColumns);
SetValue(Node, 'BriefViewFileExtAligned', gBriefViewFileExtAligned);
SetValue(Node, 'DateTimeFormat', gDateTimeFormat);
SetValue(Node, 'ColumnsTitleLikeValues', gColumnsTitleLikeValues);
SetValue(Node, 'CutTextToColumnWidth', gCutTextToColWidth);
SetValue(Node, 'ExtendCellWidth', gExtendCellWidth);
SetValue(Node, 'ShowSystemFiles', gShowSystemFiles);