diff --git a/KBLVisualizer.dof b/KBLVisualizer.dof index 22ec7e1..28c4d6a 100644 --- a/KBLVisualizer.dof +++ b/KBLVisualizer.dof @@ -113,9 +113,9 @@ RootDir= IncludeVerInfo=1 AutoIncBuild=1 MajorVer=1 -MinorVer=0 +MinorVer=1 Release=0 -Build=3 +Build=8 Debug=0 PreRelease=0 Special=0 @@ -125,12 +125,12 @@ Locale=1033 CodePage=1252 [Version Info Keys] CompanyName= -FileDescription=KBL-Editor -FileVersion=1.0.0.3 -InternalName=KBLEdit +FileDescription=KBL-Visualizer +FileVersion=1.1.0.8 +InternalName=KBLVisualizer LegalCopyright=(c)2004 by Markus Birth LegalTrademarks= -OriginalFilename=KBLEdit.exe -ProductName=KBL-Editor -ProductVersion=1.0.0.0 +OriginalFilename=KBLVisualizer.exe +ProductName=KBL-Visualizer +ProductVersion=1.1.0.0 Comments=Editor to visualize keyboard layouts for PopOnTop of Symbitz Software. diff --git a/KBLVisualizer.dpr b/KBLVisualizer.dpr index b408603..be9bcbd 100644 --- a/KBLVisualizer.dpr +++ b/KBLVisualizer.dpr @@ -1,14 +1,14 @@ -program KBLEdit; +program KBLVisualizer; uses Forms, - KBLEditU in 'KBLEditU.pas' {KBLEditForm}; + KBLVisualizerU in 'KBLVisualizerU.pas' {KBLEditForm}; {$R *.res} begin Application.Initialize; - Application.Title := 'PopOnTop Keyboard Layout Editor'; + Application.Title := 'PopOnTop Keyboard Layout Visualizer'; Application.CreateForm(TKBLEditForm, KBLEditForm); Application.Run; end. diff --git a/KBLVisualizer.txt b/KBLVisualizer.txt index c929b7f..c9b5078 100644 --- a/KBLVisualizer.txt +++ b/KBLVisualizer.txt @@ -1,4 +1,4 @@ -KBL-Editor +KBL-Visualizer (c)2004 by Markus Birth ============================================== @@ -11,8 +11,7 @@ The program itself should be self-explanatory. The left area is the working space which contains the keyboard layout you are working on. You can open and save your work using the -buttons above the text area. THE PROGRAM WON'T -ASK YOU TO SAVE YOUR WORK BEFORE EXITING! +buttons above the text area. The right hand side shows a preview of the keyboard so that you get an idea how it @@ -20,15 +19,33 @@ looks like. Use the SpinControl next to the "Visualize!"-button to select the map you want to see. +The bottom left corner contains the unicode +table. It is loaded from the file +unicode-index.txt . A double-click on a row +will paste the unicode at the cursor position. + +Bottom right there is the color editor. If you +selected a color-value in your kbl, click on +the "Get"-button to load the value into the +color editor. After changing it, you can paste +it back into your file with the "Insert"-button. + Landscape keyboards are not yet supported. I don't take *ANY* responsibility for any damage to your computer which might occur by using this program. -Please make sure the file KBLEdit.bmp is in -the same directory as KBLEdit.exe. If you -rename KBLEdit.exe, do so with KBLEdit.bmp. +Please make sure the file KBLVisualizer.bmp is +in the same directory as KBLVisualizer.exe. If +you rename KBLVisualizer.exe, do so with the bmp. -Feel free to replace KBLEdit.bmp by a screen- +Also make sure the file unicode-index.txt is +besides the other files. You can get an updated +list of unicodes from [1]. After download, just +rename it to unicode-index.txt . + +Feel free to replace KBLVisualizer.bmp by a screen- shot of your own Px00. (208x320 pixels) + +[1] http://www.unicode.org/Public/UNIDATA/Index.txt diff --git a/KBLVisualizerU.dfm b/KBLVisualizerU.dfm index f015a78..8164d03 100644 --- a/KBLVisualizerU.dfm +++ b/KBLVisualizerU.dfm @@ -1,10 +1,11 @@ object KBLEditForm: TKBLEditForm - Left = 192 + Left = 190 Top = 107 - BorderStyle = bsDialog - Caption = 'KBL-Editor' - ClientHeight = 389 - ClientWidth = 572 + BorderIcons = [biSystemMenu, biMinimize] + BorderStyle = bsSingle + Caption = 'KBL-Visualizer' + ClientHeight = 504 + ClientWidth = 670 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText @@ -12,42 +13,269 @@ object KBLEditForm: TKBLEditForm Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = False + Position = poDefault + OnCloseQuery = FormCloseQuery OnCreate = FormCreate PixelsPerInch = 96 TextHeight = 13 + object LabelUnicodeTable: TLabel + Left = 0 + Top = 368 + Width = 417 + Height = 13 + Caption = + 'Unicode table: (insert with double-click; special codes at bott' + + 'om - click list and press '#39' - '#39')' + end object Px00Screen: TImage - Left = 360 - Top = 40 + Left = 457 + Top = 35 Width = 208 Height = 320 end - object Label1: TLabel - Left = 376 - Top = 24 + object LabelByMarkusBirth: TLabel + Left = 473 + Top = 19 Width = 192 Height = 13 Caption = 'by Markus Birth ' Enabled = False end + object LabelR: TLabel + Left = 568 + Top = 392 + Width = 8 + Height = 13 + Caption = 'R' + end + object LabelG: TLabel + Left = 568 + Top = 408 + Width = 8 + Height = 13 + Caption = 'G' + end + object LabelB: TLabel + Left = 569 + Top = 424 + Width = 7 + Height = 13 + Caption = 'B' + end + object LabelColorEditor: TLabel + Left = 584 + Top = 489 + Width = 67 + Height = 13 + Caption = 'Color Editor' + Enabled = False + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [fsBold] + ParentFont = False + end + object LabelFile: TLabel + Left = 328 + Top = 8 + Width = 337 + Height = 13 + AutoSize = False + Caption = 'Filename goes here.' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [fsBold] + ParentFont = False + end + object LabelSyntax: TLabel + Left = 0 + Top = 32 + Width = 449 + Height = 13 + AutoSize = False + Caption = 'Syntax goes here.' + end + object ButtonOpen: TButton + Left = 81 + Top = 3 + Width = 75 + Height = 25 + Caption = 'Open...' + TabOrder = 1 + OnClick = ButtonOpenClick + end + object ButtonSave: TButton + Left = 161 + Top = 3 + Width = 75 + Height = 25 + Caption = 'Save' + Enabled = False + TabOrder = 2 + OnClick = ButtonSaveClick + end + object ButtonSaveAs: TButton + Left = 241 + Top = 3 + Width = 75 + Height = 25 + Caption = 'Save As...' + TabOrder = 3 + OnClick = ButtonSaveAsClick + end + object ButtonVisualize: TButton + Left = 505 + Top = 355 + Width = 161 + Height = 25 + Caption = 'Visualize!' + TabOrder = 4 + OnClick = ButtonVisualizeClick + end + object SpinEdit1: TSpinEdit + Left = 457 + Top = 355 + Width = 41 + Height = 22 + MaxValue = 255 + MinValue = 1 + TabOrder = 6 + Value = 1 + end + object Unicodes: TStringGrid + Left = 0 + Top = 384 + Width = 561 + Height = 120 + ColCount = 2 + DefaultRowHeight = 16 + FixedCols = 0 + RowCount = 2 + Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRowSizing, goColSizing, goRowSelect] + ScrollBars = ssVertical + TabOrder = 7 + OnDblClick = UnicodesDblClick + OnKeyPress = UnicodesKeyPress + ColWidths = ( + 468 + 64) + end + object ButtonNew: TButton + Left = 2 + Top = 3 + Width = 75 + Height = 25 + Caption = 'New' + TabOrder = 8 + OnClick = ButtonNewClick + end + object TrackR: TTrackBar + Left = 584 + Top = 392 + Width = 81 + Height = 25 + Max = 255 + PageSize = 16 + Frequency = 16 + TabOrder = 9 + ThumbLength = 10 + OnChange = TrackRChange + end + object TrackG: TTrackBar + Left = 584 + Top = 408 + Width = 81 + Height = 25 + Max = 255 + PageSize = 16 + Frequency = 16 + TabOrder = 10 + ThumbLength = 10 + OnChange = TrackGChange + end + object TrackB: TTrackBar + Left = 584 + Top = 424 + Width = 81 + Height = 25 + Max = 255 + PageSize = 16 + Frequency = 16 + TabOrder = 11 + ThumbLength = 10 + OnChange = TrackBChange + end + object ButtonColorGet: TButton + Left = 568 + Top = 468 + Width = 33 + Height = 17 + Caption = 'Get' + TabOrder = 13 + OnClick = ButtonColorGetClick + end + object ButtonColorInsert: TButton + Left = 632 + Top = 468 + Width = 33 + Height = 17 + Caption = 'Insert' + TabOrder = 12 + OnClick = ButtonColorInsertClick + end + object ColorPanel: TPanel + Left = 568 + Top = 448 + Width = 97 + Height = 17 + Caption = '000000' + Color = clBlack + Font.Charset = DEFAULT_CHARSET + Font.Color = clWhite + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + TabOrder = 14 + end object Memo1: TMemo - Left = 8 - Top = 40 - Width = 345 - Height = 297 + Left = 1 + Top = 48 + Width = 448 + Height = 313 HideSelection = False Lines.Strings = ( - 'T,Fitaly (US)' + 'T,Fitaly (int.)' '' - '! Maps:' - '! 1 - Lowercase (arrows)' - '! 2 - Uppercase (arrows)' - '! 3 - Numeric' - '! 4 - Numeric shifted (Symbols)' + '! created by:' + '! Markus Birth' + '! ' + '' + '! Fitaly by Textware Solutions http://www.fitaly.com' + '' + '! Maps overview:' + '! 1 - Lowercase' + '! 2 - Uppercase SHIFTED' + '! 3 - Uppercase CAPS' + '! 4 - Uppercase SHIFTED/CAPS' + '! 5 - Numeric' + '! 6 - Numeric SHIFTED' + '! 7 - Lowercase acute' + '! 8 - Lowercase grave' + '! 9 - Lowercase uml' + '!10 - Lowercase circ' + '!11 - Uppercase acute' + '!12 - Uppercase grave' + '!13 - Uppercase uml' + '!14 - Uppercase circ' '' '! MAP 1 Lowercase FITALY' '' - 'M,0,0,210,0,300,207,5,12,195,0,209,207,ffffff,000000,333333,dddd' + + 'M,0,0,210,0,300,207,5,13,195,0,209,207,ffffff,000000,333333,dddd' + 'ff' 'R' 'K,001b,2,c0c0c0,000000,Esc' @@ -57,58 +285,63 @@ object KBLEditForm: TKBLEditForm 'K,0068' 'K,0077' 'K,006b' - 'K,0031,1,ffffa0' - 'K,0032,1,ffffa0' - 'K,0008,2,c0c0c0,000000,BS' + 'K,0031,1,ffc040' + 'K,0032,1,ffc040' + 'K,0008,2,c0c0c0,000000,<---' + 'K,f7ff,1,000040,ffffff,M' 'R' - 'K,0009,2,c0c0c0,000000,TAB' + 'K,0009,2,c0c0c0,000000,Tab' 'K,0066' 'K,0069' 'K,0074' 'K,0061' 'K,006c' 'K,0079' - 'K,0033,1,ffffa0' - 'K,0034,1,ffffa0' + 'K,0033,1,ffc040' + 'K,0034,1,ffc040' 'K,000d,2,c0c0c0,000000,RET' + 'K,f6dd,1,404080,ffffff,P' 'R' - 'L,2,2,c0c0c0,000000,Cap' + 'S,2,2,c0c0c0,000000,Shift' 'K,0020,2' 'K,006e' 'K,0065' 'K,0020,2' - 'K,0035,1,ffffa0' - 'K,0036,1,ffffa0' + 'K,0035,1,ffc040' + 'K,0036,1,ffc040' 'S,2,2,c0c0c0,000000,Shift' + 'K,f6dc,1,404080,ffffff,N' 'R' - 'S,1,2,c0c0c0,000000,Ctrl' + 'L,3,2,c0c0c0,000000,Cap' 'K,0067' 'K,0064' 'K,006f' 'K,0072' 'K,0073' 'K,0062' - 'K,0037,1,ffffa0' - 'K,0038,1,ffffa0' - 'K,f807,1,c0ffff,000000,<' - 'K,f6dd,1,c0ffff,000000,<<' + 'K,0037,1,ffc040' + 'K,0038,1,ffc040' + 'S,7,1,c0ffff,000000,'#180 + 'S,8,1,c0ffff,000000,`' + 'K,f807,1,408040,ffffff,<' 'R' - 'L,3,2,c0c0c0,000000,123' + 'L,5,2,c0c0c0,000000,123' 'K,0071' 'K,006a' 'K,0075' 'K,006d' 'K,0070' 'K,0078' - 'K,0039,1,ffffa0' - 'K,0030,1,ffffa0' - 'K,f808,1,c0ffff,000000,>' - 'K,f6dc,1,c0ffff,000000,>>' + 'K,0039,1,ffc040' + 'K,0030,1,ffc040' + 'S,9,1,c0ffff,000000,'#168 + 'S,10,1,c0ffff,000000,^' + 'K,f808,1,408040,ffffff,>' '' - '! MAP 2 Uppercase FITALY' + '! MAP 2 Uppercase shifted FITALY' '' - 'M,0,0,210,0,300,207,5,12,195,0,209,207,ffffff,000000,333333,dddd' + + 'M,0,0,210,0,300,207,5,13,195,0,209,207,ffffff,000000,333333,dddd' + 'ff' 'R' 'K,001b,2,c0c0c0,000000,Esc' @@ -118,58 +351,195 @@ object KBLEditForm: TKBLEditForm 'K,0048' 'K,0057' 'K,004b' - 'K,002d,1,ffffa0' - 'K,0021,1,ffffa0' - 'K,0008,2,c0c0c0,000000,BS' + 'K,002d,1,ffc040' + 'K,0021,1,ffc040' + 'K,0008,2,c0c0c0,000000,<---' + 'K,f7ff,1,000040,ffffff,M' 'R' - 'K,0009,2,c0c0c0,000000,TAB' + 'K,0009,2,c0c0c0,000000,Tab' 'K,0046' 'K,0049' 'K,0054' 'K,0041' 'K,004c' 'K,0059' - 'K,002c,1,ffffa0' - 'K,003f,1,ffffa0' + 'K,002c,1,ffc040' + 'K,003f,1,ffc040' 'K,000d,2,c0c0c0,000000,RET' + 'K,f6dd,1,404080,ffffff,P' 'R' - 'L,1,2,000000,c0c0c0,Cap' + 'L,1,2,000000,c0c0c0,Shift' 'K,0020,2' 'K,004e' 'K,0045' 'K,0020,2' - 'K,002e,1,ffffa0' - 'K,003a,1,ffffa0' - 'S,1,2,c0c0c0,000000,Shift' + 'K,002e,1,ffc040' + 'K,003a,1,ffc040' + 'L,1,2,000000,c0c0c0,Shift' + 'K,f6dc,1,404080,ffffff,N' 'R' - 'S,1,2,c0c0c0,000000,Ctrl' + 'L,3,2,c0c0c0,000000,Cap' 'K,0047' 'K,0044' 'K,004f' 'K,0052' 'K,0053' 'K,0042' - 'K,0027,1,ffffa0' - 'K,0028,1,ffffa0' - 'K,f807,1,c0ffff,000000,<' - 'K,f6dd,1,c0ffff,000000,<<' + 'K,0027,1,ffc040' + 'K,0028,1,ffc040' + 'S,11,1,c0ffff,000000,'#180 + 'S,12,1,c0ffff,000000,`' + 'K,f807,1,408040,ffffff,<' 'R' - 'L,3,2,c0c0c0,000000,123' + 'L,5,2,c0c0c0,000000,123' 'K,0051' 'K,004a' 'K,0055' 'K,004d' 'K,0050' 'K,0058' - 'K,002f,1,ffffa0' - 'K,0029,1,ffffa0' - 'K,f808,1,c0ffff,000000,>' - 'K,f6dc,1,c0ffff,000000,>>' + 'K,002f,1,ffc040' + 'K,0029,1,ffc040' + 'S,13,1,c0ffff,000000,'#168 + 'S,14,1,c0ffff,000000,^' + 'K,f808,1,408040,ffffff,>' '' - '! MAP 3 Numeric FITALY' + '! MAP 3 Uppercase CAPSed FITALY' '' - 'M,0,0,210,0,300,207,5,12,195,0,209,207,ffffff,000000,333333,dddd' + + 'M,0,0,210,0,300,207,5,13,195,0,209,207,ffffff,000000,333333,dddd' + + 'ff' + 'R' + 'K,001b,2,c0c0c0,000000,Esc' + 'K,005a' + 'K,0056' + 'K,0043' + 'K,0048' + 'K,0057' + 'K,004b' + 'K,0031,1,ffc040' + 'K,0032,1,ffc040' + 'K,0008,2,c0c0c0,000000,<---' + 'K,f7ff,1,000040,ffffff,M' + 'R' + 'K,0009,2,c0c0c0,000000,Tab' + 'K,0046' + 'K,0049' + 'K,0054' + 'K,0041' + 'K,004c' + 'K,0059' + 'K,0033,1,ffc040' + 'K,0034,1,ffc040' + 'K,000d,2,c0c0c0,000000,RET' + 'K,f6dd,1,404080,ffffff,P' + 'R' + 'S,4,2,c0c0c0,000000,Shift' + 'K,0020,2' + 'K,004e' + 'K,0045' + 'K,0020,2' + 'K,0035,1,ffc040' + 'K,0036,1,ffc040' + 'S,4,2,c0c0c0,000000,Shift' + 'K,f6dc,1,404080,ffffff,N' + 'R' + 'L,1,2,000000,c0c0c0,Cap' + 'K,0047' + 'K,0044' + 'K,004f' + 'K,0052' + 'K,0053' + 'K,0042' + 'K,0037,1,ffc040' + 'K,0038,1,ffc040' + 'S,11,1,c0ffff,000000,'#180 + 'S,12,1,c0ffff,000000,`' + 'K,f807,1,408040,ffffff,<' + 'R' + 'L,5,2,c0c0c0,000000,123' + 'K,0051' + 'K,004a' + 'K,0055' + 'K,004d' + 'K,0050' + 'K,0058' + 'K,0039,1,ffc040' + 'K,0030,1,ffc040' + 'S,13,1,c0ffff,000000,'#168 + 'S,14,1,c0ffff,000000,^' + 'K,f808,1,408040,ffffff,>' + '' + '! MAP 4 Uppercase shifted/CAPSed FITALY' + '' + + 'M,0,0,210,0,300,207,5,13,195,0,209,207,ffffff,000000,333333,dddd' + + 'ff' + 'R' + 'K,001b,2,c0c0c0,000000,Esc' + 'K,007a' + 'K,0076' + 'K,0063' + 'K,0068' + 'K,0077' + 'K,006b' + 'K,002d,1,ffc040' + 'K,0021,1,ffc040' + 'K,0008,2,c0c0c0,000000,<---' + 'K,f7ff,1,000040,ffffff,M' + 'R' + 'K,0009,2,c0c0c0,000000,Tab' + 'K,0066' + 'K,0069' + 'K,0074' + 'K,0061' + 'K,006c' + 'K,0079' + 'K,002c,1,ffc040' + 'K,003f,1,ffc040' + 'K,000d,2,c0c0c0,000000,RET' + 'K,f6dd,1,404080,ffffff,P' + 'R' + 'L,3,2,000000,c0c0c0,Shift' + 'K,0020,2' + 'K,006e' + 'K,0065' + 'K,0020,2' + 'K,002e,1,ffc040' + 'K,003a,1,ffc040' + 'L,3,2,000000,c0c0c0,Shift' + 'K,f6dc,1,404080,ffffff,N' + 'R' + 'L,1,2,000000,c0c0c0,Cap' + 'K,0067' + 'K,0064' + 'K,006f' + 'K,0072' + 'K,0073' + 'K,0062' + 'K,0027,1,ffc040' + 'K,0028,1,ffc040' + 'S,11,1,c0ffff,000000,'#180 + 'S,12,1,c0ffff,000000,`' + 'K,f807,1,408040,ffffff,<' + 'R' + 'L,5,2,c0c0c0,000000,123' + 'K,0071' + 'K,006a' + 'K,0075' + 'K,006d' + 'K,0070' + 'K,0078' + 'K,002f,1,ffc040' + 'K,0029,1,ffc040' + 'S,13,1,c0ffff,000000,'#168 + 'S,14,1,c0ffff,000000,^' + 'K,f808,1,408040,ffffff,>' + '' + '! MAP 5 Numeric FITALY' + '' + + 'M,0,0,210,0,300,207,5,13,195,0,209,207,ffffff,000000,333333,dddd' + 'ff' 'R' 'K,001b,2,c0c0c0,000000,Esc' @@ -179,42 +549,46 @@ object KBLEditForm: TKBLEditForm 'K,00d7' 'K,00f7' 'K,002b' - 'K,002d,1,ffffa0' - 'K,0021,1,ffffa0' - 'K,0008,2,c0c0c0,000000,BS' + 'K,002d,1,ffc040' + 'K,0021,1,ffc040' + 'K,0008,2,c0c0c0,000000,<---' + 'K,f7ff,1,000040,ffffff,M' 'R' - 'K,0009,2,c0c0c0,000000,TAB' + 'K,0009,2,c0c0c0,000000,Tab' 'K,00a4' 'K,00b0' 'K,0040' 'K,0031' 'K,0032' 'K,0033' - 'K,002c,1,ffffa0' - 'K,003f,1,ffffa0' + 'K,002c,1,ffc040' + 'K,003f,1,ffc040' 'K,000d,2,c0c0c0,000000,RET' + 'K,f6dd,1,404080,ffffff,P' 'R' - 'L,4,2,c0c0c0,000000,Cap' + 'S,6,2,c0c0c0,000000,Shift' 'K,0020,2' 'K,0026' 'K,0034' 'K,0035' 'K,0036' - 'K,002e,1,ffffa0' - 'K,003a,1,ffffa0' - 'S,4,2,c0c0c0,000000,Shift' + 'K,002e,1,ffc040' + 'K,003a,1,ffc040' + 'S,6,2,c0c0c0,000000,Shift' + 'K,f6dc,1,404080,ffffff,N' 'R' - 'S,1,2,c0c0c0,000000,Ctrl' + 'L,6,2,c0c0c0,000000,Cap' 'K,00a5' 'K,00a2' 'K,0025' 'K,0037' 'K,0038' 'K,0039' - 'K,0027,1,ffffa0' - 'K,0028,1,ffffa0' - 'K,f807,1,c0ffff,000000,<' - 'K,f6dd,1,c0ffff,000000,<<' + 'K,0027,1,ffc040' + 'K,0028,1,ffc040' + 'K,f809,1,c0ffff,000000,^' + 'K,f80a,1,c0ffff,000000,v' + 'K,f802,1,408040,ffffff,H' 'R' 'L,1,2,c0c0c0,000000,abc' 'K,20ac' @@ -223,15 +597,16 @@ object KBLEditForm: TKBLEditForm 'K,002a' 'K,0030' 'K,0023' - 'K,002f,1,ffffa0' - 'K,0029,1,ffffa0' + 'K,002f,1,ffc040' + 'K,0029,1,ffc040' + 'K,f807,1,c0ffff,000000,<' 'K,f808,1,c0ffff,000000,>' - 'K,f6dc,1,c0ffff,000000,>>' + 'K,f803,1,408040,ffffff,E' '' - '! MAP 4 Symbols (Numeric shifted)' + '! MAP 6 Symbols (Numeric shifted)' '' - 'M,0,0,210,0,300,207,5,12,195,0,209,207,ffffff,000000,333333,dddd' + + 'M,0,0,210,0,300,207,5,13,195,0,209,207,ffffff,000000,333333,dddd' + 'ff' 'R' 'K,001b,2,c0c0c0,000000,Esc' @@ -241,42 +616,46 @@ object KBLEditForm: TKBLEditForm 'K,00ac' 'K,00ba' 'K,00b1' - 'K,005f,1,ffffa0' - 'K,00a1,1,ffffa0' - 'K,0008,2,c0c0c0,000000,BS' + 'K,005f,1,ffc040' + 'K,00a1,1,ffc040' + 'K,0008,2,c0c0c0,000000,<---' + 'K,f7ff,1,000040,ffffff,M' 'R' - 'K,0009,2,c0c0c0,000000,TAB' + 'K,0009,2,c0c0c0,000000,Tab' 'K,2021' 'K,2021' 'K,007c' 'K,00b9' 'K,00b2' 'K,00b3' - 'K,2018,1,ffffa0' - 'K,00bf,1,ffffa0' + 'K,2018,1,ffc040' + 'K,00bf,1,ffc040' 'K,000d,2,c0c0c0,000000,RET' + 'K,f6dd,1,404080,ffffff,P' 'R' - 'L,3,2,c0c0c0,000000,Cap' + 'L,5,2,000000,c0c0c0,Shift' 'K,00a0,2,ffffff,000000,n.b.' 'K,00a6' 'K,00bc' 'K,00bd' 'K,00be' - 'K,2019,1,ffffa0' - 'K,003b,1,ffffa0' - 'S,3,2,c0c0c0,000000,Shift' + 'K,2019,1,ffc040' + 'K,003b,1,ffc040' + 'L,5,2,000000,c0c0c0,Shift' + 'K,f6dc,1,404080,ffffff,N' 'R' - 'S,1,2,c0c0c0,000000,Ctrl' + 'L,5,2,c0c0c0,000000,Cap' 'K,00e3' 'K,00f5' 'K,2030' 'K,201a' 'K,00af' 'K,00b7' - 'K,0022,1,ffffa0' - 'K,201c,1,ffffa0' - 'K,f807,1,c0ffff,000000,<' - 'K,f6dd,1,c0ffff,000000,<<' + 'K,0022,1,ffc040' + 'K,201c,1,ffc040' + 'K,f809,1,c0ffff,000000,^' + 'K,f80a,1,c0ffff,000000,v' + 'K,f802,1,408040,ffffff,H' 'R' 'L,1,2,c0c0c0,000000,abc' 'K,00c3' @@ -285,80 +664,573 @@ object KBLEditForm: TKBLEditForm 'K,201e' 'K,00ad' 'K,2026' - 'K,005c,1,ffffa0' - 'K,201d,1,ffffa0' + 'K,005c,1,ffc040' + 'K,201d,1,ffc040' + 'K,f807,1,c0ffff,000000,<' 'K,f808,1,c0ffff,000000,>' - 'K,f6dc,1,c0ffff,000000,>>') - ScrollBars = ssVertical + 'K,f803,1,408040,ffffff,E' + '' + '! MAP 7 Lowercase acute' + '' + + 'M,0,0,210,0,300,207,5,13,195,0,209,207,ffffff,000000,333333,dddd' + + 'ff' + 'R' + 'K,001b,2,c0c0c0,000000,Esc' + 'K,007a' + 'K,0076' + 'K,00e7' + 'K,0068' + 'K,0077' + 'K,006b' + 'K,00a2,1,ffc040' + 'K,00a9,1,ffc040' + 'K,0008,2,c0c0c0,000000,<---' + 'K,f7ff,1,000040,ffffff,M' + 'R' + 'K,0009,2,c0c0c0,000000,Tab' + 'K,0066' + 'K,00ed' + 'K,0074' + 'K,00e1' + 'K,006c' + 'K,00fd' + 'K,00a3,1,ffc040' + 'K,00ae,1,ffc040' + 'K,000d,2,c0c0c0,000000,RET' + 'K,f6dd,1,404080,ffffff,P' + 'R' + 'S,11,2,c0c0c0,000000,Shift' + 'K,00b4,2' + 'K,006e' + 'K,00e9' + 'K,00b0,2' + 'K,0024,1,ffc040' + 'K,2122,1,ffc040' + 'S,11,2,c0c0c0,000000,Shift' + 'K,f6dc,1,404080,ffffff,N' + 'R' + 'L,3,2,c0c0c0,000000,Cap' + 'K,0067' + 'K,0064' + 'K,00f3' + 'K,0072' + 'K,0073' + 'K,0062' + 'K,00a5,1,ffc040' + 'K,00b6,1,ffc040' + 'L,1,1,000000,c0ffff,'#180 + 'S,8,1,c0ffff,000000,`' + 'K,f807,1,408040,ffffff,<' + 'R' + 'L,5,2,c0c0c0,000000,123' + 'K,0071' + 'K,006a' + 'K,00fa' + 'K,006d' + 'K,0070' + 'K,0078' + 'K,20ac,1,ffc040' + 'K,00a7,1,ffc040' + 'S,9,1,c0ffff,000000,'#168 + 'S,10,1,c0ffff,000000,^' + 'K,f808,1,408040,ffffff,>' + '' + '! MAP 8 Lowercase grave' + '' + + 'M,0,0,210,0,300,207,5,13,195,0,209,207,ffffff,000000,333333,dddd' + + 'ff' + 'R' + 'K,001b,2,c0c0c0,000000,Esc' + 'K,007a' + 'K,0076' + 'K,0063' + 'K,0068' + 'K,0077' + 'K,006b' + 'K,00e5,1,ffc040' + 'K,00c5,1,ffc040' + 'K,0008,2,c0c0c0,000000,<---' + 'K,f7ff,1,000040,ffffff,M' + 'R' + 'K,0009,2,c0c0c0,000000,Tab' + 'K,0066' + 'K,00ec' + 'K,00fe' + 'K,00e0' + 'K,006c' + 'K,0079' + 'K,00e6,1,ffc040' + 'K,00c6,1,ffc040' + 'K,000d,2,c0c0c0,000000,RET' + 'K,f6dd,1,404080,ffffff,P' + 'R' + 'S,12,2,c0c0c0,000000,Shift' + 'K,0060,2' + 'K,006e' + 'K,00e8' + 'K,0060,2' + 'K,00f8,1,ffc040' + 'K,00d8,1,ffc040' + 'S,12,2,c0c0c0,000000,Shift' + 'K,f6dc,1,404080,ffffff,N' + 'R' + 'L,3,2,c0c0c0,000000,Cap' + 'K,0067' + 'K,00f0' + 'K,00f2' + 'K,0072' + 'K,0073' + 'K,0062' + 'K,0153,1,ffc040' + 'K,0152,1,ffc040' + 'S,7,1,c0ffff,000000,'#180 + 'L,1,1,000000,c0ffff,`' + 'K,f807,1,408040,ffffff,<' + 'R' + 'L,5,2,c0c0c0,000000,123' + 'K,0071' + 'K,006a' + 'K,00f9' + 'K,006d' + 'K,0070' + 'K,0078' + 'K,2013,1,ffc040' + 'K,2014,1,ffc040' + 'S,9,1,c0ffff,000000,'#168 + 'S,10,1,c0ffff,000000,^' + 'K,f808,1,408040,ffffff,>' + '' + '! MAP 9 Lowercase umlaut' + '' + + 'M,0,0,210,0,300,207,5,13,195,0,209,207,ffffff,000000,333333,dddd' + + 'ff' + 'R' + 'K,001b,2,c0c0c0,000000,Esc' + 'K,007a' + 'K,0076' + 'K,0063' + 'K,0068' + 'K,0077' + 'K,006b' + 'K,003d,1,ffc040' + 'K,0023,1,ffc040' + 'K,0008,2,c0c0c0,000000,<---' + 'K,f7ff,1,000040,ffffff,M' + 'R' + 'K,0009,2,c0c0c0,000000,Tab' + 'K,0066' + 'K,00ef' + 'K,0074' + 'K,00e4' + 'K,006c' + 'K,00ff' + 'K,002a,1,ffc040' + 'K,0040,1,ffc040' + 'K,000d,2,c0c0c0,000000,RET' + 'K,f6dd,1,404080,ffffff,P' + 'R' + 'S,13,2,c0c0c0,000000,Shift' + 'K,007e,2' + 'K,00f1' + 'K,00eb' + 'K,00a8,2' + 'K,2022,1,ffc040' + 'K,0026,1,ffc040' + 'S,13,2,c0c0c0,000000,Shift' + 'K,f6dc,1,404080,ffffff,N' + 'R' + 'L,3,2,c0c0c0,000000,Cap' + 'K,0067' + 'K,0064' + 'K,00f6' + 'K,0072' + 'K,00df' + 'K,0062' + 'K,002b,1,ffc040' + 'K,0025,1,ffc040' + 'S,7,1,c0ffff,000000,'#180 + 'S,8,1,c0ffff,000000,`' + 'K,f807,1,408040,ffffff,<' + 'R' + 'L,5,2,c0c0c0,000000,123' + 'K,0071' + 'K,006a' + 'K,00fc' + 'K,00b5' + 'K,0070' + 'K,0078' + 'K,007c,1,ffc040' + 'K,00a6,1,ffc040' + 'L,1,1,000000,c0ffff,'#168 + 'S,10,1,c0ffff,000000,^' + 'K,f808,1,408040,ffffff,>' + '' + '! MAP 10 Lowercase circumflex' + '' + + 'M,0,0,210,0,300,207,5,13,195,0,209,207,ffffff,000000,333333,dddd' + + 'ff' + 'R' + 'K,001b,2,c0c0c0,000000,Esc' + 'K,017e' + 'K,0076' + 'K,0063' + 'K,0068' + 'K,0077' + 'K,006b' + 'K,2039,1,ffc040' + 'K,203a,1,ffc040' + 'K,0008,2,c0c0c0,000000,<---' + 'K,f7ff,1,000040,ffffff,M' + 'R' + 'K,0009,2,c0c0c0,000000,Tab' + 'K,0066' + 'K,00ee' + 'K,0074' + 'K,00e2' + 'K,006c' + 'K,0079' + 'K,003c,1,ffc040' + 'K,003e,1,ffc040' + 'K,000d,2,c0c0c0,000000,RET' + 'K,f6dd,1,404080,ffffff,P' + 'R' + 'S,14,2,c0c0c0,000000,Shift' + 'K,005e,2' + 'K,006e' + 'K,00ea' + 'K,005e,2' + 'K,00ab,1,ffc040' + 'K,00bb,1,ffc040' + 'S,14,2,c0c0c0,000000,Shift' + 'K,f6dc,1,404080,ffffff,N' + 'R' + 'L,3,2,c0c0c0,000000,Cap' + 'K,0067' + 'K,0064' + 'K,00f4' + 'K,0072' + 'K,0161' + 'K,0062' + 'K,007b,1,ffc040' + 'K,007d,1,ffc040' + 'S,7,1,c0ffff,000000,'#180 + 'S,8,1,c0ffff,000000,`' + 'K,f807,1,408040,ffffff,<' + 'R' + 'L,5,2,c0c0c0,000000,123' + 'K,0071' + 'K,006a' + 'K,00fb' + 'K,006d' + 'K,0070' + 'K,0078' + 'K,005b,1,ffc040' + 'K,005d,1,ffc040' + 'S,9,1,c0ffff,000000,'#168 + 'L,1,1,000000,c0ffff,^' + 'K,f808,1,408040,ffffff,>' + '' + '! MAP 11 Uppercase acute' + '' + + 'M,0,0,210,0,300,207,5,13,195,0,209,207,ffffff,000000,333333,dddd' + + 'ff' + 'R' + 'K,001b,2,c0c0c0,000000,Esc' + 'K,005a' + 'K,0056' + 'K,00c7' + 'K,0048' + 'K,0057' + 'K,004b' + 'K,00a2,1,ffc040' + 'K,00a9,1,ffc040' + 'K,0008,2,c0c0c0,000000,<---' + 'K,f7ff,1,000040,ffffff,M' + 'R' + 'K,0009,2,c0c0c0,000000,Tab' + 'K,0046' + 'K,00cd' + 'K,0054' + 'K,00c1' + 'K,004c' + 'K,00dd' + 'K,00a3,1,ffc040' + 'K,00ae,1,ffc040' + 'K,000d,2,c0c0c0,000000,RET' + 'K,f6dd,1,404080,ffffff,P' + 'R' + 'S,7,2,000000,c0c0c0,Shift' + 'K,0301,2' + 'K,004e' + 'K,00c9' + 'K,00b8,2' + 'K,0024,1,ffc040' + 'K,2122,1,ffc040' + 'S,7,2,000000,c0c0c0,Shift' + 'K,f6dc,1,404080,ffffff,N' + 'R' + 'L,3,2,c0c0c0,000000,Cap' + 'K,0047' + 'K,0044' + 'K,00d3' + 'K,0052' + 'K,0053' + 'K,0042' + 'K,00a5,1,ffc040' + 'K,00b6,1,ffc040' + 'L,1,1,000000,c0ffff,'#180 + 'S,8,1,c0ffff,000000,`' + 'K,f807,1,408040,ffffff,<' + 'R' + 'L,5,2,c0c0c0,000000,123' + 'K,0051' + 'K,004a' + 'K,00da' + 'K,004d' + 'K,0050' + 'K,0058' + 'K,20ac,1,ffc040' + 'K,00a7,1,ffc040' + 'S,9,1,c0ffff,000000,'#168 + 'S,10,1,c0ffff,000000,^' + 'K,f808,1,408040,ffffff,>' + '' + '! MAP 12 Uppercase grave' + '' + + 'M,0,0,210,0,300,207,5,13,195,0,209,207,ffffff,000000,333333,dddd' + + 'ff' + 'R' + 'K,001b,2,c0c0c0,000000,Esc' + 'K,005a' + 'K,0056' + 'K,0043' + 'K,0048' + 'K,0057' + 'K,004b' + 'K,00e5,1,ffc040' + 'K,00c5,1,ffc040' + 'K,0008,2,c0c0c0,000000,<---' + 'K,f7ff,1,000040,ffffff,M' + 'R' + 'K,0009,2,c0c0c0,000000,Tab' + 'K,0046' + 'K,00cc' + 'K,00de' + 'K,00c0' + 'K,004c' + 'K,0059' + 'K,00e6,1,ffc040' + 'K,00c6,1,ffc040' + 'K,000d,2,c0c0c0,000000,RET' + 'K,f6dd,1,404080,ffffff,P' + 'R' + 'S,8,2,000000,c0c0c0,Shift' + 'K,0060,2' + 'K,004e' + 'K,00c8' + 'K,0060,2' + 'K,00f8,1,ffc040' + 'K,00d8,1,ffc040' + 'S,8,2,000000,c0c0c0,Shift' + 'K,f6dc,1,404080,ffffff,N' + 'R' + 'L,3,2,c0c0c0,000000,Cap' + 'K,0047' + 'K,00d0' + 'K,00d2' + 'K,0052' + 'K,0053' + 'K,0042' + 'K,0153,1,ffc040' + 'K,0152,1,ffc040' + 'S,7,1,c0ffff,000000,'#180 + 'L,1,1,000000,c0ffff,`' + 'K,f807,1,408040,ffffff,<' + 'R' + 'L,5,2,c0c0c0,000000,123' + 'K,0051' + 'K,004a' + 'K,00d9' + 'K,004d' + 'K,0050' + 'K,0058' + 'K,2013,1,ffc040' + 'K,2014,1,ffc040' + 'S,9,1,c0ffff,000000,'#168 + 'S,10,1,c0ffff,000000,^' + 'K,f808,1,408040,ffffff,>' + '' + '! MAP 13 Uppercase umlaut' + '' + + 'M,0,0,210,0,300,207,5,13,195,0,209,207,ffffff,000000,333333,dddd' + + 'ff' + 'R' + 'K,001b,2,c0c0c0,000000,Esc' + 'K,005a' + 'K,0056' + 'K,0043' + 'K,0048' + 'K,0057' + 'K,004b' + 'K,003d,1,ffc040' + 'K,0023,1,ffc040' + 'K,0008,2,c0c0c0,000000,<---' + 'K,f7ff,1,000040,ffffff,M' + 'R' + 'K,0009,2,c0c0c0,000000,Tab' + 'K,0046' + 'K,00cf' + 'K,0054' + 'K,00c4' + 'K,004c' + 'K,0178' + 'K,002a,1,ffc040' + 'K,0040,1,ffc040' + 'K,000d,2,c0c0c0,000000,RET' + 'K,f6dd,1,404080,ffffff,P' + 'R' + 'S,9,2,000000,c0c0c0,Shift' + 'K,0303,2' + 'K,00d1' + 'K,00cb' + 'K,00a8,2' + 'K,2022,1,ffc040' + 'K,0026,1,ffc040' + 'S,9,2,000000,c0c0c0,Shift' + 'K,f6dc,1,404080,ffffff,N' + 'R' + 'L,3,2,c0c0c0,000000,Cap' + 'K,0047' + 'K,0044' + 'K,00d6' + 'K,0052' + 'K,00df' + 'K,0042' + 'K,002b,1,ffc040' + 'K,0025,1,ffc040' + 'S,7,1,c0ffff,000000,'#180 + 'S,8,1,c0ffff,000000,`' + 'K,f807,1,408040,ffffff,<' + 'R' + 'L,5,2,c0c0c0,000000,123' + 'K,0051' + 'K,004a' + 'K,00dc' + 'K,004d' + 'K,0050' + 'K,0058' + 'K,007c,1,ffc040' + 'K,00a6,1,ffc040' + 'L,1,1,000000,c0ffff,'#168 + 'S,10,1,c0ffff,000000,^' + 'K,f808,1,408040,ffffff,>' + '' + '! MAP 14 Uppercase circumflex' + '' + + 'M,0,0,210,0,300,207,5,13,195,0,209,207,ffffff,000000,333333,dddd' + + 'ff' + 'R' + 'K,001b,2,c0c0c0,000000,Esc' + 'K,017d' + 'K,0056' + 'K,0043' + 'K,0048' + 'K,0057' + 'K,004b' + 'K,2039,1,ffc040' + 'K,203a,1,ffc040' + 'K,0008,2,c0c0c0,000000,<---' + 'K,f7ff,1,000040,ffffff,M' + 'R' + 'K,0009,2,c0c0c0,000000,Tab' + 'K,0046' + 'K,00ce' + 'K,0054' + 'K,00c2' + 'K,004c' + 'K,0059' + 'K,003c,1,ffc040' + 'K,003e,1,ffc040' + 'K,000d,2,c0c0c0,000000,RET' + 'K,f6dd,1,404080,ffffff,P' + 'R' + 'S,10,2,000000,c0c0c0,Shift' + 'K,02c6,2' + 'K,004e' + 'K,00ca' + 'K,02c6,2' + 'K,00ab,1,ffc040' + 'K,00bb,1,ffc040' + 'S,10,2,000000,c0c0c0,Shift' + 'K,f6dc,1,404080,ffffff,N' + 'R' + 'L,3,2,c0c0c0,000000,Cap' + 'K,0047' + 'K,0044' + 'K,00d4' + 'K,0052' + 'K,0160' + 'K,0042' + 'K,007b,1,ffc040' + 'K,007d,1,ffc040' + 'S,7,1,c0ffff,000000,'#180 + 'S,8,1,c0ffff,000000,`' + 'K,f807,1,408040,ffffff,<' + 'R' + 'L,5,2,c0c0c0,000000,123' + 'K,0051' + 'K,004a' + 'K,00db' + 'K,004d' + 'K,0050' + 'K,0058' + 'K,005b,1,ffc040' + 'K,005d,1,ffc040' + 'S,9,1,c0ffff,000000,'#168 + 'L,1,1,000000,c0ffff,^' + 'K,f808,1,408040,ffffff,>') + ScrollBars = ssBoth TabOrder = 0 + WantTabs = True WordWrap = False + OnChange = Memo1Change + OnClick = Memo1Click end - object Button1: TButton - Left = 8 - Top = 8 - Width = 75 - Height = 25 - Caption = 'Open...' - TabOrder = 1 - OnClick = Button1Click - end - object Button2: TButton - Left = 88 - Top = 8 - Width = 75 - Height = 25 - Caption = 'Save' - Enabled = False - TabOrder = 2 - OnClick = Button2Click - end - object Button3: TButton - Left = 168 - Top = 8 - Width = 75 - Height = 25 - Caption = 'Save As...' - TabOrder = 3 - OnClick = Button3Click - end - object Button4: TButton - Left = 408 - Top = 360 - Width = 161 - Height = 25 - Caption = 'Visualize!' - TabOrder = 4 - OnClick = Button4Click - end - object Stat: TListBox - Left = 8 - Top = 344 - Width = 345 - Height = 41 + object Status: TListBox + Left = 1 + Top = 331 + Width = 448 + Height = 54 ItemHeight = 13 TabOrder = 5 - end - object SpinEdit1: TSpinEdit - Left = 360 - Top = 360 - Width = 41 - Height = 22 - MaxValue = 255 - MinValue = 1 - TabOrder = 6 - Value = 1 + Visible = False end object OpenDialog1: TOpenDialog DefaultExt = 'kbl' Filter = 'PopOnTob Keyboard Layouts (*.kbl)|*.kbl|All Files (*.*)|*.*' Options = [ofHideReadOnly, ofPathMustExist, ofFileMustExist, ofEnableSizing, ofDontAddToRecent] - Left = 264 - Top = 8 + Left = 385 + Top = 11 end object SaveDialog1: TSaveDialog Filter = 'PopOnTop Keyboard Layout (*.kbl)|*.kbl|All Files (*.*)|*.*' Options = [ofOverwritePrompt, ofHideReadOnly, ofPathMustExist, ofEnableSizing, ofDontAddToRecent] - Left = 320 + Left = 417 + Top = 11 + end + object TimerScroll: TTimer + Enabled = False + Interval = 250 + OnTimer = TimerScrollTimer + Left = 448 Top = 8 end end diff --git a/KBLVisualizerU.pas b/KBLVisualizerU.pas index a2e9c13..0694fa7 100644 --- a/KBLVisualizerU.pas +++ b/KBLVisualizerU.pas @@ -1,10 +1,10 @@ -unit KBLEditU; +unit KBLVisualizerU; interface uses Windows, Forms, Graphics, SysUtils, StrUtils, Spin, ExtCtrls, Dialogs, - StdCtrls, Controls, Classes; + StdCtrls, Controls, Classes, ComCtrls, Grids, Clipbrd; type TKBLEditForm = class(TForm) @@ -12,18 +12,46 @@ type SaveDialog1: TSaveDialog; Px00Screen: TImage; Memo1: TMemo; - Button1: TButton; - Button2: TButton; - Button3: TButton; - Button4: TButton; - Stat: TListBox; + ButtonOpen: TButton; + ButtonSave: TButton; + ButtonSaveAs: TButton; + ButtonVisualize: TButton; + Status: TListBox; SpinEdit1: TSpinEdit; - Label1: TLabel; - procedure Button4Click(Sender: TObject); - procedure Button1Click(Sender: TObject); - procedure Button3Click(Sender: TObject); + LabelByMarkusBirth: TLabel; + Unicodes: TStringGrid; + ButtonNew: TButton; + TrackR: TTrackBar; + LabelR: TLabel; + TrackG: TTrackBar; + TrackB: TTrackBar; + LabelG: TLabel; + LabelB: TLabel; + ButtonColorInsert: TButton; + ButtonColorGet: TButton; + ColorPanel: TPanel; + LabelColorEditor: TLabel; + LabelUnicodeTable: TLabel; + LabelFile: TLabel; + LabelSyntax: TLabel; + TimerScroll: TTimer; + procedure ButtonVisualizeClick(Sender: TObject); + procedure ButtonOpenClick(Sender: TObject); + procedure ButtonSaveAsClick(Sender: TObject); procedure FormCreate(Sender: TObject); - procedure Button2Click(Sender: TObject); + procedure ButtonSaveClick(Sender: TObject); + procedure UnicodesKeyPress(Sender: TObject; var Key: Char); + procedure UnicodesDblClick(Sender: TObject); + procedure ButtonNewClick(Sender: TObject); + procedure TrackRChange(Sender: TObject); + procedure TrackGChange(Sender: TObject); + procedure TrackBChange(Sender: TObject); + procedure ButtonColorInsertClick(Sender: TObject); + procedure ButtonColorGetClick(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure Memo1Change(Sender: TObject); + procedure TimerScrollTimer(Sender: TObject); + procedure Memo1Click(Sender: TObject); private { Private declarations } public @@ -38,6 +66,12 @@ implementation {$R *.dfm} +const + Hexmap = '0123456789ABCDEF'; + unicodefile = 'unicode-index.txt'; + debug = false; + CRLF = Chr(13)+Chr(10); + type TArray = array of string; TKey = record @@ -48,7 +82,11 @@ type ink: TColor; legend: string; end; - TRow = array of TKey; + TRow = record + keys: array of TKey; + keycap: TColor; + ink: TColor; + end; TMap = record landscape: boolean; fullscreen: boolean; @@ -62,9 +100,33 @@ type Data: array of TRow; end; +var titlestore: AnsiString; + exoc: boolean = false; + procedure ClearScreen; begin - KBLEditForm.Px00Screen.Picture.LoadFromFile(ChangeFileExt(Application.ExeName,'.bmp')); + with KBLEditForm.Px00Screen do begin + Picture.LoadFromFile(ChangeFileExt(Application.ExeName,'.bmp')); + Picture.Bitmap.PixelFormat := pf24bit; + end; +end; + +procedure Stat(s: string); +begin + if (debug) then begin + with KBLEditForm.Status do begin + Items.Add(s); + TopIndex := Items.Count-3; + end; + end; +end; + +procedure UpdateTitle; +begin + with KBLEditForm do begin + if (Length(titlestore)=0) then titlestore := Caption; + if (Length(LabelFile.Caption)>0) then Caption := titlestore + ' - [' + LabelFile.Caption + ']' else Caption := titlestore; + end; end; function GetMap(x: integer): TArray; @@ -89,19 +151,19 @@ begin Result := r; end; -function Split(x: string): TArray; +function Split(x, s: string): TArray; var i,p,o: integer; r: TArray; begin i := 0; o := 1; SetLength(r, 50); - p := PosEx(',',x,o); + p := PosEx(s,x,o); while (p>0) do begin r[i] := Copy(x,o,p-o); Inc(i); o := p+1; - p := PosEx(',',x,o); + p := PosEx(s,x,o); end; r[i] := Copy(x,o,Length(x)-o+1); Inc(i); @@ -110,24 +172,35 @@ begin end; function Hex2Col(h: string): TColor; -const Hexmap = '0123456789ABCDEF'; var r,g,b: integer; begin h := UpperCase(h); r := (Pos(h[1],hexmap)-1)*16 + (Pos(h[2],hexmap)-1); g := (Pos(h[3],hexmap)-1)*16 + (Pos(h[4],hexmap)-1); b := (Pos(h[5],hexmap)-1)*16 + (Pos(h[6],hexmap)-1); -// KBLEditForm.Stat.Items.Add('In:'+h+' --- Out r:'+IntToStr(r)+' g:'+IntToStr(g)+' b:'+IntToStr(b)); + Stat('In:'+h+' --- Out r:'+IntToStr(r)+' g:'+IntToStr(g)+' b:'+IntToStr(b)); Result := rgb(r, g, b); end; +function Dec2Hex(i: integer): string; +var s: string; +begin + s := ''; + while i>15 do begin + s := s + Hexmap[(i MOD 16)+1]; + i := i DIV 16; + end; + s := Hexmap[i+1] + s; + while Length(s) MOD 2>0 do s := '0' + s; + Result := LowerCase(s); +end; + function Hex2Str(h: string): string; -const Hexmap = '0123456789ABCDEF'; var c: integer; - t: string; + t: widestring; begin h := UpperCase(h); - c := (Pos(h[3],hexmap)-1)*16 + (Pos(h[4],hexmap)-1); + c := (Pos(h[1],hexmap)-1)*4096 + (Pos(h[2],hexmap)-1)*256 + (Pos(h[3],hexmap)-1)*16 + (Pos(h[4],hexmap)-1); t := Chr(c); Result := t; end; @@ -143,7 +216,7 @@ begin keys := 0; for i:=0 to Length(m)-1 do begin if (Length(m[i])>0) then begin - l := Split(m[i]); + l := Split(m[i], ','); if Length(l)>0 then begin if (l[0]='M') then begin if (Length(l)=17) then begin @@ -165,17 +238,21 @@ begin r.background := Hex2Col(l[16]); end; end else if (l[0]='R') then begin - if (rows>0) then SetLength(r.Data[rows-1], keys); + if (rows>0) then SetLength(r.Data[rows-1].keys, keys); Inc(rows); - SetLength(r.Data[rows-1], 100); + with r.Data[rows-1] do begin + SetLength(keys, 100); + if (Length(l)>2) then keycap := Hex2Col(l[2]) else keycap := r.keycap; + if (Length(l)>3) then ink := Hex2Col(l[3]) else ink := r.ink; + end; keys := 0; end else if (l[0]='L') OR (l[0]='K') OR (l[0]='S') then begin - with r.Data[rows-1][keys] do begin + with r.Data[rows-1].keys[keys] do begin typ := l[0][1]; value := l[1]; if (Length(l)>2) then width := StrToInt(l[2]) else width := 1; - if (Length(l)>3) then keycap := Hex2Col(l[3]) else keycap := r.keycap; - if (Length(l)>4) then ink := Hex2Col(l[4]) else ink := r.ink; + if (Length(l)>3) then keycap := Hex2Col(l[3]) else keycap := r.Data[rows-1].keycap; + if (Length(l)>4) then ink := Hex2Col(l[4]) else ink := r.Data[rows-1].ink; if (Length(l)>5) then legend := l[5] else legend := Hex2Str(l[1]); end; Inc(keys); @@ -184,33 +261,51 @@ begin end; end; if (rows>0) then begin - SetLength(r.Data[rows-1], keys); + SetLength(r.Data[rows-1].keys, keys); SetLength(r.Data, rows); end; Result := r; end; procedure KeyRect(map: TMap; i,j,ki: integer; lbl: string); -const space = 3; -var top, left, bottom, right: integer; - kw, kh: integer; - hc, vc: integer; +const space = 2; +var top, left, bottom, right: integer; // final rect for key + dt, dl, db, dr: double; // final rect as double + mw, mh: double; // keymap width/height + tw, th: integer; // Text width/height + ow, oh: double; // output key width/height key: TKey; begin - key := map.Data[i][j]; - hc := map.left + Round((map.right-map.left)/(map.cols+1)) * ki; - vc := map.top + Round((map.bottom-map.top)/(map.rows+1)) * (i+1); - kw := Round(( map.right - map.left ) / (map.cols+1)) - space; - kh := Round(( map.bottom - map.top ) / (map.rows+1)) - space; - left := hc - Round(kw/2); - right := hc + Round(kw/2) + (key.width-1)*(kw+space); - top := vc - Round(kh/2); - bottom := vc + Round(kh/2); - with KBLEditForm.Px00Screen.Canvas do begin - Brush.Color := map.Data[i][j].keycap; - Font.Color := map.Data[i][j].ink; - Rectangle(left, top, right+1, bottom+1); - TextRect(Rect(left,top,right+1,bottom+1),hc-2,vc-Round(kh/2),key.legend); + try + key := map.Data[i].keys[j]; + Stat('map: ('+IntToStr(map.left)+','+IntToStr(map.top)+'),('+IntToStr(map.right)+','+IntToStr(map.bottom)+')'); + mw := map.right-map.left; + mh := map.bottom-map.top; + Stat('map: width:'+FloatToStr(mw)+' height:'+FloatToStr(mh)); + dl := map.left + (mw/map.cols) * (ki-1) + space; + dr := map.left + (mw/map.cols) * (ki-1+key.width) - space; + dt := map.top + (mh/(map.rows)) * i + space; // ki=keyindex 1..x; i=row 0..x + db := map.top + (mh/(map.rows)) * (i+1) - space; + ow := dr-dl+1; + oh := db-dt+1; + left := Round(dl); + right := Round(dr); + top := Round(dt); + bottom := Round(db); + with KBLEditForm.Px00Screen.Canvas do begin + Brush.Color := map.Data[i].keys[j].keycap; + Font.Color := map.Data[i].keys[j].ink; + Rectangle(left, top, right+1, bottom+1); + th := TextHeight(key.legend); + tw := TextWidth(key.legend); + TextRect(Rect(left,top,right+1,bottom+1),Round(left+(ow-tw)/2),Round(top+(oh-th)/2),key.legend); + end; + except + on e: Exception do begin + ShowMessage('Exception: '+e.Message+CRLF+CRLF+'Something seems to be wrong with this map.'); + exoc := true; + Exit; + end; end; end; @@ -235,43 +330,326 @@ begin FillRect(Rect(map.left, map.top, map.right+1, map.bottom+1)); for i:=0 to Length(map.Data)-1 do begin keyindex := 1; - for j:=0 to Length(map.Data[i])-1 do begin - Keyrect(map, i, j, keyindex, map.Data[i][j].legend); - Inc(keyindex, map.Data[i][j].width); + for j:=0 to Length(map.Data[i].keys)-1 do begin + Keyrect(map, i, j, keyindex, map.Data[i].keys[j].legend); + if (exoc) then begin + exoc := false; + Exit; + end; + Inc(keyindex, map.Data[i].keys[j].width); end; end; end; end; -procedure TKBLEditForm.Button4Click(Sender: TObject); +procedure TKBLEditForm.ButtonVisualizeClick(Sender: TObject); begin ClearScreen; VisMap(SpinEdit1.Value); end; -procedure TKBLEditForm.Button1Click(Sender: TObject); +procedure TKBLEditForm.ButtonOpenClick(Sender: TObject); +var r: integer; begin + if (Memo1.Modified) then begin + r := Application.MessageBox('Do you want to save your work first?','Please confirm',MB_YESNO); + if (r=IDYES) then begin + if (ButtonSave.Enabled) then ButtonSaveClick(Sender) else ButtonSaveAsClick(Sender); + end; + end; if (OpenDialog1.Execute) then begin Memo1.Lines.LoadFromFile(OpenDialog1.FileName); - Button2.Enabled := true; + Memo1.Modified := false; + LabelFile.Caption := ExtractFileName(OpenDialog1.FileName); + UpdateTitle; + ButtonSave.Enabled := true; + SpinEdit1.Value := 1; + ClearScreen; end; end; -procedure TKBLEditForm.Button3Click(Sender: TObject); +procedure TKBLEditForm.ButtonSaveAsClick(Sender: TObject); begin + SaveDialog1.FileName := OpenDialog1.FileName; if (SaveDialog1.Execute) then begin Memo1.Lines.SaveToFile(SaveDialog1.FileName); + Memo1.Modified := false; + end; +end; + +procedure AddUnicode(code, desc: AnsiString); +begin + with KBLEditForm.Unicodes do begin + RowCount := RowCount + 1; + Cells[0, RowCount-1] := desc; + Cells[1, RowCount-1] := code; + end; +end; + +procedure LoadUnicodes; +var f: TextFile; + t: AnsiString; + d: integer; + t2: TArray; +begin + d := 1; + with KBLEditForm.Unicodes do begin + SetLength(t2, 50); + Cells[0,0] := 'Description'; + Cells[1,0] := 'Unicode'; + if (FileExists(unicodefile)) then begin + try + AssignFile(f, unicodefile); + Reset(f); + while Not Eof(f) do begin + ReadLn(f, t); + t2 := Split(t, Chr(9)); + if (Length(t2[1])>2) then begin + if (d>0) then Dec(d) else RowCount := RowCount + 1; + Cells[0, RowCount-1] := Trim(t2[0]); + Cells[1, RowCount-1] := Trim(t2[1]); + end; + end; + CloseFile(f); + except + on e: Exception do ShowMessage('ERROR: Couldn''t load unicode list from '+unicodefile+'. ('+e.Message+')'); + end; + end; + AddUnicode('', '-------------- useful PopOnTop codes follow here ---------------'); + AddUnicode('0008', 'BS Backspace'); + AddUnicode('000D', 'CR Carriage Return'); + AddUnicode('F6DC', 'Next - Move cursor to next field'); + AddUnicode('F6DD', 'Prev - Move cursor to previous field'); + AddUnicode('F802', 'Home - Move cursor to start of field/line'); + AddUnicode('F803', 'End - Move cursor to end of field/line'); + AddUnicode('F807', 'Left - Move cursor left one character'); + AddUnicode('F808', 'Right - Move cursor right one character'); + AddUnicode('F809', 'Up - Move cursor up one character'); + AddUnicode('F80A', 'Down - Move cursor down one character'); + AddUnicode('F7FE', 'Horizontal - Move keyboard horizontally'); + AddUnicode('F7FF', 'Vertical - Move keyboard vertically'); end; end; procedure TKBLEditForm.FormCreate(Sender: TObject); begin + if (debug) then Status.Visible := true; + TimerScroll.Enabled := false; + LabelFile.Caption := ''; + LabelSyntax.Caption := ''; ClearScreen; + LoadUnicodes; end; -procedure TKBLEditForm.Button2Click(Sender: TObject); +procedure TKBLEditForm.ButtonSaveClick(Sender: TObject); begin - Memo1.Lines.SaveToFile(OpenDialog1.FileName); + if (Length(OpenDialog1.FileName)>0) then begin + Memo1.Lines.SaveToFile(OpenDialog1.FileName); + Memo1.Modified := false; + end; +end; + +procedure TKBLEditForm.UnicodesKeyPress(Sender: TObject; var Key: Char); +var i: integer; + s: TGridRect; +begin + for i:=1 to Unicodes.RowCount-1 do begin + if (UpCase(Unicodes.Cells[0,i][1])=UpCase(Key)) then begin + s.Left := 0; + s.Right := 1; + s.Top := i; + s.Bottom := i; + Unicodes.Selection := s; + Unicodes.TopRow := i; + Break; + end; + end; +end; + +procedure InsertIntoMemo(x: AnsiString); +var m: AnsiString; + ss, sl: longint; + tmp: TClipboard; +begin + tmp := Clipboard; + with KBLEditForm.Memo1 do begin + m := Lines.Text; + ss := SelStart; + sl := SelLength; + if (sl>0) then begin + CutToClipboard; + // Delete(m, ss+1, sl); + end; +{ Insert(x, m, ss+1); + Lines.Text := m; } + Clipboard.SetTextBuf(PChar(x)); + PasteFromClipboard; + SelStart := ss; + SelLength := Length(x); + SetFocus; + end; + SetClipboard(tmp); +end; + +procedure TKBLEditForm.UnicodesDblClick(Sender: TObject); +var s: TGridRect; + r: integer; + c: string; +begin + s := Unicodes.Selection; + r := s.Top; + c := Unicodes.Cells[1,r]; + InsertIntoMemo(c); +end; + +procedure TKBLEditForm.ButtonNewClick(Sender: TObject); +begin + if (Memo1.Modified) then if (Application.MessageBox('Are you sure to clear everything?', 'Please confirm', MB_YESNO)=IDNO) then Exit; + Memo1.Clear; + Memo1.SetFocus; + ButtonSave.Enabled := false; + Memo1.Modified := false; + LabelFile.Caption := ''; + UpdateTitle; +end; + +procedure UpdateColor; +var r,g,b: integer; +begin + with KBLEditForm do begin + r := TrackR.Position; + g := TrackG.Position; + b := TrackB.Position; + ColorPanel.Caption := Dec2Hex(r)+Dec2Hex(g)+Dec2Hex(b); + ColorPanel.Color := rgb(r,g,b); + ColorPanel.Font.Color := rgb(r XOR $FF, g XOR $FF, b XOR $FF); + end; +end; + +procedure UpdateColorFromHex(s: string); +var col: TColor; + r,g,b: integer; +begin + with KBLEditForm do begin + col := Hex2Col(s); + r := (col AND $0000FF); + g := (col AND $00FF00) DIV $FF; + b := (col AND $FF0000) DIV $FFFF; + TrackR.Position := r; + TrackG.Position := g; + TrackB.Position := b; + ColorPanel.Color := col; + ColorPanel.Font.Color := col XOR $FFFFFF; + end; +end; + +procedure TKBLEditForm.TrackRChange(Sender: TObject); +begin + UpdateColor; +end; + +procedure TKBLEditForm.TrackGChange(Sender: TObject); +begin + UpdateColor; +end; + +procedure TKBLEditForm.TrackBChange(Sender: TObject); +begin + UpdateColor; +end; + +procedure TKBLEditForm.ButtonColorInsertClick(Sender: TObject); +begin + InsertIntoMemo(ColorPanel.Caption); +end; + +function StringIsNum(s: string): boolean; +var i: integer; +begin + for i:=1 to Length(s) do begin + if Pos(UpCase(s[i]),Hexmap)=0 then begin + Result := false; + Exit; + end; + end; + Result := true; +end; + +procedure TKBLEditForm.ButtonColorGetClick(Sender: TObject); +var s: AnsiString; +begin + s := Copy(Memo1.Lines.Text, Memo1.SelStart+1, Memo1.SelLength); + if (Length(s)=6) AND (StringIsNum(s)) then begin + UpdateColorFromHex(s); + end else begin + ShowMessage('Please select a color value first. (6-digit hexadecimal number)'); + end; +end; + + +procedure TKBLEditForm.FormCloseQuery(Sender: TObject; + var CanClose: Boolean); +begin + if (Memo1.Modified) then begin + CanClose := (Application.MessageBox('You have not saved your work. Are you sure to quit?', 'Please confirm', MB_YESNO)=IDYES); + end; +end; + +function GetFirstCharInLine(s: AnsiString; i: integer): char; +var j: integer; +begin + Result := Chr(0); + for j:=i downto 1 do begin + if (Ord(s[j])=13) OR (Ord(s[j])=10) then Break; + Result := s[j]; + end; +end; + +procedure SetSyntax(s: AnsiString); +var tw: integer; +begin + with KBLEditForm do begin + if (s<>'') then s := 'Syntax: ' + s; + LabelSyntax.Caption := s; + Px00Screen.Canvas.Font := LabelSyntax.Font; + tw := Px00Screen.Canvas.TextWidth(s); + if (tw>LabelSyntax.Width) then TimerScroll.Enabled := true else TimerScroll.Enabled := false; + end; +end; + +function GetHelpByKey(x: char): AnsiString; +begin + case UpCase(x) of + 'T': Result := 'T,Title Text'; + 'M': Result := 'M,landscape,full,top,left,bottom,right,rows,cols,top,left,bottom,right,keycap,ink,highlight,background'; + 'R': Result := 'R,keycap,ink'; + 'K': Result := 'K,value,width,keycap,ink,legend'; + 'L': Result := 'L,map,width,keycap,ink,legend'; + 'S': Result := 'S,map,width,keycap,ink,legend'; + '!': Result := '! Helpful Text'; + else + Result := ''; + end; +end; + +procedure TKBLEditForm.Memo1Change(Sender: TObject); +var x: char; +begin + x := GetFirstCharInLine(Memo1.Lines.Text, Memo1.SelStart); + SetSyntax(GetHelpByKey(x)); +end; + +procedure TKBLEditForm.TimerScrollTimer(Sender: TObject); +var x: AnsiString; +begin + x := LabelSyntax.Caption; + if (Pos(' +++ ',x)=0) then x := x + ' +++ '; + LabelSyntax.Caption := Copy(x,2,Length(x)-1)+x[1]; +end; + +procedure TKBLEditForm.Memo1Click(Sender: TObject); +begin + Memo1Change(Sender); end; end.