Hi, I have modified Character Map Dialog so that it inserts the characters right into the source editor. I have also replaced improper TSynEdit with the TStringGrid. This patch also includes fix for not always functioning read-only state of source editor(e. g. Insert Text method, Replace, ...).

tombo



Index: charactermapdlg.lfm
===================================================================
--- charactermapdlg.lfm (revision 8501)
+++ charactermapdlg.lfm (working copy)
@@ -1,760 +1,75 @@
 object CharacterMapDialog: TCharacterMapDialog
+  ActiveControl = CloseButton
   Caption = 'CharacterMapDialog'
-  ClientHeight = 405
-  ClientWidth = 412
+  ClientHeight = 397
+  ClientWidth = 360
+  FormStyle = fsStayOnTop
   KeyPreview = True
-  OnCreate = CharacterMapDialogCREATE
-  OnDestroy = CharacterMapDialogDESTROY
-  OnKeyDown = CharacterMapDialogKEYDOWN
-  Position = poscreencenter
-  HorzScrollBar.Page = 413
-  VertScrollBar.Page = 406
-  Left = 379
-  Height = 405
-  Top = 278
-  Width = 412
-  object OkButton: TButton
-    Anchors = [akleft, akbottom]
+  OnCreate = FormCreate
+  OnShow = FormShow
+  PixelsPerInch = 96
+  HorzScrollBar.Page = 359
+  VertScrollBar.Page = 396
+  Left = 528
+  Height = 397
+  Top = 142
+  Width = 360
+  object CloseButton: TButton
+    Anchors = [akBottom]
+    BorderSpacing.Around = 6
+    BorderSpacing.InnerBorder = 2
+    Cancel = True
+    Caption = 'Close'
+    Default = True
     ModalResult = 1
-    Caption = 'Ok'
-    TabStop = True
+    OnClick = CloseButtonClick
     TabOrder = 0
-    Left = 112
+    Left = 142
     Height = 25
-    Top = 374
+    Top = 368
     Width = 75
   end
-  object CancelButton: TButton
-    Anchors = [akleft, akbottom]
-    ModalResult = 2
-    Caption = 'Cancel'
-    TabStop = True
-    TabOrder = 1
-    Left = 224
-    Height = 25
-    Top = 374
-    Width = 75
-  end
   object CharactersGroupbox: TGroupBox
-    Anchors = [aktop, akleft, akright, akbottom]
+    Anchors = [akTop, akLeft, akRight, akBottom]
+    BorderSpacing.Around = 6
     Caption = 'Characters'
-    ClientHeight = 271
-    ClientWidth = 393
-    ParentColor = True
+    ClientHeight = 334
+    ClientWidth = 341
     ParentCtl3D = False
-    TabOrder = 2
+    TabOrder = 1
     Left = 8
-    Height = 288
+    Height = 352
     Top = 8
-    Width = 397
-    object CharMapSynedit: TSynEdit
-      Align = altop
-      Anchors = [aktop, akleft, akright, akbottom]
-      Font.Height = -15
-      Font.Name = 'courier'
-      Height = 248
-      Name = 'CharMapSynedit'
-      ParentCtl3D = False
-      TabOrder = 0
-      Width = 393
-      OnMouseDown = CharMapSyneditMOUSEDOWN
-      OnMouseMove = CharMapSyneditMOUSEMOVE
-      BookMarkOptions.OnChange = nil
-      Gutter.Visible = False
-      Gutter.OnChange = nil
-      Keystrokes = <      
-        item
-          Command = 3
-          ShortCut = 38
-        end      
-        item
-          Command = 103
-          ShortCut = 8230
-        end      
-        item
-          Command = 211
-          ShortCut = 16422
-        end      
-        item
-          Command = 4
-          ShortCut = 40
-        end      
-        item
-          Command = 104
-          ShortCut = 8232
-        end      
-        item
-          Command = 212
-          ShortCut = 16424
-        end      
-        item
-          Command = 1
-          ShortCut = 37
-        end      
-        item
-          Command = 101
-          ShortCut = 8229
-        end      
-        item
-          Command = 5
-          ShortCut = 16421
-        end      
-        item
-          Command = 105
-          ShortCut = 24613
-        end      
-        item
-          Command = 2
-          ShortCut = 39
-        end      
-        item
-          Command = 102
-          ShortCut = 8231
-        end      
-        item
-          Command = 6
-          ShortCut = 16423
-        end      
-        item
-          Command = 106
-          ShortCut = 24615
-        end      
-        item
-          Command = 10
-          ShortCut = 34
-        end      
-        item
-          Command = 110
-          ShortCut = 8226
-        end      
-        item
-          Command = 14
-          ShortCut = 16418
-        end      
-        item
-          Command = 114
-          ShortCut = 24610
-        end      
-        item
-          Command = 9
-          ShortCut = 33
-        end      
-        item
-          Command = 109
-          ShortCut = 8225
-        end      
-        item
-          Command = 13
-          ShortCut = 16417
-        end      
-        item
-          Command = 113
-          ShortCut = 24609
-        end      
-        item
-          Command = 7
-          ShortCut = 36
-        end      
-        item
-          Command = 107
-          ShortCut = 8228
-        end      
-        item
-          Command = 15
-          ShortCut = 16420
-        end      
-        item
-          Command = 115
-          ShortCut = 24612
-        end      
-        item
-          Command = 8
-          ShortCut = 35
-        end      
-        item
-          Command = 108
-          ShortCut = 8227
-        end      
-        item
-          Command = 16
-          ShortCut = 16419
-        end      
-        item
-          Command = 116
-          ShortCut = 24611
-        end      
-        item
-          Command = 223
-          ShortCut = 45
-        end      
-        item
-          Command = 201
-          ShortCut = 16429
-        end      
-        item
-          Command = 604
-          ShortCut = 8237
-        end      
-        item
-          Command = 502
-          ShortCut = 46
-        end      
-        item
-          Command = 603
-          ShortCut = 8238
-        end      
-        item
-          Command = 501
-          ShortCut = 8
-        end      
-        item
-          Command = 501
-          ShortCut = 8200
-        end      
-        item
-          Command = 504
-          ShortCut = 16392
-        end      
-        item
-          Command = 601
-          ShortCut = 32776
-        end      
-        item
-          Command = 602
-          ShortCut = 40968
-        end      
-        item
-          Command = 509
-          ShortCut = 13
-        end      
-        item
-          Command = 199
-          ShortCut = 16449
-        end      
-        item
-          Command = 201
-          ShortCut = 16451
-        end      
-        item
-          Command = 610
-          ShortCut = 24649
-        end      
-        item
-          Command = 509
-          ShortCut = 16461
-        end      
-        item
-          Command = 510
-          ShortCut = 16462
-        end      
-        item
-          Command = 503
-          ShortCut = 16468
-        end      
-        item
-          Command = 611
-          ShortCut = 24661
-        end      
-        item
-          Command = 604
-          ShortCut = 16470
-        end      
-        item
-          Command = 603
-          ShortCut = 16472
-        end      
-        item
-          Command = 507
-          ShortCut = 16473
-        end      
-        item
-          Command = 506
-          ShortCut = 24665
-        end      
-        item
-          Command = 601
-          ShortCut = 16474
-        end      
-        item
-          Command = 602
-          ShortCut = 24666
-        end      
-        item
-          Command = 301
-          ShortCut = 16432
-        end      
-        item
-          Command = 302
-          ShortCut = 16433
-        end      
-        item
-          Command = 303
-          ShortCut = 16434
-        end      
-        item
-          Command = 304
-          ShortCut = 16435
-        end      
-        item
-          Command = 305
-          ShortCut = 16436
-        end      
-        item
-          Command = 306
-          ShortCut = 16437
-        end      
-        item
-          Command = 307
-          ShortCut = 16438
-        end      
-        item
-          Command = 308
-          ShortCut = 16439
-        end      
-        item
-          Command = 309
-          ShortCut = 16440
-        end      
-        item
-          Command = 310
-          ShortCut = 16441
-        end      
-        item
-          Command = 351
-          ShortCut = 24624
-        end      
-        item
-          Command = 352
-          ShortCut = 24625
-        end      
-        item
-          Command = 353
-          ShortCut = 24626
-        end      
-        item
-          Command = 354
-          ShortCut = 24627
-        end      
-        item
-          Command = 355
-          ShortCut = 24628
-        end      
-        item
-          Command = 356
-          ShortCut = 24629
-        end      
-        item
-          Command = 357
-          ShortCut = 24630
-        end      
-        item
-          Command = 358
-          ShortCut = 24631
-        end      
-        item
-          Command = 359
-          ShortCut = 24632
-        end      
-        item
-          Command = 360
-          ShortCut = 24633
-        end      
-        item
-          Command = 231
-          ShortCut = 24654
-        end      
-        item
-          Command = 232
-          ShortCut = 24643
-        end      
-        item
-          Command = 233
-          ShortCut = 24652
-        end      
-        item
-          Command = 612
-          ShortCut = 9
-        end      
-        item
-          Command = 613
-          ShortCut = 8201
-        end      
-        item
-          Command = 250
-          ShortCut = 24642
-        end>
-      Lines.Strings = (
-        'CharMapSynedit'
-      )
-      Options = [eoautoindent, eonocaret, eonoselection, eoscrollpasteol, 
eoshowscrollhint, eosmarttabs, eotabstospaces, eotrimtrailingspaces]
-      ReadOnly = True
-      SelectedColor.OnChange = nil
-      Cursor = 65532
-      Height = 248
-      Width = 393
-    end
+    Width = 345
     object CharInfoLabel: TLabel
