IDE: Resizable character height in CharacterMap to improve readability.

This commit is contained in:
wp_xyz 2021-11-08 13:27:50 +01:00
parent c817696268
commit cdbd787a67
2 changed files with 122 additions and 33 deletions

View File

@ -1,7 +1,7 @@
object CharacterMapDialog: TCharacterMapDialog object CharacterMapDialog: TCharacterMapDialog
Left = 242 Left = 258
Height = 477 Height = 477
Top = 126 Top = 197
Width = 590 Width = 590
BorderStyle = bsSizeToolWin BorderStyle = bsSizeToolWin
Caption = 'CharacterMapDialog' Caption = 'CharacterMapDialog'
@ -13,7 +13,7 @@ object CharacterMapDialog: TCharacterMapDialog
OnKeyDown = FormKeyDown OnKeyDown = FormKeyDown
OnShow = FormShow OnShow = FormShow
Position = poScreenCenter Position = poScreenCenter
LCLVersion = '1.9.0.0' LCLVersion = '2.3.0.0'
object ButtonPanel: TButtonPanel object ButtonPanel: TButtonPanel
Left = 6 Left = 6
Height = 26 Height = 26
@ -59,11 +59,10 @@ object CharacterMapDialog: TCharacterMapDialog
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 6 Left = 6
Height = 15 Height = 15
Top = 380 Top = 351
Width = 118 Width = 118
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'UnicodeCharInfoLabel' Caption = 'UnicodeCharInfoLabel'
ParentColor = False
end end
object UnicodeGrid: TStringGrid object UnicodeGrid: TStringGrid
AnchorSideLeft.Control = pgUnicode AnchorSideLeft.Control = pgUnicode
@ -72,7 +71,7 @@ object CharacterMapDialog: TCharacterMapDialog
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = cbUniRange AnchorSideBottom.Control = cbUniRange
Left = 0 Left = 0
Height = 370 Height = 341
Top = 0 Top = 0
Width = 570 Width = 570
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
@ -91,6 +90,12 @@ object CharacterMapDialog: TCharacterMapDialog
OnPrepareCanvas = GridPrepareCanvas OnPrepareCanvas = GridPrepareCanvas
OnSelectCell = UnicodeGridSelectCell OnSelectCell = UnicodeGridSelectCell
ColWidths = ( ColWidths = (
36
36
36
36
36
36
35 35
35 35
35 35
@ -101,22 +106,15 @@ object CharacterMapDialog: TCharacterMapDialog
35 35
35 35
35 35
35
35
35
35
35
41
) )
end end
object cbUniRange: TComboBox object cbUniRange: TComboBox
AnchorSideTop.Control = UnicodeGrid AnchorSideTop.Control = UnicodeGrid
AnchorSideRight.Control = SortUniRangeListButton AnchorSideRight.Control = SortUniRangeListButton
AnchorSideBottom.Control = pgUnicode AnchorSideBottom.Control = seUniSize
AnchorSideBottom.Side = asrBottom
Left = 242 Left = 242
Height = 23 Height = 23
Top = 376 Top = 347
Width = 291 Width = 291
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
BorderSpacing.Around = 6 BorderSpacing.Around = 6
@ -132,11 +130,10 @@ object CharacterMapDialog: TCharacterMapDialog
AnchorSideRight.Control = cbUniRange AnchorSideRight.Control = cbUniRange
Left = 203 Left = 203
Height = 15 Height = 15
Top = 380 Top = 351
Width = 33 Width = 33
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
Caption = 'Range' Caption = 'Range'
ParentColor = False
end end
object SortUniRangeListButton: TSpeedButton object SortUniRangeListButton: TSpeedButton
AnchorSideTop.Control = cbUniRange AnchorSideTop.Control = cbUniRange
@ -146,7 +143,7 @@ object CharacterMapDialog: TCharacterMapDialog
AnchorSideBottom.Control = pgUnicode AnchorSideBottom.Control = pgUnicode
Left = 539 Left = 539
Height = 25 Height = 25
Top = 375 Top = 346
Width = 25 Width = 25
AllowAllUp = True AllowAllUp = True
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
@ -156,6 +153,40 @@ object CharacterMapDialog: TCharacterMapDialog
ShowHint = True ShowHint = True
ParentShowHint = False ParentShowHint = False
end end
object seUniSize: TSpinEdit
AnchorSideLeft.Control = cbUniRange
AnchorSideTop.Control = cbCodePage
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = pgUnicode
AnchorSideBottom.Side = asrBottom
Left = 242
Height = 23
Top = 376
Width = 80
Alignment = taRightJustify
Anchors = [akLeft, akBottom]
BorderSpacing.Top = 6
BorderSpacing.Right = 6
BorderSpacing.Bottom = 6
MaxValue = 32
MinValue = 8
OnChange = seUniSizeChange
TabOrder = 2
Value = 12
end
object UniSizeLabel: TLabel
AnchorSideTop.Control = seUniSize
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = RangeLabel
AnchorSideRight.Side = asrBottom
Left = 162
Height = 15
Top = 380
Width = 74
Anchors = [akTop, akRight]
Caption = 'Character Size'
FocusControl = seUniSize
end
end end
object pgAnsi: TTabSheet object pgAnsi: TTabSheet
Caption = 'ANSI' Caption = 'ANSI'
@ -171,11 +202,10 @@ object CharacterMapDialog: TCharacterMapDialog
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 6 Left = 6
Height = 15 Height = 15
Top = 380 Top = 351
Width = 97 Width = 97
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'AnsiCharInfoLabel' Caption = 'AnsiCharInfoLabel'
ParentColor = False
end end
object AnsiGrid: TStringGrid object AnsiGrid: TStringGrid
AnchorSideLeft.Control = pgAnsi AnchorSideLeft.Control = pgAnsi
@ -184,7 +214,7 @@ object CharacterMapDialog: TCharacterMapDialog
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = cbCodePage AnchorSideBottom.Control = cbCodePage
Left = 0 Left = 0
Height = 370 Height = 341
Top = 0 Top = 0
Width = 570 Width = 570
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
@ -220,16 +250,14 @@ object CharacterMapDialog: TCharacterMapDialog
) )
end end
object cbCodePage: TComboBox object cbCodePage: TComboBox
AnchorSideTop.Control = AnsiGrid
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = pgAnsi AnchorSideRight.Control = pgAnsi
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = pgAnsi AnchorSideBottom.Control = seAnsiSize
AnchorSideBottom.Side = asrBottom Left = 242
Left = 245
Height = 23 Height = 23
Top = 376 Top = 347
Width = 319 Width = 322
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
BorderSpacing.Around = 6 BorderSpacing.Around = 6
DropDownCount = 25 DropDownCount = 25
@ -268,13 +296,46 @@ object CharacterMapDialog: TCharacterMapDialog
AnchorSideTop.Control = cbCodePage AnchorSideTop.Control = cbCodePage
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = cbCodePage AnchorSideRight.Control = cbCodePage
Left = 182 Left = 179
Height = 15 Height = 15
Top = 380 Top = 351
Width = 57 Width = 57
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
Caption = 'Code page' Caption = 'Code page'
ParentColor = False end
object AnsiSizeLabel: TLabel
AnchorSideTop.Control = seAnsiSize
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = CodePageLabel
AnchorSideRight.Side = asrBottom
Left = 162
Height = 15
Top = 380
Width = 74
Anchors = [akTop, akRight]
Caption = 'Character Size'
FocusControl = seAnsiSize
end
object seAnsiSize: TSpinEdit
AnchorSideLeft.Control = cbCodePage
AnchorSideTop.Control = cbCodePage
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = pgAnsi
AnchorSideBottom.Side = asrBottom
Left = 242
Height = 23
Top = 376
Width = 80
Alignment = taRightJustify
Anchors = [akLeft, akBottom]
BorderSpacing.Top = 6
BorderSpacing.Right = 6
BorderSpacing.Bottom = 6
MaxValue = 32
MinValue = 8
OnChange = seAnsiSizeChange
TabOrder = 2
Value = 12
end end
end end
end end

