View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0029078 | Patches | IDE | public | 2015-11-23 22:26 | 2016-03-18 22:26 |
Reporter | CudaText man | Assigned To | Juha Manninen | ||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | resolved | Resolution | fixed | ||
Product Version | 1.5 (SVN) | ||||
Summary | 0029078: CharMap improve | ||||
Description | make select-cell hilited, not simply dot-framed; make hotkeys 1/2: switch to tab1/tab2, needed to use dialog on keyboard; make show status not only on mousemove but with OnSelectCell. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | r50710 | ||||
LazTarget | - | ||||
Widgetset | |||||
Attached Files |
|
related to | 0029161 | resolved | Juha Manninen | Patches | CharMap layout change |
related to | 0029856 | resolved | Bart Broersma | Lazarus | IDE Charmap don't show Rus chars in 128..255 |
|
char1.diff (7,447 bytes)
Index: ide/charactermapdlg.lfm =================================================================== --- ide/charactermapdlg.lfm (revision 50487) +++ ide/charactermapdlg.lfm (working copy) @@ -3,7 +3,6 @@ Height = 477 Top = 128 Width = 593 - ActiveControl = PageControl1 BorderStyle = bsSizeToolWin Caption = 'CharacterMapDialog' ClientHeight = 477 @@ -12,6 +11,7 @@ KeyPreview = True OnCreate = FormCreate OnKeyDown = FormKeyDown + OnKeyPress = FormKeyPress OnShow = FormShow Position = poScreenCenter LCLVersion = '1.5' @@ -31,7 +31,7 @@ CancelButton.Name = 'CancelButton' CancelButton.DefaultCaption = True CancelButton.Enabled = False - TabOrder = 0 + TabOrder = 1 ShowButtons = [pbClose, pbHelp] ShowBevel = False end @@ -49,9 +49,9 @@ Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Around = 6 TabIndex = 0 - TabOrder = 1 + TabOrder = 0 object TabSheet1: TTabSheet - Caption = 'ANSI' + Caption = '1: ANSI' ClientHeight = 399 ClientWidth = 577 object CharInfoLabel: TLabel @@ -83,16 +83,18 @@ Anchors = [akTop, akLeft, akRight, akBottom] ColCount = 17 DefaultColWidth = 16 - Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goSmoothScroll] + DefaultDrawing = False + Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goDrawFocusSelected, goSmoothScroll] RowCount = 15 TabOrder = 0 OnKeyPress = StringGridKeyPress OnMouseDown = StringGridMouseDown OnMouseMove = StringGrid1MouseMove + OnSelectCell = StringGrid1SelectCell end end object TabSheet2: TTabSheet - Caption = 'Unicode' + Caption = '2: Unicode' ClientHeight = 399 ClientWidth = 577 object UnicodeCharInfoLabel: TLabel @@ -120,14 +122,16 @@ Anchors = [akTop, akLeft, akRight, akBottom] ColCount = 16 DefaultColWidth = 16 + DefaultDrawing = False FixedCols = 0 FixedRows = 0 - Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goSmoothScroll] + Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goDrawFocusSelected, goSmoothScroll] RowCount = 15 TabOrder = 0 OnKeyPress = StringGridKeyPress OnMouseDown = StringGridMouseDown OnMouseMove = StringGrid2MouseMove + OnSelectCell = StringGrid2SelectCell end object cbUniRange: TComboBox AnchorSideRight.Control = TabSheet2 @@ -134,10 +138,10 @@ AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = TabSheet2 AnchorSideBottom.Side = asrBottom - Left = 359 + Left = 280 Height = 31 Top = 362 - Width = 212 + Width = 291 Anchors = [akRight, akBottom] BorderSpacing.Around = 6 DropDownCount = 25 Index: ide/charactermapdlg.pas =================================================================== --- ide/charactermapdlg.pas (revision 50487) +++ ide/charactermapdlg.pas (working copy) @@ -59,9 +59,14 @@ TabSheet2: TTabSheet; procedure cbUniRangeSelect(Sender: TObject); procedure FormKeyDown(Sender: TObject; var Key: Word; {%H-}Shift: TShiftState); + procedure FormKeyPress(Sender: TObject; var Key: char); procedure HelpButtonClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormShow(Sender: TObject); + procedure StringGrid1SelectCell(Sender: TObject; aCol, aRow: Integer; + var CanSelect: Boolean); + procedure StringGrid2SelectCell(Sender: TObject; aCol, aRow: Integer; + var CanSelect: Boolean); procedure StringGridKeyPress(Sender: TObject; var Key: char); procedure StringGridMouseDown(Sender: TObject; Button: TMouseButton; {%H-}Shift: TShiftState; X, Y: Integer); @@ -71,6 +76,8 @@ Y: Integer); private FOnInsertCharacter: TOnInsertCharacterEvent; + procedure DoStatusGrid1(ACol, ARow: integer); + procedure DoStatusGrid2(ACol, ARow: integer); procedure FillCharMap; public property OnInsertCharacter: TOnInsertCharacterEvent read FOnInsertCharacter @@ -152,6 +159,22 @@ end; end; +procedure TCharacterMapDialog.FormKeyPress(Sender: TObject; var Key: char); +begin + if Key='1' then + begin + PageControl1.ActivePage:=TabSheet1; + Key:=#0; + exit + end; + if Key='2' then + begin + PageControl1.ActivePage:=TabSheet2; + Key:=#0; + exit + end; +end; + procedure TCharacterMapDialog.FormShow(Sender: TObject); var i:integer; begin @@ -168,6 +191,18 @@ cbUniRangeSelect(nil); end; +procedure TCharacterMapDialog.StringGrid1SelectCell(Sender: TObject; aCol, + aRow: Integer; var CanSelect: Boolean); +begin + DoStatusGrid1(aCol, aRow); +end; + +procedure TCharacterMapDialog.StringGrid2SelectCell(Sender: TObject; aCol, + aRow: Integer; var CanSelect: Boolean); +begin + DoStatusGrid2(aCol, aRow); +end; + procedure TCharacterMapDialog.StringGridKeyPress(Sender: TObject; var Key: char); var sg: TStringGrid; @@ -197,10 +232,23 @@ end; end; +procedure TCharacterMapDialog.DoStatusGrid1(ACol, ARow: integer); +var + CharOrd: Byte; +begin + if StringGrid1.Cells[ACol, ARow] <> '' then + begin + CharOrd := Ord(UTF8ToAnsi(StringGrid1.Cells[ACol, ARow])[1]); + CharInfoLabel.Caption := 'Decimal = ' + IntToStr(CharOrd) + + ', Hex = $' + HexStr(CharOrd, 2); + end + else + CharInfoLabel.Caption := '-'; +end; + procedure TCharacterMapDialog.StringGrid1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); var - CharOrd: Byte; Row, Col: Integer; begin if StringGrid1.MouseToGridZone(X, Y) = gzNormal then @@ -207,14 +255,7 @@ begin Col:=0; Row:=0; StringGrid1.MouseToCell(X, Y, Col, Row); - if StringGrid1.Cells[Col, Row] <> '' then - begin - CharOrd := Ord(UTF8ToAnsi(StringGrid1.Cells[Col, Row])[1]); - CharInfoLabel.Caption := 'Decimal = ' + IntToStr(CharOrd) + - ', Hex = $' + HexStr(CharOrd, 2); - end - else - CharInfoLabel.Caption := '-'; + DoStatusGrid1(Col, Row); end else begin @@ -222,22 +263,31 @@ end; end; +procedure TCharacterMapDialog.DoStatusGrid2(ACol, ARow: integer); +var + S: Cardinal; + tmp, tmp2: String; + i: Integer; +begin + if cbUniRange.ItemIndex<0 then exit; + S:=UnicodeBlocks[cbUniRange.ItemIndex].S+(ACol)+(ARow*16); + tmp:=UnicodeToUTF8(S); + tmp2:=''; + for i:=1 to Length(tmp) do + tmp2:=tmp2+'$'+IntToHex(Ord(tmp[i]),2); + UnicodeCharInfoLabel.Caption:='U+'+inttohex(S,4)+', UTF-8: '+tmp2; +end; + procedure TCharacterMapDialog.StringGrid2MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); -var Row, Col, i: Integer; - S:Cardinal; - tmp,tmp2:String; +var + Row, Col: Integer; begin if StringGrid2.MouseToGridZone(X, Y) = gzNormal then begin Col:=0; Row:=0; StringGrid2.MouseToCell(X, Y, Col, Row); - S:=UnicodeBlocks[cbUniRange.ItemIndex].S+(Col)+(Row*16); - tmp:=UnicodeToUTF8(S); - tmp2:=''; - for i:=1 to Length(tmp) do - tmp2:=tmp2+'$'+IntToHex(Ord(tmp[i]),2); - UnicodeCharInfoLabel.Caption:='U+'+inttohex(S,4)+', UTF-8 = '+tmp2; + DoStatusGrid2(Col, Row); end else begin |
|
> make hotkeys 1/2: switch to tab1/tab2, needed to use dialog on keyboard; OS / widgetsets already have a way to navigate tabs without mouse. I don't think we need an extra non-standard way to do it. > make show status not only on mousemove but with OnSelectCell. I think this is OK although it confuses things when both mouse and keyboard are used. This is a real improvement when only keyboard is used. However the whole Character Map dialog has more serious issues which should be fixed. Maybe you could look at them. 1. The "ANSI" tab shows lower 0-$7F ASCII chars and then '?' for the upper $80-$FF range. Below the grid the details show info for the real '?' char: Decimal 63, Hex $3F. It is a bug. 2. What does the other "Unicode" tab actually show? I guess it shows the upper ANSI codepage for different locales and their corresponding Unicode + UTF8 codes. It is not obvious where the set of characters come from. If they come from upper ANSI codepage, it should be indicated somehow. Maybe the original author Mattias can explain the logic. I can also study the code later ... |
|
-- the other "Unicode" tab actually show? It shows chars from Nth range. Range is selected below. e.g. range can be UnicodeBlocks: array[0..MaxUnicodeBlocks] of TUnicodeBlock = ( (S: $0020; E: $007F; PG: 'Basic Latin'), //Warning this is for charactermapdlg.pas: Full range starts at $0000 (S: $00A0; E: $00FF; PG: 'Latin-1 Supplement'), //Warning this is for charactermapdlg.pas: Full range starts at $0080 (S: $0100; E: $017F; PG: 'Latin Extended-A'), (S: $0180; E: $024F; PG: 'Latin Extended-B'), |
|
chars "?" story is: Mattias converts ANSi codes 0..255 using AnsiToUtf8() and for Linux this is bad. coz Linux ansi CP not inited OK. for Win32 it works ok. coz Win (Russian) has CP1251 codepage. and code is ok |
|
Ok, right. Maybe the Unicode range Combobox should have text "Range" in front of it. This is only a subset of Unicode ranges. More could be added at some point. Yes, the "?" on Linux should be fixed. |
|
char2.diff (7,268 bytes)
Index: ide/charactermapdlg.lfm =================================================================== --- ide/charactermapdlg.lfm (revision 50531) +++ ide/charactermapdlg.lfm (working copy) @@ -3,7 +3,6 @@ Height = 477 Top = 128 Width = 593 - ActiveControl = PageControl1 BorderStyle = bsSizeToolWin Caption = 'CharacterMapDialog' ClientHeight = 477 @@ -12,6 +11,7 @@ KeyPreview = True OnCreate = FormCreate OnKeyDown = FormKeyDown + OnKeyPress = FormKeyPress OnShow = FormShow Position = poScreenCenter LCLVersion = '1.5' @@ -31,7 +31,7 @@ CancelButton.Name = 'CancelButton' CancelButton.DefaultCaption = True CancelButton.Enabled = False - TabOrder = 0 + TabOrder = 1 ShowButtons = [pbClose, pbHelp] ShowBevel = False end @@ -49,9 +49,9 @@ Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Around = 6 TabIndex = 0 - TabOrder = 1 + TabOrder = 0 object TabSheet1: TTabSheet - Caption = 'ANSI' + Caption = '1: ANSI' ClientHeight = 399 ClientWidth = 577 object CharInfoLabel: TLabel @@ -83,16 +83,18 @@ Anchors = [akTop, akLeft, akRight, akBottom] ColCount = 17 DefaultColWidth = 16 - Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goSmoothScroll] + DefaultDrawing = False + Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goDrawFocusSelected, goSmoothScroll] RowCount = 15 TabOrder = 0 OnKeyPress = StringGridKeyPress OnMouseDown = StringGridMouseDown OnMouseMove = StringGrid1MouseMove + OnSelectCell = StringGrid1SelectCell end end object TabSheet2: TTabSheet - Caption = 'Unicode' + Caption = '2: Unicode' ClientHeight = 399 ClientWidth = 577 object UnicodeCharInfoLabel: TLabel @@ -120,14 +122,16 @@ Anchors = [akTop, akLeft, akRight, akBottom] ColCount = 16 DefaultColWidth = 16 + DefaultDrawing = False FixedCols = 0 FixedRows = 0 - Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goSmoothScroll] + Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goDrawFocusSelected, goSmoothScroll] RowCount = 15 TabOrder = 0 OnKeyPress = StringGridKeyPress OnMouseDown = StringGridMouseDown OnMouseMove = StringGrid2MouseMove + OnSelectCell = StringGrid2SelectCell end object cbUniRange: TComboBox AnchorSideRight.Control = TabSheet2 @@ -134,10 +138,10 @@ AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = TabSheet2 AnchorSideBottom.Side = asrBottom - Left = 359 + Left = 280 Height = 31 Top = 362 - Width = 212 + Width = 291 Anchors = [akRight, akBottom] BorderSpacing.Around = 6 DropDownCount = 25 Index: ide/charactermapdlg.pas =================================================================== --- ide/charactermapdlg.pas (revision 50531) +++ ide/charactermapdlg.pas (working copy) @@ -59,9 +59,14 @@ TabSheet2: TTabSheet; procedure cbUniRangeSelect(Sender: TObject); procedure FormKeyDown(Sender: TObject; var Key: Word; {%H-}Shift: TShiftState); + procedure FormKeyPress(Sender: TObject; var Key: char); procedure HelpButtonClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormShow(Sender: TObject); + procedure StringGrid1SelectCell(Sender: TObject; aCol, aRow: Integer; + var CanSelect: Boolean); + procedure StringGrid2SelectCell(Sender: TObject; aCol, aRow: Integer; + var CanSelect: Boolean); procedure StringGridKeyPress(Sender: TObject; var Key: char); procedure StringGridMouseDown(Sender: TObject; Button: TMouseButton; {%H-}Shift: TShiftState; X, Y: Integer); @@ -71,6 +76,8 @@ Y: Integer); private FOnInsertCharacter: TOnInsertCharacterEvent; + procedure DoStatusGrid1(ACol, ARow: integer); + procedure DoStatusGrid2(ACol, ARow: integer); procedure FillCharMap; public property OnInsertCharacter: TOnInsertCharacterEvent read FOnInsertCharacter @@ -152,6 +159,22 @@ end; end; +procedure TCharacterMapDialog.FormKeyPress(Sender: TObject; var Key: char); +begin + if Key='1' then + begin + PageControl1.ActivePage:=TabSheet1; + Key:=#0; + exit + end; + if Key='2' then + begin + PageControl1.ActivePage:=TabSheet2; + Key:=#0; + exit + end; +end; + procedure TCharacterMapDialog.FormShow(Sender: TObject); var i:integer; begin @@ -168,6 +191,18 @@ cbUniRangeSelect(nil); end; +procedure TCharacterMapDialog.StringGrid1SelectCell(Sender: TObject; aCol, + aRow: Integer; var CanSelect: Boolean); +begin + DoStatusGrid1(aCol, aRow); +end; + +procedure TCharacterMapDialog.StringGrid2SelectCell(Sender: TObject; aCol, + aRow: Integer; var CanSelect: Boolean); +begin + DoStatusGrid2(aCol, aRow); +end; + procedure TCharacterMapDialog.StringGridKeyPress(Sender: TObject; var Key: char); var sg: TStringGrid; @@ -197,10 +232,17 @@ end; end; +procedure TCharacterMapDialog.DoStatusGrid1(ACol, ARow: integer); +var + N: integer; +begin + N := ACol-1 + (ARow-1)*16 + 32; + CharInfoLabel.Caption := Format('Decimal: %s, Hex: $%s', [IntToStr(N), IntToHex(N, 2)]); +end; + procedure TCharacterMapDialog.StringGrid1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); var - CharOrd: Byte; Row, Col: Integer; begin if StringGrid1.MouseToGridZone(X, Y) = gzNormal then @@ -207,14 +249,7 @@ begin Col:=0; Row:=0; StringGrid1.MouseToCell(X, Y, Col, Row); - if StringGrid1.Cells[Col, Row] <> '' then - begin - CharOrd := Ord(UTF8ToAnsi(StringGrid1.Cells[Col, Row])[1]); - CharInfoLabel.Caption := 'Decimal = ' + IntToStr(CharOrd) + - ', Hex = $' + HexStr(CharOrd, 2); - end - else - CharInfoLabel.Caption := '-'; + DoStatusGrid1(Col, Row); end else begin @@ -222,22 +257,31 @@ end; end; +procedure TCharacterMapDialog.DoStatusGrid2(ACol, ARow: integer); +var + S: Cardinal; + tmp, tmp2: String; + i: Integer; +begin + if cbUniRange.ItemIndex<0 then exit; + S:=UnicodeBlocks[cbUniRange.ItemIndex].S+(ACol)+(ARow*16); + tmp:=UnicodeToUTF8(S); + tmp2:=''; + for i:=1 to Length(tmp) do + tmp2:=tmp2+'$'+IntToHex(Ord(tmp[i]),2); + UnicodeCharInfoLabel.Caption:='U+'+inttohex(S,4)+', UTF-8: '+tmp2; +end; + procedure TCharacterMapDialog.StringGrid2MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); -var Row, Col, i: Integer; - S:Cardinal; - tmp,tmp2:String; +var + Row, Col: Integer; begin if StringGrid2.MouseToGridZone(X, Y) = gzNormal then begin Col:=0; Row:=0; StringGrid2.MouseToCell(X, Y, Col, Row); - S:=UnicodeBlocks[cbUniRange.ItemIndex].S+(Col)+(Row*16); - tmp:=UnicodeToUTF8(S); - tmp2:=''; - for i:=1 to Length(tmp) do - tmp2:=tmp2+'$'+IntToHex(Ord(tmp[i]),2); - UnicodeCharInfoLabel.Caption:='U+'+inttohex(S,4)+', UTF-8 = '+tmp2; + DoStatusGrid2(Col, Row); end else begin |
|
New pch attached. fixed "?" status. I cannot find how to change tabs at Linux ubuntu UI: so I left keys 1/2. |
|
I applied after adding a "Range" label and removing the 1/2 keys. Why did you want to add such non-standard keys for exactly this PageControl but not for others? There are many PageControls in Lazarus IDE. With GTK2 + Xubuntu at least "Home" and "End" keys work for that purpose when a tab has focus. With QT the arrow keys work. In my opinion the arrow keys are logical and should work always, but such things depend on widgetset. |
Date Modified | Username | Field | Change |
---|---|---|---|
2015-11-23 22:26 | CudaText man | New Issue | |
2015-11-23 22:26 | CudaText man | File Added: char1.diff | |
2015-12-06 14:39 | Juha Manninen | Assigned To | => Juha Manninen |
2015-12-06 14:39 | Juha Manninen | Status | new => assigned |
2015-12-06 17:35 | Juha Manninen | LazTarget | => - |
2015-12-06 17:35 | Juha Manninen | Note Added: 0087820 | |
2015-12-06 17:35 | Juha Manninen | Status | assigned => feedback |
2015-12-06 18:26 | CudaText man | Note Added: 0087823 | |
2015-12-06 18:26 | CudaText man | Status | feedback => assigned |
2015-12-06 18:27 | CudaText man | Note Edited: 0087823 | View Revisions |
2015-12-06 18:32 | CudaText man | Note Added: 0087824 | |
2015-12-06 22:52 | Juha Manninen | Note Added: 0087828 | |
2015-12-07 00:49 | CudaText man | File Added: char2.diff | |
2015-12-07 00:49 | CudaText man | Note Added: 0087829 | |
2015-12-07 00:50 | CudaText man | Note Edited: 0087829 | View Revisions |
2015-12-08 14:00 | Juha Manninen | Fixed in Revision | => r50710 |
2015-12-08 14:00 | Juha Manninen | Note Added: 0087838 | |
2015-12-08 14:00 | Juha Manninen | Status | assigned => resolved |
2015-12-08 14:00 | Juha Manninen | Resolution | open => fixed |
2015-12-10 15:02 | Juha Manninen | Relationship added | related to 0029161 |
2016-03-18 22:26 | Juha Manninen | Relationship added | related to 0029856 |