IDE: Auto-column widths in charactermap (issue #32701).

git-svn-id: trunk@56428 -
This commit is contained in:
wp 2017-11-17 13:24:35 +00:00
parent a3606b5a94
commit fb71f9ddca
2 changed files with 84 additions and 29 deletions

View File

@ -13,7 +13,7 @@ object CharacterMapDialog: TCharacterMapDialog
OnKeyDown = FormKeyDown OnKeyDown = FormKeyDown
OnShow = FormShow OnShow = FormShow
Position = poScreenCenter Position = poScreenCenter
LCLVersion = '1.7' LCLVersion = '1.9.0.0'
object ButtonPanel: TButtonPanel object ButtonPanel: TButtonPanel
Left = 6 Left = 6
Height = 26 Height = 26
@ -44,23 +44,23 @@ object CharacterMapDialog: TCharacterMapDialog
Height = 433 Height = 433
Top = 6 Top = 6
Width = 578 Width = 578
ActivePage = pgUnicode ActivePage = pgAnsi
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6 BorderSpacing.Around = 6
TabIndex = 0 TabIndex = 1
TabOrder = 0 TabOrder = 0
object pgUnicode: TTabSheet object pgUnicode: TTabSheet
Caption = 'Unicode' Caption = 'Unicode'
ClientHeight = 407 ClientHeight = 405
ClientWidth = 570 ClientWidth = 570
object UnicodeCharInfoLabel: TLabel object UnicodeCharInfoLabel: TLabel
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = cbUniRange AnchorSideTop.Control = cbUniRange
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 6 Left = 6
Height = 13 Height = 15
Top = 384 Top = 380
Width = 106 Width = 118
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'UnicodeCharInfoLabel' Caption = 'UnicodeCharInfoLabel'
ParentColor = False ParentColor = False
@ -72,10 +72,11 @@ object CharacterMapDialog: TCharacterMapDialog
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = cbUniRange AnchorSideBottom.Control = cbUniRange
Left = 0 Left = 0
Height = 374 Height = 370
Top = 0 Top = 0
Width = 570 Width = 570
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
AutoFillColumns = True
ColCount = 16 ColCount = 16
DefaultColWidth = 16 DefaultColWidth = 16
DefaultDrawing = False DefaultDrawing = False
@ -87,7 +88,26 @@ object CharacterMapDialog: TCharacterMapDialog
OnKeyPress = StringGridKeyPress OnKeyPress = StringGridKeyPress
OnMouseDown = StringGridMouseDown OnMouseDown = StringGridMouseDown
OnMouseMove = UnicodeGridMouseMove OnMouseMove = UnicodeGridMouseMove
OnPrepareCanvas = GridPrepareCanvas
OnSelectCell = UnicodeGridSelectCell OnSelectCell = UnicodeGridSelectCell
ColWidths = (
35
35
35
35
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
@ -95,13 +115,13 @@ object CharacterMapDialog: TCharacterMapDialog
AnchorSideBottom.Control = pgUnicode AnchorSideBottom.Control = pgUnicode
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 242 Left = 242
Height = 21 Height = 23
Top = 380 Top = 376
Width = 291 Width = 291
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
BorderSpacing.Around = 6 BorderSpacing.Around = 6
DropDownCount = 25 DropDownCount = 25
ItemHeight = 13 ItemHeight = 15
OnSelect = cbUniRangeSelect OnSelect = cbUniRangeSelect
Style = csDropDownList Style = csDropDownList
TabOrder = 1 TabOrder = 1
@ -110,10 +130,10 @@ object CharacterMapDialog: TCharacterMapDialog
AnchorSideTop.Control = cbUniRange AnchorSideTop.Control = cbUniRange
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = cbUniRange AnchorSideRight.Control = cbUniRange
Left = 205 Left = 203
Height = 13 Height = 15
Top = 384 Top = 380
Width = 31 Width = 33
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
Caption = 'Range' Caption = 'Range'
ParentColor = False ParentColor = False
@ -126,7 +146,7 @@ object CharacterMapDialog: TCharacterMapDialog
AnchorSideBottom.Control = pgUnicode AnchorSideBottom.Control = pgUnicode
Left = 539 Left = 539
Height = 25 Height = 25
Top = 378 Top = 375
Width = 25 Width = 25
AllowAllUp = True AllowAllUp = True
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
@ -139,7 +159,7 @@ object CharacterMapDialog: TCharacterMapDialog
end end
object pgAnsi: TTabSheet object pgAnsi: TTabSheet
Caption = 'ANSI' Caption = 'ANSI'
ClientHeight = 407 ClientHeight = 405
ClientWidth = 570 ClientWidth = 570
object AnsiCharInfoLabel: TLabel object AnsiCharInfoLabel: TLabel
AnchorSideLeft.Control = pgAnsi AnchorSideLeft.Control = pgAnsi
@ -150,9 +170,9 @@ object CharacterMapDialog: TCharacterMapDialog
AnchorSideBottom.Control = pgAnsi AnchorSideBottom.Control = pgAnsi
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 6 Left = 6
Height = 13 Height = 15
Top = 384 Top = 380
Width = 88 Width = 97
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'AnsiCharInfoLabel' Caption = 'AnsiCharInfoLabel'
ParentColor = False ParentColor = False
@ -164,7 +184,7 @@ object CharacterMapDialog: TCharacterMapDialog
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = cbCodePage AnchorSideBottom.Control = cbCodePage
Left = 0 Left = 0
Height = 374 Height = 370
Top = 0 Top = 0
Width = 570 Width = 570
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
@ -177,7 +197,27 @@ object CharacterMapDialog: TCharacterMapDialog
OnKeyPress = StringGridKeyPress OnKeyPress = StringGridKeyPress
OnMouseDown = StringGridMouseDown OnMouseDown = StringGridMouseDown
OnMouseMove = AnsiGridMouseMove OnMouseMove = AnsiGridMouseMove
OnPrepareCanvas = GridPrepareCanvas
OnSelectCell = AnsiGridSelectCell OnSelectCell = AnsiGridSelectCell
ColWidths = (
16
34
34
34
34
34
34
34
34
34
34
34
34
34
34
34
40
)
end end
object cbCodePage: TComboBox object cbCodePage: TComboBox
AnchorSideTop.Control = AnsiGrid AnchorSideTop.Control = AnsiGrid
@ -187,13 +227,13 @@ object CharacterMapDialog: TCharacterMapDialog
AnchorSideBottom.Control = pgAnsi AnchorSideBottom.Control = pgAnsi
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 245 Left = 245
Height = 21 Height = 23
Top = 380 Top = 376
Width = 319 Width = 319
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
BorderSpacing.Around = 6 BorderSpacing.Around = 6
DropDownCount = 25 DropDownCount = 25
ItemHeight = 13 ItemHeight = 15
Items.Strings = ( Items.Strings = (
'cp1250 - Central and East European Latin' 'cp1250 - Central and East European Latin'
'cp1251 - Cyrillic' 'cp1251 - Cyrillic'
@ -228,10 +268,10 @@ object CharacterMapDialog: TCharacterMapDialog
AnchorSideTop.Control = cbCodePage AnchorSideTop.Control = cbCodePage
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = cbCodePage AnchorSideRight.Control = cbCodePage
Left = 187 Left = 182
Height = 13 Height = 15
Top = 384 Top = 380
Width = 52 Width = 57
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
Caption = 'Code page' Caption = 'Code page'
ParentColor = False ParentColor = False

View File

@ -62,6 +62,8 @@ type
UnicodeGrid: TStringGrid; UnicodeGrid: TStringGrid;
pgAnsi: TTabSheet; pgAnsi: TTabSheet;
pgUnicode: TTabSheet; pgUnicode: TTabSheet;
procedure GridPrepareCanvas(sender: TObject; aCol, aRow: Integer;
aState: TGridDrawState);
procedure cbCodePageSelect(Sender: TObject); procedure cbCodePageSelect(Sender: TObject);
procedure cbUniRangeSelect(Sender: TObject); procedure cbUniRangeSelect(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word; {%H-}Shift: TShiftState); procedure FormKeyDown(Sender: TObject; var Key: Word; {%H-}Shift: TShiftState);
@ -209,7 +211,8 @@ begin
AnsiGrid.Font.Size := 10; AnsiGrid.Font.Size := 10;
UnicodeGrid.Font.Size := 10; UnicodeGrid.Font.Size := 10;
AnsiGrid.AutoSizeColumns; AnsiGrid.AutoSizeColumn(0);
AnsiGrid.AutoFillColumns := true;
FUnicodeBlockIndex:=NOT_SELECTED; FUnicodeBlockIndex:=NOT_SELECTED;
FillUniRangeList(SortUniRangeListButton.Down); FillUniRangeList(SortUniRangeListButton.Down);
@ -286,6 +289,18 @@ begin
AnsiCharInfoLabel.Caption := '-'; AnsiCharInfoLabel.Caption := '-';
end; end;
procedure TCharacterMapDialog.GridPrepareCanvas(sender: TObject; aCol,
aRow: Integer; aState: TGridDrawState);
var
ts: TTextStyle;
begin
with (Sender as TStringGrid) do begin
ts := Canvas.TextStyle;
ts.Alignment := taCenter;
Canvas.TextStyle := ts;
end;
end;
procedure TCharacterMapDialog.DoStatusUnicodeGrid(ACol, ARow: integer); procedure TCharacterMapDialog.DoStatusUnicodeGrid(ACol, ARow: integer);
var var
S: Cardinal; S: Cardinal;