View File

@ -41,7 +41,7 @@ uses
Classes, SysUtils, Math, Classes, SysUtils, Math,
// LCL // LCL
Controls, Graphics, Dialogs, Buttons, StdCtrls, Forms, Controls, Graphics, Dialogs, Buttons, StdCtrls, Forms,
LCLType, LCLUnicodeData, Grids, ButtonPanel, ComCtrls, LCLType, LCLUnicodeData, Grids, ButtonPanel, ComCtrls, Spin,
// LazUtils // LazUtils
GraphType, LazUTF8, LConvEncoding, GraphType, LazUTF8, LConvEncoding,
// IdeIntf // IdeIntf
@ -59,9 +59,13 @@ type
cbCodePage: TComboBox; cbCodePage: TComboBox;
AnsiCharInfoLabel: TLabel; AnsiCharInfoLabel: TLabel;
cbUniRange: TComboBox; cbUniRange: TComboBox;
AnsiSizeLabel: TLabel;
UniSizeLabel: TLabel;
seUniSize: TSpinEdit;
SortUniRangeListButton: TSpeedButton; SortUniRangeListButton: TSpeedButton;
CodePageLabel: TLabel; CodePageLabel: TLabel;
RangeLabel: TLabel; RangeLabel: TLabel;
seAnsiSize: TSpinEdit;
UnicodeCharInfoLabel: TLabel; UnicodeCharInfoLabel: TLabel;
PageControl1: TPageControl; PageControl1: TPageControl;
AnsiGrid: TStringGrid; AnsiGrid: TStringGrid;
@ -76,6 +80,8 @@ type
procedure HelpButtonClick(Sender: TObject); procedure HelpButtonClick(Sender: TObject);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject); procedure FormShow(Sender: TObject);
procedure seAnsiSizeChange(Sender: TObject);
procedure seUniSizeChange(Sender: TObject);
procedure SortUniRangeListButtonClick(Sender: TObject); procedure SortUniRangeListButtonClick(Sender: TObject);
procedure AnsiGridSelectCell(Sender: TObject; aCol, aRow: Integer; procedure AnsiGridSelectCell(Sender: TObject; aCol, aRow: Integer;
var {%H-}CanSelect: Boolean); var {%H-}CanSelect: Boolean);
@ -211,13 +217,21 @@ begin
end; end;
procedure TCharacterMapDialog.FormShow(Sender: TObject); procedure TCharacterMapDialog.FormShow(Sender: TObject);
var
savedFontSize: Integer;
begin begin
AnsiGrid.Font.Name := EditorOpts.EditorFont; AnsiGrid.Font.Name := EditorOpts.EditorFont;
UnicodeGrid.Font.Name := EditorOpts.EditorFont; UnicodeGrid.Font.Name := EditorOpts.EditorFont;
AnsiGrid.Font.Size := 10; AnsiGrid.Font.Size := seAnsiSize.Value;
UnicodeGrid.Font.Size := 10; UnicodeGrid.Font.Size := seUniSize.Value;
// Auto-adjust the width of the AnsiGrid's fixed column. Note that
// the font defined in PrepareCanvas is ignored by AutoSizeColumn.
savedfontSize := AnsiGrid.Font.Size;
AnsiGrid.Font.Size := 10;
AnsiGrid.AutoSizeColumn(0); AnsiGrid.AutoSizeColumn(0);
AnsiGrid.Font.Size := savedFontSize;
// Now also auto-adjust the widths of the other AnsiGrid to fill the client area.
AnsiGrid.AutoFillColumns := true; AnsiGrid.AutoFillColumns := true;
FUnicodeBlockIndex:=NOT_SELECTED; FUnicodeBlockIndex:=NOT_SELECTED;
@ -227,6 +241,18 @@ begin
cbUniRange.DropDownCount := Math.max(EnvironmentOptions.DropDownCount, 25); cbUniRange.DropDownCount := Math.max(EnvironmentOptions.DropDownCount, 25);
end; end;
procedure TCharacterMapDialog.seAnsiSizeChange(Sender: TObject);
begin
AnsiGrid.Font.Size := seAnsiSize.Value;
seUniSize.Value := seAnsiSize.Value;
end;
procedure TCharacterMapDialog.seUniSizeChange(Sender: TObject);
begin
UnicodeGrid.Font.Size := seUniSize.Value;
seAnsiSize.Value := seUniSize.Value;
end;
procedure TCharacterMapDialog.SortUniRangeListButtonClick(Sender: TObject); procedure TCharacterMapDialog.SortUniRangeListButtonClick(Sender: TObject);
begin begin
FillUniRangeList(SortUniRangeListButton.Down); FillUniRangeList(SortUniRangeListButton.Down);
@ -306,6 +332,8 @@ begin
ts := Canvas.TextStyle; ts := Canvas.TextStyle;
ts.Alignment := taCenter; ts.Alignment := taCenter;
Canvas.TextStyle := ts; Canvas.TextStyle := ts;
if (Sender = AnsiGrid) and ((aCol = 0) or (aRow = 0)) then
Canvas.Font.Size := 10;
end; end;
end; end;