-      Align = albottom
-      Anchors = [akleft, akright, akbottom]
+      Align = alBottom
+      BorderSpacing.Around = 6
       Caption = 'CharInfoLabel'
-      Layout = tltop
-      Height = 20
-      Top = 251
-      Width = 393
+      Color = clNone
+      ParentColor = False
+      Left = 6
+      Height = 14
+      Top = 314
+      Width = 329
     end
-  end
-  object TextGroupbox: TGroupBox
-    Anchors = [akleft, akright, akbottom]
-    Caption = 'Text'
-    ClientHeight = 53
-    ClientWidth = 393
-    ParentColor = True
-    ParentCtl3D = False
-    TabOrder = 3
-    Left = 8
-    Height = 70
-    Top = 296
-    Width = 397
-    object TextSynedit: TSynEdit
-      Align = alclient
-      Font.Height = -15
-      Font.Name = 'courier'
-      Height = 53
-      Name = 'TextSynedit'
-      ParentCtl3D = False
-      TabOrder = 0
-      Width = 393
-      BookMarkOptions.OnChange = nil
-      Gutter.Visible = False
-      Gutter.OnChange = nil
-      Keystrokes = <      
-        item
-          Command = 3
-          ShortCut = 38
-        end      
-        item
-          Command = 103
-          ShortCut = 8230
-        end      
-        item
-          Command = 211
-          ShortCut = 16422
-        end      
-        item
-          Command = 4
-          ShortCut = 40
-        end      
-        item
-          Command = 104
-          ShortCut = 8232
-        end      
-        item
-          Command = 212
-          ShortCut = 16424
-        end      
-        item
-          Command = 1
-          ShortCut = 37
-        end      
-        item
-          Command = 101
-          ShortCut = 8229
-        end      
-        item
-          Command = 5
-          ShortCut = 16421
-        end      
-        item
-          Command = 105
-          ShortCut = 24613
-        end      
-        item
-          Command = 2
-          ShortCut = 39
-        end      
-        item
-          Command = 102
-          ShortCut = 8231
-        end      
-        item
-          Command = 6
-          ShortCut = 16423
-        end      
-        item
-          Command = 106
-          ShortCut = 24615
-        end      
-        item
-          Command = 10
-          ShortCut = 34
-        end      
-        item
-          Command = 110
-          ShortCut = 8226
-        end      
-        item
-          Command = 14
-          ShortCut = 16418
-        end      
-        item
-          Command = 114
-          ShortCut = 24610
-        end      
-        item
-          Command = 9
-          ShortCut = 33
-        end      
-        item
-          Command = 109
-          ShortCut = 8225
-        end      
-        item
-          Command = 13
-          ShortCut = 16417
-        end      
-        item
-          Command = 113
-          ShortCut = 24609
-        end      
-        item
-          Command = 7
-          ShortCut = 36
-        end      
-        item
-          Command = 107
-          ShortCut = 8228
-        end      
-        item
-          Command = 15
-          ShortCut = 16420
-        end      
-        item
-          Command = 115
-          ShortCut = 24612
-        end      
-        item
-          Command = 8
-          ShortCut = 35
-        end      
-        item
-          Command = 108
-          ShortCut = 8227
-        end      
-        item
-          Command = 16
-          ShortCut = 16419
-        end      
-        item
-          Command = 116
-          ShortCut = 24611
-        end      
-        item
-          Command = 223
-          ShortCut = 45
-        end      
-        item
-          Command = 201
-          ShortCut = 16429
-        end      
-        item
-          Command = 604
-          ShortCut = 8237
-        end      
-        item
-          Command = 502
-          ShortCut = 46
-        end      
-        item
-          Command = 603
-          ShortCut = 8238
-        end      
-        item
-          Command = 501
-          ShortCut = 8
-        end      
-        item
-          Command = 501
-          ShortCut = 8200
-        end      
-        item
-          Command = 504
-          ShortCut = 16392
-        end      
-        item
-          Command = 601
-          ShortCut = 32776
-        end      
-        item
-          Command = 602
-          ShortCut = 40968
-        end      
-        item
-          Command = 509
-          ShortCut = 13
-        end      
-        item
-          Command = 199
-          ShortCut = 16449
-        end      
-        item
-          Command = 201
-          ShortCut = 16451
-        end      
-        item
-          Command = 610
-          ShortCut = 24649
-        end      
-        item
-          Command = 509
-          ShortCut = 16461
-        end      
-        item
-          Command = 510
-          ShortCut = 16462
-        end      
-        item
-          Command = 503
-          ShortCut = 16468
-        end      
-        item
-          Command = 611
-          ShortCut = 24661
-        end      
-        item
-          Command = 604
-          ShortCut = 16470
-        end      
-        item
-          Command = 603
-          ShortCut = 16472
-        end      
-        item
-          Command = 507
-          ShortCut = 16473
-        end      
-        item
-          Command = 506
-          ShortCut = 24665
-        end      
-        item
-          Command = 601
-          ShortCut = 16474
-        end      
-        item
-          Command = 602
-          ShortCut = 24666
-        end      
-        item
-          Command = 301
-          ShortCut = 16432
-        end      
-        item
-          Command = 302
-          ShortCut = 16433
-        end      
-        item
-          Command = 303
-          ShortCut = 16434
-        end      
-        item
-          Command = 304
-          ShortCut = 16435
-        end      
-        item
-          Command = 305
-          ShortCut = 16436
-        end      
-        item
-          Command = 306
-          ShortCut = 16437
-        end      
-        item
-          Command = 307
-          ShortCut = 16438
-        end      
-        item
-          Command = 308
-          ShortCut = 16439
-        end      
-        item
-          Command = 309
-          ShortCut = 16440
-        end      
-        item
-          Command = 310
-          ShortCut = 16441
-        end      
-        item
-          Command = 351
-          ShortCut = 24624
-        end      
-        item
-          Command = 352
-          ShortCut = 24625
-        end      
-        item
-          Command = 353
-          ShortCut = 24626
-        end      
-        item
-          Command = 354
-          ShortCut = 24627
-        end      
-        item
-          Command = 355
-          ShortCut = 24628
-        end      
-        item
-          Command = 356
-          ShortCut = 24629
-        end      
-        item
-          Command = 357
-          ShortCut = 24630
-        end      
-        item
-          Command = 358
-          ShortCut = 24631
-        end      
-        item
-          Command = 359
-          ShortCut = 24632
-        end      
-        item
-          Command = 360
-          ShortCut = 24633
-        end      
-        item
-          Command = 231
-          ShortCut = 24654
-        end      
-        item
-          Command = 232
-          ShortCut = 24643
-        end      
-        item
-          Command = 233
-          ShortCut = 24652
-        end      
-        item
-          Command = 612
-          ShortCut = 9
-        end      
-        item
-          Command = 613
-          ShortCut = 8201
-        end      
-        item
-          Command = 250
-          ShortCut = 24642
-        end>
-      Lines.Strings = (
-        'TextSynedit'
-      )
-      SelectedColor.OnChange = nil
-      Cursor = 65532
-      Height = 53
-      Width = 393
+    object StringGrid1: TStringGrid
+      Anchors = [akTop, akLeft, akRight, akBottom]
+      BorderSpacing.Around = 6
+      ColCount = 17
+      DefaultColWidth = 16
+      FixedColor = clBtnFace
+      GridLineWidth = 0
+      Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, 
goSmoothScroll]
+      RowCount = 15
+      ScrollBars = ssAutoBoth
+      VisibleColCount = 16
+      VisibleRowCount = 14
+      OnMouseDown = StringGrid1MouseDown
+      OnMouseMove = StringGrid1MouseMove
+      Left = 6
+      Height = 304
+      Top = 6
+      Width = 329
     end
   end
 end
Index: charactermapdlg.lrs
===================================================================
--- charactermapdlg.lrs (revision 8501)
+++ charactermapdlg.lrs (working copy)
@@ -1,124 +1,28 @@
 { This is an automatically generated lazarus resource file }
 
 LazarusResources.Add('TCharacterMapDialog','FORMDATA',[
-  
'TPF0'#19'TCharacterMapDialog'#18'CharacterMapDialog'#7'Caption'#6#18'Charact'
-  
+'erMapDialog'#12'ClientHeight'#3#149#1#11'ClientWidth'#3#156#1#10'KeyPreview'
-  
+#9#8'OnCreate'#7#24'CharacterMapDialogCREATE'#9'OnDestroy'#7#25'CharacterMap'
-  
+'DialogDESTROY'#9'OnKeyDown'#7#25'CharacterMapDialogKEYDOWN'#8'Position'#7#14
-  +'poscreencenter'#18'HorzScrollBar.Page'#3#157#1#18'VertScrollBar.Page'#3#150
-  
+#1#4'Left'#3'{'#1#6'Height'#3#149#1#3'Top'#3#22#1#5'Width'#3#156#1#0#7'TButt'
-  +'on'#8'OkButton'#7'Anchors'#11#6'akleft'#8'akbottom'#0#11'ModalResult'#2#1#7
-  +'Caption'#6#2'Ok'#7'TabStop'#9#8'TabOrder'#2#0#4'Left'#2'p'#6'Height'#2#25#3
-  
+'Top'#3'v'#1#5'Width'#2'K'#0#0#7'TButton'#12'CancelButton'#7'Anchors'#11#6'a'
-  
+'kleft'#8'akbottom'#0#11'ModalResult'#2#2#7'Caption'#6#6'Cancel'#7'TabStop'#9
-  
+#8'TabOrder'#2#1#4'Left'#3#224#0#6'Height'#2#25#3'Top'#3'v'#1#5'Width'#2'K'#0
-  
+#0#9'TGroupBox'#18'CharactersGroupbox'#7'Anchors'#11#5'aktop'#6'akleft'#7'ak'
-  +'right'#8'akbottom'#0#7'Caption'#6#10'Characters'#12'ClientHeight'#3#15#1#11
-  +'ClientWidth'#3#137#1#11'ParentColor'#9#11'ParentCtl3D'#8#8'TabOrder'#2#2#4
-  +'Left'#2#8#6'Height'#3' 
'#1#3'Top'#2#8#5'Width'#3#141#1#0#8'TSynEdit'#14'Cha'
-  
+'rMapSynedit'#5'Align'#7#5'altop'#7'Anchors'#11#5'aktop'#6'akleft'#7'akright'
-  +#8'akbottom'#0#11'Font.Height'#2#241#9'Font.Name'#6#7'courier'#6'Height'#3
-  
+#248#0#4'Name'#6#14'CharMapSynedit'#11'ParentCtl3D'#8#8'TabOrder'#2#0#5'Widt'
-  +'h'#3#137#1#11'OnMouseDown'#7#23'CharMapSyneditMOUSEDOWN'#11'OnMouseMove'#7
-  
+#23'CharMapSyneditMOUSEMOVE'#24'BookMarkOptions.OnChange'#13#14'Gutter.Visib'
-  +'le'#8#15'Gutter.OnChange'#13#10'Keystrokes'#14#1#7'Command'#2#3#8'ShortCut'
-  +#2'&'#0#1#7'Command'#2'g'#8'ShortCut'#3'& 
'#0#1#7'Command'#3#211#0#8'ShortCu'
-  
+'t'#3'&@'#0#1#7'Command'#2#4#8'ShortCut'#2'('#0#1#7'Command'#2'h'#8'ShortCut'
-  +#3'( 
'#0#1#7'Command'#3#212#0#8'ShortCut'#3'(@'#0#1#7'Command'#2#1#8'ShortCu'
-  +'t'#2'%'#0#1#7'Command'#2'e'#8'ShortCut'#3'% 
'#0#1#7'Command'#2#5#8'ShortCut'
-  
+#3'%@'#0#1#7'Command'#2'i'#8'ShortCut'#3'%`'#0#1#7'Command'#2#2#8'ShortCut'#2
-  +''''#0#1#7'Command'#2'f'#8'ShortCut'#3''' '#0#1#7'Command'#2#6#8'ShortCut'#3
-  +'''@'#0#1#7'Command'#2'j'#8'ShortCut'#3'''`'#0#1#7'Command'#2#10#8'ShortCut'
-  +#2'"'#0#1#7'Command'#2'n'#8'ShortCut'#3'" 
'#0#1#7'Command'#2#14#8'ShortCut'#3
-  +'"@'#0#1#7'Command'#2'r'#8'ShortCut'#3'"`'#0#1#7'Command'#2#9#8'ShortCut'#2
-  +'!'#0#1#7'Command'#2'm'#8'ShortCut'#3'! '#0#1#7'Command'#2#13#8'ShortCut'#3
-  +'!@'#0#1#7'Command'#2'q'#8'ShortCut'#3'!`'#0#1#7'Command'#2#7#8'ShortCut'#2
-  +'$'#0#1#7'Command'#2'k'#8'ShortCut'#3'$ '#0#1#7'Command'#2#15#8'ShortCut'#3
-  +'$@'#0#1#7'Command'#2's'#8'ShortCut'#3'$`'#0#1#7'Command'#2#8#8'ShortCut'#2
-  +'#'#0#1#7'Command'#2'l'#8'ShortCut'#3'# '#0#1#7'Command'#2#16#8'ShortCut'#3
-  
+'#@'#0#1#7'Command'#2't'#8'ShortCut'#3'#`'#0#1#7'Command'#3#223#0#8'ShortCut'
-  
+#2'-'#0#1#7'Command'#3#201#0#8'ShortCut'#3'-@'#0#1#7'Command'#3'\'#2#8'Short'
-  +'Cut'#3'- '#0#1#7'Command'#3#246#1#8'ShortCut'#2'.'#0#1#7'Command'#3'['#2#8
-  +'ShortCut'#3'. '#0#1#7'Command'#3#245#1#8'ShortCut'#2#8#0#1#7'Command'#3#245
-  +#1#8'ShortCut'#3#8' 
'#0#1#7'Command'#3#248#1#8'ShortCut'#3#8'@'#0#1#7'Comman'
-  +'d'#3'Y'#2#8'ShortCut'#4#8#128#0#0#0#1#7'Command'#3'Z'#2#8'ShortCut'#4#8#160
-  
+#0#0#0#1#7'Command'#3#253#1#8'ShortCut'#2#13#0#1#7'Command'#3#199#0#8'ShortC'
-  +'ut'#3'A@'#0#1#7'Command'#3#201#0#8'ShortCut'#3'C@'#0#1#7'Command'#3'b'#2#8
-  +'ShortCut'#3'I`'#0#1#7'Command'#3#253#1#8'ShortCut'#3'M@'#0#1#7'Command'#3
-  
+#254#1#8'ShortCut'#3'N@'#0#1#7'Command'#3#247#1#8'ShortCut'#3'T@'#0#1#7'Comm'
-  +'and'#3'c'#2#8'ShortCut'#3'U`'#0#1#7'Command'#3'\'#2#8'ShortCut'#3'V@'#0#1#7
-  
+'Command'#3'['#2#8'ShortCut'#3'X@'#0#1#7'Command'#3#251#1#8'ShortCut'#3'Y@'#0
-  +#1#7'Command'#3#250#1#8'ShortCut'#3'Y`'#0#1#7'Command'#3'Y'#2#8'ShortCut'#3
-  
+'Z@'#0#1#7'Command'#3'Z'#2#8'ShortCut'#3'Z`'#0#1#7'Command'#3'-'#1#8'ShortCu'
-  
+'t'#3'0@'#0#1#7'Command'#3'.'#1#8'ShortCut'#3'1@'#0#1#7'Command'#3'/'#1#8'Sh'
-  +'ortCut'#3'2@'#0#1#7'Command'#3'0'#1#8'ShortCut'#3'3@'#0#1#7'Command'#3'1'#1
-  +#8'ShortCut'#3'4@'#0#1#7'Command'#3'2'#1#8'ShortCut'#3'5@'#0#1#7'Command'#3
-  
+'3'#1#8'ShortCut'#3'6@'#0#1#7'Command'#3'4'#1#8'ShortCut'#3'7@'#0#1#7'Comman'
-  
+'d'#3'5'#1#8'ShortCut'#3'8@'#0#1#7'Command'#3'6'#1#8'ShortCut'#3'9@'#0#1#7'C'
-  
+'ommand'#3'_'#1#8'ShortCut'#3'0`'#0#1#7'Command'#3'`'#1#8'ShortCut'#3'1`'#0#1
-  +#7'Command'#3'a'#1#8'ShortCut'#3'2`'#0#1#7'Command'#3'b'#1#8'ShortCut'#3'3`'
-  +#0#1#7'Command'#3'c'#1#8'ShortCut'#3'4`'#0#1#7'Command'#3'd'#1#8'ShortCut'#3
-  
+'5`'#0#1#7'Command'#3'e'#1#8'ShortCut'#3'6`'#0#1#7'Command'#3'f'#1#8'ShortCu'
-  
+'t'#3'7`'#0#1#7'Command'#3'g'#1#8'ShortCut'#3'8`'#0#1#7'Command'#3'h'#1#8'Sh'
-  +'ortCut'#3'9`'#0#1#7'Command'#3#231#0#8'ShortCut'#3'N`'#0#1#7'Command'#3#232
-  +#0#8'ShortCut'#3'C`'#0#1#7'Command'#3#233#0#8'ShortCut'#3'L`'#0#1#7'Command'
-  +#3'd'#2#8'ShortCut'#2#9#0#1#7'Command'#3'e'#2#8'ShortCut'#3#9' 
'#0#1#7'Comma'
-  
+'nd'#3#250#0#8'ShortCut'#3'B`'#0#0#13'Lines.Strings'#1#6#14'CharMapSynedit'#0
-  
+#7'Options'#11#12'eoautoindent'#9'eonocaret'#13'eonoselection'#15'eoscrollpa'
-  
,'steol'#16'eoshowscrollhint'#11'eosmarttabs'#14'eotabstospaces'#20'eotrimtra'
-  +'ilingspaces'#0#8'ReadOnly'#9#22'SelectedColor.OnChange'#13#6'Cursor'#4#252
-  
+#255#0#0#6'Height'#3#248#0#5'Width'#3#137#1#0#0#6'TLabel'#13'CharInfoLabel'#5
-  
+'Align'#7#8'albottom'#7'Anchors'#11#6'akleft'#7'akright'#8'akbottom'#0#7'Cap'
-  
+'tion'#6#13'CharInfoLabel'#6'Layout'#7#5'tltop'#6'Height'#2#20#3'Top'#3#251#0
-  
+#5'Width'#3#137#1#0#0#0#9'TGroupBox'#12'TextGroupbox'#7'Anchors'#11#6'akleft'
-  
+#7'akright'#8'akbottom'#0#7'Caption'#6#4'Text'#12'ClientHeight'#2'5'#11'Clie'
-  
+'ntWidth'#3#137#1#11'ParentColor'#9#11'ParentCtl3D'#8#8'TabOrder'#2#3#4'Left'
-  
+#2#8#6'Height'#2'F'#3'Top'#3'('#1#5'Width'#3#141#1#0#8'TSynEdit'#11'TextSyne'
-  +'dit'#5'Align'#7#8'alclient'#11'Font.Height'#2#241#9'Font.Name'#6#7'courier'
-  
+#6'Height'#2'5'#4'Name'#6#11'TextSynedit'#11'ParentCtl3D'#8#8'TabOrder'#2#0#5
-  
+'Width'#3#137#1#24'BookMarkOptions.OnChange'#13#14'Gutter.Visible'#8#15'Gutt'
-  
+'er.OnChange'#13#10'Keystrokes'#14#1#7'Command'#2#3#8'ShortCut'#2'&'#0#1#7'C'
-  +'ommand'#2'g'#8'ShortCut'#3'& '#0#1#7'Command'#3#211#0#8'ShortCut'#3'&@'#0#1
-  +#7'Command'#2#4#8'ShortCut'#2'('#0#1#7'Command'#2'h'#8'ShortCut'#3'( '#0#1#7
-  
+'Command'#3#212#0#8'ShortCut'#3'(@'#0#1#7'Command'#2#1#8'ShortCut'#2'%'#0#1#7
-  +'Command'#2'e'#8'ShortCut'#3'% '#0#1#7'Command'#2#5#8'ShortCut'#3'%@'#0#1#7
-  +'Command'#2'i'#8'ShortCut'#3'%`'#0#1#7'Command'#2#2#8'ShortCut'#2''''#0#1#7
-  +'Command'#2'f'#8'ShortCut'#3''' 
'#0#1#7'Command'#2#6#8'ShortCut'#3'''@'#0#1#7
-  +'Command'#2'j'#8'ShortCut'#3'''`'#0#1#7'Command'#2#10#8'ShortCut'#2'"'#0#1#7
-  +'Command'#2'n'#8'ShortCut'#3'" '#0#1#7'Command'#2#14#8'ShortCut'#3'"@'#0#1#7
-  
+'Command'#2'r'#8'ShortCut'#3'"`'#0#1#7'Command'#2#9#8'ShortCut'#2'!'#0#1#7'C'
-  +'ommand'#2'm'#8'ShortCut'#3'! '#0#1#7'Command'#2#13#8'ShortCut'#3'!@'#0#1#7
-  
+'Command'#2'q'#8'ShortCut'#3'!`'#0#1#7'Command'#2#7#8'ShortCut'#2'$'#0#1#7'C'
-  +'ommand'#2'k'#8'ShortCut'#3'$ '#0#1#7'Command'#2#15#8'ShortCut'#3'$@'#0#1#7
-  
+'Command'#2's'#8'ShortCut'#3'$`'#0#1#7'Command'#2#8#8'ShortCut'#2'#'#0#1#7'C'
-  +'ommand'#2'l'#8'ShortCut'#3'# '#0#1#7'Command'#2#16#8'ShortCut'#3'#@'#0#1#7
-  +'Command'#2't'#8'ShortCut'#3'#`'#0#1#7'Command'#3#223#0#8'ShortCut'#2'-'#0#1
-  +#7'Command'#3#201#0#8'ShortCut'#3'-@'#0#1#7'Command'#3'\'#2#8'ShortCut'#3'- 
'
-  +#0#1#7'Command'#3#246#1#8'ShortCut'#2'.'#0#1#7'Command'#3'['#2#8'ShortCut'#3
-  +'. 
'#0#1#7'Command'#3#245#1#8'ShortCut'#2#8#0#1#7'Command'#3#245#1#8'ShortCu'
-  +'t'#3#8' '#0#1#7'Command'#3#248#1#8'ShortCut'#3#8'@'#0#1#7'Command'#3'Y'#2#8
-  
+'ShortCut'#4#8#128#0#0#0#1#7'Command'#3'Z'#2#8'ShortCut'#4#8#160#0#0#0#1#7'C'
-  +'ommand'#3#253#1#8'ShortCut'#2#13#0#1#7'Command'#3#199#0#8'ShortCut'#3'A@'#0
-  +#1#7'Command'#3#201#0#8'ShortCut'#3'C@'#0#1#7'Command'#3'b'#2#8'ShortCut'#3
-  
+'I`'#0#1#7'Command'#3#253#1#8'ShortCut'#3'M@'#0#1#7'Command'#3#254#1#8'Short'
-  +'Cut'#3'N@'#0#1#7'Command'#3#247#1#8'ShortCut'#3'T@'#0#1#7'Command'#3'c'#2#8
-  +'ShortCut'#3'U`'#0#1#7'Command'#3'\'#2#8'ShortCut'#3'V@'#0#1#7'Command'#3'['
-  +#2#8'ShortCut'#3'X@'#0#1#7'Command'#3#251#1#8'ShortCut'#3'Y@'#0#1#7'Command'
-  
+#3#250#1#8'ShortCut'#3'Y`'#0#1#7'Command'#3'Y'#2#8'ShortCut'#3'Z@'#0#1#7'Com'
-  
+'mand'#3'Z'#2#8'ShortCut'#3'Z`'#0#1#7'Command'#3'-'#1#8'ShortCut'#3'0@'#0#1#7
-  +'Command'#3'.'#1#8'ShortCut'#3'1@'#0#1#7'Command'#3'/'#1#8'ShortCut'#3'2@'#0
-  
+#1#7'Command'#3'0'#1#8'ShortCut'#3'3@'#0#1#7'Command'#3'1'#1#8'ShortCut'#3'4'
-  
+'@'#0#1#7'Command'#3'2'#1#8'ShortCut'#3'5@'#0#1#7'Command'#3'3'#1#8'ShortCut'
-  
+#3'6@'#0#1#7'Command'#3'4'#1#8'ShortCut'#3'7@'#0#1#7'Command'#3'5'#1#8'Short'
-  +'Cut'#3'8@'#0#1#7'Command'#3'6'#1#8'ShortCut'#3'9@'#0#1#7'Command'#3'_'#1#8
-  +'ShortCut'#3'0`'#0#1#7'Command'#3'`'#1#8'ShortCut'#3'1`'#0#1#7'Command'#3'a'
-  
+#1#8'ShortCut'#3'2`'#0#1#7'Command'#3'b'#1#8'ShortCut'#3'3`'#0#1#7'Command'#3
-  
+'c'#1#8'ShortCut'#3'4`'#0#1#7'Command'#3'd'#1#8'ShortCut'#3'5`'#0#1#7'Comman'
-  
+'d'#3'e'#1#8'ShortCut'#3'6`'#0#1#7'Command'#3'f'#1#8'ShortCut'#3'7`'#0#1#7'C'
-  
+'ommand'#3'g'#1#8'ShortCut'#3'8`'#0#1#7'Command'#3'h'#1#8'ShortCut'#3'9`'#0#1
-  
+#7'Command'#3#231#0#8'ShortCut'#3'N`'#0#1#7'Command'#3#232#0#8'ShortCut'#3'C'
-  
+'`'#0#1#7'Command'#3#233#0#8'ShortCut'#3'L`'#0#1#7'Command'#3'd'#2#8'ShortCu'
-  +'t'#2#9#0#1#7'Command'#3'e'#2#8'ShortCut'#3#9' 
'#0#1#7'Command'#3#250#0#8'Sh'
-  
+'ortCut'#3'B`'#0#0#13'Lines.Strings'#1#6#11'TextSynedit'#0#22'SelectedColor.'
-  
+'OnChange'#13#6'Cursor'#4#252#255#0#0#6'Height'#2'5'#5'Width'#3#137#1#0#0#0#0
+  'TPF0'#19'TCharacterMapDialog'#18'CharacterMapDialog'#13'ActiveControl'#7#11
+  
+'CloseButton'#7'Caption'#6#18'CharacterMapDialog'#12'ClientHeight'#3#141#1#11
+  
+'ClientWidth'#3'h'#1#9'FormStyle'#7#11'fsStayOnTop'#10'KeyPreview'#9#8'OnCre'
+  
+'ate'#7#10'FormCreate'#6'OnShow'#7#8'FormShow'#13'PixelsPerInch'#2'`'#18'Hor'
+  
+'zScrollBar.Page'#3'g'#1#18'VertScrollBar.Page'#3#140#1#4'Left'#3#16#2#6'Hei'
+  +'ght'#3#141#1#3'Top'#3#142#0#5'Width'#3'h'#1#0#7'TButton'#11'CloseButton'#7
+  
+'Anchors'#11#8'akBottom'#0#20'BorderSpacing.Around'#2#6#25'BorderSpacing.Inn'
+  
+'erBorder'#2#2#6'Cancel'#9#7'Caption'#6#5'Close'#7'Default'#9#11'ModalResult'
+  
+#2#1#7'OnClick'#7#16'CloseButtonClick'#8'TabOrder'#2#0#4'Left'#3#142#0#6'Hei'
+  
+'ght'#2#25#3'Top'#3'p'#1#5'Width'#2'K'#0#0#9'TGroupBox'#18'CharactersGroupbo'
+  
+'x'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#20'BorderSpaci'
+  
+'ng.Around'#2#6#7'Caption'#6#10'Characters'#12'ClientHeight'#3'N'#1#11'Clien'
+  +'tWidth'#3'U'#1#11'ParentCtl3D'#8#8'TabOrder'#2#1#4'Left'#2#8#6'Height'#3'`'
+  
+#1#3'Top'#2#8#5'Width'#3'Y'#1#0#6'TLabel'#13'CharInfoLabel'#5'Align'#7#8'alB'
+  +'ottom'#20'BorderSpacing.Around'#2#6#7'Caption'#6#13'CharInfoLabel'#5'Color'
+  
+#7#6'clNone'#11'ParentColor'#8#4'Left'#2#6#6'Height'#2#14#3'Top'#3':'#1#5'Wi'
+  
+'dth'#3'I'#1#0#0#11'TStringGrid'#11'StringGrid1'#7'Anchors'#11#5'akTop'#6'ak'
+  
+'Left'#7'akRight'#8'akBottom'#0#20'BorderSpacing.Around'#2#6#8'ColCount'#2#17
+  
+#15'DefaultColWidth'#2#16#10'FixedColor'#7#9'clBtnFace'#13'GridLineWidth'#2#0
+  
+#7'Options'#11#15'goFixedVertLine'#15'goFixedHorzLine'#10'goVertLine'#10'goH'
+  
+'orzLine'#14'goSmoothScroll'#0#8'RowCount'#2#15#10'ScrollBars'#7#10'ssAutoBo'
+  +'th'#15'VisibleColCount'#2#16#15'VisibleRowCount'#2#14#11'OnMouseDown'#7#20
+  
+'StringGrid1MouseDown'#11'OnMouseMove'#7#20'StringGrid1MouseMove'#4'Left'#2#6
+  +#6'Height'#3'0'#1#3'Top'#2#6#5'Width'#3'I'#1#0#0#0#0
 ]);
Index: charactermapdlg.pas
===================================================================
--- charactermapdlg.pas (revision 8501)
+++ charactermapdlg.pas (working copy)
@@ -37,208 +37,125 @@
 
 uses
   Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Buttons,
-  SynEdit, StdCtrls, LCLType, LCLProc, GraphType, LazarusIDEStrConsts, 
EditorOptions,
-  SynEditHighlighter, SynHighlighterPosition;
+  StdCtrls, LCLType, GraphType, LazarusIDEStrConsts, EditorOptions,
+  EnvironmentOpts, Grids;
 
 type
+  TOnInsertCharacterEvent = procedure (const C: Char) of object;
+
+  { TCharacterMapDialog }
+
   TCharacterMapDialog = class(TForm)
-    CharactersGroupbox: TGROUPBOX;
-    CharInfoLabel: TLABEL;
-    TextSynedit: TSYNEDIT;
-    TextGroupbox: TGROUPBOX;
-    OkButton: TBUTTON;
-    CancelButton: TBUTTON;
-    CharMapSynedit: TSYNEDIT;
-    procedure CharMapSyneditMOUSEDOWN(Sender: TOBject; Button: TMouseButton;
+    CharactersGroupbox: TGroupbox;
+    CharInfoLabel: TLabel;
+    CloseButton: TButton;
+    StringGrid1: TStringGrid;
+    procedure FormCreate(Sender: TObject);
+    procedure FormShow(Sender: TObject);
+    procedure CloseButtonClick(Sender: TObject);
+    procedure StringGrid1MouseDown(Sender: TObject; Button: TMouseButton;
       Shift: TShiftState; X, Y: Integer);
-    procedure CharMapSyneditMOUSEMOVE(Sender: TObject; Shift: TShiftState; X,
+    procedure StringGrid1MouseMove(Sender: TObject; Shift: TShiftState; X,
       Y: Integer);
-    procedure CharacterMapDialogCREATE(Sender: TObject);
-    procedure CharacterMapDialogDESTROY(Sender: TObject);
-    procedure CharacterMapDialogKEYDOWN(Sender: TObject; var Key: Word;
-      Shift: TShiftState);
   private
-    FPositionHighlighter: TSynPositionHighlighter;
-    FCharacters: string;
-    FHighlightAttr: TSynHighlighterAttributes;
-    FHighlightAttrID: Integer;
-    FTextAttrID: Integer;
+    FOnInsertCharacter: TOnInsertCharacterEvent;
     procedure FillCharMap;
-    procedure SelectCharacter(Row, Col: integer);
-    procedure HighlightCharacter(Row, Col: integer);
-    function GetCharacterInfo(Row, Col: integer): string;
-    procedure SetCharacters(const AValue: string);
-    procedure SetSynEditSettings;
-    function RowColValid(Row, Col: integer): boolean;
-    function GetCharOrd(Row, Col: integer): integer;
-    function RowColToSynEditRowCol(Row, Col: integer): TPoint;
-    procedure SynEditXYToRowCol(X, Y: integer; var Row, Col: integer);
   public
-    property Characters: string read FCharacters write SetCharacters;
+    property OnInsertCharacter: TOnInsertCharacterEvent read FOnInsertCharacter
+                                                        write 
FOnInsertCharacter;
   end;
 
-function ShowCharacterMap(var s: string): boolean;
+procedure ShowCharacterMap(AOnInsertChar: TOnInsertCharacterEvent);
 
-implementation
-
-function ShowCharacterMap(var s: string): boolean;
 var
   CharacterMapDialog: TCharacterMapDialog;
+
+implementation
+
+procedure ShowCharacterMap(AOnInsertChar: TOnInsertCharacterEvent);
 begin
-  CharacterMapDialog:=TCharacterMapDialog.Create(nil);
-  Result:=CharacterMapDialog.ShowModal=mrOk;
-  if Result then
-    s:=CharacterMapDialog.Characters;
-  CharacterMapDialog.Free;
+  if CharacterMapDialog = nil then
+    Application.CreateForm(TCharacterMapDialog, CharacterMapDialog);
+    
+  CharacterMapDialog.OnInsertCharacter := AOnInsertChar;
+  CharacterMapDialog.Show;
 end;
 
 { TCharacterMapDialog }
 
-procedure TCharacterMapDialog.CharacterMapDialogKEYDOWN(Sender: TObject;
-  var Key: Word; Shift: TShiftState);
+procedure TCharacterMapDialog.FormCreate(Sender: TObject);
 begin
-  if Key=VK_ESCAPE then ModalResult:=mrCancel;
-end;
+  Caption := lisCharacterMap;
+  CharactersGroupbox.Caption := lisCharacterMap;
+  CloseButton.Caption := lisClose;
 
-procedure TCharacterMapDialog.CharMapSyneditMOUSEMOVE(Sender: TObject;
-  Shift: TShiftState; X, Y: Integer);
-var
-  Row: Integer;
-  Col: Integer;
-begin
-  SynEditXYToRowCol(X,Y,Row,Col);
-  HighlightCharacter(Row,Col);
+  //EnvironmentOptions.IDEWindowLayoutList.Apply(Self, Name);
+  FillCharMap;
 end;
 
-procedure TCharacterMapDialog.FillCharMap;
-var
-  y: Integer;
-  x: Integer;
-  CurLine: String;
-  CharOrd: Integer;
-  CurChar: string;
+procedure TCharacterMapDialog.FormShow(Sender: TObject);
 begin
-  CharMapSynedit.Lines.Clear;
-  for y:=0 to 13 do begin
-    CurLine:='';
-    for x:=0 to 15 do begin
-      CharOrd:=(y+2)*16+x;
-      CurChar:=chr(CharOrd)+' ';
-      CurLine:=CurLine+CurChar;
-    end;
-    CharMapSynedit.Lines.Add(CurLine);
-  end;
+  StringGrid1.Font.Name := EditorOpts.EditorFont;
+  StringGrid1.Font.Size := 10;
+
+  StringGrid1.AutoSizeColumns;
 end;
 
-procedure TCharacterMapDialog.SelectCharacter(Row, Col: integer);
+procedure TCharacterMapDialog.CloseButtonClick(Sender: TObject);
 begin
-
+  Close;
 end;
 
-procedure TCharacterMapDialog.HighlightCharacter(Row, Col: integer);
+procedure TCharacterMapDialog.StringGrid1MouseDown(Sender: TObject;
+  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
 var
-  s: String;
-  HighlightPos: TPoint;
+  Row, Col: Integer;
 begin
-  s:=GetCharacterInfo(Row,Col);
-  //writeln('TCharacterMapDialog.HighlightCharacter Row=',Row,' Col=',Col,' 
',s);
-  CharInfoLabel.Caption:=s;
-  FPositionHighlighter.ClearAllTokens;
-  if RowColValid(Row,Col) then begin
-    HighlightPos:=RowColToSynEditRowCol(Row,Col);
-    FPositionHighlighter.AddToken(HighlightPos.Y-1,HighlightPos.X-1,
-                                  FTextAttrID);
-    FPositionHighlighter.AddToken(HighlightPos.Y-1,HighlightPos.X+1,
-                                  FHighlightAttrID);
+  if (Button = mbLeft) and (StringGrid1.MouseToGridZone(X, Y) = gzNormal) then
+  begin
+    StringGrid1.MouseToCell(X, Y, Col, Row);
+    if Assigned(OnInsertCharacter) then
+      OnInsertCharacter(StringGrid1.Cells[Col, Row][1]);
   end;
 end;
 
-function TCharacterMapDialog.GetCharacterInfo(Row, Col: integer): string;
+procedure TCharacterMapDialog.StringGrid1MouseMove(Sender: TObject;
+  Shift: TShiftState; X, Y: Integer);
 var
-  CharOrd: Integer;
+  CharOrd: Byte;
+  Row, Col: Integer;
 begin
-  if RowColValid(Row,Col) then begin
-    CharOrd:=GetCharOrd(Row,Col);
-    Result:='Decimal='+IntToStr(CharOrd)+' Hex='+HexStr(CharOrd,2);
-  end else begin
-    Result:='-';
+  if StringGrid1.MouseToGridZone(X, Y) = gzNormal then
+  begin
+    StringGrid1.MouseToCell(X, Y, Col, Row);
+    
+    CharOrd := Ord(StringGrid1.Cells[Col, Row][1]);
+    CharInfoLabel.Caption := 'Decimal = ' + IntToStr(CharOrd) +
+                             ', Hex = $'  + HexStr(CharOrd, 2);
+  end
+  else
+  begin
+    CharInfoLabel.Caption := '-';
   end;
 end;
 
-procedure TCharacterMapDialog.SetCharacters(const AValue: string);
-begin
-  if FCharacters=AValue then exit;
-  FCharacters:=AValue;
-  TextSynedit.Lines.Text:=AValue;
-end;
-
-procedure TCharacterMapDialog.SetSynEditSettings;
-begin
-  EditorOpts.GetSynEditSettings(CharMapSynedit);
-  EditorOpts.GetSynEditSettings(TextSynedit);
-end;
-
-function TCharacterMapDialog.RowColValid(Row, Col: integer): boolean;
-begin
-  Result:=(Row>=1) and (Row<=14) and (Col>=1) and (Col<=16);
-end;
-
-function TCharacterMapDialog.GetCharOrd(Row, Col: integer): integer;
-begin
-  Result:=(Row+1)*16+Col-1;
-end;
-
-function TCharacterMapDialog.RowColToSynEditRowCol(Row, Col: integer): TPoint;
-begin
-  Result.X:=Col*2-1;
-  Result.Y:=Row;
-end;
-
-procedure TCharacterMapDialog.SynEditXYToRowCol(X, Y: integer; var Row,
-  Col: integer);
+procedure TCharacterMapDialog.FillCharMap;
 var
-  RowColumn: TPoint;
+  R, C: Integer;
 begin
-  RowColumn:=CharMapSynedit.PixelsToRowColumn(Point(X,Y));
-  Row:=RowColumn.Y;
-  Col:=RowColumn.X div 2;
-end;
-
-procedure TCharacterMapDialog.CharacterMapDialogCREATE(Sender: TObject);
-begin
-  Caption:=lisCharacterMap;
-  FHighlightAttr:=TSynHighlighterAttributes.Create('Highlight');
-  with FHighlightAttr do begin
-    Foreground:=clBlue;
-    Style:=Style+[fsBold];
+  for R := 0 to Pred(StringGrid1.RowCount) do
+  begin
+    if R <> 0 then  StringGrid1.Cells[0, R] := Format('%.3d +', [Succ(R) * 
16]);
+    for C := 1 to Pred(StringGrid1.ColCount) do
+    begin
+      if R = 0 then StringGrid1.Cells[C, R] := Format('%.2d', [Pred(C)])
+      else
+        StringGrid1.Cells[C, R] := Chr(Succ(R) * 16 + Pred(C));
+    end;
   end;
-  FPositionHighlighter:=TSynPositionHighlighter.Create(Self);
-  FHighlightAttrID:=FPositionHighlighter.GetCopiedTokenID(FHighlightAttr);
-  FTextAttrID:=
-    FPositionHighlighter.GetCopiedTokenID(FPositionHighlighter.TextAttri);
-  CharMapSynedit.Highlighter:=FPositionHighlighter;
-  SetSynEditSettings;
-  FillCharMap;
-  TextSynedit.Lines.Clear;
 end;
 
-procedure TCharacterMapDialog.CharMapSyneditMOUSEDOWN(Sender: TOBject;
-  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
-var
-  Row: Integer;
-  Col: Integer;
-begin
-  SynEditXYToRowCol(X,Y,Row,Col);
-  if not RowColValid(Row,Col) then exit;
-  Characters:=Characters+chr(GetCharOrd(Row,Col));
-end;
 
-procedure TCharacterMapDialog.CharacterMapDialogDESTROY(Sender: TObject);
-begin
-  FreeAndNil(FPositionHighlighter);
-  FreeAndNil(FHighlightAttr);
-end;
-
 initialization
   {$I charactermapdlg.lrs}
 
Index: uniteditor.pp
===================================================================
--- uniteditor.pp       (revision 8501)
+++ uniteditor.pp       (working copy)
@@ -417,6 +417,7 @@
     procedure ShowUnitInfo(Sender: TObject);
     procedure SrcPopUpMenuPopup(Sender: TObject);
     procedure ToggleLineNumbersClicked(Sender: TObject);
+    procedure InsertCharacter(const C: Char);
   private
     fAutoFocusLock: integer;
     FCodeTemplateModul: TSynEditAutoComplete;
@@ -984,6 +985,7 @@
   if SourceNotebook<>nil then
     SourceNotebook.InitFindDialog;
   //debugln('TSourceEditor.StartFindAndReplace A 
FindReplaceDlg.FindText="',dbgstr(FindReplaceDlg.FindText),'"');
+  if ReadOnly then Replace := False;
   if Replace then
     FindReplaceDlg.Options :=
       FindReplaceDlg.Options + [ssoReplace, ssoReplaceAll, ssoPrompt]
@@ -1643,17 +1645,15 @@
 end;
 
 procedure TSourceEditor.InsertCharacterFromMap;
-var
-  NewChars: string;
 begin
-  if not ShowCharacterMap(NewChars) then exit;
-  FEditor.SelText:=NewChars;
+  ShowCharacterMap(@(SourceNoteBook.InsertCharacter));
 end;
 
 procedure TSourceEditor.InsertGPLNotice(CommentType: TCommentType);
 var
   Txt: string;
 begin
+  if ReadOnly then Exit;
   Txt:=CommentText(LCLProc.BreakString(
            Format(lisGPLNotice,[#13#13,#13#13,#13#13]),
            FEditor.RightEdge-2,0),CommentType);
@@ -1664,6 +1664,7 @@
 var
   Txt: string;
 begin
+  if ReadOnly then Exit;
   Txt:=CommentText(LCLProc.BreakString(
            Format(lisLGPLNotice,[#13#13,#13#13,#13#13]),
            FEditor.RightEdge-2,0),CommentType);
@@ -1672,23 +1673,27 @@
 
 procedure TSourceEditor.InsertUsername;
 begin
+  if ReadOnly then Exit;
   FEditor.SelText:=GetCurrentUserName;
 end;
 
 procedure TSourceEditor.InsertDateTime;
 begin
+  if ReadOnly then Exit;
   FEditor.SelText:=DateTimeToStr(now);
 end;
 
 procedure TSourceEditor.InsertChangeLogEntry;
 var s: string;
 begin
+  if ReadOnly then Exit;
   s:=DateToStr(now)+'   '+GetCurrentUserName+' '+GetCurrentMailAddress;
   FEditor.SelText:=s;
 end;
 
 procedure TSourceEditor.InsertCVSKeyword(const AKeyWord: string);
 begin
+  if ReadOnly then Exit;
   FEditor.SelText:='$'+AKeyWord+'$'+LineEnding;
 end;
 
@@ -2130,6 +2135,7 @@
 procedure TSourceEditor.ReplaceLines(StartLine, EndLine: integer;
   const NewText: string);
 begin
+  if ReadOnly then Exit;
   FEditor.BeginUndoBlock;
   FEditor.BlockBegin:=Point(1,StartLine);
   FEditor.BlockEnd:=Point(length(FEditor.Lines[Endline-1])+1,EndLine);
@@ -4836,6 +4842,18 @@
   if Assigned(FOnToggleObjectInspClicked) then 
FOnToggleObjectInspClicked(Sender);
 end;
 
+procedure TSourceNotebook.InsertCharacter(const C: Char);
+var
+  FActiveEdit: TSourceEditor;
+begin
+  FActiveEdit := GetActiveSE;
+  if FActiveEdit <> nil then
+  begin
+    if FActiveEdit.ReadOnly then Exit;
+    FActiveEdit.EditorComponent.SelText := C;
+  end;
+end;
+
 procedure TSourceNotebook.InitFindDialog;
 var c: TFindDlgComponent;
 begin

Reply via email to