From a5583d441c455613424a894628ed9307e36ad056 Mon Sep 17 00:00:00 2001 From: Jayed Ahsan Saad <42943920+JayedAhsan@users.noreply.github.com> Date: Mon, 31 Jan 2022 21:01:50 +0600 Subject: [PATCH 1/6] Replaced 3rd Party libraries with built in libraries 1. Migrated Project to Delphi 10.4. 2. Replaced NativeXML [no longer supported] with IXMLDocument. 3. Replaced PCRE library with built in Regex library. 4. Replaced DISQLite3 with FireDAC. 5. Removed Delphi Jedi 6. Clean up unnecessary files. --- Keyboard and Spell checker/Avro_Keyboard.dpr | 178 +- Keyboard and Spell checker/Avro_Keyboard.res | Bin 87608 -> 87928 bytes .../Classes/clsAbbreviation.pas | 161 +- .../Classes/clsAvroPhonetic.pas | 120 +- .../Classes/clsE2BCharBased.pas | 2610 ++++--- .../Classes/clsEnglishToBangla.pas | 2426 +++--- .../Classes/clsFileVersion.pas | 225 +- .../Classes/clsGenericLayoutModern.pas | 1235 ++-- .../Classes/clsGenericLayoutOld.pas | 1486 ++-- .../Classes/clsLayout.pas | 411 +- .../Classes/clsPhoneticRegExBuilder.pas | 1301 ++-- .../Classes/clsRegistry_XMLSetting.pas | 276 +- .../Classes/clsSkinLayoutConverter.pas | 917 +-- .../Classes/clsUpdateInfoDownloader.pas | 434 +- Keyboard and Spell checker/Forms/uForm1.dfm | 2 +- Keyboard and Spell checker/Forms/uForm1.pas | 3096 ++++---- .../Forms/uFrmSplash.pas | 153 +- .../Forms/uLayoutViewer.dfm | 8 - .../Forms/uLayoutViewer.pas | 673 +- Keyboard and Spell checker/Forms/uTopBar.dfm | 11 +- Keyboard and Spell checker/Forms/uTopBar.pas | 2890 ++++---- .../Forms/ufrmAbout.dfm | 2 +- .../Forms/ufrmAbout.pas | 364 +- .../Forms/ufrmAboutSkinLayout.pas | 112 +- .../Forms/ufrmAutoCorrect.pas | 824 ++- .../Forms/ufrmAvroMouse.dfm | 216 - .../Forms/ufrmAvroMouse.pas | 497 +- .../Forms/ufrmConflict.pas | 119 +- .../Forms/ufrmEncodingWarning.pas | 156 +- .../Forms/ufrmOptions.pas | 1904 ++--- .../Forms/ufrmPrevW.dfm | 16 +- .../Forms/ufrmPrevW.pas | 1016 +-- .../Forms/ufrmUpdateNotify.pas | 208 +- .../SpellChecker/Avro_Spell_Checker.dpr | 1 - .../SpellChecker/Avro_Spell_Checker.res | Bin 164948 -> 164688 bytes .../SpellChecker/HashTable.pas | 774 +- .../SpellChecker/Hashing.pas | 205 +- .../SpellChecker/clsRegistry_XMLSetting.pas | 343 +- .../Units/BanglaChars.pas | 524 +- .../Units/KeyboardFunctions.pas | 622 +- .../Units/KeyboardHook.pas | 1523 ++-- .../Units/KeyboardLayoutLoader.pas | 1254 ++-- .../Units/Levenshtein.pas | 49 +- .../Units/NativeXml LICENSE.txt | 10 - .../Units/NativeXml.inc | 105 - .../Units/NativeXml.pas | 6377 ---------------- Keyboard and Spell checker/Units/PCRE.pas | 2230 ------ .../Units/Phonetic_RegExp_Constants.pas | 955 +-- .../Units/SkinLoader.pas | 1182 +-- .../Units/VirtualKeyCode.pas | 458 +- .../Units/WindowsVersion.pas | 348 +- .../Units/pcre_chartables.obj | Bin 2593 -> 0 bytes .../Units/pcre_compile.obj | Bin 32119 -> 0 bytes .../Units/pcre_config.obj | Bin 1706 -> 0 bytes .../Units/pcre_dfa_exec.obj | Bin 25903 -> 0 bytes Keyboard and Spell checker/Units/pcre_dll.pas | 945 --- .../Units/pcre_exec.obj | Bin 60748 -> 0 bytes .../Units/pcre_fullinfo.obj | Bin 2036 -> 0 bytes Keyboard and Spell checker/Units/pcre_get.obj | Bin 3320 -> 0 bytes .../Units/pcre_globals.obj | Bin 1745 -> 0 bytes .../Units/pcre_info.obj | Bin 1642 -> 0 bytes .../Units/pcre_maketables.obj | Bin 2480 -> 0 bytes .../Units/pcre_newline.obj | Bin 2263 -> 0 bytes .../Units/pcre_ord2utf8.obj | Bin 1642 -> 0 bytes .../Units/pcre_refcount.obj | Bin 1584 -> 0 bytes .../Units/pcre_study.obj | Bin 3787 -> 0 bytes .../Units/pcre_tables.obj | Bin 3536 -> 0 bytes .../Units/pcre_try_flipped.obj | Bin 1891 -> 0 bytes Keyboard and Spell checker/Units/pcre_ucd.obj | Bin 54691 -> 0 bytes .../Units/pcre_valid_utf8.obj | Bin 1808 -> 0 bytes .../Units/pcre_version.obj | Bin 1584 -> 0 bytes .../Units/pcre_xclass.obj | Bin 2435 -> 0 bytes .../Units/pcreposix.obj | Bin 3402 -> 0 bytes .../Units/uAutoCorrect.pas | 120 +- .../Units/uCmdLineHelper.pas | 275 +- .../Units/uCommandLineFunctions.pas | 312 +- Keyboard and Spell checker/Units/uDBase.pas | 779 +- .../Units/uFileFolderHandling.pas | 518 +- Keyboard and Spell checker/Units/uLocale.pas | 547 +- .../Units/uProcessHandler.pas | 53 +- .../Units/uRegExPhoneticSearch.pas | 1960 ++--- .../Units/uRegistrySettings.pas | 1143 +-- .../Units/uSimilarSort.pas | 66 +- .../Units/uWindowHandlers.pas | 292 +- Keyboard and Spell checker/Units/u_Admin.pas | 288 +- .../Units/u_VirtualFontInstall.pas | 224 +- Keyboard and Spell checker/clean_files.bat | 10 + .../Classes/clsRegistry_XMLSetting.pas | 247 +- Layout Editor/Classes/uShapeInterceptor.pas | 151 +- Layout Editor/Forms/uFrmAbout.dfm | 2 +- Layout Editor/Forms/uFrmAbout.pas | 114 +- Layout Editor/Forms/uFrmMain.dfm | 12 +- Layout Editor/Forms/uFrmMain.pas | 1815 ++--- Layout Editor/LayoutEditor.dpr | 39 +- Layout Editor/LayoutEditor.res | Bin 37400 -> 37192 bytes Layout Editor/Units/uRegistrySettings.pas | 204 +- Layout Editor/clean_files.bat | 10 + Skin Designer/SkinDesigner.dpr | 2 +- Skin Designer/SkinDesigner.res | Bin 105040 -> 104864 bytes Skin Designer/clean_files.bat | 10 + Skin Designer/nativexml.pas | 6484 ----------------- Skin Designer/ufrmSkinCreator.pas | 909 +-- .../Unicode_to_Bijoy.dpr | 32 +- Unicode to ascii converter/Unit1.pas | 162 +- Unicode to ascii converter/clean_files.bat | 10 + .../clsUnicodeToBijoy2000.pas | 1766 ++--- 106 files changed, 23151 insertions(+), 37357 deletions(-) delete mode 100644 Keyboard and Spell checker/Units/NativeXml LICENSE.txt delete mode 100644 Keyboard and Spell checker/Units/NativeXml.inc delete mode 100644 Keyboard and Spell checker/Units/NativeXml.pas delete mode 100644 Keyboard and Spell checker/Units/PCRE.pas delete mode 100644 Keyboard and Spell checker/Units/pcre_chartables.obj delete mode 100644 Keyboard and Spell checker/Units/pcre_compile.obj delete mode 100644 Keyboard and Spell checker/Units/pcre_config.obj delete mode 100644 Keyboard and Spell checker/Units/pcre_dfa_exec.obj delete mode 100644 Keyboard and Spell checker/Units/pcre_dll.pas delete mode 100644 Keyboard and Spell checker/Units/pcre_exec.obj delete mode 100644 Keyboard and Spell checker/Units/pcre_fullinfo.obj delete mode 100644 Keyboard and Spell checker/Units/pcre_get.obj delete mode 100644 Keyboard and Spell checker/Units/pcre_globals.obj delete mode 100644 Keyboard and Spell checker/Units/pcre_info.obj delete mode 100644 Keyboard and Spell checker/Units/pcre_maketables.obj delete mode 100644 Keyboard and Spell checker/Units/pcre_newline.obj delete mode 100644 Keyboard and Spell checker/Units/pcre_ord2utf8.obj delete mode 100644 Keyboard and Spell checker/Units/pcre_refcount.obj delete mode 100644 Keyboard and Spell checker/Units/pcre_study.obj delete mode 100644 Keyboard and Spell checker/Units/pcre_tables.obj delete mode 100644 Keyboard and Spell checker/Units/pcre_try_flipped.obj delete mode 100644 Keyboard and Spell checker/Units/pcre_ucd.obj delete mode 100644 Keyboard and Spell checker/Units/pcre_valid_utf8.obj delete mode 100644 Keyboard and Spell checker/Units/pcre_version.obj delete mode 100644 Keyboard and Spell checker/Units/pcre_xclass.obj delete mode 100644 Keyboard and Spell checker/Units/pcreposix.obj create mode 100644 Keyboard and Spell checker/clean_files.bat create mode 100644 Layout Editor/clean_files.bat create mode 100644 Skin Designer/clean_files.bat delete mode 100644 Skin Designer/nativexml.pas create mode 100644 Unicode to ascii converter/clean_files.bat diff --git a/Keyboard and Spell checker/Avro_Keyboard.dpr b/Keyboard and Spell checker/Avro_Keyboard.dpr index 7388141..8efa8c0 100644 --- a/Keyboard and Spell checker/Avro_Keyboard.dpr +++ b/Keyboard and Spell checker/Avro_Keyboard.dpr @@ -1,39 +1,31 @@ { - ============================================================================= - ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. - - The Original Code is Avro Keyboard 5. - - The Initial Developer of the Original Code is - Mehdi Hasan Khan . - - Copyright (C) OmicronLab . All Rights Reserved. - - - Contributor(s): ______________________________________. - - ***************************************************************************** - ============================================================================= + ============================================================================= + ***************************************************************************** + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. + The Original Code is Avro Keyboard 5. + The Initial Developer of the Original Code is + Mehdi Hasan Khan . + Copyright (C) OmicronLab . All Rights Reserved. + + Contributor(s): ______________________________________. + ***************************************************************************** + ============================================================================= } - Program Avro_Keyboard; uses Forms, Windows, - uForm1 in 'Forms\uForm1.pas' { AvroMainForm1 }, + uForm1 in 'Forms\uForm1.pas' {AvroMainForm1} , BanglaChars in 'Units\BanglaChars.pas', - nativexml in 'Units\nativexml.pas', - uTopBar in 'Forms\uTopBar.pas' { TopBar }, + uTopBar in 'Forms\uTopBar.pas' {TopBar} , SkinLoader in 'Units\SkinLoader.pas', KeyboardLayoutLoader in 'Units\KeyboardLayoutLoader.pas', clsEnglishToBangla in 'Classes\clsEnglishToBangla.pas', @@ -51,14 +43,14 @@ uses uFileFolderHandling in 'Units\uFileFolderHandling.pas', u_VirtualFontInstall in 'Units\u_VirtualFontInstall.pas', u_Admin in 'Units\u_Admin.pas', - ufrmAbout in 'Forms\ufrmAbout.pas' { frmAbout }, - ufrmAboutSkinLayout in 'Forms\ufrmAboutSkinLayout.pas' { frmAboutSkinLayout }, - ufrmAutoCorrect in 'Forms\ufrmAutoCorrect.pas' { frmAutoCorrect }, - ufrmAvroMouse in 'Forms\ufrmAvroMouse.pas' { frmAvroMouse }, - ufrmOptions in 'Forms\ufrmOptions.pas' { frmOptions }, - ufrmPrevW in 'Forms\ufrmPrevW.pas' { frmPrevW }, - ufrmUpdateNotify in 'Forms\ufrmUpdateNotify.pas' { frmUpdateNotify }, - uLayoutViewer in 'Forms\uLayoutViewer.pas' { LayoutViewer }, + ufrmAbout in 'Forms\ufrmAbout.pas' {frmAbout} , + ufrmAboutSkinLayout in 'Forms\ufrmAboutSkinLayout.pas' {frmAboutSkinLayout} , + ufrmAutoCorrect in 'Forms\ufrmAutoCorrect.pas' {frmAutoCorrect} , + ufrmAvroMouse in 'Forms\ufrmAvroMouse.pas' {frmAvroMouse} , + ufrmOptions in 'Forms\ufrmOptions.pas' {frmOptions} , + ufrmPrevW in 'Forms\ufrmPrevW.pas' {frmPrevW} , + ufrmUpdateNotify in 'Forms\ufrmUpdateNotify.pas' {frmUpdateNotify} , + uLayoutViewer in 'Forms\uLayoutViewer.pas' {LayoutViewer} , uProcessHandler in 'Units\uProcessHandler.pas', uWindowHandlers in 'Units\uWindowHandlers.pas', clsUpdateInfoDownloader in 'Classes\clsUpdateInfoDownloader.pas', @@ -66,8 +58,8 @@ uses WindowsVersion in 'Units\WindowsVersion.pas', uLocale in 'Units\uLocale.pas', Phonetic_RegExp_Constants in 'Units\Phonetic_RegExp_Constants.pas', - PCRE in 'Units\PCRE.pas', - pcre_dll in 'Units\pcre_dll.pas', + // PCRE in 'Units\PCRE.pas', + // pcre_dll in 'Units\pcre_dll.pas', clsPhoneticRegExBuilder in 'Classes\clsPhoneticRegExBuilder.pas', uDBase in 'Units\uDBase.pas', uRegExPhoneticSearch in 'Units\uRegExPhoneticSearch.pas', @@ -78,73 +70,63 @@ uses clsSkinLayoutConverter in 'Classes\clsSkinLayoutConverter.pas', uCmdLineHelper in 'Units\uCmdLineHelper.pas', uCommandLineFunctions in 'Units\uCommandLineFunctions.pas', - ufrmConflict in 'Forms\ufrmConflict.pas' { frmConflict }, - uFrmSplash in 'Forms\uFrmSplash.pas' { frmSplash }, + ufrmConflict in 'Forms\ufrmConflict.pas' {frmConflict} , + uFrmSplash in 'Forms\uFrmSplash.pas' {frmSplash} , clsAbbreviation in 'Classes\clsAbbreviation.pas', - clsUnicodeToBijoy2000 in '..\Unicode to ascii converter\clsUnicodeToBijoy2000.pas', - ufrmEncodingWarning in 'Forms\ufrmEncodingWarning.pas' { frmEncodingWarning }; + clsUnicodeToBijoy2000 + in '..\Unicode to ascii converter\clsUnicodeToBijoy2000.pas', + ufrmEncodingWarning in 'Forms\ufrmEncodingWarning.pas' {frmEncodingWarning}; Var - Mutex: THandle; - - {$R *.res} - {$R docico.res} + Mutex: THandle; +{$R *.res} +{$R docico.res} Begin - { Disable FPU exceptions. No need to restore, setting is process specific. } - Set8087CW($133F); - - - /// //////////////////////////////////////////////////////////////////////////// - // Check parameters - If uCommandLineFunctions.HandleAllCommandLine Then Begin - Application.Terminate; - exit; - End; - - - /// /////////////////////////////////////////////////////////////////////////// - { DONE : check for previous instance } - Mutex := CreateMutex(Nil, True, 'Avro_Keyboard'); - If (Mutex = 0) Or (GetLastError <> 0) Then Begin - - uCommandLineFunctions.SendCommand('restore'); - - Application.MessageBox('Avro Keyboard is already running on this system and' + #10 + 'running more than one instance is not allowed.', 'Avro Keyboard', - MB_OK + MB_ICONEXCLAMATION + MB_DEFBUTTON1 + MB_APPLMODAL); - - Application.Terminate; - exit; - End; - /// ///////////////////////////////////////////////////////////// - - - - /// /////////////////////////////////////////////////////////////////////////// - // Load Avro - Application.Initialize; - - // Hide Application from taskbar - Application.Title := 'Launching Avro Keyboard...'; - SetWindowLong(Application.Handle, GWL_EXSTYLE, GetWindowLong(Application.Handle, GWL_EXSTYLE) Or WS_EX_TOOLWINDOW); - Application.MainFormOnTaskBar := False; - - - // First item is applications main form - Application.CreateForm(TAvroMainForm1, AvroMainForm1); + { Disable FPU exceptions. No need to restore, setting is process specific. } + Set8087CW($133F); + + /// //////////////////////////////////////////////////////////////////////////// + // Check parameters + If uCommandLineFunctions.HandleAllCommandLine Then + Begin + Application.Terminate; + exit; + End; + + /// /////////////////////////////////////////////////////////////////////////// + { DONE : check for previous instance } + Mutex := CreateMutex(Nil, True, 'Avro_Keyboard'); + If (Mutex = 0) Or (GetLastError <> 0) Then + Begin + uCommandLineFunctions.SendCommand('restore'); + Application.MessageBox('Avro Keyboard is already running on this system and' + + #10 + 'running more than one instance is not allowed.', 'Avro Keyboard', + MB_OK + MB_ICONEXCLAMATION + MB_DEFBUTTON1 + MB_APPLMODAL); + Application.Terminate; + exit; + End; + /// ///////////////////////////////////////////////////////////// + + /// /////////////////////////////////////////////////////////////////////////// + // Load Avro + Application.Initialize; + // Hide Application from taskbar + Application.Title := 'Launching Avro Keyboard...'; + SetWindowLong(Application.Handle, GWL_EXSTYLE, + GetWindowLong(Application.Handle, GWL_EXSTYLE) Or WS_EX_TOOLWINDOW); + Application.MainFormOnTaskBar := False; + + // First item is applications main form + Application.CreateForm(TAvroMainForm1, AvroMainForm1); Application.Title := ''; - // Hide Application from taskbar - ShowWindow(Application.Handle, SW_HIDE); - - - - - - Application.Run; - /// ///////////////////////////////////////////////////// + // Hide Application from taskbar + ShowWindow(Application.Handle, SW_HIDE); + Application.Run; + /// ///////////////////////////////////////////////////// - If Mutex <> 0 Then - CloseHandle(Mutex); + If Mutex <> 0 Then + CloseHandle(Mutex); End. diff --git a/Keyboard and Spell checker/Avro_Keyboard.res b/Keyboard and Spell checker/Avro_Keyboard.res index c3430ebf7450de0bd4693cb3a78dac0499a6c9e3..424d13227bda8dbdc2e235dece8c9eefb68157c4 100644 GIT binary patch delta 1302 zcmbW1&ubGw6vyB62Q{%pJy@y~oi2ht zqO~_c1aEWHKR~@nJ=UWa!9T!*|A1!^A-?=*8qtd#nBBMEdGmR1-ptO2H-kUk4Zfrk z`vU+J02+;x*a=zyQ3#>hZu>H~LhcMw6o`DgLe3BV>PK_$%L;kbNAB%CxIy~K?F|?Q z0_)&|3uSyVuptYJErgDm4O6YB1$xWJfmQS=p~_&prQ8P&byQqbd@yikb2gFnHF9N_ zzNe(JOrr9|GO-4lNy?wgBtCk4=pgyAp5*1{HS&CzKC~;2m}kP?o|bf-Ovqe;4DDzw zVV-$j#nM?|xlTGvv32yCF6nPL>PFb|aaMbXuOpW=xO-(6VLEz1+s?fK%&BT;# z>AovmGnmp{TP^0YYCIZEsJH&4Dd}LxuX5G1HT3}aR|JO(@gGrQm;R2j&i$P0Sb^(r z#t$Pk!Rfp0#j5Qp{A0CRXQ;P8BREMjxW^rXJ9@oSumd5;2*K@ArJk0$nSY_Mjk7W>nGZ|3a(du zD?mIeka78>fLr+*t&812lvb^buH*VripeU1E8QVA9hP6wd7{lyyDLOLnyaFxPFTRTKN#N=7~Vw%LfZ!&ut zc=clG;XR5MPa=pQUOjjb51vKvf7r>}eBUOvozq=hLLl$=`SJZc&-?R@`r)RNVc|7ZSZfKsD#|X;@P>}>8z4I?x1pC{hSe}!OJV^EBW*G(~Ftmm&}=A zoY_~aGH>`Xd+YpzQ;LGc;ox9Fd`Rj_F~_wn^lWc+eimcXq7-@$-G0phj}g|FBF3yA zKv~-*-nEjJD4x|5%9`)MZLmVzs8n&2MGo=Pcnl#WzE{=^qfjiAZWc=gqj-JU&~Q>8 zguV@w`e7xsyM%$w=bC8t-iX1006gJu_eV^E>bJrwDP9`*C-4zy-fbY`a^fw6W4;># zPrTYZf7d`u7bY35<#i&fBc@yu!TkohdMOE-`d@Ik-b5R{G=YL0g<^RV$`Bq$Kp8k& zA&H3#9iZc&7-Ae=e=qa3?SryHY4?7Oi=){|G|C^rMN+)ma#UrcXE1$K8&Y znff6#Qy0~g)w~^l)PS$G(E6TSk6dgJxWu+3%xZdRBYiQSZ*>X9H3!F*8v!PsBlCb_ z)&)FOhG`T8e#j`^7CHVd#ce{Fg?A#)mTfIp>Z1sl| qZ{IyBqm|>0z6v8ak%?9c#_?A5HZm_JR;E667s(a!g>8gq6y+D#>qjL3 diff --git a/Keyboard and Spell checker/Classes/clsAbbreviation.pas b/Keyboard and Spell checker/Classes/clsAbbreviation.pas index b812940..859200f 100644 --- a/Keyboard and Spell checker/Classes/clsAbbreviation.pas +++ b/Keyboard and Spell checker/Classes/clsAbbreviation.pas @@ -1,120 +1,117 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= } - - Unit clsAbbreviation; Interface Uses - classes, - sysutils, - StrUtils; + classes, + sysutils, + StrUtils; Type - TAbbreviation = Class - Private - - Public - Function CheckConvert(EnglishT: String): String; - End; + TAbbreviation = Class + Private + Public + Function CheckConvert(EnglishT: String): String; + End; Implementation Uses - BanglaChars; + BanglaChars; { TAbbreviation } -{===============================================================================} +{ =============================================================================== } Function TAbbreviation.CheckConvert(EnglishT: String): String; Var - T : String; + T: String; Begin - EnglishT := Trim(EnglishT); - - If Length(EnglishT) <= 0 Then Begin - Result := ''; - exit; - End; - - - If Uppercase(EnglishT) <> EnglishT Then Begin - Result := ''; - exit; - End; - - T := EnglishT; - T := ReplaceStr(T, 'A', b_E); - T := ReplaceStr(T, 'B', b_B + b_Ikar); - T := ReplaceStr(T, 'C', b_S + b_Ikar); - T := ReplaceStr(T, 'D', b_Dd + b_Ikar); - T := ReplaceStr(T, 'E', b_I); - T := ReplaceStr(T, 'F', b_E + b_Ph); - T := ReplaceStr(T, 'G', b_J + b_Ikar); - T := ReplaceStr(T, 'H', b_E + b_I + b_C); - T := ReplaceStr(T, 'I', b_AA + b_I); - T := ReplaceStr(T, 'J', b_J + b_EKar); - T := ReplaceStr(T, 'K', b_K + b_EKar); - T := ReplaceStr(T, 'L', b_E + b_L); - T := ReplaceStr(T, 'M', b_E + b_m); - T := ReplaceStr(T, 'N', b_E + b_n); - T := ReplaceStr(T, 'O', b_O); - T := ReplaceStr(T, 'P', b_p + b_Ikar); - T := ReplaceStr(T, 'Q', b_k + b_Ikar + b_U); - T := ReplaceStr(T, 'R', b_AA + b_R); - T := ReplaceStr(T, 'S', b_E + b_S); - T := ReplaceStr(T, 'T', b_Tt + b_Ikar); - T := ReplaceStr(T, 'U', b_I + b_U); - T := ReplaceStr(T, 'V', b_Bh + b_Ikar); - T := ReplaceStr(T, 'W', b_Dd + b_b + b_Hasanta + b_L + b_Ikar + b_U); - T := ReplaceStr(T, 'X', b_E+b_k+b_Hasanta+b_S); - T := ReplaceStr(T, 'Y', b_O+b_Y+b_AAkar+b_I); - T := ReplaceStr(T, 'Z', b_J + b_EKar+b_Dd); - - T := ReplaceStr(T, '0', b_0); - T := ReplaceStr(T, '1', b_1); - T := ReplaceStr(T, '2', b_2); - T := ReplaceStr(T, '3', b_3); - T := ReplaceStr(T, '4', b_4); - T := ReplaceStr(T, '5', b_5); - T := ReplaceStr(T, '6', b_6); - T := ReplaceStr(T, '7', b_7); - T := ReplaceStr(T, '8', b_8); - T := ReplaceStr(T, '9', b_9); - - Result := T; + EnglishT := Trim(EnglishT); + + If Length(EnglishT) <= 0 Then + Begin + Result := ''; + exit; + End; + + If Uppercase(EnglishT) <> EnglishT Then + Begin + Result := ''; + exit; + End; + + T := EnglishT; + T := ReplaceStr(T, 'A', b_E); + T := ReplaceStr(T, 'B', b_B + b_Ikar); + T := ReplaceStr(T, 'C', b_S + b_Ikar); + T := ReplaceStr(T, 'D', b_Dd + b_Ikar); + T := ReplaceStr(T, 'E', b_I); + T := ReplaceStr(T, 'F', b_E + b_Ph); + T := ReplaceStr(T, 'G', b_J + b_Ikar); + T := ReplaceStr(T, 'H', b_E + b_I + b_C); + T := ReplaceStr(T, 'I', b_AA + b_I); + T := ReplaceStr(T, 'J', b_J + b_EKar); + T := ReplaceStr(T, 'K', b_K + b_EKar); + T := ReplaceStr(T, 'L', b_E + b_L); + T := ReplaceStr(T, 'M', b_E + b_m); + T := ReplaceStr(T, 'N', b_E + b_n); + T := ReplaceStr(T, 'O', b_O); + T := ReplaceStr(T, 'P', b_p + b_Ikar); + T := ReplaceStr(T, 'Q', b_K + b_Ikar + b_U); + T := ReplaceStr(T, 'R', b_AA + b_R); + T := ReplaceStr(T, 'S', b_E + b_S); + T := ReplaceStr(T, 'T', b_Tt + b_Ikar); + T := ReplaceStr(T, 'U', b_I + b_U); + T := ReplaceStr(T, 'V', b_Bh + b_Ikar); + T := ReplaceStr(T, 'W', b_Dd + b_B + b_Hasanta + b_L + b_Ikar + b_U); + T := ReplaceStr(T, 'X', b_E + b_K + b_Hasanta + b_S); + T := ReplaceStr(T, 'Y', b_O + b_Y + b_AAkar + b_I); + T := ReplaceStr(T, 'Z', b_J + b_EKar + b_Dd); + + T := ReplaceStr(T, '0', b_0); + T := ReplaceStr(T, '1', b_1); + T := ReplaceStr(T, '2', b_2); + T := ReplaceStr(T, '3', b_3); + T := ReplaceStr(T, '4', b_4); + T := ReplaceStr(T, '5', b_5); + T := ReplaceStr(T, '6', b_6); + T := ReplaceStr(T, '7', b_7); + T := ReplaceStr(T, '8', b_8); + T := ReplaceStr(T, '9', b_9); + + Result := T; End; -{===============================================================================} +{ =============================================================================== } End. - diff --git a/Keyboard and Spell checker/Classes/clsAvroPhonetic.pas b/Keyboard and Spell checker/Classes/clsAvroPhonetic.pas index eb0ce73..8907e23 100644 --- a/Keyboard and Spell checker/Classes/clsAvroPhonetic.pas +++ b/Keyboard and Spell checker/Classes/clsAvroPhonetic.pas @@ -1,130 +1,128 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - -{COMPLETE TRANSFERING!} +{ COMPLETE TRANSFERING! } Unit clsAvroPhonetic; Interface Uses - classes, - sysutils, - StrUtils, - clsE2BCharBased; + classes, + sysutils, + StrUtils, + clsE2BCharBased; -//Skeleton of Class TAvroPhonetic +// Skeleton of Class TAvroPhonetic Type - TAvroPhonetic = Class - Private - CharBased: TE2BCharBased; - - Procedure SetAutoCorrectEnabled(Const Value: Boolean); - Function GetAutoCorrectEnabled: Boolean; - Public - Constructor Create; //Initializer - Destructor Destroy; Override; //Destructor - - Function ProcessVKeyDown(Const KeyCode: Integer; Var Block: Boolean): String; - Procedure ProcessVKeyUP(Const KeyCode: Integer; Var Block: Boolean); - Procedure ResetDeadKey; - Procedure SelectCandidate(Const Item: String); //For Avro Phonetic - //Published - Property AutoCorrectEnabled: Boolean - Read GetAutoCorrectEnabled Write SetAutoCorrectEnabled; - End; - + TAvroPhonetic = Class + Private + CharBased: TE2BCharBased; + + Procedure SetAutoCorrectEnabled(Const Value: Boolean); + Function GetAutoCorrectEnabled: Boolean; + Public + Constructor Create; // Initializer + Destructor Destroy; Override; // Destructor + + Function ProcessVKeyDown(Const KeyCode: Integer; + Var Block: Boolean): String; + Procedure ProcessVKeyUP(Const KeyCode: Integer; Var Block: Boolean); + Procedure ResetDeadKey; + Procedure SelectCandidate(Const Item: String); // For Avro Phonetic + // Published + Property AutoCorrectEnabled: Boolean Read GetAutoCorrectEnabled + Write SetAutoCorrectEnabled; + End; Implementation { TAvroPhonetic } -{===============================================================================} +{ =============================================================================== } Constructor TAvroPhonetic.Create; Begin - Inherited; + Inherited; - CharBased := TE2BCharBased.Create; + CharBased := TE2BCharBased.Create; End; -{===============================================================================} +{ =============================================================================== } Destructor TAvroPhonetic.Destroy; Begin - FreeAndNil(CharBased); - Inherited; + FreeAndNil(CharBased); + Inherited; End; -{===============================================================================} +{ =============================================================================== } Function TAvroPhonetic.GetAutoCorrectEnabled: Boolean; Begin - Result := CharBased.AutoCorrectEnabled; + Result := CharBased.AutoCorrectEnabled; End; -{===============================================================================} +{ =============================================================================== } Function TAvroPhonetic.ProcessVKeyDown(Const KeyCode: Integer; - Var Block: Boolean): String; + Var Block: Boolean): String; Begin - Result := CharBased.ProcessVKeyDown(Keycode, Block); + Result := CharBased.ProcessVKeyDown(KeyCode, Block); End; -{===============================================================================} +{ =============================================================================== } Procedure TAvroPhonetic.ProcessVKeyUP(Const KeyCode: Integer; - Var Block: Boolean); + Var Block: Boolean); Begin - CharBased.ProcessVKeyUP(Keycode, Block); + CharBased.ProcessVKeyUP(KeyCode, Block); End; -{===============================================================================} +{ =============================================================================== } Procedure TAvroPhonetic.ResetDeadKey; Begin - CharBased.ResetDeadKey; + CharBased.ResetDeadKey; End; -{===============================================================================} +{ =============================================================================== } Procedure TAvroPhonetic.SelectCandidate(Const Item: String); Begin - CharBased.SelectCandidate(Item); + CharBased.SelectCandidate(Item); End; -{===============================================================================} +{ =============================================================================== } Procedure TAvroPhonetic.SetAutoCorrectEnabled(Const Value: Boolean); Begin - CharBased.AutoCorrectEnabled := Value; + CharBased.AutoCorrectEnabled := Value; End; -{===============================================================================} +{ =============================================================================== } End. - diff --git a/Keyboard and Spell checker/Classes/clsE2BCharBased.pas b/Keyboard and Spell checker/Classes/clsE2BCharBased.pas index 57d708c..d49b7e3 100644 --- a/Keyboard and Spell checker/Classes/clsE2BCharBased.pas +++ b/Keyboard and Spell checker/Classes/clsE2BCharBased.pas @@ -1,32 +1,31 @@ { - ============================================================================= - ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + ============================================================================= + ***************************************************************************** + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. - ***************************************************************************** - ============================================================================= + ***************************************************************************** + ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - { COMPLETE TRANSFERING } Unit clsE2BCharBased; @@ -34,94 +33,99 @@ Interface Uses - classes, - sysutils, - StrUtils, - clsEnglishToBangla, - clsPhoneticRegExBuilder, - Generics.Collections, - clsAbbreviation, - clsUnicodeToBijoy2000; + classes, + sysutils, + StrUtils, + clsEnglishToBangla, + clsPhoneticRegExBuilder, + Generics.Collections, + clsAbbreviation, + clsUnicodeToBijoy2000; Const - Max_EnglishLength = 50; - Max_RegExQueryLength = 5000; + Max_EnglishLength = 50; + Max_RegExQueryLength = 5000; Type - TPhoneticCache = Record - EnglishT: String; - Results: TStringList; - End; + TPhoneticCache = Record + EnglishT: String; + Results: TStringList; + End; - // Skeleton of Class TE2BCharBased + // Skeleton of Class TE2BCharBased Type - TE2BCharBased = Class - Private - Parser: TEnglishToBangla; - RegExBuilder: TEnglishToRegEx; - Abbreviation: TAbbreviation; - Bijoy: TUnicodeToBijoy2000; - EnglishT: String; - PrevBanglaT: String; - BlockLast: boolean; - WStringList: TStringList; - NewBanglaText: String; - FAutoCorrect: boolean; - CandidateDict: TDictionary; - ManuallySelectedCandidate: boolean; - DetermineZWNJ_ZWJ: String; - PhoneticCache: Array [1 .. Max_EnglishLength] Of TPhoneticCache; - - Procedure Fix_ZWNJ_ZWJ(Var rList: TStringList); - Procedure ProcessSpace(Var Block: boolean); - Procedure ParseAndSend; - Procedure ParseAndSendNow; - Procedure ProcessEnter(Var Block: boolean); - Procedure DoBackspace(Var Block: boolean); - Procedure MyProcessVKeyDown(Const KeyCode: Integer; Var Block: boolean; Const var_IfShift: boolean; Const var_IfTrueShift: boolean); - Procedure AddStr(Const Str: String); - - Procedure LoadCandidateOptions; - Procedure SaveCandidateOptions; - Procedure UpdateCandidateOption; - - Procedure AddToCache(Const MiddleMain_T: String; Var rList: TStringList); - Procedure AddSuffix(Const MiddleMain_T: String; Var rList: TStringList); - - Procedure CutText(Const inputEStr: String; Var outSIgnore: String; Var outMidMain: String; Var outEIgnore: String); - Procedure PadResults(Const Starting_Ignoreable_T, Ending_Ignorable_T: String; Var rList: TStringList); - Function EscapeSpecialCharacters(Const inputT: String): String; - - Procedure SetAutoCorrectEnabled(Const Value: boolean); - Function GetAutoCorrectEnabled: boolean; - - Public - Constructor Create; // Initializer - Destructor Destroy; Override; // Destructor - - Function ProcessVKeyDown(Const KeyCode: Integer; Var Block: boolean): String; - Procedure ProcessVKeyUP(Const KeyCode: Integer; Var Block: boolean); - Procedure ResetDeadKey; - Procedure SelectCandidate(Const Item: String); - // Published - Property AutoCorrectEnabled: boolean Read GetAutoCorrectEnabled Write SetAutoCorrectEnabled; - End; + TE2BCharBased = Class + Private + Parser: TEnglishToBangla; + RegExBuilder: TEnglishToRegEx; + Abbreviation: TAbbreviation; + Bijoy: TUnicodeToBijoy2000; + EnglishT: String; + PrevBanglaT: String; + BlockLast: boolean; + WStringList: TStringList; + NewBanglaText: String; + FAutoCorrect: boolean; + CandidateDict: TDictionary; + ManuallySelectedCandidate: boolean; + DetermineZWNJ_ZWJ: String; + PhoneticCache: Array [0 .. Max_EnglishLength] Of TPhoneticCache; + + Procedure Fix_ZWNJ_ZWJ(Var rList: TStringList); + Procedure ProcessSpace(Var Block: boolean); + Procedure ParseAndSend; + Procedure ParseAndSendNow; + Procedure ProcessEnter(Var Block: boolean); + Procedure DoBackspace(Var Block: boolean); + Procedure MyProcessVKeyDown(Const KeyCode: Integer; Var Block: boolean; + Const var_IfShift: boolean; Const var_IfTrueShift: boolean); + Procedure AddStr(Const Str: String); + + Procedure LoadCandidateOptions; + Procedure SaveCandidateOptions; + Procedure UpdateCandidateOption; + + Procedure AddToCache(Const MiddleMain_T: String; Var rList: TStringList); + Procedure AddSuffix(Const MiddleMain_T: String; Var rList: TStringList); + + Procedure CutText(Const inputEStr: String; Var outSIgnore: String; + Var outMidMain: String; Var outEIgnore: String); + Procedure PadResults(Const Starting_Ignoreable_T, Ending_Ignorable_T + : String; Var rList: TStringList); + Function EscapeSpecialCharacters(Const inputT: String): String; + + Procedure SetAutoCorrectEnabled(Const Value: boolean); + Function GetAutoCorrectEnabled: boolean; + + Public + Constructor Create; // Initializer + Destructor Destroy; Override; // Destructor + + Function ProcessVKeyDown(Const KeyCode: Integer; + Var Block: boolean): String; + Procedure ProcessVKeyUP(Const KeyCode: Integer; Var Block: boolean); + Procedure ResetDeadKey; + Procedure SelectCandidate(Const Item: String); + // Published + Property AutoCorrectEnabled: boolean Read GetAutoCorrectEnabled + Write SetAutoCorrectEnabled; + End; Implementation Uses - KeyboardFunctions, - VirtualKeyCode, - uForm1, - clsLayout, - uRegistrySettings, - ufrmPrevW, - uSimilarSort, - uRegExPhoneticSearch, - uFileFolderHandling, - BanglaChars, - uDBase, - WindowsVersion; + KeyboardFunctions, + VirtualKeyCode, + uForm1, + clsLayout, + uRegistrySettings, + ufrmPrevW, + uSimilarSort, + uRegExPhoneticSearch, + uFileFolderHandling, + BanglaChars, + uDBase, + WindowsVersion; { TE2BCharBased } @@ -129,179 +133,205 @@ Procedure TE2BCharBased.AddStr(Const Str: String); Begin - EnglishT := EnglishT + Str; + EnglishT := EnglishT + Str; - ParseAndSend; + ParseAndSend; - If ShowPrevWindow = 'YES' Then - frmPrevW.UpdateMe(EnglishT) - Else - frmPrevW.MakeMeHide; + If ShowPrevWindow = 'YES' Then + frmPrevW.UpdateMe(EnglishT) + Else + frmPrevW.MakeMeHide; End; { =============================================================================== } -Procedure TE2BCharBased.AddSuffix(Const MiddleMain_T: String; Var rList: TStringList); +Procedure TE2BCharBased.AddSuffix(Const MiddleMain_T: String; + Var rList: TStringList); Var - iLen, J, K: Integer; - isSuffix: String; - B_Suffix: String; - TempList: TStringList; + iLen, J, K: Integer; + isSuffix: String; + B_Suffix: String; + TempList: TStringList; Begin - iLen := Length(MiddleMain_T); - rList.Sorted := True; - rList.Duplicates := dupIgnore; - - If iLen >= 2 Then Begin - TempList := TStringList.Create; - For J := 2 To iLen Do Begin - isSuffix := LowerCase(MidStr(MiddleMain_T, J, iLen)); - - If suffix.TryGetValue(isSuffix, B_Suffix) Then Begin - If PhoneticCache[iLen - Length(isSuffix)].Results.Count > 0 Then Begin - For K := 0 To PhoneticCache[iLen - Length(isSuffix)].Results.Count - 1 Do Begin - If IsVowel(RightStr(PhoneticCache[iLen - Length(isSuffix)].Results[K], 1)) And (IsKar(LeftStr(B_Suffix, 1))) Then Begin - TempList.Add(PhoneticCache[iLen - Length(isSuffix)].Results[K] + b_Y + B_Suffix); - End - Else Begin - If RightStr(PhoneticCache[iLen - Length(isSuffix)].Results[K], 1) = b_Khandatta Then - TempList.Add(MidStr(PhoneticCache[iLen - Length(isSuffix)].Results[K], 1, Length(PhoneticCache[iLen - Length(isSuffix)].Results[K]) - 1) + b_T + B_Suffix) - Else If RightStr(PhoneticCache[iLen - Length(isSuffix)].Results[K], 1) = b_Anushar Then - TempList.Add(MidStr(PhoneticCache[iLen - Length(isSuffix)].Results[K], 1, Length(PhoneticCache[iLen - Length(isSuffix)].Results[K]) - 1) + b_NGA + B_Suffix) - Else - TempList.Add(PhoneticCache[iLen - Length(isSuffix)].Results[K] + B_Suffix); - End; - End; - End; - End; - End; - - For J := 0 To TempList.Count - 1 Do Begin - rList.Add(TempList[J]); - End; - - TempList.Clear; - FreeAndNil(TempList); - End; + iLen := Length(MiddleMain_T); + rList.Sorted := True; + rList.Duplicates := dupIgnore; + + If iLen >= 2 Then + Begin + TempList := TStringList.Create; + For J := 2 To iLen Do + Begin + isSuffix := LowerCase(MidStr(MiddleMain_T, J, iLen)); + + If suffix.TryGetValue(isSuffix, B_Suffix) Then + Begin + If PhoneticCache[iLen - Length(isSuffix)].Results.Count > 0 Then + Begin + For K := 0 To PhoneticCache[iLen - Length(isSuffix) + ].Results.Count - 1 Do + Begin + If IsVowel(RightStr(PhoneticCache[iLen - Length(isSuffix) + ].Results[K], 1)) And (IsKar(LeftStr(B_Suffix, 1))) Then + Begin + TempList.Add(PhoneticCache[iLen - Length(isSuffix)].Results[K] + + b_Y + B_Suffix); + End + Else + Begin + If RightStr(PhoneticCache[iLen - Length(isSuffix)].Results[K], 1) + = b_Khandatta Then + TempList.Add(MidStr(PhoneticCache[iLen - Length(isSuffix) + ].Results[K], 1, Length(PhoneticCache[iLen - Length(isSuffix) + ].Results[K]) - 1) + b_T + B_Suffix) + Else If RightStr(PhoneticCache[iLen - Length(isSuffix) + ].Results[K], 1) = b_Anushar Then + TempList.Add(MidStr(PhoneticCache[iLen - Length(isSuffix) + ].Results[K], 1, Length(PhoneticCache[iLen - Length(isSuffix) + ].Results[K]) - 1) + b_NGA + B_Suffix) + Else + TempList.Add(PhoneticCache[iLen - Length(isSuffix)].Results[K] + + B_Suffix); + End; + End; + End; + End; + End; + + For J := 0 To TempList.Count - 1 Do + Begin + rList.Add(TempList[J]); + End; + + TempList.Clear; + FreeAndNil(TempList); + End; End; { =============================================================================== } -Procedure TE2BCharBased.AddToCache(Const MiddleMain_T: String; Var rList: TStringList); +Procedure TE2BCharBased.AddToCache(Const MiddleMain_T: String; + Var rList: TStringList); Var - iLen: Integer; + iLen: Integer; Begin - iLen := Length(MiddleMain_T); - PhoneticCache[iLen].EnglishT := MiddleMain_T; - PhoneticCache[iLen].Results.Clear; - PhoneticCache[iLen].Results.Assign(rList); + iLen := Length(MiddleMain_T); + PhoneticCache[iLen].EnglishT := MiddleMain_T; + PhoneticCache[iLen].Results.Clear; + PhoneticCache[iLen].Results.Assign(rList); End; { =============================================================================== } Constructor TE2BCharBased.Create; Var - I: Integer; + I: Integer; Begin - Inherited; - Parser := TEnglishToBangla.Create; - Abbreviation := TAbbreviation.Create; - Bijoy := TUnicodeToBijoy2000.Create; - RegExBuilder := TEnglishToRegEx.Create; - WStringList := TStringList.Create; - CandidateDict := TDictionary.Create; - LoadCandidateOptions; - - For I := Low(PhoneticCache) To High(PhoneticCache) Do Begin - PhoneticCache[I].Results := TStringList.Create; - End; - - // If IsWinVistaOrLater Then - DetermineZWNJ_ZWJ := ZWJ; - // Else - // DetermineZWNJ_ZWJ := ZWNJ; + Inherited; + Parser := TEnglishToBangla.Create; + Abbreviation := TAbbreviation.Create; + Bijoy := TUnicodeToBijoy2000.Create; + RegExBuilder := TEnglishToRegEx.Create; + WStringList := TStringList.Create; + CandidateDict := TDictionary.Create; + LoadCandidateOptions; + + For I := Low(PhoneticCache) To High(PhoneticCache) Do + Begin + PhoneticCache[I].Results := TStringList.Create; + End; + + // If IsWinVistaOrLater Then + DetermineZWNJ_ZWJ := ZWJ; + // Else + // DetermineZWNJ_ZWJ := ZWNJ; End; { =============================================================================== } -Procedure TE2BCharBased.CutText(Const inputEStr: String; Var outSIgnore, outMidMain, outEIgnore: String); +Procedure TE2BCharBased.CutText(Const inputEStr: String; + Var outSIgnore, outMidMain, outEIgnore: String); Var - I: Integer; - p, q: Integer; - EStrLen: Integer; - tStr: Char; - reverse_inputEStr: String; - temporaryString: String; + I: Integer; + p, q: Integer; + EStrLen: Integer; + tStr: Char; + reverse_inputEStr: String; + temporaryString: String; Begin - tStr := #0; - p := 0; + tStr := #0; + p := 0; - EStrLen := Length(inputEStr); - // Start Cutting outSIgnore - For I := 1 To EStrLen Do Begin + EStrLen := Length(inputEStr); + // Start Cutting outSIgnore + For I := 1 To EStrLen Do + Begin - temporaryString := MidStr(inputEStr, I, 1); - If Length(temporaryString) > 0 Then - tStr := temporaryString[1]; + temporaryString := MidStr(inputEStr, I, 1); + If Length(temporaryString) > 0 Then + tStr := temporaryString[1]; - Case tStr Of - '~', '!', '@', '#', '%', '&', '*', '(', ')', '-', '_', '=', '+', '[', ']', '{', '}', #39, '"', ';', '<', '>', '/', '?', '|', '\', '.': + Case tStr Of + '~', '!', '@', '#', '%', '&', '*', '(', ')', '-', '_', '=', '+', '[', ']', + '{', '}', #39, '"', ';', '<', '>', '/', '?', '|', '\', '.': - p := I; + p := I; - ',': - p := I; + ',': + p := I; - ':': - Break; + ':': + Break; - '`': - p := I - Else - Break; - End; - End; + '`': + p := I + Else + Break; + End; + End; - outSIgnore := LeftStr(inputEStr, p); - // End Cutting outSIgnore + outSIgnore := LeftStr(inputEStr, p); + // End Cutting outSIgnore - // Start Cutting outEIgnore - tStr := #0; - q := 0; + // Start Cutting outEIgnore + tStr := #0; + q := 0; - reverse_inputEStr := ReverseString(inputEStr); - For I := 1 To EStrLen - p Do Begin - temporaryString := MidStr(reverse_inputEStr, I, 1); - If Length(temporaryString) > 0 Then - tStr := temporaryString[1]; + reverse_inputEStr := ReverseString(inputEStr); + For I := 1 To EStrLen - p Do + Begin + temporaryString := MidStr(reverse_inputEStr, I, 1); + If Length(temporaryString) > 0 Then + tStr := temporaryString[1]; - Case tStr Of - '~', '!', '@', '#', '%', '&', '*', '(', ')', '-', '_', '=', '+', '[', ']', '{', '}', #39, #34, ';', '<', '>', '/', '.', '?', '|', '\': - q := I; - ',': - q := I; + Case tStr Of + '~', '!', '@', '#', '%', '&', '*', '(', ')', '-', '_', '=', '+', '[', ']', + '{', '}', #39, #34, ';', '<', '>', '/', '.', '?', '|', '\': + q := I; + ',': + q := I; - '`': - q := I; + '`': + q := I; - ':': - q := I; + ':': + q := I; - Else - Break; - End; - End; + Else + Break; + End; + End; - outEIgnore := RightStr(inputEStr, q); - // End Cutting outEIgnore + outEIgnore := RightStr(inputEStr, q); + // End Cutting outEIgnore - // Start Cutting outMidMain - temporaryString := MidStr(inputEStr, p + 1, Length(inputEStr)); - temporaryString := LeftStr(temporaryString, Length(temporaryString) - q); - outMidMain := temporaryString; + // Start Cutting outMidMain + temporaryString := MidStr(inputEStr, p + 1, Length(inputEStr)); + temporaryString := LeftStr(temporaryString, Length(temporaryString) - q); + outMidMain := temporaryString; End; @@ -309,62 +339,68 @@ Destructor TE2BCharBased.Destroy; Var - I: Integer; + I: Integer; Begin - WStringList.Clear; - FreeAndNil(WStringList); - FreeAndNil(Bijoy); - FreeAndNil(Parser); - FreeAndNil(RegExBuilder); - FreeAndNil(Abbreviation); - If SaveCandidate = 'YES' Then - SaveCandidateOptions; - FreeAndNil(CandidateDict); - - For I := Low(PhoneticCache) To High(PhoneticCache) Do Begin - PhoneticCache[I].Results.Clear; - PhoneticCache[I].Results.Free; - End; - - Inherited; + WStringList.Clear; + FreeAndNil(WStringList); + FreeAndNil(Bijoy); + FreeAndNil(Parser); + FreeAndNil(RegExBuilder); + FreeAndNil(Abbreviation); + If SaveCandidate = 'YES' Then + SaveCandidateOptions; + FreeAndNil(CandidateDict); + + For I := Low(PhoneticCache) To High(PhoneticCache) Do + Begin + PhoneticCache[I].Results.Clear; + PhoneticCache[I].Results.Free; + End; + + Inherited; End; { =============================================================================== } Procedure TE2BCharBased.DoBackspace(Var Block: boolean); Var - BijoyNewBanglaText: String; + BijoyNewBanglaText: String; Begin - If (Length(EnglishT) - 1) <= 0 Then Begin - - If OutputIsBijoy <> 'YES' Then Begin - If (Length(NewBanglaText) - 1) >= 1 Then - Backspace(Length(NewBanglaText) - 1); - End - Else Begin - BijoyNewBanglaText := Bijoy.Convert(NewBanglaText); - If (Length(BijoyNewBanglaText) - 1) >= 1 Then - Backspace(Length(BijoyNewBanglaText) - 1); - End; - - ResetDeadKey; - Block := False; - End - Else If (Length(EnglishT) - 1) > 0 Then Begin - Block := True; - EnglishT := LeftStr(EnglishT, Length(EnglishT) - 1); - ParseAndSend; - End; - - If ShowPrevWindow = 'YES' Then Begin - If EnglishT <> '' Then - frmPrevW.UpdateMe(EnglishT) - Else - frmPrevW.MakeMeHide; - End - Else - frmPrevW.MakeMeHide; + If (Length(EnglishT) - 1) <= 0 Then + Begin + + If OutputIsBijoy <> 'YES' Then + Begin + If (Length(NewBanglaText) - 1) >= 1 Then + Backspace(Length(NewBanglaText) - 1); + End + Else + Begin + BijoyNewBanglaText := Bijoy.Convert(NewBanglaText); + If (Length(BijoyNewBanglaText) - 1) >= 1 Then + Backspace(Length(BijoyNewBanglaText) - 1); + End; + + ResetDeadKey; + Block := False; + End + Else If (Length(EnglishT) - 1) > 0 Then + Begin + Block := True; + EnglishT := LeftStr(EnglishT, Length(EnglishT) - 1); + ParseAndSend; + End; + + If ShowPrevWindow = 'YES' Then + Begin + If EnglishT <> '' Then + frmPrevW.UpdateMe(EnglishT) + Else + frmPrevW.MakeMeHide; + End + Else + frmPrevW.MakeMeHide; End; @@ -372,48 +408,48 @@ Function TE2BCharBased.EscapeSpecialCharacters(Const inputT: String): String; Var - T: String; + T: String; Begin - T := inputT; - T := ReplaceStr(T, '\', ''); - T := ReplaceStr(T, '|', ''); - T := ReplaceStr(T, '(', ''); - T := ReplaceStr(T, ')', ''); - T := ReplaceStr(T, '[', ''); - T := ReplaceStr(T, ']', ''); - T := ReplaceStr(T, '{', ''); - T := ReplaceStr(T, '}', ''); - T := ReplaceStr(T, '^', ''); - T := ReplaceStr(T, '$', ''); - T := ReplaceStr(T, '*', ''); - T := ReplaceStr(T, '+', ''); - T := ReplaceStr(T, '?', ''); - T := ReplaceStr(T, '.', ''); - - // Additional characters - T := ReplaceStr(T, '~', ''); - T := ReplaceStr(T, '!', ''); - T := ReplaceStr(T, '@', ''); - T := ReplaceStr(T, '#', ''); - T := ReplaceStr(T, '%', ''); - T := ReplaceStr(T, '&', ''); - T := ReplaceStr(T, '-', ''); - T := ReplaceStr(T, '_', ''); - T := ReplaceStr(T, '=', ''); - T := ReplaceStr(T, #39, ''); - T := ReplaceStr(T, '"', ''); - T := ReplaceStr(T, ';', ''); - T := ReplaceStr(T, '<', ''); - T := ReplaceStr(T, '>', ''); - T := ReplaceStr(T, '/', ''); - T := ReplaceStr(T, '\', ''); - T := ReplaceStr(T, ',', ''); - T := ReplaceStr(T, ':', ''); - T := ReplaceStr(T, '`', ''); - T := ReplaceStr(T, b_Taka, ''); - T := ReplaceStr(T, b_Dari, ''); - - Result := T; + T := inputT; + T := ReplaceStr(T, '\', ''); + T := ReplaceStr(T, '|', ''); + T := ReplaceStr(T, '(', ''); + T := ReplaceStr(T, ')', ''); + T := ReplaceStr(T, '[', ''); + T := ReplaceStr(T, ']', ''); + T := ReplaceStr(T, '{', ''); + T := ReplaceStr(T, '}', ''); + T := ReplaceStr(T, '^', ''); + T := ReplaceStr(T, '$', ''); + T := ReplaceStr(T, '*', ''); + T := ReplaceStr(T, '+', ''); + T := ReplaceStr(T, '?', ''); + T := ReplaceStr(T, '.', ''); + + // Additional characters + T := ReplaceStr(T, '~', ''); + T := ReplaceStr(T, '!', ''); + T := ReplaceStr(T, '@', ''); + T := ReplaceStr(T, '#', ''); + T := ReplaceStr(T, '%', ''); + T := ReplaceStr(T, '&', ''); + T := ReplaceStr(T, '-', ''); + T := ReplaceStr(T, '_', ''); + T := ReplaceStr(T, '=', ''); + T := ReplaceStr(T, #39, ''); + T := ReplaceStr(T, '"', ''); + T := ReplaceStr(T, ';', ''); + T := ReplaceStr(T, '<', ''); + T := ReplaceStr(T, '>', ''); + T := ReplaceStr(T, '/', ''); + T := ReplaceStr(T, '\', ''); + T := ReplaceStr(T, ',', ''); + T := ReplaceStr(T, ':', ''); + T := ReplaceStr(T, '`', ''); + T := ReplaceStr(T, b_Taka, ''); + T := ReplaceStr(T, b_Dari, ''); + + Result := T; End; @@ -421,952 +457,1100 @@ Procedure TE2BCharBased.Fix_ZWNJ_ZWJ(Var rList: TStringList); Var - I: Integer; - StartCounter, EndCounter: Integer; + I: Integer; + StartCounter, EndCounter: Integer; Begin - StartCounter := 0; - EndCounter := rList.Count - 1; + StartCounter := 0; + EndCounter := rList.Count - 1; - If EndCounter <= 0 Then - exit; + If EndCounter <= 0 Then + exit; - rList.Sorted := False; + rList.Sorted := False; - For I := StartCounter To EndCounter Do Begin - rList[I] := ReplaceStr(rList[I], b_R + ZWNJ + b_Hasanta + b_Z, b_R + DetermineZWNJ_ZWJ + b_Hasanta + b_Z); - End; + For I := StartCounter To EndCounter Do + Begin + rList[I] := ReplaceStr(rList[I], b_R + ZWNJ + b_Hasanta + b_Z, + b_R + DetermineZWNJ_ZWJ + b_Hasanta + b_Z); + End; End; { =============================================================================== } Function TE2BCharBased.GetAutoCorrectEnabled: boolean; Begin - Result := Parser.AutoCorrectEnabled; + Result := Parser.AutoCorrectEnabled; End; { =============================================================================== } Procedure TE2BCharBased.LoadCandidateOptions; Var - I, p: Integer; - FirstPart, SecondPart: String; - tmpList: TStringList; + I, p: Integer; + FirstPart, SecondPart: String; + tmpList: TStringList; Begin - If FileExists(GetAvroDataDir + 'CandidateOptions.dat') = False Then - exit; - Try - Try - tmpList := TStringList.Create; - tmpList.LoadFromFile(GetAvroDataDir + 'CandidateOptions.dat', TEncoding.UTF8); - For I := 1 To tmpList.Count - 1 Do Begin - If trim(tmpList[I]) <> '' Then Begin - p := Pos(' ', trim(tmpList[I])); - FirstPart := LeftStr(trim(tmpList[I]), p - 1); - SecondPart := MidStr(trim(tmpList[I]), p + 1, Length(trim(tmpList[I]))); - CandidateDict.AddOrSetValue(FirstPart, SecondPart); - End; - End; - Except - On E: Exception Do Begin - // Nothing - End; - End; - Finally - tmpList.Clear; - FreeAndNil(tmpList); - End; + If FileExists(GetAvroDataDir + 'CandidateOptions.dat') = False Then + exit; + Try + Try + tmpList := TStringList.Create; + tmpList.LoadFromFile(GetAvroDataDir + 'CandidateOptions.dat', + TEncoding.UTF8); + For I := 1 To tmpList.Count - 1 Do + Begin + If trim(tmpList[I]) <> '' Then + Begin + p := Pos(' ', trim(tmpList[I])); + FirstPart := LeftStr(trim(tmpList[I]), p - 1); + SecondPart := MidStr(trim(tmpList[I]), p + 1, + Length(trim(tmpList[I]))); + CandidateDict.AddOrSetValue(FirstPart, SecondPart); + End; + End; + Except + On E: Exception Do + Begin + // Nothing + End; + End; + Finally + tmpList.Clear; + FreeAndNil(tmpList); + End; End; { =============================================================================== } -Procedure TE2BCharBased.MyProcessVKeyDown(Const KeyCode: Integer; Var Block: boolean; Const var_IfShift, var_IfTrueShift: boolean); +Procedure TE2BCharBased.MyProcessVKeyDown(Const KeyCode: Integer; + Var Block: boolean; Const var_IfShift, var_IfTrueShift: boolean); Begin - Block := False; - Case KeyCode Of - VK_DECIMAL: Begin - AddStr('.`'); - Block := True; - exit; - End; - VK_DIVIDE: Begin - AddStr('/'); - Block := True; - exit; - End; - VK_MULTIPLY: Begin - AddStr('*'); - Block := True; - exit; - End; - VK_SUBTRACT: Begin - AddStr('-'); - Block := True; - exit; - End; - VK_ADD: Begin - AddStr('+'); - Block := True; - exit; - End; - - VK_OEM_1: Begin // key ;: - If var_IfTrueShift = True Then - AddStr(':'); - If var_IfTrueShift = False Then - AddStr(';'); - Block := True; - exit; - End; - VK_OEM_2: Begin // key /? - If var_IfTrueShift = True Then Begin - AddStr('?'); - Block := True; - End; - - If var_IfTrueShift = False Then Begin - AddStr('/'); - Block := True; - End; - exit; - End; - - VK_OEM_3: Begin // key `~ - If var_IfTrueShift = True Then - AddStr('~'); - If var_IfTrueShift = False Then - AddStr('`'); - Block := True; - exit; - End; - - VK_OEM_4: Begin // key [{ - If var_IfTrueShift = True Then - AddStr('{'); - If var_IfTrueShift = False Then - AddStr('['); - Block := True; - exit; - End; - - VK_OEM_5: Begin // key \| - If var_IfTrueShift = True Then Begin - If PipeToDot = 'YES' Then - AddStr('.`') { New dot! } - Else - AddStr('|'); - End; - If var_IfTrueShift = False Then - AddStr('\'); - Block := True; - exit; - End; - VK_OEM_6: Begin // key ]} - If var_IfTrueShift = True Then - AddStr('}'); - If var_IfTrueShift = False Then - AddStr(']'); - Block := True; - exit; - End; - VK_OEM_7: Begin // key '" - If var_IfTrueShift = True Then - AddStr('"'); - If var_IfTrueShift = False Then - AddStr(#39); - Block := True; - exit; - End; - VK_OEM_COMMA: Begin // key ,< - If var_IfTrueShift = True Then - AddStr('<'); - If var_IfTrueShift = False Then - AddStr(','); - Block := True; - exit; - End; - VK_OEM_MINUS: Begin // key - underscore - If var_IfTrueShift = True Then - AddStr('_'); - If var_IfTrueShift = False Then - AddStr('-'); - Block := True; - exit; - End; - VK_OEM_PERIOD: Begin // key . > - If var_IfTrueShift = True Then - AddStr('>'); - If var_IfTrueShift = False Then - AddStr('.'); - Block := True; - exit; - End; - VK_OEM_PLUS: Begin // key =+ - If var_IfTrueShift = True Then - AddStr('+'); - If var_IfTrueShift = False Then - AddStr('='); - Block := True; - exit; - End; - - VK_0: Begin - If var_IfTrueShift = True Then - AddStr(')'); - If var_IfTrueShift = False Then - AddStr('0'); - Block := True; - exit; - End; - VK_1: Begin - If var_IfTrueShift = True Then - AddStr('!'); - If var_IfTrueShift = False Then - AddStr('1'); - Block := True; - exit; - End; - VK_2: Begin - If var_IfTrueShift = True Then - AddStr('@'); - If var_IfTrueShift = False Then - AddStr('2'); - Block := True; - exit; - End; - VK_3: Begin - If var_IfTrueShift = True Then - AddStr('#'); - If var_IfTrueShift = False Then - AddStr('3'); - Block := True; - exit; - End; - VK_4: Begin - If var_IfTrueShift = True Then - AddStr('$'); - If var_IfTrueShift = False Then - AddStr('4'); - Block := True; - exit; - End; - VK_5: Begin - If var_IfTrueShift = True Then - AddStr('%'); - If var_IfTrueShift = False Then - AddStr('5'); - Block := True; - exit; - End; - VK_6: Begin - If var_IfTrueShift = True Then - AddStr('^'); - If var_IfTrueShift = False Then - AddStr('6'); - Block := True; - exit; - End; - VK_7: Begin - If var_IfTrueShift = True Then - AddStr('&'); - If var_IfTrueShift = False Then - AddStr('7'); - Block := True; - exit; - End; - VK_8: Begin - If var_IfTrueShift = True Then - AddStr('*'); - If var_IfTrueShift = False Then - AddStr('8'); - Block := True; - exit; - End; - VK_9: Begin - If var_IfTrueShift = True Then - AddStr('('); - If var_IfTrueShift = False Then - AddStr('9'); - Block := True; - exit; - End; - - VK_NUMPAD0: Begin - AddStr('0'); - Block := True; - exit; - End; - VK_NUMPAD1: Begin - AddStr('1'); - Block := True; - exit; - End; - VK_NUMPAD2: Begin - AddStr('2'); - Block := True; - exit; - End; - VK_NUMPAD3: Begin - AddStr('3'); - Block := True; - exit; - End; - VK_NUMPAD4: Begin - AddStr('4'); - Block := True; - exit; - End; - VK_NUMPAD5: Begin - AddStr('5'); - Block := True; - exit; - End; - VK_NUMPAD6: Begin - AddStr('6'); - Block := True; - exit; - End; - VK_NUMPAD7: Begin - AddStr('7'); - Block := True; - exit; - End; - VK_NUMPAD8: Begin - AddStr('8'); - Block := True; - exit; - End; - VK_NUMPAD9: Begin - AddStr('9'); - Block := True; - exit; - End; - - A_Key: Begin - If var_IfShift = True Then - AddStr('A'); - If var_IfShift = False Then - AddStr('a'); - Block := True; - exit; - End; - B_Key: Begin - If var_IfShift = True Then - AddStr('B'); - If var_IfShift = False Then - AddStr('b'); - Block := True; - exit; - End; - C_Key: Begin - If var_IfShift = True Then - AddStr('C'); - If var_IfShift = False Then - AddStr('c'); - Block := True; - exit; - End; - D_Key: Begin - If var_IfShift = True Then - AddStr('D'); - If var_IfShift = False Then - AddStr('d'); - Block := True; - exit; - End; - E_Key: Begin - If var_IfShift = True Then - AddStr('E'); - If var_IfShift = False Then - AddStr('e'); - Block := True; - exit; - End; - F_Key: Begin - If var_IfShift = True Then - AddStr('F'); - If var_IfShift = False Then - AddStr('f'); - Block := True; - exit; - End; - G_Key: Begin - If var_IfShift = True Then - AddStr('G'); - If var_IfShift = False Then - AddStr('g'); - Block := True; - exit; - End; - H_Key: Begin - If var_IfShift = True Then - AddStr('H'); - If var_IfShift = False Then - AddStr('h'); - Block := True; - exit; - End; - I_Key: Begin - If var_IfShift = True Then - AddStr('I'); - If var_IfShift = False Then - AddStr('i'); - Block := True; - exit; - End; - J_Key: Begin - If var_IfShift = True Then - AddStr('J'); - If var_IfShift = False Then - AddStr('j'); - Block := True; - exit; - End; - K_Key: Begin - If var_IfShift = True Then - AddStr('K'); - If var_IfShift = False Then - AddStr('k'); - Block := True; - exit; - End; - L_Key: Begin - If var_IfShift = True Then - AddStr('L'); - If var_IfShift = False Then - AddStr('l'); - Block := True; - exit; - End; - M_Key: Begin - If var_IfShift = True Then - AddStr('M'); - If var_IfShift = False Then - AddStr('m'); - Block := True; - exit; - End; - N_Key: Begin - If var_IfShift = True Then - AddStr('N'); - If var_IfShift = False Then - AddStr('n'); - Block := True; - exit; - End; - O_Key: Begin - If var_IfShift = True Then - AddStr('O'); - If var_IfShift = False Then - AddStr('o'); - Block := True; - exit; - End; - P_Key: Begin - If var_IfShift = True Then - AddStr('P'); - If var_IfShift = False Then - AddStr('p'); - Block := True; - exit; - End; - Q_Key: Begin - If var_IfShift = True Then - AddStr('Q'); - If var_IfShift = False Then - AddStr('q'); - Block := True; - exit; - End; - R_Key: Begin - If var_IfShift = True Then - AddStr('R'); - If var_IfShift = False Then - AddStr('r'); - Block := True; - exit; - End; - S_Key: Begin - If var_IfShift = True Then - AddStr('S'); - If var_IfShift = False Then - AddStr('s'); - Block := True; - exit; - End; - T_Key: Begin - If var_IfShift = True Then - AddStr('T'); - If var_IfShift = False Then - AddStr('t'); - Block := True; - exit; - End; - U_Key: Begin - If var_IfShift = True Then - AddStr('U'); - If var_IfShift = False Then - AddStr('u'); - Block := True; - exit; - End; - V_Key: Begin - If var_IfShift = True Then - AddStr('V'); - If var_IfShift = False Then - AddStr('v'); - Block := True; - exit; - End; - W_Key: Begin - If var_IfShift = True Then - AddStr('W'); - If var_IfShift = False Then - AddStr('w'); - Block := True; - exit; - End; - X_Key: Begin - If var_IfShift = True Then - AddStr('X'); - If var_IfShift = False Then - AddStr('x'); - Block := True; - exit; - End; - Y_Key: Begin - If var_IfShift = True Then - AddStr('Y'); - If var_IfShift = False Then - AddStr('y'); - Block := True; - exit; - End; - Z_Key: Begin - If var_IfShift = True Then - AddStr('Z'); - If var_IfShift = False Then - AddStr('z'); - Block := True; - exit; - End; - - // Special cases--------------------> - VK_HOME: Begin - Block := False; - ResetDeadKey; - exit; - End; - VK_END: Begin - Block := False; - ResetDeadKey; - exit; - End; - VK_PRIOR: Begin - Block := False; - ResetDeadKey; - exit; - End; - VK_NEXT: Begin - Block := False; - ResetDeadKey; - exit; - End; - VK_UP: Begin - If (frmPrevW.List.Count > 1) And (EnglishT <> '') Then Begin - Block := True; - frmPrevW.SelectPrevItem; - UpdateCandidateOption; - exit; - End - Else Begin - Block := False; - ResetDeadKey; - exit; - End; - End; - VK_DOWN: Begin - If (frmPrevW.List.Count > 1) And (EnglishT <> '') Then Begin - Block := True; - frmPrevW.SelectNextItem; - UpdateCandidateOption; - exit; - End - Else Begin - Block := False; - ResetDeadKey; - exit; - End; - End; - VK_RIGHT: Begin - Block := False; - ResetDeadKey; - exit; - End; - VK_LEFT: Begin - Block := False; - ResetDeadKey; - exit; - End; - VK_BACK: Begin - DoBackspace(Block); - exit; - End; - VK_DELETE: Begin - Block := False; - ResetDeadKey; - exit; - End; - VK_ESCAPE: Begin - If (frmPrevW.PreviewWVisible = True) And (EnglishT <> '') Then Begin - Block := True; - ResetDeadKey; - exit; - End; - End; - - VK_INSERT: Begin - Block := True; - exit; - End; - End; + Block := False; + Case KeyCode Of + VK_DECIMAL: + Begin + AddStr('.`'); + Block := True; + exit; + End; + VK_DIVIDE: + Begin + AddStr('/'); + Block := True; + exit; + End; + VK_MULTIPLY: + Begin + AddStr('*'); + Block := True; + exit; + End; + VK_SUBTRACT: + Begin + AddStr('-'); + Block := True; + exit; + End; + VK_ADD: + Begin + AddStr('+'); + Block := True; + exit; + End; + + VK_OEM_1: + Begin // key ;: + If var_IfTrueShift = True Then + AddStr(':'); + If var_IfTrueShift = False Then + AddStr(';'); + Block := True; + exit; + End; + VK_OEM_2: + Begin // key /? + If var_IfTrueShift = True Then + Begin + AddStr('?'); + Block := True; + End; + + If var_IfTrueShift = False Then + Begin + AddStr('/'); + Block := True; + End; + exit; + End; + + VK_OEM_3: + Begin // key `~ + If var_IfTrueShift = True Then + AddStr('~'); + If var_IfTrueShift = False Then + AddStr('`'); + Block := True; + exit; + End; + + VK_OEM_4: + Begin // key [{ + If var_IfTrueShift = True Then + AddStr('{'); + If var_IfTrueShift = False Then + AddStr('['); + Block := True; + exit; + End; + + VK_OEM_5: + Begin // key \| + If var_IfTrueShift = True Then + Begin + If PipeToDot = 'YES' Then + AddStr('.`') { New dot! } + Else + AddStr('|'); + End; + If var_IfTrueShift = False Then + AddStr('\'); + Block := True; + exit; + End; + VK_OEM_6: + Begin // key ]} + If var_IfTrueShift = True Then + AddStr('}'); + If var_IfTrueShift = False Then + AddStr(']'); + Block := True; + exit; + End; + VK_OEM_7: + Begin // key '" + If var_IfTrueShift = True Then + AddStr('"'); + If var_IfTrueShift = False Then + AddStr(#39); + Block := True; + exit; + End; + VK_OEM_COMMA: + Begin // key ,< + If var_IfTrueShift = True Then + AddStr('<'); + If var_IfTrueShift = False Then + AddStr(','); + Block := True; + exit; + End; + VK_OEM_MINUS: + Begin // key - underscore + If var_IfTrueShift = True Then + AddStr('_'); + If var_IfTrueShift = False Then + AddStr('-'); + Block := True; + exit; + End; + VK_OEM_PERIOD: + Begin // key . > + If var_IfTrueShift = True Then + AddStr('>'); + If var_IfTrueShift = False Then + AddStr('.'); + Block := True; + exit; + End; + VK_OEM_PLUS: + Begin // key =+ + If var_IfTrueShift = True Then + AddStr('+'); + If var_IfTrueShift = False Then + AddStr('='); + Block := True; + exit; + End; + + VK_0: + Begin + If var_IfTrueShift = True Then + AddStr(')'); + If var_IfTrueShift = False Then + AddStr('0'); + Block := True; + exit; + End; + VK_1: + Begin + If var_IfTrueShift = True Then + AddStr('!'); + If var_IfTrueShift = False Then + AddStr('1'); + Block := True; + exit; + End; + VK_2: + Begin + If var_IfTrueShift = True Then + AddStr('@'); + If var_IfTrueShift = False Then + AddStr('2'); + Block := True; + exit; + End; + VK_3: + Begin + If var_IfTrueShift = True Then + AddStr('#'); + If var_IfTrueShift = False Then + AddStr('3'); + Block := True; + exit; + End; + VK_4: + Begin + If var_IfTrueShift = True Then + AddStr('$'); + If var_IfTrueShift = False Then + AddStr('4'); + Block := True; + exit; + End; + VK_5: + Begin + If var_IfTrueShift = True Then + AddStr('%'); + If var_IfTrueShift = False Then + AddStr('5'); + Block := True; + exit; + End; + VK_6: + Begin + If var_IfTrueShift = True Then + AddStr('^'); + If var_IfTrueShift = False Then + AddStr('6'); + Block := True; + exit; + End; + VK_7: + Begin + If var_IfTrueShift = True Then + AddStr('&'); + If var_IfTrueShift = False Then + AddStr('7'); + Block := True; + exit; + End; + VK_8: + Begin + If var_IfTrueShift = True Then + AddStr('*'); + If var_IfTrueShift = False Then + AddStr('8'); + Block := True; + exit; + End; + VK_9: + Begin + If var_IfTrueShift = True Then + AddStr('('); + If var_IfTrueShift = False Then + AddStr('9'); + Block := True; + exit; + End; + + VK_NUMPAD0: + Begin + AddStr('0'); + Block := True; + exit; + End; + VK_NUMPAD1: + Begin + AddStr('1'); + Block := True; + exit; + End; + VK_NUMPAD2: + Begin + AddStr('2'); + Block := True; + exit; + End; + VK_NUMPAD3: + Begin + AddStr('3'); + Block := True; + exit; + End; + VK_NUMPAD4: + Begin + AddStr('4'); + Block := True; + exit; + End; + VK_NUMPAD5: + Begin + AddStr('5'); + Block := True; + exit; + End; + VK_NUMPAD6: + Begin + AddStr('6'); + Block := True; + exit; + End; + VK_NUMPAD7: + Begin + AddStr('7'); + Block := True; + exit; + End; + VK_NUMPAD8: + Begin + AddStr('8'); + Block := True; + exit; + End; + VK_NUMPAD9: + Begin + AddStr('9'); + Block := True; + exit; + End; + + A_Key: + Begin + If var_IfShift = True Then + AddStr('A'); + If var_IfShift = False Then + AddStr('a'); + Block := True; + exit; + End; + B_Key: + Begin + If var_IfShift = True Then + AddStr('B'); + If var_IfShift = False Then + AddStr('b'); + Block := True; + exit; + End; + C_Key: + Begin + If var_IfShift = True Then + AddStr('C'); + If var_IfShift = False Then + AddStr('c'); + Block := True; + exit; + End; + D_Key: + Begin + If var_IfShift = True Then + AddStr('D'); + If var_IfShift = False Then + AddStr('d'); + Block := True; + exit; + End; + E_Key: + Begin + If var_IfShift = True Then + AddStr('E'); + If var_IfShift = False Then + AddStr('e'); + Block := True; + exit; + End; + F_Key: + Begin + If var_IfShift = True Then + AddStr('F'); + If var_IfShift = False Then + AddStr('f'); + Block := True; + exit; + End; + G_Key: + Begin + If var_IfShift = True Then + AddStr('G'); + If var_IfShift = False Then + AddStr('g'); + Block := True; + exit; + End; + H_Key: + Begin + If var_IfShift = True Then + AddStr('H'); + If var_IfShift = False Then + AddStr('h'); + Block := True; + exit; + End; + I_Key: + Begin + If var_IfShift = True Then + AddStr('I'); + If var_IfShift = False Then + AddStr('i'); + Block := True; + exit; + End; + J_Key: + Begin + If var_IfShift = True Then + AddStr('J'); + If var_IfShift = False Then + AddStr('j'); + Block := True; + exit; + End; + K_Key: + Begin + If var_IfShift = True Then + AddStr('K'); + If var_IfShift = False Then + AddStr('k'); + Block := True; + exit; + End; + L_Key: + Begin + If var_IfShift = True Then + AddStr('L'); + If var_IfShift = False Then + AddStr('l'); + Block := True; + exit; + End; + M_Key: + Begin + If var_IfShift = True Then + AddStr('M'); + If var_IfShift = False Then + AddStr('m'); + Block := True; + exit; + End; + N_Key: + Begin + If var_IfShift = True Then + AddStr('N'); + If var_IfShift = False Then + AddStr('n'); + Block := True; + exit; + End; + O_Key: + Begin + If var_IfShift = True Then + AddStr('O'); + If var_IfShift = False Then + AddStr('o'); + Block := True; + exit; + End; + P_Key: + Begin + If var_IfShift = True Then + AddStr('P'); + If var_IfShift = False Then + AddStr('p'); + Block := True; + exit; + End; + Q_Key: + Begin + If var_IfShift = True Then + AddStr('Q'); + If var_IfShift = False Then + AddStr('q'); + Block := True; + exit; + End; + R_Key: + Begin + If var_IfShift = True Then + AddStr('R'); + If var_IfShift = False Then + AddStr('r'); + Block := True; + exit; + End; + S_Key: + Begin + If var_IfShift = True Then + AddStr('S'); + If var_IfShift = False Then + AddStr('s'); + Block := True; + exit; + End; + T_Key: + Begin + If var_IfShift = True Then + AddStr('T'); + If var_IfShift = False Then + AddStr('t'); + Block := True; + exit; + End; + U_Key: + Begin + If var_IfShift = True Then + AddStr('U'); + If var_IfShift = False Then + AddStr('u'); + Block := True; + exit; + End; + V_Key: + Begin + If var_IfShift = True Then + AddStr('V'); + If var_IfShift = False Then + AddStr('v'); + Block := True; + exit; + End; + W_Key: + Begin + If var_IfShift = True Then + AddStr('W'); + If var_IfShift = False Then + AddStr('w'); + Block := True; + exit; + End; + X_Key: + Begin + If var_IfShift = True Then + AddStr('X'); + If var_IfShift = False Then + AddStr('x'); + Block := True; + exit; + End; + Y_Key: + Begin + If var_IfShift = True Then + AddStr('Y'); + If var_IfShift = False Then + AddStr('y'); + Block := True; + exit; + End; + Z_Key: + Begin + If var_IfShift = True Then + AddStr('Z'); + If var_IfShift = False Then + AddStr('z'); + Block := True; + exit; + End; + + // Special cases--------------------> + VK_HOME: + Begin + Block := False; + ResetDeadKey; + exit; + End; + VK_END: + Begin + Block := False; + ResetDeadKey; + exit; + End; + VK_PRIOR: + Begin + Block := False; + ResetDeadKey; + exit; + End; + VK_NEXT: + Begin + Block := False; + ResetDeadKey; + exit; + End; + VK_UP: + Begin + If (frmPrevW.List.Count > 1) And (EnglishT <> '') Then + Begin + Block := True; + frmPrevW.SelectPrevItem; + UpdateCandidateOption; + exit; + End + Else + Begin + Block := False; + ResetDeadKey; + exit; + End; + End; + VK_DOWN: + Begin + If (frmPrevW.List.Count > 1) And (EnglishT <> '') Then + Begin + Block := True; + frmPrevW.SelectNextItem; + UpdateCandidateOption; + exit; + End + Else + Begin + Block := False; + ResetDeadKey; + exit; + End; + End; + VK_RIGHT: + Begin + Block := False; + ResetDeadKey; + exit; + End; + VK_LEFT: + Begin + Block := False; + ResetDeadKey; + exit; + End; + VK_BACK: + Begin + DoBackspace(Block); + exit; + End; + VK_DELETE: + Begin + Block := False; + ResetDeadKey; + exit; + End; + VK_ESCAPE: + Begin + If (frmPrevW.PreviewWVisible = True) And (EnglishT <> '') Then + Begin + Block := True; + ResetDeadKey; + exit; + End; + End; + + VK_INSERT: + Begin + Block := True; + exit; + End; + End; End; { =============================================================================== } -Procedure TE2BCharBased.PadResults(Const Starting_Ignoreable_T, Ending_Ignorable_T: String; Var rList: TStringList); +Procedure TE2BCharBased.PadResults(Const Starting_Ignoreable_T, + Ending_Ignorable_T: String; Var rList: TStringList); Var - B_Starting_Ignoreable_T, B_Ending_Ignorable_T: String; - I: Integer; + B_Starting_Ignoreable_T, B_Ending_Ignorable_T: String; + I: Integer; Begin - Parser.AutoCorrectEnabled := False; - B_Starting_Ignoreable_T := Parser.Convert(Starting_Ignoreable_T); - B_Ending_Ignorable_T := Parser.Convert(Ending_Ignorable_T); - - rList.Sorted := False; - For I := 0 To rList.Count - 1 Do Begin - rList[I] := B_Starting_Ignoreable_T + rList[I] + B_Ending_Ignorable_T; - End; + Parser.AutoCorrectEnabled := False; + B_Starting_Ignoreable_T := Parser.Convert(Starting_Ignoreable_T); + B_Ending_Ignorable_T := Parser.Convert(Ending_Ignorable_T); + + rList.Sorted := False; + For I := 0 To rList.Count - 1 Do + Begin + rList[I] := B_Starting_Ignoreable_T + rList[I] + B_Ending_Ignorable_T; + End; End; { =============================================================================== } Procedure TE2BCharBased.ParseAndSend; Var - I: Integer; - RegExQuery: String; - TempBanglaText1, TempBanglaText2: String; + I: Integer; + RegExQuery: String; + TempBanglaText1, TempBanglaText2: String; - DictionaryFirstItem: String; - Starting_Ignoreable_T, Middle_Main_T, Ending_Ignorable_T: String; + DictionaryFirstItem: String; + Starting_Ignoreable_T, Middle_Main_T, Ending_Ignorable_T: String; - AbbText: String; - CandidateItem: String; + AbbText: String; + CandidateItem: String; Begin - frmPrevW.List.Items.Clear; - - Parser.AutoCorrectEnabled := True; - TempBanglaText1 := Parser.Convert(EnglishT); - Parser.AutoCorrectEnabled := False; - TempBanglaText2 := Parser.Convert(EnglishT); - - If TempBanglaText1 = TempBanglaText2 Then - frmPrevW.List.Items.Add(TempBanglaText1) - Else Begin - // If FAutoCorrect Then Begin - frmPrevW.List.Items.Add(TempBanglaText1); - frmPrevW.List.Items.Add(TempBanglaText2); - // End - // Else Begin - // frmPrevW.List.Items.Add(TempBanglaText2); - // frmPrevW.List.Items.Add(TempBanglaText1); - // End; - End; - - If (PhoneticMode = 'ONLYCHAR') Or (ShowPrevWindow = 'NO') Then Begin - If (TempBanglaText1 <> TempBanglaText2) Then Begin - If FAutoCorrect Then - frmPrevW.SelectItem(EscapeSpecialCharacters(TempBanglaText1)) - Else - frmPrevW.SelectItem(EscapeSpecialCharacters(TempBanglaText2)); - End - Else - frmPrevW.SelectFirstItem; - End - Else Begin - CutText(EnglishT, Starting_Ignoreable_T, Middle_Main_T, Ending_Ignorable_T); - If (Length(Middle_Main_T) <= Max_EnglishLength) And (Length(Middle_Main_T) > 0) Then Begin - - WStringList.Clear; - - If Middle_Main_T = PhoneticCache[Length(Middle_Main_T)].EnglishT Then Begin - WStringList.Assign(PhoneticCache[Length(Middle_Main_T)].Results); - AddSuffix(Middle_Main_T, WStringList); - SimilarSort(TempBanglaText2, WStringList); - AbbText := ''; - AbbText := Abbreviation.CheckConvert(Middle_Main_T); - If AbbText <> '' Then - WStringList.Add(AbbText); - PadResults(Starting_Ignoreable_T, Ending_Ignorable_T, WStringList); - End - Else Begin - RegExQuery := RegExBuilder.Convert(Middle_Main_T); - uRegExPhoneticSearch.SearchPhonetic(Middle_Main_T, RegExQuery, WStringList); - - Fix_ZWNJ_ZWJ(WStringList); - AddToCache(Middle_Main_T, WStringList); - AddSuffix(Middle_Main_T, WStringList); - SimilarSort(TempBanglaText2, WStringList); - AbbText := ''; - AbbText := Abbreviation.CheckConvert(Middle_Main_T); - If AbbText <> '' Then - WStringList.Add(AbbText); - PadResults(Starting_Ignoreable_T, Ending_Ignorable_T, WStringList); - End; - - If WStringList.Count > 0 Then - DictionaryFirstItem := WStringList[0]; - - For I := 0 To WStringList.Count - 1 Do Begin - If (WStringList[I] <> TempBanglaText1) And (WStringList[I] <> TempBanglaText2) Then - frmPrevW.List.Items.Add(WStringList[I]); - End; - - // frmPrevW.SelectFirstItem; - if CandidateDict.TryGetValue(Middle_Main_T, CandidateItem) And (SaveCandidate = 'YES') Then Begin - frmPrevW.SelectItem(EscapeSpecialCharacters(CandidateItem)); - End - Else Begin - If WStringList.Count > 0 Then Begin - If Length(Middle_Main_T) = 1 Then - frmPrevW.SelectFirstItem - Else Begin - If (TempBanglaText1 <> TempBanglaText2) Then Begin - If FAutoCorrect Then - frmPrevW.SelectItem(EscapeSpecialCharacters(TempBanglaText1)) - Else Begin - If PhoneticMode = 'DICT' Then Begin - If DictionaryFirstItem <> '' Then - frmPrevW.SelectItem(EscapeSpecialCharacters(DictionaryFirstItem)) - Else - frmPrevW.SelectItem(EscapeSpecialCharacters(WStringList[0])); - End - Else If PhoneticMode = 'CHAR' Then Begin - frmPrevW.SelectItem(EscapeSpecialCharacters(TempBanglaText2)) - End; - End; - End - Else Begin - If PhoneticMode = 'DICT' Then Begin - If DictionaryFirstItem <> '' Then - frmPrevW.SelectItem(EscapeSpecialCharacters(DictionaryFirstItem)) - Else - frmPrevW.SelectItem(EscapeSpecialCharacters(WStringList[0])); - End - Else If PhoneticMode = 'CHAR' Then Begin - frmPrevW.SelectItem(EscapeSpecialCharacters(TempBanglaText2)) - End; - End; - End; - End - Else - frmPrevW.SelectFirstItem; - End; - End - Else - frmPrevW.SelectFirstItem; - End; - - frmPrevW.ShowHideList; - - ManuallySelectedCandidate := False; + frmPrevW.List.Items.Clear; + + Parser.AutoCorrectEnabled := True; + TempBanglaText1 := Parser.Convert(EnglishT); + Parser.AutoCorrectEnabled := False; + TempBanglaText2 := Parser.Convert(EnglishT); + + If TempBanglaText1 = TempBanglaText2 Then + frmPrevW.List.Items.Add(TempBanglaText1) + Else + Begin + // If FAutoCorrect Then Begin + frmPrevW.List.Items.Add(TempBanglaText1); + frmPrevW.List.Items.Add(TempBanglaText2); + // End + // Else Begin + // frmPrevW.List.Items.Add(TempBanglaText2); + // frmPrevW.List.Items.Add(TempBanglaText1); + // End; + End; + + If (PhoneticMode = 'ONLYCHAR') Or (ShowPrevWindow = 'NO') Then + Begin + If (TempBanglaText1 <> TempBanglaText2) Then + Begin + If FAutoCorrect Then + frmPrevW.SelectItem(EscapeSpecialCharacters(TempBanglaText1)) + Else + frmPrevW.SelectItem(EscapeSpecialCharacters(TempBanglaText2)); + End + Else + frmPrevW.SelectFirstItem; + End + Else + Begin + CutText(EnglishT, Starting_Ignoreable_T, Middle_Main_T, Ending_Ignorable_T); + If (Length(Middle_Main_T) <= Max_EnglishLength) And + (Length(Middle_Main_T) > 0) Then + Begin + + WStringList.Clear; + + If Middle_Main_T = PhoneticCache[Length(Middle_Main_T)].EnglishT Then + Begin + WStringList.Assign(PhoneticCache[Length(Middle_Main_T)].Results); + AddSuffix(Middle_Main_T, WStringList); + SimilarSort(TempBanglaText2, WStringList); + AbbText := ''; + AbbText := Abbreviation.CheckConvert(Middle_Main_T); + If AbbText <> '' Then + WStringList.Add(AbbText); + PadResults(Starting_Ignoreable_T, Ending_Ignorable_T, WStringList); + End + Else + Begin + RegExQuery := RegExBuilder.Convert(Middle_Main_T); + uRegExPhoneticSearch.SearchPhonetic(Middle_Main_T, RegExQuery, + WStringList); + + Fix_ZWNJ_ZWJ(WStringList); + AddToCache(Middle_Main_T, WStringList); + AddSuffix(Middle_Main_T, WStringList); + SimilarSort(TempBanglaText2, WStringList); + AbbText := ''; + AbbText := Abbreviation.CheckConvert(Middle_Main_T); + If AbbText <> '' Then + WStringList.Add(AbbText); + PadResults(Starting_Ignoreable_T, Ending_Ignorable_T, WStringList); + End; + + If WStringList.Count > 0 Then + DictionaryFirstItem := WStringList[0]; + + For I := 0 To WStringList.Count - 1 Do + Begin + If (WStringList[I] <> TempBanglaText1) And + (WStringList[I] <> TempBanglaText2) Then + frmPrevW.List.Items.Add(WStringList[I]); + End; + + // frmPrevW.SelectFirstItem; + if CandidateDict.TryGetValue(Middle_Main_T, CandidateItem) And + (SaveCandidate = 'YES') Then + Begin + frmPrevW.SelectItem(EscapeSpecialCharacters(CandidateItem)); + End + Else + Begin + If WStringList.Count > 0 Then + Begin + If Length(Middle_Main_T) = 1 Then + frmPrevW.SelectFirstItem + Else + Begin + If (TempBanglaText1 <> TempBanglaText2) Then + Begin + If FAutoCorrect Then + frmPrevW.SelectItem(EscapeSpecialCharacters(TempBanglaText1)) + Else + Begin + If PhoneticMode = 'DICT' Then + Begin + If DictionaryFirstItem <> '' Then + frmPrevW.SelectItem + (EscapeSpecialCharacters(DictionaryFirstItem)) + Else + frmPrevW.SelectItem + (EscapeSpecialCharacters(WStringList[0])); + End + Else If PhoneticMode = 'CHAR' Then + Begin + frmPrevW.SelectItem(EscapeSpecialCharacters(TempBanglaText2)) + End; + End; + End + Else + Begin + If PhoneticMode = 'DICT' Then + Begin + If DictionaryFirstItem <> '' Then + frmPrevW.SelectItem + (EscapeSpecialCharacters(DictionaryFirstItem)) + Else + frmPrevW.SelectItem(EscapeSpecialCharacters(WStringList[0])); + End + Else If PhoneticMode = 'CHAR' Then + Begin + frmPrevW.SelectItem(EscapeSpecialCharacters(TempBanglaText2)) + End; + End; + End; + End + Else + frmPrevW.SelectFirstItem; + End; + End + Else + frmPrevW.SelectFirstItem; + End; + + frmPrevW.ShowHideList; + + ManuallySelectedCandidate := False; End; { =============================================================================== } Procedure TE2BCharBased.ParseAndSendNow; Var - I, Matched, UnMatched: Integer; - BijoyPrevBanglaT, BijoyNewBanglaText: String; + I, Matched, UnMatched: Integer; + BijoyPrevBanglaT, BijoyNewBanglaText: String; Begin - Matched := 0; - - If OutputIsBijoy <> 'YES' Then Begin - { Output to Unicode } - If PrevBanglaT = '' Then Begin - SendKey_Char(NewBanglaText); - PrevBanglaT := NewBanglaText; - End - Else Begin - For I := 1 To Length(PrevBanglaT) Do Begin - If MidStr(PrevBanglaT, I, 1) = MidStr(NewBanglaText, I, 1) Then - Matched := Matched + 1 - Else - Break; - End; - UnMatched := Length(PrevBanglaT) - Matched; - - If UnMatched >= 1 Then - Backspace(UnMatched); - SendKey_Char(MidStr(NewBanglaText, Matched + 1, Length(NewBanglaText))); - PrevBanglaT := NewBanglaText; - End; - - End - Else Begin - { Output to Bijoy } - BijoyPrevBanglaT := Bijoy.Convert(PrevBanglaT); - BijoyNewBanglaText := Bijoy.Convert(NewBanglaText); - - If BijoyPrevBanglaT = '' Then Begin - SendKey_Char(BijoyNewBanglaText); - PrevBanglaT := NewBanglaText; - End - Else Begin - For I := 1 To Length(BijoyPrevBanglaT) Do Begin - If MidStr(BijoyPrevBanglaT, I, 1) = MidStr(BijoyNewBanglaText, I, 1) Then - Matched := Matched + 1 - Else - Break; - End; - UnMatched := Length(BijoyPrevBanglaT) - Matched; - - If UnMatched >= 1 Then - Backspace(UnMatched); - SendKey_Char(MidStr(BijoyNewBanglaText, Matched + 1, Length(BijoyNewBanglaText))); - PrevBanglaT := NewBanglaText; - End; - - End; + Matched := 0; + + If OutputIsBijoy <> 'YES' Then + Begin + { Output to Unicode } + If PrevBanglaT = '' Then + Begin + SendKey_Char(NewBanglaText); + PrevBanglaT := NewBanglaText; + End + Else + Begin + For I := 1 To Length(PrevBanglaT) Do + Begin + If MidStr(PrevBanglaT, I, 1) = MidStr(NewBanglaText, I, 1) Then + Matched := Matched + 1 + Else + Break; + End; + UnMatched := Length(PrevBanglaT) - Matched; + + If UnMatched >= 1 Then + Backspace(UnMatched); + SendKey_Char(MidStr(NewBanglaText, Matched + 1, Length(NewBanglaText))); + PrevBanglaT := NewBanglaText; + End; + + End + Else + Begin + { Output to Bijoy } + BijoyPrevBanglaT := Bijoy.Convert(PrevBanglaT); + BijoyNewBanglaText := Bijoy.Convert(NewBanglaText); + + If BijoyPrevBanglaT = '' Then + Begin + SendKey_Char(BijoyNewBanglaText); + PrevBanglaT := NewBanglaText; + End + Else + Begin + For I := 1 To Length(BijoyPrevBanglaT) Do + Begin + If MidStr(BijoyPrevBanglaT, I, 1) = MidStr(BijoyNewBanglaText, + I, 1) Then + Matched := Matched + 1 + Else + Break; + End; + UnMatched := Length(BijoyPrevBanglaT) - Matched; + + If UnMatched >= 1 Then + Backspace(UnMatched); + SendKey_Char(MidStr(BijoyNewBanglaText, Matched + 1, + Length(BijoyNewBanglaText))); + PrevBanglaT := NewBanglaText; + End; + + End; End; { =============================================================================== } Procedure TE2BCharBased.ProcessEnter(Var Block: boolean); Begin - ResetDeadKey; - Block := False; + ResetDeadKey; + Block := False; End; { =============================================================================== } Procedure TE2BCharBased.ProcessSpace(Var Block: boolean); Begin - ResetDeadKey; - Block := False; + ResetDeadKey; + Block := False; End; { =============================================================================== } -Function TE2BCharBased.ProcessVKeyDown(Const KeyCode: Integer; Var Block: boolean): String; +Function TE2BCharBased.ProcessVKeyDown(Const KeyCode: Integer; + Var Block: boolean): String; Var - m_Block: boolean; + m_Block: boolean; Begin - m_Block := False; - If (IfControl = True) Or (IfAlter = True) Or (IfWinKey = True) Then Begin - Block := False; - BlockLast := False; - ProcessVKeyDown := ''; - exit; - End; - - If (KeyCode = VK_SHIFT) Or (KeyCode = VK_LSHIFT) Or (KeyCode = VK_RSHIFT) Then Begin - Block := False; - BlockLast := False; - ProcessVKeyDown := ''; - exit; - End; - - If AvroMainForm1.GetMyCurrentKeyboardMode = SysDefault Then Begin - Block := False; - BlockLast := False; - ProcessVKeyDown := ''; - exit; - End - Else If AvroMainForm1.GetMyCurrentKeyboardMode = bangla Then Begin - If KeyCode = VK_SPACE Then Begin - ProcessSpace(Block); - ProcessVKeyDown := ''; - exit; - End - Else If KeyCode = VK_TAB Then Begin - If TabBrowsing = 'YES' Then Begin - If (frmPrevW.List.Count > 1) And (EnglishT <> '') Then Begin - Block := True; - frmPrevW.SelectNextItem; - UpdateCandidateOption; - exit; - End - Else Begin - ResetDeadKey; - Block := False; - ProcessVKeyDown := ''; - exit; - End; - End - Else Begin - ResetDeadKey; - Block := False; - ProcessVKeyDown := ''; - exit; - End; - End - Else If KeyCode = VK_RETURN Then Begin - ProcessEnter(Block); - ProcessVKeyDown := ''; - exit; - End - Else Begin - - MyProcessVKeyDown(KeyCode, m_Block, IfShift, IfTrueShift); - ProcessVKeyDown := ''; - - Block := m_Block; - BlockLast := m_Block; - End; - End; + m_Block := False; + If (IfControl = True) Or (IfAlter = True) Or (IfWinKey = True) Then + Begin + Block := False; + BlockLast := False; + ProcessVKeyDown := ''; + exit; + End; + + If (KeyCode = VK_SHIFT) Or (KeyCode = VK_LSHIFT) Or (KeyCode = VK_RSHIFT) Then + Begin + Block := False; + BlockLast := False; + ProcessVKeyDown := ''; + exit; + End; + + If AvroMainForm1.GetMyCurrentKeyboardMode = SysDefault Then + Begin + Block := False; + BlockLast := False; + ProcessVKeyDown := ''; + exit; + End + Else If AvroMainForm1.GetMyCurrentKeyboardMode = bangla Then + Begin + If KeyCode = VK_SPACE Then + Begin + ProcessSpace(Block); + ProcessVKeyDown := ''; + exit; + End + Else If KeyCode = VK_TAB Then + Begin + If TabBrowsing = 'YES' Then + Begin + If (frmPrevW.List.Count > 1) And (EnglishT <> '') Then + Begin + Block := True; + frmPrevW.SelectNextItem; + UpdateCandidateOption; + exit; + End + Else + Begin + ResetDeadKey; + Block := False; + ProcessVKeyDown := ''; + exit; + End; + End + Else + Begin + ResetDeadKey; + Block := False; + ProcessVKeyDown := ''; + exit; + End; + End + Else If KeyCode = VK_RETURN Then + Begin + ProcessEnter(Block); + ProcessVKeyDown := ''; + exit; + End + Else + Begin + + MyProcessVKeyDown(KeyCode, m_Block, IfShift, IfTrueShift); + ProcessVKeyDown := ''; + + Block := m_Block; + BlockLast := m_Block; + End; + End; End; { =============================================================================== } -Procedure TE2BCharBased.ProcessVKeyUP(Const KeyCode: Integer; Var Block: boolean); +Procedure TE2BCharBased.ProcessVKeyUP(Const KeyCode: Integer; + Var Block: boolean); Begin - If (KeyCode = VK_SHIFT) Or (KeyCode = VK_RSHIFT) Or (KeyCode = VK_LSHIFT) Or (KeyCode = VK_LCONTROL) Or (KeyCode = VK_RCONTROL) Or (KeyCode = VK_CONTROL) Or (KeyCode = VK_MENU) Or - (KeyCode = VK_LMENU) Or (KeyCode = VK_RMENU) Or (IfWinKey = True) Then Begin - Block := False; - BlockLast := False; - exit; - End; - - If AvroMainForm1.GetMyCurrentKeyboardMode = SysDefault Then Begin - Block := False; - BlockLast := False; - End - Else If AvroMainForm1.GetMyCurrentKeyboardMode = bangla Then Begin - If BlockLast = True Then - Block := True; - End; + If (KeyCode = VK_SHIFT) Or (KeyCode = VK_RSHIFT) Or (KeyCode = VK_LSHIFT) Or + (KeyCode = VK_LCONTROL) Or (KeyCode = VK_RCONTROL) Or (KeyCode = VK_CONTROL) + Or (KeyCode = VK_MENU) Or (KeyCode = VK_LMENU) Or (KeyCode = VK_RMENU) Or + (IfWinKey = True) Then + Begin + Block := False; + BlockLast := False; + exit; + End; + + If AvroMainForm1.GetMyCurrentKeyboardMode = SysDefault Then + Begin + Block := False; + BlockLast := False; + End + Else If AvroMainForm1.GetMyCurrentKeyboardMode = bangla Then + Begin + If BlockLast = True Then + Block := True; + End; End; { =============================================================================== } Procedure TE2BCharBased.ResetDeadKey; Var - I: Integer; + I: Integer; Begin - PrevBanglaT := ''; - EnglishT := ''; - BlockLast := False; - NewBanglaText := ''; + PrevBanglaT := ''; + EnglishT := ''; + BlockLast := False; + NewBanglaText := ''; - For I := Low(PhoneticCache) To High(PhoneticCache) Do Begin - PhoneticCache[I].EnglishT := ''; - PhoneticCache[I].Results.Clear; - End; + For I := Low(PhoneticCache) To High(PhoneticCache) Do + Begin + PhoneticCache[I].EnglishT := ''; + PhoneticCache[I].Results.Clear; + End; - If ShowPrevWindow = 'YES' Then - frmPrevW.MakeMeHide; + If ShowPrevWindow = 'YES' Then + frmPrevW.MakeMeHide; End; @@ -1374,57 +1558,63 @@ Procedure TE2BCharBased.SaveCandidateOptions; Var - S: String; - tmpList: TStringList; + S: String; + tmpList: TStringList; Begin - Try - Try - tmpList := TStringList.Create; - tmpList.Add('// Avro Phonetic Candidate Selection Options (Do not remove this line)'); - for S in CandidateDict.Keys do begin - tmpList.Add(S + ' ' + CandidateDict.Items[S]); - End; - tmpList.SaveToFile(GetAvroDataDir + 'CandidateOptions.dat', TEncoding.UTF8); - Except - On E: Exception Do Begin - // Nothing - End; - End; - Finally - tmpList.Clear; - FreeAndNil(tmpList); - End; + Try + Try + tmpList := TStringList.Create; + tmpList.Add + ('// Avro Phonetic Candidate Selection Options (Do not remove this line)'); + for S in CandidateDict.Keys do + begin + tmpList.Add(S + ' ' + CandidateDict.Items[S]); + End; + tmpList.SaveToFile(GetAvroDataDir + 'CandidateOptions.dat', + TEncoding.UTF8); + Except + On E: Exception Do + Begin + // Nothing + End; + End; + Finally + tmpList.Clear; + FreeAndNil(tmpList); + End; End; { =============================================================================== } Procedure TE2BCharBased.SelectCandidate(Const Item: String); Begin - NewBanglaText := Item; - ParseAndSendNow; - ManuallySelectedCandidate := True; + NewBanglaText := Item; + ParseAndSendNow; + ManuallySelectedCandidate := True; End; { =============================================================================== } Procedure TE2BCharBased.SetAutoCorrectEnabled(Const Value: boolean); Begin - Parser.AutoCorrectEnabled := Value; - FAutoCorrect := Value; + Parser.AutoCorrectEnabled := Value; + FAutoCorrect := Value; End; { =============================================================================== } Procedure TE2BCharBased.UpdateCandidateOption; Var - Dummy, Middle_Main_T: String; + Dummy, Middle_Main_T: String; Begin - CutText(EnglishT, Dummy, Middle_Main_T, Dummy); - If ManuallySelectedCandidate Then Begin - If trim(Middle_Main_T) <> '' Then Begin - CandidateDict.AddOrSetValue(Middle_Main_T, NewBanglaText); - End; - End; + CutText(EnglishT, Dummy, Middle_Main_T, Dummy); + If ManuallySelectedCandidate Then + Begin + If trim(Middle_Main_T) <> '' Then + Begin + CandidateDict.AddOrSetValue(Middle_Main_T, NewBanglaText); + End; + End; End; { =============================================================================== } diff --git a/Keyboard and Spell checker/Classes/clsEnglishToBangla.pas b/Keyboard and Spell checker/Classes/clsEnglishToBangla.pas index fcac466..5ca8715 100644 --- a/Keyboard and Spell checker/Classes/clsEnglishToBangla.pas +++ b/Keyboard and Spell checker/Classes/clsEnglishToBangla.pas @@ -1,32 +1,31 @@ { - ============================================================================= - ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + ============================================================================= + ***************************************************************************** + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. - ***************************************************************************** - ============================================================================= + ***************************************************************************** + ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - { COMPLETE TRANSFERING! } Unit clsEnglishToBangla; @@ -34,68 +33,68 @@ Interface Uses - classes, - sysutils, - StrUtils; - + classes, + sysutils, + StrUtils; // Skeleton of Class TEnglishToBangla Type - TEnglishToBangla = Class - Private - pEnglishText: String; - ln: Integer; // Length of English String - pos: Integer; // Position of processing at English String - RS: String; // Result String - AutoCorrect: Boolean; - DetermineZWNJ_ZWJ: String; - - Procedure CutText(Const inputEStr: String; Var outSIgnore: String; Var outMidMain: String; Var outEIgnore: String); - Function MyConvert(): String; - Procedure Dot; - Procedure smallO; - Procedure O; - Procedure h; - Procedure s; - Procedure l; - Procedure R; - Procedure m; - Procedure b; - Procedure p; - Procedure d; - Procedure T; - Procedure J; - Procedure c; - Procedure n; - Procedure k; - Procedure g; - Function Cnv(Const Compare: String; Const IfTrue: String): Boolean; - Procedure AddRs(Const T: String); - Procedure AddRsEx(Const T: String; p: Integer = 0); - Function PrevT: String; - Function PrevTEx(Const Position: Integer): String; - Function NextT: String; - Function NextTEx(iLength: Integer; skipstart: Integer = 0): String; - Function Vowel(Const T: String): Boolean; - Function Consonent(Const T: String): Boolean; - Function Number(Const T: String): Boolean; - Function Begining: Boolean; - Public - Constructor Create; // Initializer - Function Convert(Const EnglishT: String): String; - Function CorrectCase(Const inputT: String): String; - // Published - Property AutoCorrectEnabled: Boolean Read AutoCorrect Write AutoCorrect; - - End; + TEnglishToBangla = Class + Private + pEnglishText: String; + ln: Integer; // Length of English String + pos: Integer; // Position of processing at English String + RS: String; // Result String + AutoCorrect: Boolean; + DetermineZWNJ_ZWJ: String; + + Procedure CutText(Const inputEStr: String; Var outSIgnore: String; + Var outMidMain: String; Var outEIgnore: String); + Function MyConvert(): String; + Procedure Dot; + Procedure smallO; + Procedure O; + Procedure h; + Procedure s; + Procedure l; + Procedure R; + Procedure m; + Procedure b; + Procedure p; + Procedure d; + Procedure T; + Procedure J; + Procedure c; + Procedure n; + Procedure k; + Procedure g; + Function Cnv(Const Compare: String; Const IfTrue: String): Boolean; + Procedure AddRs(Const T: String); + Procedure AddRsEx(Const T: String; p: Integer = 0); + Function PrevT: String; + Function PrevTEx(Const Position: Integer): String; + Function NextT: String; + Function NextTEx(iLength: Integer; skipstart: Integer = 0): String; + Function Vowel(Const T: String): Boolean; + Function Consonent(Const T: String): Boolean; + Function Number(Const T: String): Boolean; + Function Begining: Boolean; + Public + Constructor Create; // Initializer + Function Convert(Const EnglishT: String): String; + Function CorrectCase(Const inputT: String): String; + // Published + Property AutoCorrectEnabled: Boolean Read AutoCorrect Write AutoCorrect; + + End; Implementation Uses - uAutoCorrect, - BanglaChars, - WindowsVersion, - uRegistrySettings; + uAutoCorrect, + BanglaChars, + WindowsVersion, + uRegistrySettings; { TEnglishToBangla } @@ -103,44 +102,44 @@ Procedure TEnglishToBangla.AddRs(Const T: String); Begin - RS := RS + T; - pos := pos + 1; + RS := RS + T; + pos := pos + 1; End; { =============================================================================== } Procedure TEnglishToBangla.AddRsEx(Const T: String; p: Integer); Begin - RS := RS + T; - pos := pos + p; + RS := RS + T; + pos := pos + p; End; { =============================================================================== } Procedure TEnglishToBangla.b; Begin - If Cnv('bdh', b_B + b_Hasanta + b_Dh) = True Then - Exit; // B+Dh - If Cnv('bhl', b_Bh + b_Hasanta + b_L) = True Then - Exit; // Bh+L - - If Cnv('bj', b_B + b_Hasanta + b_J) = True Then - Exit; // B+J - If Cnv('bd', b_B + b_Hasanta + b_D) = True Then - Exit; // B+D - If Cnv('bb', b_B + b_Hasanta + b_B) = True Then - Exit; // B+B - If Cnv('bl', b_B + b_Hasanta + b_L) = True Then - Exit; // B+L - If Cnv('bh', b_Bh) = True Then - Exit; // Bh - If Cnv('vl', b_Bh + b_Hasanta + b_L) = True Then - Exit; // Bh+L - - If Cnv('b', b_B) = True Then - Exit; // B - If Cnv('v', b_Bh) = True Then - Exit; // Bh + If Cnv('bdh', b_B + b_Hasanta + b_Dh) = True Then + Exit; // B+Dh + If Cnv('bhl', b_Bh + b_Hasanta + b_L) = True Then + Exit; // Bh+L + + If Cnv('bj', b_B + b_Hasanta + b_J) = True Then + Exit; // B+J + If Cnv('bd', b_B + b_Hasanta + b_D) = True Then + Exit; // B+D + If Cnv('bb', b_B + b_Hasanta + b_B) = True Then + Exit; // B+B + If Cnv('bl', b_B + b_Hasanta + b_L) = True Then + Exit; // B+L + If Cnv('bh', b_Bh) = True Then + Exit; // Bh + If Cnv('vl', b_Bh + b_Hasanta + b_L) = True Then + Exit; // Bh+L + + If Cnv('b', b_B) = True Then + Exit; // B + If Cnv('v', b_Bh) = True Then + Exit; // Bh End; { =============================================================================== } @@ -149,323 +148,346 @@ Function TEnglishToBangla.Begining: Boolean; Var - T: Char; - temp: String; + T: Char; + temp: String; Begin - Result := False; - - temp := PrevT; - T := #0; - If length(temp) > 0 Then - T := temp[1]; - - If length(T) > 0 Then Begin - Case T Of - '0' .. '9': - Begining := False; - 'A' .. 'Z': - Begining := False; - 'a' .. 'z': - Begining := False; - Else - Begining := True; - End; - End - Else - Begining := True; + Result := False; + + temp := PrevT; + T := #0; + If length(temp) > 0 Then + T := temp[1]; + + If length(T) > 0 Then + Begin + Case T Of + '0' .. '9': + Begining := False; + 'A' .. 'Z': + Begining := False; + 'a' .. 'z': + Begining := False; + Else + Begining := True; + End; + End + Else + Begining := True; End; {$HINTS On} - { =============================================================================== } Procedure TEnglishToBangla.c; Begin - If Cnv('cNG', b_C + b_Hasanta + b_NYA) = True Then - Exit; // C+NYA - If Cnv('cch', b_C + b_Hasanta + b_CH) = True Then - Exit; // C+C - If Cnv('cc', b_C + b_Hasanta + b_C) = True Then - Exit; // C+C - // If Cnv('chh', b_CH) = True Then Exit ; //Ch - If Cnv('ch', b_CH) = True Then - Exit; // C - If Cnv('c', b_C) = True Then - Exit; // C + If Cnv('cNG', b_C + b_Hasanta + b_NYA) = True Then + Exit; // C+NYA + If Cnv('cch', b_C + b_Hasanta + b_CH) = True Then + Exit; // C+C + If Cnv('cc', b_C + b_Hasanta + b_C) = True Then + Exit; // C+C + // If Cnv('chh', b_CH) = True Then Exit ; //Ch + If Cnv('ch', b_CH) = True Then + Exit; // C + If Cnv('c', b_C) = True Then + Exit; // C End; { =============================================================================== } {$HINTS Off} -Function TEnglishToBangla.Cnv(Const Compare: String; Const IfTrue: String): Boolean; +Function TEnglishToBangla.Cnv(Const Compare: String; + Const IfTrue: String): Boolean; Var - i: Integer; - tmp: String; + i: Integer; + tmp: String; Begin - Result := False; - i := length(Compare); - tmp := MidStr(pEnglishText, pos, i); - - If Compare = tmp Then Begin - Result := True; - RS := RS + IfTrue; - pos := pos + i; - End - Else - Result := False; + Result := False; + i := length(Compare); + tmp := MidStr(pEnglishText, pos, i); + + If Compare = tmp Then + Begin + Result := True; + RS := RS + IfTrue; + pos := pos + i; + End + Else + Result := False; End; {$HINTS On} - { =============================================================================== } {$HINTS Off} Function TEnglishToBangla.Consonent(Const T: String): Boolean; Var - temp: Char; - myT: String; + temp: Char; + myT: String; Begin - Result := False; - myT := LowerCase(T); - temp := #0; - If length(myT) > 0 Then - temp := myT[1]; - - Case temp Of - 'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z': - Consonent := True; - Else - Consonent := False; - End; + Result := False; + myT := LowerCase(T); + temp := #0; + If length(myT) > 0 Then + temp := myT[1]; + + Case temp Of + 'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', + 't', 'v', 'w', 'x', 'y', 'z': + Consonent := True; + Else + Consonent := False; + End; End; {$HINTS On} - { =============================================================================== } Function TEnglishToBangla.Convert(Const EnglishT: String): String; Var - EngStr: String; - Starting_Ignoreable_T, Middle_Main_T, Ending_Ignorable_T: String; - tempStr: String; - DictItem: String; + EngStr: String; + Starting_Ignoreable_T, Middle_Main_T, Ending_Ignorable_T: String; + tempStr: String; + DictItem: String; Begin - If EnglishT = '' Then - Exit; - - // As is support - If AutoCorrect = True Then Begin - If dict.TryGetValue(EnglishT, DictItem) Then Begin - If EnglishT = DictItem Then Begin - Convert := EnglishT; - Exit; - End; - End; - End; - - /// //////////////////// - - EngStr := CorrectCase(EnglishT); - - If AutoCorrect = True Then Begin - If dict.TryGetValue(EngStr, DictItem) Then Begin - pEnglishText := DictItem; - Convert := MyConvert; - End - Else Begin - // Whole word not found in the dictionary, lets try ignoring punctuations - Starting_Ignoreable_T := ''; - Middle_Main_T := ''; - Ending_Ignorable_T := ''; - CutText(EngStr, Starting_Ignoreable_T, Middle_Main_T, Ending_Ignorable_T); - - If dict.TryGetValue(Middle_Main_T, DictItem) Then Begin - If Starting_Ignoreable_T <> '' Then Begin - pEnglishText := Starting_Ignoreable_T; - tempStr := MyConvert; - End; - - If Middle_Main_T <> '' Then Begin - pEnglishText := DictItem; - tempStr := tempStr + MyConvert; - End; - - If Ending_Ignorable_T <> '' Then Begin - pEnglishText := Ending_Ignorable_T; - tempStr := tempStr + MyConvert; - End; - - Convert := tempStr; - End - Else Begin // Autocorrect enabled but word not found even after ignoring punctuations - pEnglishText := EngStr; - Convert := MyConvert; - End; - End; - End - Else Begin - pEnglishText := EngStr; - Convert := MyConvert; - End; + If EnglishT = '' Then + Exit; + + // As is support + If AutoCorrect = True Then + Begin + If dict.TryGetValue(EnglishT, DictItem) Then + Begin + If EnglishT = DictItem Then + Begin + Convert := EnglishT; + Exit; + End; + End; + End; + + /// //////////////////// + + EngStr := CorrectCase(EnglishT); + + If AutoCorrect = True Then + Begin + If dict.TryGetValue(EngStr, DictItem) Then + Begin + pEnglishText := DictItem; + Convert := MyConvert; + End + Else + Begin + // Whole word not found in the dictionary, lets try ignoring punctuations + Starting_Ignoreable_T := ''; + Middle_Main_T := ''; + Ending_Ignorable_T := ''; + CutText(EngStr, Starting_Ignoreable_T, Middle_Main_T, Ending_Ignorable_T); + + If dict.TryGetValue(Middle_Main_T, DictItem) Then + Begin + If Starting_Ignoreable_T <> '' Then + Begin + pEnglishText := Starting_Ignoreable_T; + tempStr := MyConvert; + End; + + If Middle_Main_T <> '' Then + Begin + pEnglishText := DictItem; + tempStr := tempStr + MyConvert; + End; + + If Ending_Ignorable_T <> '' Then + Begin + pEnglishText := Ending_Ignorable_T; + tempStr := tempStr + MyConvert; + End; + + Convert := tempStr; + End + Else + Begin // Autocorrect enabled but word not found even after ignoring punctuations + pEnglishText := EngStr; + Convert := MyConvert; + End; + End; + End + Else + Begin + pEnglishText := EngStr; + Convert := MyConvert; + End; End; { =============================================================================== } Function TEnglishToBangla.CorrectCase(Const inputT: String): String; Var - i, l: Integer; - s, temp: String; - T: Char; + i, l: Integer; + s, temp: String; + T: Char; Begin - l := length(inputT); - T := #0; - s := ''; - - For i := 1 To l Do Begin - temp := MidStr(inputT, i, 1); - If length(temp) > 0 Then - T := temp[1]; - - - Case T Of - 'o', 'O', 'i', 'I', 'u', 'U': - s := s + T; - 'd', 'D', 'g', 'G', 'j', 'n', 'N', 'r', 'R', 's', 'S', 't', 'T', 'y', 'Y', 'z', 'Z': - s := s + T; - 'J': - If EnableJoNukta = 'YES' Then Begin - s := s + T; - End - Else Begin - s := s + LowerCase(T); - End; - Else - s := s + LowerCase(T); - End; - End; - - Result := s; + l := length(inputT); + T := #0; + s := ''; + + For i := 1 To l Do + Begin + temp := MidStr(inputT, i, 1); + If length(temp) > 0 Then + T := temp[1]; + + Case T Of + 'o', 'O', 'i', 'I', 'u', 'U': + s := s + T; + 'd', 'D', 'g', 'G', 'j', 'n', 'N', 'r', 'R', 's', 'S', 't', 'T', 'y', + 'Y', 'z', 'Z': + s := s + T; + 'J': + If EnableJoNukta = 'YES' Then + Begin + s := s + T; + End + Else + Begin + s := s + LowerCase(T); + End; + Else + s := s + LowerCase(T); + End; + End; + + Result := s; End; { =============================================================================== } Constructor TEnglishToBangla.Create; Begin - AutoCorrect := True; + AutoCorrect := True; - // If IsWinVistaOrLater Then - DetermineZWNJ_ZWJ := ZWJ; - // Else - // DetermineZWNJ_ZWJ := ZWNJ; + // If IsWinVistaOrLater Then + DetermineZWNJ_ZWJ := ZWJ; + // Else + // DetermineZWNJ_ZWJ := ZWNJ; End; { =============================================================================== } -Procedure TEnglishToBangla.CutText(Const inputEStr: String; Var outSIgnore, outMidMain, outEIgnore: String); +Procedure TEnglishToBangla.CutText(Const inputEStr: String; + Var outSIgnore, outMidMain, outEIgnore: String); Var - i: Integer; - p, q: Integer; - EStrLen: Integer; - tStr: Char; - reverse_inputEStr: String; - temporaryString: String; + i: Integer; + p, q: Integer; + EStrLen: Integer; + tStr: Char; + reverse_inputEStr: String; + temporaryString: String; Begin - tStr := #0; - p := 0; - - EStrLen := length(inputEStr); - // Start Cutting outSIgnore - For i := 1 To EStrLen Do Begin - temporaryString := MidStr(inputEStr, i, 1); - If length(temporaryString) > 0 Then - tStr := temporaryString[1]; - Case tStr Of - '~', '!', '@', '#', '%', '&', '*', '(', ')', '-', '_', '=', '+', '[', ']', '{', '}', #39, '"', ';', '<', '>', '/', '?', '|', '\', '.': - - p := i; - - ',': - If MidStr(inputEStr, i + 1, 1) = ',' Then - Break - Else - p := i; - - - ':': - If MidStr(inputEStr, i + 1, 1) = '`' Then - p := i - Else - Break; - - '`': - If i - 1 >= 1 Then Begin - If (MidStr(inputEStr, i - 1, 1) = '.') Or (MidStr(inputEStr, i - 1, 1) = ':') Then - p := i - Else - Break; - End - Else - Break; - Else - Break; - End; - End; - - outSIgnore := LeftStr(inputEStr, p); - // End Cutting outSIgnore - - // Start Cutting outEIgnore - tStr := #0; - q := 0; - - reverse_inputEStr := ReverseString(inputEStr); - For i := 1 To EStrLen - p Do Begin - temporaryString := MidStr(reverse_inputEStr, i, 1); - If length(temporaryString) > 0 Then - tStr := temporaryString[1]; - - Case tStr Of - '~', '!', '@', '#', '%', '&', '*', '(', ')', '-', '_', '=', '+', '[', ']', '{', '}', #39, #34, ';', '<', '>', '/', '.', '?', '|', '\': - q := i; - ',': - If MidStr(reverse_inputEStr, i + 1, 1) = ',' Then - Break - Else - q := i; - - '`': - If (MidStr(reverse_inputEStr, i + 1, 1) = ':') Or (MidStr(reverse_inputEStr, i + 1, 1) = '.') Then - q := i - Else - Break; - ':': - If i - 1 >= 1 Then Begin - If MidStr(reverse_inputEStr, i - 1, 1) = '`' Then - q := i - Else - Break; - End - Else - Break; - Else - Break; - End; - End; - - outEIgnore := RightStr(inputEStr, q); - // End Cutting outEIgnore - - // Start Cutting outMidMain - temporaryString := MidStr(inputEStr, p + 1, length(inputEStr)); - temporaryString := LeftStr(temporaryString, length(temporaryString) - q); - outMidMain := temporaryString; - + tStr := #0; + p := 0; + + EStrLen := length(inputEStr); + // Start Cutting outSIgnore + For i := 1 To EStrLen Do + Begin + temporaryString := MidStr(inputEStr, i, 1); + If length(temporaryString) > 0 Then + tStr := temporaryString[1]; + Case tStr Of + '~', '!', '@', '#', '%', '&', '*', '(', ')', '-', '_', '=', '+', '[', ']', + '{', '}', #39, '"', ';', '<', '>', '/', '?', '|', '\', '.': + + p := i; + + ',': + If MidStr(inputEStr, i + 1, 1) = ',' Then + Break + Else + p := i; + + ':': + If MidStr(inputEStr, i + 1, 1) = '`' Then + p := i + Else + Break; + + '`': + If i - 1 >= 1 Then + Begin + If (MidStr(inputEStr, i - 1, 1) = '.') Or + (MidStr(inputEStr, i - 1, 1) = ':') Then + p := i + Else + Break; + End + Else + Break; + Else + Break; + End; + End; + + outSIgnore := LeftStr(inputEStr, p); + // End Cutting outSIgnore + + // Start Cutting outEIgnore + tStr := #0; + q := 0; + + reverse_inputEStr := ReverseString(inputEStr); + For i := 1 To EStrLen - p Do + Begin + temporaryString := MidStr(reverse_inputEStr, i, 1); + If length(temporaryString) > 0 Then + tStr := temporaryString[1]; + + Case tStr Of + '~', '!', '@', '#', '%', '&', '*', '(', ')', '-', '_', '=', '+', '[', ']', + '{', '}', #39, #34, ';', '<', '>', '/', '.', '?', '|', '\': + q := i; + ',': + If MidStr(reverse_inputEStr, i + 1, 1) = ',' Then + Break + Else + q := i; + + '`': + If (MidStr(reverse_inputEStr, i + 1, 1) = ':') Or + (MidStr(reverse_inputEStr, i + 1, 1) = '.') Then + q := i + Else + Break; + ':': + If i - 1 >= 1 Then + Begin + If MidStr(reverse_inputEStr, i - 1, 1) = '`' Then + q := i + Else + Break; + End + Else + Break; + Else + Break; + End; + End; + + outEIgnore := RightStr(inputEStr, q); + // End Cutting outEIgnore + + // Start Cutting outMidMain + temporaryString := MidStr(inputEStr, p + 1, length(inputEStr)); + temporaryString := LeftStr(temporaryString, length(temporaryString) - q); + outMidMain := temporaryString; End; @@ -473,114 +495,114 @@ Procedure TEnglishToBangla.d; Begin - If Cnv('dhn', b_Dh + b_Hasanta + b_N) = True Then - Exit; // Dh+N - If Cnv('dhm', b_Dh + b_Hasanta + b_M) = True Then - Exit; // Dh+M - If Cnv('dgh', b_D + b_Hasanta + b_GH) = True Then - Exit; // D+Gh - If Cnv('ddh', b_D + b_Hasanta + b_Dh) = True Then - Exit; // D+Dh - If Cnv('dbh', b_D + b_Hasanta + b_Bh) = True Then - Exit; // D+Bh - - If Cnv('dv', b_D + b_Hasanta + b_Bh) = True Then - Exit; // D+Bh - If Cnv('dm', b_D + b_Hasanta + b_M) = True Then - Exit; // D+M - If Cnv('DD', b_Dd + b_Hasanta + b_Dd) = True Then - Exit; // Dd+Dd - If Cnv('Dh', b_Ddh) = True Then - Exit; // Ddh - If Cnv('dh', b_Dh) = True Then - Exit; // Dh - If Cnv('dg', b_D + b_Hasanta + b_G) = True Then - Exit; // D+G - If Cnv('dd', b_D + b_Hasanta + b_D) = True Then - Exit; // D+D - - If Cnv('D', b_Dd) = True Then - Exit; // Dd - If Cnv('d', b_D) = True Then - Exit; // D + If Cnv('dhn', b_Dh + b_Hasanta + b_N) = True Then + Exit; // Dh+N + If Cnv('dhm', b_Dh + b_Hasanta + b_M) = True Then + Exit; // Dh+M + If Cnv('dgh', b_D + b_Hasanta + b_GH) = True Then + Exit; // D+Gh + If Cnv('ddh', b_D + b_Hasanta + b_Dh) = True Then + Exit; // D+Dh + If Cnv('dbh', b_D + b_Hasanta + b_Bh) = True Then + Exit; // D+Bh + + If Cnv('dv', b_D + b_Hasanta + b_Bh) = True Then + Exit; // D+Bh + If Cnv('dm', b_D + b_Hasanta + b_M) = True Then + Exit; // D+M + If Cnv('DD', b_Dd + b_Hasanta + b_Dd) = True Then + Exit; // Dd+Dd + If Cnv('Dh', b_Ddh) = True Then + Exit; // Ddh + If Cnv('dh', b_Dh) = True Then + Exit; // Dh + If Cnv('dg', b_D + b_Hasanta + b_G) = True Then + Exit; // D+G + If Cnv('dd', b_D + b_Hasanta + b_D) = True Then + Exit; // D+D + + If Cnv('D', b_Dd) = True Then + Exit; // Dd + If Cnv('d', b_D) = True Then + Exit; // D End; { =============================================================================== } Procedure TEnglishToBangla.Dot; Begin - If Cnv('...', '...') = True Then - Exit; // ... - - If Cnv('.`', '.') = True Then - Exit; // . - If Cnv('..', b_Dari + b_Dari) = True Then - Exit; // || - - if Number(NextT) = True then begin - If Cnv('.', '.') = True Then - Exit; // Decimal Mark - end - else - If Cnv('.', b_Dari) = True Then - Exit; // | + If Cnv('...', '...') = True Then + Exit; // ... + + If Cnv('.`', '.') = True Then + Exit; // . + If Cnv('..', b_Dari + b_Dari) = True Then + Exit; // || + + if Number(NextT) = True then + begin + If Cnv('.', '.') = True Then + Exit; // Decimal Mark + end + else If Cnv('.', b_Dari) = True Then + Exit; // | End; { =============================================================================== } Procedure TEnglishToBangla.g; Begin - If Cnv('ghn', b_GH + b_Hasanta + b_N) = True Then - Exit; // gh+N - If Cnv('Ghn', b_GH + b_Hasanta + b_N) = True Then - Exit; // gh+N - - If Cnv('gdh', b_G + b_Hasanta + b_Dh) = True Then - Exit; // g+dh - If Cnv('Gdh', b_G + b_Hasanta + b_Dh) = True Then - Exit; // g+dh - - If Cnv('gN', b_G + b_Hasanta + b_Nn) = True Then - Exit; // g+N - If Cnv('GN', b_G + b_Hasanta + b_Nn) = True Then - Exit; // g+N - - If Cnv('gn', b_G + b_Hasanta + b_N) = True Then - Exit; // g+n - If Cnv('Gn', b_G + b_Hasanta + b_N) = True Then - Exit; // g+n - - If Cnv('gm', b_G + b_Hasanta + b_M) = True Then - Exit; // g+M - If Cnv('Gm', b_G + b_Hasanta + b_M) = True Then - Exit; // g+M - - If Cnv('gl', b_G + b_Hasanta + b_L) = True Then - Exit; // g+L - If Cnv('Gl', b_G + b_Hasanta + b_L) = True Then - Exit; // g+L - - If Cnv('gg', b_J + b_Hasanta + b_NYA) = True Then - Exit; // gg - If Cnv('GG', b_J + b_Hasanta + b_NYA) = True Then - Exit; // gg - If Cnv('Gg', b_J + b_Hasanta + b_NYA) = True Then - Exit; // gg - If Cnv('gG', b_J + b_Hasanta + b_NYA) = True Then - Exit; // gg - - If Cnv('gh', b_GH) = True Then - Exit; // gh - If Cnv('Gh', b_GH) = True Then - Exit; // gh - - // If Cnv('gb', b_G + b_Hasanta + b_B) = True Then Exit ; //g+b - // If Cnv('Gb', b_G + b_Hasanta + b_B) = True Then Exit ; //g+b - - If Cnv('g', b_G) = True Then - Exit; // g - If Cnv('G', b_G) = True Then - Exit; // g + If Cnv('ghn', b_GH + b_Hasanta + b_N) = True Then + Exit; // gh+N + If Cnv('Ghn', b_GH + b_Hasanta + b_N) = True Then + Exit; // gh+N + + If Cnv('gdh', b_G + b_Hasanta + b_Dh) = True Then + Exit; // g+dh + If Cnv('Gdh', b_G + b_Hasanta + b_Dh) = True Then + Exit; // g+dh + + If Cnv('gN', b_G + b_Hasanta + b_Nn) = True Then + Exit; // g+N + If Cnv('GN', b_G + b_Hasanta + b_Nn) = True Then + Exit; // g+N + + If Cnv('gn', b_G + b_Hasanta + b_N) = True Then + Exit; // g+n + If Cnv('Gn', b_G + b_Hasanta + b_N) = True Then + Exit; // g+n + + If Cnv('gm', b_G + b_Hasanta + b_M) = True Then + Exit; // g+M + If Cnv('Gm', b_G + b_Hasanta + b_M) = True Then + Exit; // g+M + + If Cnv('gl', b_G + b_Hasanta + b_L) = True Then + Exit; // g+L + If Cnv('Gl', b_G + b_Hasanta + b_L) = True Then + Exit; // g+L + + If Cnv('gg', b_J + b_Hasanta + b_NYA) = True Then + Exit; // gg + If Cnv('GG', b_J + b_Hasanta + b_NYA) = True Then + Exit; // gg + If Cnv('Gg', b_J + b_Hasanta + b_NYA) = True Then + Exit; // gg + If Cnv('gG', b_J + b_Hasanta + b_NYA) = True Then + Exit; // gg + + If Cnv('gh', b_GH) = True Then + Exit; // gh + If Cnv('Gh', b_GH) = True Then + Exit; // gh + + // If Cnv('gb', b_G + b_Hasanta + b_B) = True Then Exit ; //g+b + // If Cnv('Gb', b_G + b_Hasanta + b_B) = True Then Exit ; //g+b + + If Cnv('g', b_G) = True Then + Exit; // g + If Cnv('G', b_G) = True Then + Exit; // g End; { =============================================================================== } @@ -588,398 +610,413 @@ Procedure TEnglishToBangla.h; Begin - If Cnv('hN', b_H + b_Hasanta + b_Nn) = True Then - Exit; // H+Nn - If Cnv('hn', b_H + b_Hasanta + b_N) = True Then - Exit; // H+N - If Cnv('hm', b_H + b_Hasanta + b_M) = True Then - Exit; // H+m - If Cnv('hl', b_H + b_Hasanta + b_L) = True Then - Exit; // H+L - - If Cnv('h', b_H) = True Then - Exit; // H + If Cnv('hN', b_H + b_Hasanta + b_Nn) = True Then + Exit; // H+Nn + If Cnv('hn', b_H + b_Hasanta + b_N) = True Then + Exit; // H+N + If Cnv('hm', b_H + b_Hasanta + b_M) = True Then + Exit; // H+m + If Cnv('hl', b_H + b_Hasanta + b_L) = True Then + Exit; // H+L + + If Cnv('h', b_H) = True Then + Exit; // H End; { =============================================================================== } Procedure TEnglishToBangla.J; Begin - If Cnv('jjh', b_J + b_Hasanta + b_JH) = True Then - Exit; // J+Jh - If Cnv('jNG', b_J + b_Hasanta + b_NYA) = True Then - Exit; // J+NYA - If Cnv('jh', b_JH) = True Then - Exit; // Jh - If Cnv('jj', b_J + b_Hasanta + b_J) = True Then - Exit; // J+J - If Cnv('j', b_J) = True Then - Exit; // J - If EnableJoNukta = 'YES' Then Begin - If Cnv('J', b_J + b_Nukta) = True Then - Exit; // J+Nukta - End - Else Begin - If Cnv('J', b_J) = True Then - Exit; // J+Nukta - End; + If Cnv('jjh', b_J + b_Hasanta + b_JH) = True Then + Exit; // J+Jh + If Cnv('jNG', b_J + b_Hasanta + b_NYA) = True Then + Exit; // J+NYA + If Cnv('jh', b_JH) = True Then + Exit; // Jh + If Cnv('jj', b_J + b_Hasanta + b_J) = True Then + Exit; // J+J + If Cnv('j', b_J) = True Then + Exit; // J + If EnableJoNukta = 'YES' Then + Begin + If Cnv('J', b_J + b_Nukta) = True Then + Exit; // J+Nukta + End + Else + Begin + If Cnv('J', b_J) = True Then + Exit; // J+Nukta + End; End; { =============================================================================== } Procedure TEnglishToBangla.k; Begin - If Cnv('kkhN', b_K + b_Hasanta + b_Ss + b_Hasanta + b_Nn) = True Then - Exit; // khioN - If Cnv('kShN', b_K + b_Hasanta + b_Ss + b_Hasanta + b_Nn) = True Then - Exit; // khioN - If Cnv('kkhm', b_K + b_Hasanta + b_Ss + b_Hasanta + b_M) = True Then - Exit; // khioM - If Cnv('kShm', b_K + b_Hasanta + b_Ss + b_Hasanta + b_M) = True Then - Exit; // khioM - - If Cnv('kxN', b_K + b_Hasanta + b_Ss + b_Hasanta + b_Nn) = True Then - Exit; // khioN - If Cnv('kxm', b_K + b_Hasanta + b_Ss + b_Hasanta + b_M) = True Then - Exit; // khioM - If Cnv('kkh', b_K + b_Hasanta + b_Ss) = True Then - Exit; // khio - If Cnv('kSh', b_K + b_Hasanta + b_Ss) = True Then - Exit; // khio - - If Cnv('ksh', b_K + b_Sh) = True Then - Exit; // K`Sh - - If Cnv('kx', b_K + b_Hasanta + b_Ss) = True Then - Exit; // khio - If Cnv('kk', b_K + b_Hasanta + b_K) = True Then - Exit; // k+k - If Cnv('kT', b_K + b_Hasanta + b_Tt) = True Then - Exit; // k+T - If Cnv('kt', b_K + b_Hasanta + b_T) = True Then - Exit; // k+t - If Cnv('km', b_K + b_Hasanta + b_M) = True Then - Exit; // k+M - If Cnv('kl', b_K + b_Hasanta + b_L) = True Then - Exit; // k+L - If Cnv('ks', b_K + b_Hasanta + b_S) = True Then - Exit; // k+S - - If Cnv('kh', b_KH) = True Then - Exit; // kh - - If Cnv('k', b_K) = True Then - Exit; // k + If Cnv('kkhN', b_K + b_Hasanta + b_Ss + b_Hasanta + b_Nn) = True Then + Exit; // khioN + If Cnv('kShN', b_K + b_Hasanta + b_Ss + b_Hasanta + b_Nn) = True Then + Exit; // khioN + If Cnv('kkhm', b_K + b_Hasanta + b_Ss + b_Hasanta + b_M) = True Then + Exit; // khioM + If Cnv('kShm', b_K + b_Hasanta + b_Ss + b_Hasanta + b_M) = True Then + Exit; // khioM + + If Cnv('kxN', b_K + b_Hasanta + b_Ss + b_Hasanta + b_Nn) = True Then + Exit; // khioN + If Cnv('kxm', b_K + b_Hasanta + b_Ss + b_Hasanta + b_M) = True Then + Exit; // khioM + If Cnv('kkh', b_K + b_Hasanta + b_Ss) = True Then + Exit; // khio + If Cnv('kSh', b_K + b_Hasanta + b_Ss) = True Then + Exit; // khio + + If Cnv('ksh', b_K + b_Sh) = True Then + Exit; // K`Sh + + If Cnv('kx', b_K + b_Hasanta + b_Ss) = True Then + Exit; // khio + If Cnv('kk', b_K + b_Hasanta + b_K) = True Then + Exit; // k+k + If Cnv('kT', b_K + b_Hasanta + b_Tt) = True Then + Exit; // k+T + If Cnv('kt', b_K + b_Hasanta + b_T) = True Then + Exit; // k+t + If Cnv('km', b_K + b_Hasanta + b_M) = True Then + Exit; // k+M + If Cnv('kl', b_K + b_Hasanta + b_L) = True Then + Exit; // k+L + If Cnv('ks', b_K + b_Hasanta + b_S) = True Then + Exit; // k+S + + If Cnv('kh', b_KH) = True Then + Exit; // kh + + If Cnv('k', b_K) = True Then + Exit; // k End; { =============================================================================== } Procedure TEnglishToBangla.l; Begin - If Cnv('lbh', b_L + b_Hasanta + b_Bh) = True Then - Exit; // L+Bh - If Cnv('ldh', b_L + b_Hasanta + b_Dh) = True Then - Exit; // L+Dh - - If Cnv('lkh', b_L + b_KH) = True Then - Exit; // L & Kk - If Cnv('lgh', b_L + b_GH) = True Then - Exit; // L & Gh - If Cnv('lph', b_L + b_Ph) = True Then - Exit; // L & Ph - - If Cnv('lk', b_L + b_Hasanta + b_K) = True Then - Exit; // L+K - If Cnv('lg', b_L + b_Hasanta + b_G) = True Then - Exit; // L+G - If Cnv('lT', b_L + b_Hasanta + b_Tt) = True Then - Exit; // L+T - If Cnv('lD', b_L + b_Hasanta + b_Dd) = True Then - Exit; // L+Dd - If Cnv('lp', b_L + b_Hasanta + b_P) = True Then - Exit; // L+P - If Cnv('lv', b_L + b_Hasanta + b_Bh) = True Then - Exit; // L+Bh - If Cnv('lm', b_L + b_Hasanta + b_M) = True Then - Exit; // L+M - If Cnv('ll', b_L + b_Hasanta + b_L) = True Then - Exit; // L+L - If Cnv('lb', b_L + b_Hasanta + b_B) = True Then - Exit; // L+B - - If Cnv('l', b_L) = True Then - Exit; // L + If Cnv('lbh', b_L + b_Hasanta + b_Bh) = True Then + Exit; // L+Bh + If Cnv('ldh', b_L + b_Hasanta + b_Dh) = True Then + Exit; // L+Dh + + If Cnv('lkh', b_L + b_KH) = True Then + Exit; // L & Kk + If Cnv('lgh', b_L + b_GH) = True Then + Exit; // L & Gh + If Cnv('lph', b_L + b_Ph) = True Then + Exit; // L & Ph + + If Cnv('lk', b_L + b_Hasanta + b_K) = True Then + Exit; // L+K + If Cnv('lg', b_L + b_Hasanta + b_G) = True Then + Exit; // L+G + If Cnv('lT', b_L + b_Hasanta + b_Tt) = True Then + Exit; // L+T + If Cnv('lD', b_L + b_Hasanta + b_Dd) = True Then + Exit; // L+Dd + If Cnv('lp', b_L + b_Hasanta + b_P) = True Then + Exit; // L+P + If Cnv('lv', b_L + b_Hasanta + b_Bh) = True Then + Exit; // L+Bh + If Cnv('lm', b_L + b_Hasanta + b_M) = True Then + Exit; // L+M + If Cnv('ll', b_L + b_Hasanta + b_L) = True Then + Exit; // L+L + If Cnv('lb', b_L + b_Hasanta + b_B) = True Then + Exit; // L+B + + If Cnv('l', b_L) = True Then + Exit; // L End; { =============================================================================== } Procedure TEnglishToBangla.m; Begin - If Cnv('mth', b_M + b_Hasanta + b_Th) = True Then - Exit; // M+Th - If Cnv('mph', b_M + b_Hasanta + b_Ph) = True Then - Exit; // M+Ph - If Cnv('mbh', b_M + b_Hasanta + b_Bh) = True Then - Exit; // M+V - If Cnv('mpl', b_M + b_P + b_Hasanta + b_L) = True Then - Exit; // M+V - - If Cnv('mn', b_M + b_Hasanta + b_N) = True Then - Exit; // M+N - If Cnv('mp', b_M + b_Hasanta + b_P) = True Then - Exit; // M+P - If Cnv('mv', b_M + b_Hasanta + b_Bh) = True Then - Exit; // M+V - If Cnv('mm', b_M + b_Hasanta + b_M) = True Then - Exit; // M+M - If Cnv('ml', b_M + b_Hasanta + b_L) = True Then - Exit; // M+L - If Cnv('mb', b_M + b_Hasanta + b_B) = True Then - Exit; // M+B - If Cnv('mf', b_M + b_Hasanta + b_Ph) = True Then - Exit; // M+Ph - - If Cnv('m', b_M) = True Then - Exit; // M + If Cnv('mth', b_M + b_Hasanta + b_Th) = True Then + Exit; // M+Th + If Cnv('mph', b_M + b_Hasanta + b_Ph) = True Then + Exit; // M+Ph + If Cnv('mbh', b_M + b_Hasanta + b_Bh) = True Then + Exit; // M+V + If Cnv('mpl', b_M + b_P + b_Hasanta + b_L) = True Then + Exit; // M+V + + If Cnv('mn', b_M + b_Hasanta + b_N) = True Then + Exit; // M+N + If Cnv('mp', b_M + b_Hasanta + b_P) = True Then + Exit; // M+P + If Cnv('mv', b_M + b_Hasanta + b_Bh) = True Then + Exit; // M+V + If Cnv('mm', b_M + b_Hasanta + b_M) = True Then + Exit; // M+M + If Cnv('ml', b_M + b_Hasanta + b_L) = True Then + Exit; // M+L + If Cnv('mb', b_M + b_Hasanta + b_B) = True Then + Exit; // M+B + If Cnv('mf', b_M + b_Hasanta + b_Ph) = True Then + Exit; // M+Ph + + If Cnv('m', b_M) = True Then + Exit; // M End; { =============================================================================== } Function TEnglishToBangla.MyConvert: String; Var - tt: Char; - tString: String; + tt: Char; + tString: String; Begin - ln := length(pEnglishText); - pos := 1; - RS := ''; - - Repeat - tString := MidStr(pEnglishText, pos, 1); - tt := #0; - If length(tString) > 0 Then - tt := tString[1]; - - Case tt Of - // --------START Number Generation--------------- - // 1st, we'll convert numbers. Hassel free :) - '0': - AddRs(b_0); - '1': - AddRs(b_1); - '2': - AddRs(b_2); - '3': - AddRs(b_3); - '4': - AddRs(b_4); - '5': - AddRs(b_5); - '6': - AddRs(b_6); - '7': - AddRs(b_7); - '8': - AddRs(b_8); - '9': - AddRs(b_9); - // ------------End Number Generation------------- - - - - // --------START Vowel Generation--------------- - // 2nd, we'll convert Vowels.Comperatively easy - - 'o': - smallO(); // SmallO - - 'a', 'A': - If NextT = 'Z' Then - AddRsEx(b_A + b_Hasanta + b_Z + b_AAkar, 2) - Else If (Begining = True) And (NextT <> '`') Then - AddRs(b_AA) - Else If (Consonent(PrevT) = False) And (PrevT <> 'a') And (NextT <> '`') Then - AddRs(b_Y + b_AAkar) - Else If NextT = '`' Then - AddRsEx(b_AAkar, 2) - Else If (PrevT = 'a') And (NextT <> '`') Then - AddRs(b_AA) - Else - AddRs(b_AAkar); - - 'i': - If ((Consonent(PrevT) = False) Or (Begining = True)) And (NextT <> '`') Then - AddRs(b_I) - Else If NextT = '`' Then - AddRsEx(b_Ikar, 2) - Else - AddRs(b_Ikar); - - 'I': - If ((Consonent(PrevT) = False) Or (Begining = True)) And (NextT <> '`') Then - AddRs(b_II) - Else If NextT = '`' Then - AddRsEx(b_IIkar, 2) - Else - AddRs(b_IIkar); - - 'u': - If ((Consonent(PrevT) = False) Or (Begining = True)) And (NextT <> '`') Then - AddRs(b_U) - Else If NextT = '`' Then - AddRsEx(b_Ukar, 2) - Else - AddRs(b_Ukar); - - 'U': - If ((Consonent(PrevT) = False) Or (Begining = True)) And (NextT <> '`') Then - AddRs(b_UU) - Else If NextT = '`' Then - AddRsEx(b_UUkar, 2) - Else - AddRs(b_UUkar); - // We'll process ra, Ra,Rha, rri, rrikar, ra fola, reph later - - 'e', 'E': - If ((Consonent(PrevT) = False) Or (Begining = True)) And (NextT <> '`') Then Begin - If NextT = 'e' Then - AddRsEx(b_II, 2) - Else - AddRs(b_E); - End - Else If NextT = '`' Then - AddRsEx(b_Ekar, 2) - Else Begin - If NextT = 'e' Then - AddRsEx(b_IIkar, 2) - Else - AddRs(b_Ekar); - End; - - // Now-O,OI,OU processing! Its fun man:) - - 'O': - O(); // Capital O - // -----------------End Vowel Generation--------------- - - // -----------------START Consonent Processing--------------- - 'k': - k(); - 'G', 'g': - g(); - 'N', 'n': - n(); - 'c': - c(); - 'J', 'j': - J(); - 'T', 't': - T(); - 'D', 'd': - d(); - 'p', 'f': - p(); - 'b', 'v': - b(); - 'm': - m(); - 'z': - AddRs(b_Z); - 'Z': - If PrevT = 'r' Then Begin - If (Consonent(PrevTEx(2)) = True) And (PrevTEx(2) <> 'r') And (PrevTEx(2) <> 'y') And (PrevTEx(2) <> 'w') And (PrevTEx(2) <> 'x') Then - // Previous character is R-Fola, don't add ZWJ - AddRs(b_Hasanta + b_Z) - Else - AddRs(DetermineZWNJ_ZWJ + b_Hasanta + b_Z); - End - Else - AddRs(b_Hasanta + b_Z); - - 'R', 'r': - R(); - 'l': - l(); - 'S', 's': - s(); - 'h': - h(); - 'y': - If (Consonent(PrevT) = False) And (Begining <> True) Then - AddRs(b_Y) - Else If Begining = True Then - AddRs(b_I + b_Y) - Else Begin - If PrevT = 'r' Then Begin - If (Consonent(PrevTEx(2)) = True) And (PrevTEx(2) <> 'r') And (PrevTEx(2) <> 'y') And (PrevTEx(2) <> 'w') And (PrevTEx(2) <> 'x') Then - // Previous character is R-Fola, don't add ZWJ - AddRs(b_Hasanta + b_Z) - Else - AddRs(DetermineZWNJ_ZWJ + b_Hasanta + b_Z); - End - Else - AddRs(b_Hasanta + b_Z); - End; - - 'Y': - AddRs(b_Y); // Force Y - 'w': - If (Begining = True) And (Vowel(NextT) = True) Then - AddRs(b_O + b_Y) - Else If Consonent(PrevT) = True Then - AddRs(b_Hasanta + b_B) - Else - AddRs(b_O); - - 'q': - AddRs(b_K); - 'x': - If Begining = True Then - AddRs(b_E + b_K + b_Hasanta + b_S) - Else - AddRs(b_K + b_Hasanta + b_S); - // -----------------End Consonent Generation--------------- - - // -----------------Start Symbol Generation--------------- - '.': - Dot(); - ':': - If NextT <> '`' Then - AddRs(b_Bisharga) - Else - AddRsEx(':', 2); - - '^': - If NextT <> '`' Then - AddRs(b_Chandra) - Else - AddRsEx('^', 2); - - - ',': - If NextT = ',' Then - AddRsEx(b_Hasanta + ZWNJ, 2) - Else - AddRs(','); - - '$': - AddRs(b_Taka); - - // -----------------End Symbol Generation--------------- - - - // ` - Make sure it is just above case else! - '`': - pos := pos + 1; // No change made here,just to bypass juktakkhar making - - Else - AddRs(tt); - - End; - - Until pos > ln; - - MyConvert := RS; + ln := length(pEnglishText); + pos := 1; + RS := ''; + + Repeat + tString := MidStr(pEnglishText, pos, 1); + tt := #0; + If length(tString) > 0 Then + tt := tString[1]; + + Case tt Of + // --------START Number Generation--------------- + // 1st, we'll convert numbers. Hassel free :) + '0': + AddRs(b_0); + '1': + AddRs(b_1); + '2': + AddRs(b_2); + '3': + AddRs(b_3); + '4': + AddRs(b_4); + '5': + AddRs(b_5); + '6': + AddRs(b_6); + '7': + AddRs(b_7); + '8': + AddRs(b_8); + '9': + AddRs(b_9); + // ------------End Number Generation------------- + + + + // --------START Vowel Generation--------------- + // 2nd, we'll convert Vowels.Comperatively easy + + 'o': + smallO(); // SmallO + + 'a', 'A': + If NextT = 'Z' Then + AddRsEx(b_A + b_Hasanta + b_Z + b_AAkar, 2) + Else If (Begining = True) And (NextT <> '`') Then + AddRs(b_AA) + Else If (Consonent(PrevT) = False) And (PrevT <> 'a') And + (NextT <> '`') Then + AddRs(b_Y + b_AAkar) + Else If NextT = '`' Then + AddRsEx(b_AAkar, 2) + Else If (PrevT = 'a') And (NextT <> '`') Then + AddRs(b_AA) + Else + AddRs(b_AAkar); + + 'i': + If ((Consonent(PrevT) = False) Or (Begining = True)) And + (NextT <> '`') Then + AddRs(b_I) + Else If NextT = '`' Then + AddRsEx(b_Ikar, 2) + Else + AddRs(b_Ikar); + + 'I': + If ((Consonent(PrevT) = False) Or (Begining = True)) And + (NextT <> '`') Then + AddRs(b_II) + Else If NextT = '`' Then + AddRsEx(b_IIkar, 2) + Else + AddRs(b_IIkar); + + 'u': + If ((Consonent(PrevT) = False) Or (Begining = True)) And + (NextT <> '`') Then + AddRs(b_U) + Else If NextT = '`' Then + AddRsEx(b_Ukar, 2) + Else + AddRs(b_Ukar); + + 'U': + If ((Consonent(PrevT) = False) Or (Begining = True)) And + (NextT <> '`') Then + AddRs(b_UU) + Else If NextT = '`' Then + AddRsEx(b_UUkar, 2) + Else + AddRs(b_UUkar); + // We'll process ra, Ra,Rha, rri, rrikar, ra fola, reph later + + 'e', 'E': + If ((Consonent(PrevT) = False) Or (Begining = True)) And + (NextT <> '`') Then + Begin + If NextT = 'e' Then + AddRsEx(b_II, 2) + Else + AddRs(b_E); + End + Else If NextT = '`' Then + AddRsEx(b_Ekar, 2) + Else + Begin + If NextT = 'e' Then + AddRsEx(b_IIkar, 2) + Else + AddRs(b_Ekar); + End; + + // Now-O,OI,OU processing! Its fun man:) + + 'O': + O(); // Capital O + // -----------------End Vowel Generation--------------- + + // -----------------START Consonent Processing--------------- + 'k': + k(); + 'G', 'g': + g(); + 'N', 'n': + n(); + 'c': + c(); + 'J', 'j': + J(); + 'T', 't': + T(); + 'D', 'd': + d(); + 'p', 'f': + p(); + 'b', 'v': + b(); + 'm': + m(); + 'z': + AddRs(b_Z); + 'Z': + If PrevT = 'r' Then + Begin + If (Consonent(PrevTEx(2)) = True) And (PrevTEx(2) <> 'r') And + (PrevTEx(2) <> 'y') And (PrevTEx(2) <> 'w') And + (PrevTEx(2) <> 'x') Then + // Previous character is R-Fola, don't add ZWJ + AddRs(b_Hasanta + b_Z) + Else + AddRs(DetermineZWNJ_ZWJ + b_Hasanta + b_Z); + End + Else + AddRs(b_Hasanta + b_Z); + + 'R', 'r': + R(); + 'l': + l(); + 'S', 's': + s(); + 'h': + h(); + 'y': + If (Consonent(PrevT) = False) And (Begining <> True) Then + AddRs(b_Y) + Else If Begining = True Then + AddRs(b_I + b_Y) + Else + Begin + If PrevT = 'r' Then + Begin + If (Consonent(PrevTEx(2)) = True) And (PrevTEx(2) <> 'r') And + (PrevTEx(2) <> 'y') And (PrevTEx(2) <> 'w') And + (PrevTEx(2) <> 'x') Then + // Previous character is R-Fola, don't add ZWJ + AddRs(b_Hasanta + b_Z) + Else + AddRs(DetermineZWNJ_ZWJ + b_Hasanta + b_Z); + End + Else + AddRs(b_Hasanta + b_Z); + End; + + 'Y': + AddRs(b_Y); // Force Y + 'w': + If (Begining = True) And (Vowel(NextT) = True) Then + AddRs(b_O + b_Y) + Else If Consonent(PrevT) = True Then + AddRs(b_Hasanta + b_B) + Else + AddRs(b_O); + + 'q': + AddRs(b_K); + 'x': + If Begining = True Then + AddRs(b_E + b_K + b_Hasanta + b_S) + Else + AddRs(b_K + b_Hasanta + b_S); + // -----------------End Consonent Generation--------------- + + // -----------------Start Symbol Generation--------------- + '.': + Dot(); + ':': + If NextT <> '`' Then + AddRs(b_Bisharga) + Else + AddRsEx(':', 2); + + '^': + If NextT <> '`' Then + AddRs(b_Chandra) + Else + AddRsEx('^', 2); + + ',': + If NextT = ',' Then + AddRsEx(b_Hasanta + ZWNJ, 2) + Else + AddRs(','); + + '$': + AddRs(b_Taka); + + // -----------------End Symbol Generation--------------- + + // ` - Make sure it is just above case else! + '`': + pos := pos + 1; // No change made here,just to bypass juktakkhar making + + Else + AddRs(tt); + + End; + + Until pos > ln; + + MyConvert := RS; End; @@ -988,419 +1025,433 @@ Procedure TEnglishToBangla.n; Begin - If Cnv('NgkSh', b_NGA + b_Hasanta + b_K + b_Hasanta + b_Ss) = True Then - Exit; // NGA+Khio - If Cnv('Ngkkh', b_NGA + b_Hasanta + b_K + b_Hasanta + b_Ss) = True Then - Exit; // NGA+Khio - - - If Cnv('NGch', b_NYA + b_Hasanta + b_CH) = True Then - Exit; // NYA+Ch - If Cnv('Nggh', b_NGA + b_Hasanta + b_GH) = True Then - Exit; // NGA+Gh - If Cnv('Ngkh', b_NGA + b_Hasanta + b_KH) = True Then - Exit; // NGA+Kh - If Cnv('NGjh', b_NYA + b_Hasanta + b_JH) = True Then - Exit; // NYA+Jh - If Cnv('ngOU', b_NGA + b_Hasanta + b_G + b_OUkar) = True Then - Exit; // NGA+G - If Cnv('ngOI', b_NGA + b_Hasanta + b_G + b_OIkar) = True Then - Exit; // NGA+G - If Cnv('Ngkx', b_NGA + b_Hasanta + b_K + b_Hasanta + b_Ss) = True Then - Exit; // NGA+Khio - - If Cnv('NGc', b_NYA + b_Hasanta + b_C) = True Then - Exit; // NYA+Ch - If Cnv('nch', b_NYA + b_Hasanta + b_CH) = True Then - Exit; // NYA+Ch - If Cnv('njh', b_NYA + b_Hasanta + b_JH) = True Then - Exit; // NYA+Jh - If Cnv('ngh', b_NGA + b_Hasanta + b_GH) = True Then - Exit; // NGA+Gh - If Cnv('Ngk', b_NGA + b_Hasanta + b_K) = True Then - Exit; // NGA+K - If Cnv('Ngx', b_NGA + b_Hasanta + b_Ss) = True Then - Exit; // NGA+Khio - If Cnv('Ngg', b_NGA + b_Hasanta + b_G) = True Then - Exit; // NGA+G - If Cnv('Ngm', b_NGA + b_Hasanta + b_M) = True Then - Exit; // NGA+M - If Cnv('NGj', b_NYA + b_Hasanta + b_J) = True Then - Exit; // NYA+J - If Cnv('ndh', b_N + b_Hasanta + b_Dh) = True Then - Exit; // N+Dh - If Cnv('nTh', b_N + b_Hasanta + b_Tth) = True Then - Exit; // N+Tth - If Cnv('NTh', b_Nn + b_Hasanta + b_Tth) = True Then - Exit; // Nn+Tth - If Cnv('nth', b_N + b_Hasanta + b_Th) = True Then - Exit; // N+Th - If Cnv('nkh', b_NGA + b_Hasanta + b_KH) = True Then - Exit; // NGA+Kh - If Cnv('ngo', b_NGA + b_Hasanta + b_G) = True Then - Exit; // NGA+G - If Cnv('nga', b_NGA + b_Hasanta + b_G + b_AAkar) = True Then - Exit; // NGA+G - If Cnv('ngi', b_NGA + b_Hasanta + b_G + b_Ikar) = True Then - Exit; // NGA+G - If Cnv('ngI', b_NGA + b_Hasanta + b_G + b_IIkar) = True Then - Exit; // NGA+G - If Cnv('ngu', b_NGA + b_Hasanta + b_G + b_Ukar) = True Then - Exit; // NGA+G - If Cnv('ngU', b_NGA + b_Hasanta + b_G + b_UUkar) = True Then - Exit; // NGA+G - If Cnv('nge', b_NGA + b_Hasanta + b_G + b_Ekar) = True Then - Exit; // NGA+G - If Cnv('ngO', b_NGA + b_Hasanta + b_G + b_Okar) = True Then - Exit; // NGA+G - If Cnv('NDh', b_Nn + b_Hasanta + b_Ddh) = True Then - Exit; // Nn+Ddh - - If Cnv('nsh', b_N + b_Sh) = True Then - Exit; // N & Sh - - If Cnv('Ngr', b_NGA + b_R) = True Then - Exit; // NGA & R - If Cnv('NGr', b_NYA + b_R) = True Then - Exit; // NYA & R - If Cnv('ngr', b_Anushar + b_R) = True Then - Exit; // Anushar & R - - If Cnv('nj', b_NYA + b_Hasanta + b_J) = True Then - Exit; // NYA+J - If Cnv('Ng', b_NGA) = True Then - Exit; // NGA - If Cnv('NG', b_NYA) = True Then - Exit; // NYA - If Cnv('nk', b_NGA + b_Hasanta + b_K) = True Then - Exit; // NGA+K - If Cnv('ng', b_Anushar) = True Then - Exit; // Anushar - If Cnv('nn', b_N + b_Hasanta + b_N) = True Then - Exit; // N+N - If Cnv('NN', b_Nn + b_Hasanta + b_Nn) = True Then - Exit; // Nn+Nn - If Cnv('Nn', b_Nn + b_Hasanta + b_N) = True Then - Exit; // Nn+N - If Cnv('nm', b_N + b_Hasanta + b_M) = True Then - Exit; // N+M - If Cnv('Nm', b_Nn + b_Hasanta + b_M) = True Then - Exit; // Nn+M - If Cnv('nd', b_N + b_Hasanta + b_D) = True Then - Exit; // N+D - If Cnv('nT', b_N + b_Hasanta + b_Tt) = True Then - Exit; // N+Tt - If Cnv('NT', b_Nn + b_Hasanta + b_Tt) = True Then - Exit; // Nn+Tt - If Cnv('nD', b_N + b_Hasanta + b_Dd) = True Then - Exit; // N+Dd - If Cnv('ND', b_Nn + b_Hasanta + b_Dd) = True Then - Exit; // Nn+Dd - If Cnv('nt', b_N + b_Hasanta + b_T) = True Then - Exit; // N+T - If Cnv('ns', b_N + b_Hasanta + b_S) = True Then - Exit; // N+S - If Cnv('nc', b_NYA + b_Hasanta + b_C) = True Then - Exit; // NYA+C - - If Cnv('n', b_N) = True Then - Exit; // N - If Cnv('N', b_Nn) = True Then - Exit; // N + If Cnv('NgkSh', b_NGA + b_Hasanta + b_K + b_Hasanta + b_Ss) = True Then + Exit; // NGA+Khio + If Cnv('Ngkkh', b_NGA + b_Hasanta + b_K + b_Hasanta + b_Ss) = True Then + Exit; // NGA+Khio + + If Cnv('NGch', b_NYA + b_Hasanta + b_CH) = True Then + Exit; // NYA+Ch + If Cnv('Nggh', b_NGA + b_Hasanta + b_GH) = True Then + Exit; // NGA+Gh + If Cnv('Ngkh', b_NGA + b_Hasanta + b_KH) = True Then + Exit; // NGA+Kh + If Cnv('NGjh', b_NYA + b_Hasanta + b_JH) = True Then + Exit; // NYA+Jh + If Cnv('ngOU', b_NGA + b_Hasanta + b_G + b_OUkar) = True Then + Exit; // NGA+G + If Cnv('ngOI', b_NGA + b_Hasanta + b_G + b_OIkar) = True Then + Exit; // NGA+G + If Cnv('Ngkx', b_NGA + b_Hasanta + b_K + b_Hasanta + b_Ss) = True Then + Exit; // NGA+Khio + + If Cnv('NGc', b_NYA + b_Hasanta + b_C) = True Then + Exit; // NYA+Ch + If Cnv('nch', b_NYA + b_Hasanta + b_CH) = True Then + Exit; // NYA+Ch + If Cnv('njh', b_NYA + b_Hasanta + b_JH) = True Then + Exit; // NYA+Jh + If Cnv('ngh', b_NGA + b_Hasanta + b_GH) = True Then + Exit; // NGA+Gh + If Cnv('Ngk', b_NGA + b_Hasanta + b_K) = True Then + Exit; // NGA+K + If Cnv('Ngx', b_NGA + b_Hasanta + b_Ss) = True Then + Exit; // NGA+Khio + If Cnv('Ngg', b_NGA + b_Hasanta + b_G) = True Then + Exit; // NGA+G + If Cnv('Ngm', b_NGA + b_Hasanta + b_M) = True Then + Exit; // NGA+M + If Cnv('NGj', b_NYA + b_Hasanta + b_J) = True Then + Exit; // NYA+J + If Cnv('ndh', b_N + b_Hasanta + b_Dh) = True Then + Exit; // N+Dh + If Cnv('nTh', b_N + b_Hasanta + b_Tth) = True Then + Exit; // N+Tth + If Cnv('NTh', b_Nn + b_Hasanta + b_Tth) = True Then + Exit; // Nn+Tth + If Cnv('nth', b_N + b_Hasanta + b_Th) = True Then + Exit; // N+Th + If Cnv('nkh', b_NGA + b_Hasanta + b_KH) = True Then + Exit; // NGA+Kh + If Cnv('ngo', b_NGA + b_Hasanta + b_G) = True Then + Exit; // NGA+G + If Cnv('nga', b_NGA + b_Hasanta + b_G + b_AAkar) = True Then + Exit; // NGA+G + If Cnv('ngi', b_NGA + b_Hasanta + b_G + b_Ikar) = True Then + Exit; // NGA+G + If Cnv('ngI', b_NGA + b_Hasanta + b_G + b_IIkar) = True Then + Exit; // NGA+G + If Cnv('ngu', b_NGA + b_Hasanta + b_G + b_Ukar) = True Then + Exit; // NGA+G + If Cnv('ngU', b_NGA + b_Hasanta + b_G + b_UUkar) = True Then + Exit; // NGA+G + If Cnv('nge', b_NGA + b_Hasanta + b_G + b_Ekar) = True Then + Exit; // NGA+G + If Cnv('ngO', b_NGA + b_Hasanta + b_G + b_Okar) = True Then + Exit; // NGA+G + If Cnv('NDh', b_Nn + b_Hasanta + b_Ddh) = True Then + Exit; // Nn+Ddh + + If Cnv('nsh', b_N + b_Sh) = True Then + Exit; // N & Sh + + If Cnv('Ngr', b_NGA + b_R) = True Then + Exit; // NGA & R + If Cnv('NGr', b_NYA + b_R) = True Then + Exit; // NYA & R + If Cnv('ngr', b_Anushar + b_R) = True Then + Exit; // Anushar & R + + If Cnv('nj', b_NYA + b_Hasanta + b_J) = True Then + Exit; // NYA+J + If Cnv('Ng', b_NGA) = True Then + Exit; // NGA + If Cnv('NG', b_NYA) = True Then + Exit; // NYA + If Cnv('nk', b_NGA + b_Hasanta + b_K) = True Then + Exit; // NGA+K + If Cnv('ng', b_Anushar) = True Then + Exit; // Anushar + If Cnv('nn', b_N + b_Hasanta + b_N) = True Then + Exit; // N+N + If Cnv('NN', b_Nn + b_Hasanta + b_Nn) = True Then + Exit; // Nn+Nn + If Cnv('Nn', b_Nn + b_Hasanta + b_N) = True Then + Exit; // Nn+N + If Cnv('nm', b_N + b_Hasanta + b_M) = True Then + Exit; // N+M + If Cnv('Nm', b_Nn + b_Hasanta + b_M) = True Then + Exit; // Nn+M + If Cnv('nd', b_N + b_Hasanta + b_D) = True Then + Exit; // N+D + If Cnv('nT', b_N + b_Hasanta + b_Tt) = True Then + Exit; // N+Tt + If Cnv('NT', b_Nn + b_Hasanta + b_Tt) = True Then + Exit; // Nn+Tt + If Cnv('nD', b_N + b_Hasanta + b_Dd) = True Then + Exit; // N+Dd + If Cnv('ND', b_Nn + b_Hasanta + b_Dd) = True Then + Exit; // Nn+Dd + If Cnv('nt', b_N + b_Hasanta + b_T) = True Then + Exit; // N+T + If Cnv('ns', b_N + b_Hasanta + b_S) = True Then + Exit; // N+S + If Cnv('nc', b_NYA + b_Hasanta + b_C) = True Then + Exit; // NYA+C + + If Cnv('n', b_N) = True Then + Exit; // N + If Cnv('N', b_Nn) = True Then + Exit; // N End; { =============================================================================== } Function TEnglishToBangla.NextT: String; Begin - NextT := MidStr(pEnglishText, pos + 1, 1); + NextT := MidStr(pEnglishText, pos + 1, 1); End; { =============================================================================== } Function TEnglishToBangla.NextTEx(iLength: Integer; skipstart: Integer): String; Begin - If iLength < 1 Then - iLength := 1; + If iLength < 1 Then + iLength := 1; - NextTEx := MidStr(pEnglishText, pos + skipstart + 1, iLength); + NextTEx := MidStr(pEnglishText, pos + skipstart + 1, iLength); End; { =============================================================================== } Procedure TEnglishToBangla.O; Begin - If Cnv('OI`', b_OIkar) = True Then - Exit; // OIKar - If Cnv('OU`', b_OUkar) = True Then - Exit; // OUKar - - If Cnv('O`', b_Okar) = True Then - Exit; // OKar - - If (Consonent(PrevT) = False) Or (Begining = True) Then Begin - If Cnv('OI', b_OI) = True Then - Exit; // OI - If Cnv('OU', b_OU) = True Then - Exit; // OU - If Cnv('O', b_O) = True Then - Exit; // O - End - Else Begin - If Cnv('OI', b_OIkar) = True Then - Exit; // OIKar - If Cnv('OU', b_OUkar) = True Then - Exit; // OUKar - If Cnv('O', b_Okar) = True Then - Exit; // OKar - End; + If Cnv('OI`', b_OIkar) = True Then + Exit; // OIKar + If Cnv('OU`', b_OUkar) = True Then + Exit; // OUKar + + If Cnv('O`', b_Okar) = True Then + Exit; // OKar + + If (Consonent(PrevT) = False) Or (Begining = True) Then + Begin + If Cnv('OI', b_OI) = True Then + Exit; // OI + If Cnv('OU', b_OU) = True Then + Exit; // OU + If Cnv('O', b_O) = True Then + Exit; // O + End + Else + Begin + If Cnv('OI', b_OIkar) = True Then + Exit; // OIKar + If Cnv('OU', b_OUkar) = True Then + Exit; // OUKar + If Cnv('O', b_Okar) = True Then + Exit; // OKar + End; End; { =============================================================================== } Procedure TEnglishToBangla.p; Begin - If Cnv('phl', b_Ph + b_Hasanta + b_L) = True Then - Exit; // Ph+L - - If Cnv('pT', b_P + b_Hasanta + b_Tt) = True Then - Exit; // P+Tt - If Cnv('pt', b_P + b_Hasanta + b_T) = True Then - Exit; // P+T - If Cnv('pn', b_P + b_Hasanta + b_N) = True Then - Exit; // P+N - If Cnv('pp', b_P + b_Hasanta + b_P) = True Then - Exit; // P+P - If Cnv('pl', b_P + b_Hasanta + b_L) = True Then - Exit; // P+L - If Cnv('ps', b_P + b_Hasanta + b_S) = True Then - Exit; // P+S - If Cnv('ph', b_Ph) = True Then - Exit; // Ph - If Cnv('fl', b_Ph + b_Hasanta + b_L) = True Then - Exit; // Ph+L - - If Cnv('f', b_Ph) = True Then - Exit; // Ph - If Cnv('p', b_P) = True Then - Exit; // P + If Cnv('phl', b_Ph + b_Hasanta + b_L) = True Then + Exit; // Ph+L + + If Cnv('pT', b_P + b_Hasanta + b_Tt) = True Then + Exit; // P+Tt + If Cnv('pt', b_P + b_Hasanta + b_T) = True Then + Exit; // P+T + If Cnv('pn', b_P + b_Hasanta + b_N) = True Then + Exit; // P+N + If Cnv('pp', b_P + b_Hasanta + b_P) = True Then + Exit; // P+P + If Cnv('pl', b_P + b_Hasanta + b_L) = True Then + Exit; // P+L + If Cnv('ps', b_P + b_Hasanta + b_S) = True Then + Exit; // P+S + If Cnv('ph', b_Ph) = True Then + Exit; // Ph + If Cnv('fl', b_Ph + b_Hasanta + b_L) = True Then + Exit; // Ph+L + + If Cnv('f', b_Ph) = True Then + Exit; // Ph + If Cnv('p', b_P) = True Then + Exit; // P End; { =============================================================================== } Function TEnglishToBangla.PrevT: String; Var - i: Integer; + i: Integer; Begin - i := pos - 1; - If i < 1 Then Begin - PrevT := ''; - Exit; - End; + i := pos - 1; + If i < 1 Then + Begin + PrevT := ''; + Exit; + End; - PrevT := MidStr(pEnglishText, i, 1); + PrevT := MidStr(pEnglishText, i, 1); End; { =============================================================================== } Function TEnglishToBangla.PrevTEx(Const Position: Integer): String; Var - i: Integer; + i: Integer; Begin - i := pos - Position; - If i < 1 Then Begin - PrevTEx := ''; - Exit; - End; - - PrevTEx := MidStr(pEnglishText, i, 1); + i := pos - Position; + If i < 1 Then + Begin + PrevTEx := ''; + Exit; + End; + + PrevTEx := MidStr(pEnglishText, i, 1); End; { =============================================================================== } Procedure TEnglishToBangla.R; Begin - If NextTEx(1, 2) = '`' Then Begin - If Cnv('rri', b_RRIkar) = True Then - Exit; // RRI-Kar - End; - - If Consonent(PrevT) = False Then Begin - If Cnv('rri', b_RRI) = True Then - Exit; // RRI - End - Else If Begining = True Then Begin - If Cnv('rri', b_RRI) = True Then - Exit; // RRI - End - Else Begin - If Cnv('rri', b_RRIkar) = True Then - Exit; // RRI-Kar - End; - - If (Consonent(PrevT) = False) And (Vowel(NextTEx(1, 1)) = False) And (NextTEx(1, 1) <> 'r') And (NextTEx(1, 1) <> '') Then Begin - If Cnv('rr', b_R + b_Hasanta) = True Then - Exit; // Reph - End; - - If Cnv('Rg', b_Rr + b_Hasanta + b_G) = True Then - Exit; // Rh+G - If Cnv('Rh', b_Rrh) = True Then - Exit; // Rrh - - If (Consonent(PrevT) = True) And (PrevT <> 'r') And (PrevT <> 'y') And (PrevT <> 'w') And (PrevT <> 'x') And (PrevT <> 'Z') Then Begin - If Cnv('r', b_Hasanta + b_R) = True Then - Exit; // R-Fola - End - Else Begin - If Cnv('r', b_R) = True Then - Exit; // R - End; - - If Cnv('R', b_Rr) = True Then - Exit; // Rh + If NextTEx(1, 2) = '`' Then + Begin + If Cnv('rri', b_RRIkar) = True Then + Exit; // RRI-Kar + End; + + If Consonent(PrevT) = False Then + Begin + If Cnv('rri', b_RRI) = True Then + Exit; // RRI + End + Else If Begining = True Then + Begin + If Cnv('rri', b_RRI) = True Then + Exit; // RRI + End + Else + Begin + If Cnv('rri', b_RRIkar) = True Then + Exit; // RRI-Kar + End; + + If (Consonent(PrevT) = False) And (Vowel(NextTEx(1, 1)) = False) And + (NextTEx(1, 1) <> 'r') And (NextTEx(1, 1) <> '') Then + Begin + If Cnv('rr', b_R + b_Hasanta) = True Then + Exit; // Reph + End; + + If Cnv('Rg', b_Rr + b_Hasanta + b_G) = True Then + Exit; // Rh+G + If Cnv('Rh', b_Rrh) = True Then + Exit; // Rrh + + If (Consonent(PrevT) = True) And (PrevT <> 'r') And (PrevT <> 'y') And + (PrevT <> 'w') And (PrevT <> 'x') And (PrevT <> 'Z') Then + Begin + If Cnv('r', b_Hasanta + b_R) = True Then + Exit; // R-Fola + End + Else + Begin + If Cnv('r', b_R) = True Then + Exit; // R + End; + + If Cnv('R', b_Rr) = True Then + Exit; // Rh End; { =============================================================================== } Procedure TEnglishToBangla.s; Begin - If Cnv('shch', b_Sh + b_Hasanta + b_CH) = True Then - Exit; // Sh+Chh - If Cnv('ShTh', b_Ss + b_Hasanta + b_Tth) = True Then - Exit; // Sh+Tth - If Cnv('Shph', b_Ss + b_Hasanta + b_Ph) = True Then - Exit; // Sh+Ph - - If Cnv('Sch', b_Sh + b_Hasanta + b_CH) = True Then - Exit; // Sh+Chh - If Cnv('skl', b_S + b_Hasanta + b_K + b_Hasanta + b_L) = True Then - Exit; // S+K+L - If Cnv('skh', b_S + b_Hasanta + b_KH) = True Then - Exit; // S+Kh - If Cnv('sth', b_S + b_Hasanta + b_Th) = True Then - Exit; // S+Th - If Cnv('sph', b_S + b_Hasanta + b_Ph) = True Then - Exit; // S+Ph - If Cnv('shc', b_Sh + b_Hasanta + b_C) = True Then - Exit; // Sh+C - If Cnv('sht', b_Sh + b_Hasanta + b_T) = True Then - Exit; // Sh+T - If Cnv('shn', b_Sh + b_Hasanta + b_N) = True Then - Exit; // Sh+N - If Cnv('shm', b_Sh + b_Hasanta + b_M) = True Then - Exit; // Sh+M - If Cnv('shl', b_Sh + b_Hasanta + b_L) = True Then - Exit; // Sh+L - If Cnv('Shk', b_Ss + b_Hasanta + b_K) = True Then - Exit; // Sh+K - If Cnv('ShT', b_Ss + b_Hasanta + b_Tt) = True Then - Exit; // Sh+Tt - If Cnv('ShN', b_Ss + b_Hasanta + b_Nn) = True Then - Exit; // Sh+Nn - If Cnv('Shp', b_Ss + b_Hasanta + b_P) = True Then - Exit; // Sh+P - If Cnv('Shf', b_Ss + b_Hasanta + b_Ph) = True Then - Exit; // Sh+Ph - If Cnv('Shm', b_Ss + b_Hasanta + b_M) = True Then - Exit; // Sh+M - If Cnv('spl', b_S + b_Hasanta + b_P + b_Hasanta + b_L) = True Then - Exit; // s+p+l - - If Cnv('sk', b_S + b_Hasanta + b_K) = True Then - Exit; // S+K - If Cnv('Sc', b_Sh + b_Hasanta + b_C) = True Then - Exit; // Sh+Ch - If Cnv('sT', b_S + b_Hasanta + b_Tt) = True Then - Exit; // S+Tt - If Cnv('st', b_S + b_Hasanta + b_T) = True Then - Exit; // S+T - If Cnv('sn', b_S + b_Hasanta + b_N) = True Then - Exit; // S+N - If Cnv('sp', b_S + b_Hasanta + b_P) = True Then - Exit; // S+P - If Cnv('sf', b_S + b_Hasanta + b_Ph) = True Then - Exit; // S+Ph - If Cnv('sm', b_S + b_Hasanta + b_M) = True Then - Exit; // S+M - If Cnv('sl', b_S + b_Hasanta + b_L) = True Then - Exit; // S+L - If Cnv('sh', b_Sh) = True Then - Exit; // Sh - If Cnv('Sc', b_Sh + b_Hasanta + b_C) = True Then - Exit; // Sh+Ch - If Cnv('St', b_Sh + b_Hasanta + b_T) = True Then - Exit; // Sh+T - If Cnv('Sn', b_Sh + b_Hasanta + b_N) = True Then - Exit; // Sh+N - If Cnv('Sm', b_Sh + b_Hasanta + b_M) = True Then - Exit; // Sh+M - If Cnv('Sl', b_Sh + b_Hasanta + b_L) = True Then - Exit; // Sh+L - If Cnv('Sh', b_Ss) = True Then - Exit; // Sh - - If Cnv('s', b_S) = True Then - Exit; // S - If Cnv('S', b_Sh) = True Then - Exit; // Sh + If Cnv('shch', b_Sh + b_Hasanta + b_CH) = True Then + Exit; // Sh+Chh + If Cnv('ShTh', b_Ss + b_Hasanta + b_Tth) = True Then + Exit; // Sh+Tth + If Cnv('Shph', b_Ss + b_Hasanta + b_Ph) = True Then + Exit; // Sh+Ph + + If Cnv('Sch', b_Sh + b_Hasanta + b_CH) = True Then + Exit; // Sh+Chh + If Cnv('skl', b_S + b_Hasanta + b_K + b_Hasanta + b_L) = True Then + Exit; // S+K+L + If Cnv('skh', b_S + b_Hasanta + b_KH) = True Then + Exit; // S+Kh + If Cnv('sth', b_S + b_Hasanta + b_Th) = True Then + Exit; // S+Th + If Cnv('sph', b_S + b_Hasanta + b_Ph) = True Then + Exit; // S+Ph + If Cnv('shc', b_Sh + b_Hasanta + b_C) = True Then + Exit; // Sh+C + If Cnv('sht', b_Sh + b_Hasanta + b_T) = True Then + Exit; // Sh+T + If Cnv('shn', b_Sh + b_Hasanta + b_N) = True Then + Exit; // Sh+N + If Cnv('shm', b_Sh + b_Hasanta + b_M) = True Then + Exit; // Sh+M + If Cnv('shl', b_Sh + b_Hasanta + b_L) = True Then + Exit; // Sh+L + If Cnv('Shk', b_Ss + b_Hasanta + b_K) = True Then + Exit; // Sh+K + If Cnv('ShT', b_Ss + b_Hasanta + b_Tt) = True Then + Exit; // Sh+Tt + If Cnv('ShN', b_Ss + b_Hasanta + b_Nn) = True Then + Exit; // Sh+Nn + If Cnv('Shp', b_Ss + b_Hasanta + b_P) = True Then + Exit; // Sh+P + If Cnv('Shf', b_Ss + b_Hasanta + b_Ph) = True Then + Exit; // Sh+Ph + If Cnv('Shm', b_Ss + b_Hasanta + b_M) = True Then + Exit; // Sh+M + If Cnv('spl', b_S + b_Hasanta + b_P + b_Hasanta + b_L) = True Then + Exit; // s+p+l + + If Cnv('sk', b_S + b_Hasanta + b_K) = True Then + Exit; // S+K + If Cnv('Sc', b_Sh + b_Hasanta + b_C) = True Then + Exit; // Sh+Ch + If Cnv('sT', b_S + b_Hasanta + b_Tt) = True Then + Exit; // S+Tt + If Cnv('st', b_S + b_Hasanta + b_T) = True Then + Exit; // S+T + If Cnv('sn', b_S + b_Hasanta + b_N) = True Then + Exit; // S+N + If Cnv('sp', b_S + b_Hasanta + b_P) = True Then + Exit; // S+P + If Cnv('sf', b_S + b_Hasanta + b_Ph) = True Then + Exit; // S+Ph + If Cnv('sm', b_S + b_Hasanta + b_M) = True Then + Exit; // S+M + If Cnv('sl', b_S + b_Hasanta + b_L) = True Then + Exit; // S+L + If Cnv('sh', b_Sh) = True Then + Exit; // Sh + If Cnv('Sc', b_Sh + b_Hasanta + b_C) = True Then + Exit; // Sh+Ch + If Cnv('St', b_Sh + b_Hasanta + b_T) = True Then + Exit; // Sh+T + If Cnv('Sn', b_Sh + b_Hasanta + b_N) = True Then + Exit; // Sh+N + If Cnv('Sm', b_Sh + b_Hasanta + b_M) = True Then + Exit; // Sh+M + If Cnv('Sl', b_Sh + b_Hasanta + b_L) = True Then + Exit; // Sh+L + If Cnv('Sh', b_Ss) = True Then + Exit; // Sh + + If Cnv('s', b_S) = True Then + Exit; // S + If Cnv('S', b_Sh) = True Then + Exit; // Sh End; { =============================================================================== } Procedure TEnglishToBangla.smallO; Begin - If ((Consonent(PrevT) = False) Or (Begining = True)) And (NextT <> '`') Then Begin - If Cnv('oo', b_U) = True Then - Exit; // U - If Cnv('oZ', b_A + b_Hasanta + b_Z) = True Then - Exit; // U - - If (Vowel(PrevT) = True) And (PrevT <> 'o') Then Begin - If Cnv('o', b_O) = True Then - Exit; // O - End - Else If Cnv('o', b_A) = True Then - Exit; // A - End; - - If Cnv('oo', b_Ukar) = True Then - Exit; // U Kar - If Cnv('o`', '') = True Then - Exit; // Nothing - If Cnv('o', '') = True Then - Exit; // Nothing + If ((Consonent(PrevT) = False) Or (Begining = True)) And (NextT <> '`') Then + Begin + If Cnv('oo', b_U) = True Then + Exit; // U + If Cnv('oZ', b_A + b_Hasanta + b_Z) = True Then + Exit; // U + + If (Vowel(PrevT) = True) And (PrevT <> 'o') Then + Begin + If Cnv('o', b_O) = True Then + Exit; // O + End + Else If Cnv('o', b_A) = True Then + Exit; // A + End; + + If Cnv('oo', b_Ukar) = True Then + Exit; // U Kar + If Cnv('o`', '') = True Then + Exit; // Nothing + If Cnv('o', '') = True Then + Exit; // Nothing End; { =============================================================================== } Procedure TEnglishToBangla.T; Begin - If Cnv('tth', b_T + b_Hasanta + b_Th) = True Then - Exit; // T+Th - If Cnv('t``', b_Khandatta) = True Then - Exit; // Khandatta - - If Cnv('TT', b_Tt + b_Hasanta + b_Tt) = True Then - Exit; // Tt+Tt - If Cnv('Tm', b_Tt + b_Hasanta + b_M) = True Then - Exit; // Tt+M - If Cnv('Th', b_Tth) = True Then - Exit; // Tth - If Cnv('tn', b_T + b_Hasanta + b_N) = True Then - Exit; // T+N - If Cnv('tm', b_T + b_Hasanta + b_M) = True Then - Exit; // T+M - If Cnv('th', b_Th) = True Then - Exit; // Th - If Cnv('tt', b_T + b_Hasanta + b_T) = True Then - Exit; // T+T - - If Cnv('T', b_Tt) = True Then - Exit; // Tt - If Cnv('t', b_T) = True Then - Exit; // T + If Cnv('tth', b_T + b_Hasanta + b_Th) = True Then + Exit; // T+Th + If Cnv('t``', b_Khandatta) = True Then + Exit; // Khandatta + + If Cnv('TT', b_Tt + b_Hasanta + b_Tt) = True Then + Exit; // Tt+Tt + If Cnv('Tm', b_Tt + b_Hasanta + b_M) = True Then + Exit; // Tt+M + If Cnv('Th', b_Tth) = True Then + Exit; // Tth + If Cnv('tn', b_T + b_Hasanta + b_N) = True Then + Exit; // T+N + If Cnv('tm', b_T + b_Hasanta + b_M) = True Then + Exit; // T+M + If Cnv('th', b_Th) = True Then + Exit; // Th + If Cnv('tt', b_T + b_Hasanta + b_T) = True Then + Exit; // T+T + + If Cnv('T', b_Tt) = True Then + Exit; // Tt + If Cnv('t', b_T) = True Then + Exit; // T End; { =============================================================================== } @@ -1409,40 +1460,39 @@ Function TEnglishToBangla.Vowel(Const T: String): Boolean; Var - myT: String; + myT: String; Begin - Result := False; - myT := LowerCase(T); - If length(myT) > 0 Then - myT := myT[1]; - If (myT = 'a') Or (myT = 'e') Or (myT = 'i') Or (myT = 'o') Or (myT = 'u') Then - Result := True - Else - Result := False; + Result := False; + myT := LowerCase(T); + If length(myT) > 0 Then + myT := myT[1]; + If (myT = 'a') Or (myT = 'e') Or (myT = 'i') Or (myT = 'o') Or + (myT = 'u') Then + Result := True + Else + Result := False; End; - Function TEnglishToBangla.Number(Const T: String): Boolean; Var - temp: Char; - myT: String; + temp: Char; + myT: String; Begin - Result := False; - myT := LowerCase(T); - temp := #0; - If length(myT) > 0 Then - temp := myT[1]; - - Case temp Of - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - Number := True; - Else - Number := False; - End; + Result := False; + myT := LowerCase(T); + temp := #0; + If length(myT) > 0 Then + temp := myT[1]; + + Case temp Of + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + Number := True; + Else + Number := False; + End; End; {$HINTS On} - End. diff --git a/Keyboard and Spell checker/Classes/clsFileVersion.pas b/Keyboard and Spell checker/Classes/clsFileVersion.pas index 5b34d16..a668ff6 100644 --- a/Keyboard and Spell checker/Classes/clsFileVersion.pas +++ b/Keyboard and Spell checker/Classes/clsFileVersion.pas @@ -1,25 +1,25 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= @@ -30,163 +30,160 @@ {$ELSE} {$INCLUDE ../ProjectDefines.inc} {$ENDIF} - -{COMPLETE TRANSFERING!} +{ COMPLETE TRANSFERING! } Unit clsFileVersion; Interface Uses Windows, - SysUtils, - Classes, - Forms; + SysUtils, + Classes, + Forms; Type - {TFileVersion Class} - TFileVersion = Class(TObject) - Private - FMajor, FMinor, - FRelease, FBuild: word; - FFileName: String; - Procedure SetFFileName(Const AValue: String); - Function GetAsString: String; - Function GetAsStringZero: String; - Function GetAsHex: String; - Function GetAsHexDelim: String; - Function GetAsInt64: Int64; - Protected - Procedure GetVersionInfo; - Public - Constructor Create(Const AFileName: String = ''); - // Properties - Property FileName: String Read FFileName Write SetFFileName; - Property VerMajor: word Read FMajor; - Property VerMinor: word Read FMinor; - Property VerRelease: word Read FRelease; - Property VerBuild: word Read FBuild; - Property AsString: String Read GetAsString; - Property AsStringZero: String Read GetAsStringZero; - Property AsHex: String Read GetAsHex; - Property AsHexDelim: String Read GetAsHexDelim; - Property AsInt64: Int64 Read GetAsInt64; - End; - + { TFileVersion Class } + TFileVersion = Class(TObject) + Private + FMajor, FMinor, FRelease, FBuild: word; + FFileName: String; + Procedure SetFFileName(Const AValue: String); + Function GetAsString: String; + Function GetAsStringZero: String; + Function GetAsHex: String; + Function GetAsHexDelim: String; + Function GetAsInt64: Int64; + Protected + Procedure GetVersionInfo; + Public + Constructor Create(Const AFileName: String = ''); + // Properties + Property FileName: String Read FFileName Write SetFFileName; + Property VerMajor: word Read FMajor; + Property VerMinor: word Read FMinor; + Property VerRelease: word Read FRelease; + Property VerBuild: word Read FBuild; + Property AsString: String Read GetAsString; + Property AsStringZero: String Read GetAsStringZero; + Property AsHex: String Read GetAsHex; + Property AsHexDelim: String Read GetAsHexDelim; + Property AsInt64: Int64 Read GetAsInt64; + End; Implementation Uses - uFileFolderHandling; + uFileFolderHandling; -{===============================================================================} +{ =============================================================================== } Constructor TFileVersion.Create(Const AFileName: String = ''); Begin - Inherited Create; - - If AFileName = '' Then - {$IFNDEF SpellCheckerDll} - FFileName := Application.ExeName - {$ELSE} - FFileName := GetDllFullPath - {$ENDIF} - Else - FFileName := AFileName; - - GetVersionInfo; + Inherited Create; + + If AFileName = '' Then +{$IFNDEF SpellCheckerDll} + FFileName := Application.ExeName +{$ELSE} + FFileName := GetDllFullPath +{$ENDIF} + Else + FFileName := AFileName; + + GetVersionInfo; End; -{===============================================================================} +{ =============================================================================== } Procedure TFileVersion.SetFFileName(Const AValue: String); Begin - FFileName := AValue; - GetVersionInfo; + FFileName := AValue; + GetVersionInfo; End; -{===============================================================================} +{ =============================================================================== } Function TFileVersion.GetAsString: String; Begin - Result := IntToStr(FMajor) + '.' + IntToStr(FMinor) + '.' + - IntToStr(FRelease) + '.' + IntToStr(FBuild); + Result := IntToStr(FMajor) + '.' + IntToStr(FMinor) + '.' + IntToStr(FRelease) + + '.' + IntToStr(FBuild); End; -{===============================================================================} +{ =============================================================================== } Function TFileVersion.GetAsStringZero: String; Begin - Result := FormatFloat('000', FMajor Mod 1000) + '.' + - FormatFloat('000', FMinor Mod 1000) + '.' + - FormatFloat('000', FRelease Mod 1000) + '.' + - FormatFloat('000', FBuild Mod 1000); + Result := FormatFloat('000', FMajor Mod 1000) + '.' + + FormatFloat('000', FMinor Mod 1000) + '.' + FormatFloat('000', + FRelease Mod 1000) + '.' + FormatFloat('000', FBuild Mod 1000); End; -{===============================================================================} +{ =============================================================================== } Function TFileVersion.GetAsHex: String; Begin - Result := IntToHex(FMajor, 4) + IntToHex(FMinor, 4) + - IntToHex(FRelease, 4) + IntToHex(FBuild, 4); + Result := IntToHex(FMajor, 4) + IntToHex(FMinor, 4) + IntToHex(FRelease, 4) + + IntToHex(FBuild, 4); End; -{===============================================================================} +{ =============================================================================== } Function TFileVersion.GetAsHexDelim: String; Begin - Result := IntToHex(FMajor, 4) + '-' + IntToHex(FMinor, 4) + '-' + - IntToHex(FRelease, 4) + '-' + IntToHex(FBuild, 4); + Result := IntToHex(FMajor, 4) + '-' + IntToHex(FMinor, 4) + '-' + + IntToHex(FRelease, 4) + '-' + IntToHex(FBuild, 4); End; -{===============================================================================} +{ =============================================================================== } Function TFileVersion.GetAsInt64: Int64; Var - iResult : Int64; + iResult: Int64; Begin - iResult := FMajor; - iResult := (iResult Shl 16) + FMinor; - iResult := (iResult Shl 16) + FRelease; - iResult := (iResult Shl 16) + FBuild; + iResult := FMajor; + iResult := (iResult Shl 16) + FMinor; + iResult := (iResult Shl 16) + FRelease; + iResult := (iResult Shl 16) + FBuild; - Result := iResult; + Result := iResult; End; -{===============================================================================} +{ =============================================================================== } Procedure TFileVersion.GetVersionInfo; Var - iVerInfoSize, iVerValueSize, iDummy: DWORD; - pVerInfo : Pointer; - rVerValue : PVSFixedFileInfo; + iVerInfoSize, iVerValueSize, iDummy: DWORD; + pVerInfo: Pointer; + rVerValue: PVSFixedFileInfo; Begin - FMajor := 0; - FMinor := 0; - FRelease := 0; - FBuild := 0; - iVerInfoSize := GetFileVersionInfoSize(PChar(FFileName), iDummy); - - If iVerInfoSize > 0 Then Begin - GetMem(pVerInfo, iVerInfoSize); - - Try - GetFileVersionInfo(PChar(FFileName), 0, iVerInfoSize, pVerInfo); - VerQueryValue(pVerInfo, '\', Pointer(rVerValue), iVerValueSize); - - With rVerValue^ Do Begin - FMajor := dwFileVersionMS Shr 16; - FMinor := dwFileVersionMS And $FFFF; - FRelease := dwFileVersionLS Shr 16; - FBuild := dwFileVersionLS And $FFFF; - End; - Finally - FreeMem(pVerInfo, iVerInfoSize); - End; - End; + FMajor := 0; + FMinor := 0; + FRelease := 0; + FBuild := 0; + iVerInfoSize := GetFileVersionInfoSize(PChar(FFileName), iDummy); + + If iVerInfoSize > 0 Then + Begin + GetMem(pVerInfo, iVerInfoSize); + + Try + GetFileVersionInfo(PChar(FFileName), 0, iVerInfoSize, pVerInfo); + VerQueryValue(pVerInfo, '\', Pointer(rVerValue), iVerValueSize); + + With rVerValue^ Do + Begin + FMajor := dwFileVersionMS Shr 16; + FMinor := dwFileVersionMS And $FFFF; + FRelease := dwFileVersionLS Shr 16; + FBuild := dwFileVersionLS And $FFFF; + End; + Finally + FreeMem(pVerInfo, iVerInfoSize); + End; + End; End; -{===============================================================================} +{ =============================================================================== } End. - diff --git a/Keyboard and Spell checker/Classes/clsGenericLayoutModern.pas b/Keyboard and Spell checker/Classes/clsGenericLayoutModern.pas index d3890a6..9e15401 100644 --- a/Keyboard and Spell checker/Classes/clsGenericLayoutModern.pas +++ b/Keyboard and Spell checker/Classes/clsGenericLayoutModern.pas @@ -1,729 +1,822 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - -{COMPLETE TRANSFERING!} +{ COMPLETE TRANSFERING! } Unit clsGenericLayoutModern; Interface Uses - classes, - sysutils, - StrUtils, - clsUnicodeToBijoy2000 ; + classes, + sysutils, + StrUtils, + clsUnicodeToBijoy2000; Const - TrackL = 100; + TrackL = 100; - //Skeleton of Class TGenericLayoutModern + // Skeleton of Class TGenericLayoutModern Type - TGenericLayoutModern = Class - Private - Bijoy: TUnicodeToBijoy2000; - LastChar: String; - DeadKey: Boolean; - DeadKeyChars: String; - DetermineZWNJ_ZWJ: String; - LastChars: Array[1..TrackL] Of String; - PrevBanglaT, NewBanglaText: String; - - Procedure InternalBackspace(KeyRepeat: Integer = 1); - Procedure DoBackspace(Var Block: Boolean); - Procedure ParseAndSendNow; - Function InsertKar(Const sKar: String): String; - Function InsertReph: String; - Procedure DeleteLastCharSteps_Ex(StepCount: Integer); - Procedure SetLastChar(Const wChar: String); - Procedure ResetLastChar; - Function MyProcessVKeyDown(Const KeyCode: Integer; - Var Block: Boolean; Const var_IfShift, var_IfTrueShift, var_IfAltGr: Boolean): String; - Procedure MyProcessVKeyUP(Const KeyCode: Integer; - Var Block: Boolean; Const var_IfShift: Boolean; Const var_IfTrueShift: Boolean; Const var_IfAltGr: Boolean); - - Function IsDeadKeyChar(Const CheckS: String): Boolean; - - Public - Constructor Create; //Initializer - Destructor Destroy; Override; //Destructor - - Function ProcessVKeyDown(Const KeyCode: Integer; Var Block: Boolean): String; - Procedure ProcessVKeyUP(Const KeyCode: Integer; Var Block: Boolean); - Procedure ResetDeadKey; - End; + TGenericLayoutModern = Class + Private + Bijoy: TUnicodeToBijoy2000; + LastChar: String; + DeadKey: Boolean; + DeadKeyChars: String; + DetermineZWNJ_ZWJ: String; + LastChars: Array [1 .. TrackL] Of String; + PrevBanglaT, NewBanglaText: String; + + Procedure InternalBackspace(KeyRepeat: Integer = 1); + Procedure DoBackspace(Var Block: Boolean); + Procedure ParseAndSendNow; + Function InsertKar(Const sKar: String): String; + Function InsertReph: String; + Procedure DeleteLastCharSteps_Ex(StepCount: Integer); + Procedure SetLastChar(Const wChar: String); + Procedure ResetLastChar; + Function MyProcessVKeyDown(Const KeyCode: Integer; Var Block: Boolean; + Const var_IfShift, var_IfTrueShift, var_IfAltGr: Boolean): String; + Procedure MyProcessVKeyUP(Const KeyCode: Integer; Var Block: Boolean; + Const var_IfShift: Boolean; Const var_IfTrueShift: Boolean; + Const var_IfAltGr: Boolean); + + Function IsDeadKeyChar(Const CheckS: String): Boolean; + + Public + Constructor Create; // Initializer + Destructor Destroy; Override; // Destructor + + Function ProcessVKeyDown(Const KeyCode: Integer; + Var Block: Boolean): String; + Procedure ProcessVKeyUP(Const KeyCode: Integer; Var Block: Boolean); + Procedure ResetDeadKey; + End; Implementation Uses - uRegistrySettings, - Banglachars, - KeyboardFunctions, - uForm1, - KeyboardLayoutLoader, - clsLayout, - VirtualKeycode, - WindowsVersion; + uRegistrySettings, + Banglachars, + KeyboardFunctions, + uForm1, + KeyboardLayoutLoader, + clsLayout, + VirtualKeycode, + WindowsVersion; -{===============================================================================} +{ =============================================================================== } { TGenericLayoutModern } Constructor TGenericLayoutModern.Create; Begin - Inherited; - //:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=: - //Initialize DeadKeyChar Variable - //:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= - //Standards Symbols + Inherited; + // :=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=: + // Initialize DeadKeyChar Variable + // :=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= + // Standards Symbols - DeadKeyChars := '`~!@#$%^+*-_=+\|"/;:,./?><()[]{}' + #39; + DeadKeyChars := '`~!@#$%^+*-_=+\|"/;:,./?><()[]{}' + #39; - //English Numbers + Letters - DeadKeyChars := DeadKeyChars + '1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM'; + // English Numbers + Letters + DeadKeyChars := DeadKeyChars + + '1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM'; - //Bangla Numbers - DeadKeyChars := DeadKeyChars + b_0 + b_1 + b_2 + b_3 + b_4 + b_5 + b_6 + b_7 + b_8 + b_9; + // Bangla Numbers + DeadKeyChars := DeadKeyChars + b_0 + b_1 + b_2 + b_3 + b_4 + b_5 + b_6 + b_7 + + b_8 + b_9; - //Bangla Vowels + Kars - DeadKeyChars := DeadKeyChars + b_A + b_AA + b_AAkar + b_I + b_II + b_IIkar + b_Ikar + b_U + b_Ukar + b_UU + b_UUkar + b_RRI + b_RRIkar + b_E + b_Ekar + b_O + b_OI + b_OIkar + b_Okar + b_OU + b_OUkar; + // Bangla Vowels + Kars + DeadKeyChars := DeadKeyChars + b_A + b_AA + b_AAkar + b_I + b_II + b_IIkar + + b_Ikar + b_U + b_Ukar + b_UU + b_UUkar + b_RRI + b_RRIkar + b_E + b_Ekar + + b_O + b_OI + b_OIkar + b_Okar + b_OU + b_OUkar; - //Bangla Unusual Vowels + Kars - DeadKeyChars := DeadKeyChars + b_Vocalic_L + b_Vocalic_LL + b_Vocalic_RR + b_Vocalic_RR_Kar + b_Vocalic_L_Kar + b_Vocalic_LL_Kar; + // Bangla Unusual Vowels + Kars + DeadKeyChars := DeadKeyChars + b_Vocalic_L + b_Vocalic_LL + b_Vocalic_RR + + b_Vocalic_RR_Kar + b_Vocalic_L_Kar + b_Vocalic_LL_Kar; - //Bangla Symbols/Signs - DeadKeyChars := DeadKeyChars + b_Anushar + b_Bisharga + b_Khandatta + b_Dari + b_Taka; + // Bangla Symbols/Signs + DeadKeyChars := DeadKeyChars + b_Anushar + b_Bisharga + b_Khandatta + + b_Dari + b_Taka; - //Bangla Unusal Symbols/Signs - DeadKeyChars := DeadKeyChars + b_LengthMark + b_RupeeMark + b_CurrencyNumerator1 + b_CurrencyNumerator2 + b_CurrencyNumerator3 + b_CurrencyNumerator4 + b_CurrencyNumerator1LessThanDenominator + b_CurrencyDenominator16; + // Bangla Unusal Symbols/Signs + DeadKeyChars := DeadKeyChars + b_LengthMark + b_RupeeMark + + b_CurrencyNumerator1 + b_CurrencyNumerator2 + b_CurrencyNumerator3 + + b_CurrencyNumerator4 + b_CurrencyNumerator1LessThanDenominator + + b_CurrencyDenominator16; - //:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= - //End Initialize DeadKeyChar Variable - //:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= + // :=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= + // End Initialize DeadKeyChar Variable + // :=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= - ResetLastChar; + ResetLastChar; - // If IsWinVistaOrLater Then - DetermineZWNJ_ZWJ := ZWJ; - // Else - // DetermineZWNJ_ZWJ := ZWNJ; + // If IsWinVistaOrLater Then + DetermineZWNJ_ZWJ := ZWJ; + // Else + // DetermineZWNJ_ZWJ := ZWNJ; - Bijoy := TUnicodeToBijoy2000.Create; + Bijoy := TUnicodeToBijoy2000.Create; End; -{===============================================================================} +{ =============================================================================== } Procedure TGenericLayoutModern.DeleteLastCharSteps_Ex(StepCount: Integer); Var - I, J : Integer; - t1 : String; + I, J: Integer; + t1: String; Begin - For i := TrackL Downto 1 Do - t1 := t1 + LastChars[i]; + For I := TrackL Downto 1 Do + t1 := t1 + LastChars[I]; - If StepCount > TrackL Then StepCount := TrackL; + If StepCount > TrackL Then + StepCount := TrackL; - t1 := StringOfChar(' ', StepCount) + LeftStr(t1, Length(t1) - StepCount); + t1 := StringOfChar(' ', StepCount) + LeftStr(t1, Length(t1) - StepCount); - For i := TrackL Downto 1 Do Begin - J := TrackL + 1 - i; - LastChars[i] := MidStr(t1, J, 1); - End; - LastChar := LastChars[1]; + For I := TrackL Downto 1 Do + Begin + J := TrackL + 1 - I; + LastChars[I] := MidStr(t1, J, 1); + End; + LastChar := LastChars[1]; End; -{===============================================================================} +{ =============================================================================== } Destructor TGenericLayoutModern.Destroy; Begin - FreeAndNil(Bijoy); + FreeAndNil(Bijoy); - Inherited; + Inherited; End; -{===============================================================================} +{ =============================================================================== } Procedure TGenericLayoutModern.DoBackspace(Var Block: Boolean); Var - BijoyNewBanglaText : String; + BijoyNewBanglaText: String; Begin - If (Length(PrevBanglaT) - 1) <= 0 Then Begin - - If OutputIsBijoy <> 'YES' Then Begin - If (Length(NewBanglaText) - 1) >= 1 Then - Backspace(Length(NewBanglaText) - 1); - End - Else Begin - BijoyNewBanglaText := Bijoy.Convert(NewBanglaText); - If (Length(BijoyNewBanglaText) - 1) >= 1 Then - Backspace(Length(BijoyNewBanglaText) - 1); - End; - - ResetDeadKey; - Block := False; - End - Else Begin - Block := True; - InternalBackspace; - //ParseAndSendNow; - End; + If (Length(PrevBanglaT) - 1) <= 0 Then + Begin + + If OutputIsBijoy <> 'YES' Then + Begin + If (Length(NewBanglaText) - 1) >= 1 Then + Backspace(Length(NewBanglaText) - 1); + End + Else + Begin + BijoyNewBanglaText := Bijoy.Convert(NewBanglaText); + If (Length(BijoyNewBanglaText) - 1) >= 1 Then + Backspace(Length(BijoyNewBanglaText) - 1); + End; + + ResetDeadKey; + Block := False; + End + Else + Begin + Block := True; + InternalBackspace; + // ParseAndSendNow; + End; End; -{===============================================================================} +{ =============================================================================== } Function TGenericLayoutModern.InsertKar(Const sKar: String): String; Begin - If AutomaticallyFixChandra = 'YES' Then Begin - If LastChar = b_Chandra Then Begin - InternalBackspace; - InsertKar := sKar + b_Chandra; - End - Else - InsertKar := sKar; - End - Else - InsertKar := sKar; + If AutomaticallyFixChandra = 'YES' Then + Begin + If LastChar = b_Chandra Then + Begin + InternalBackspace; + InsertKar := sKar + b_Chandra; + End + Else + InsertKar := sKar; + End + Else + InsertKar := sKar; End; -{===============================================================================} +{ =============================================================================== } {$HINTS Off} Function TGenericLayoutModern.InsertReph: String; Var - RephMoveable : Boolean; - TmpStr : String; - I, J : Integer; + RephMoveable: Boolean; + TmpStr: String; + I, J: Integer; Begin - RephMoveable := False; - - If OldStyleReph = 'NO' Then - RephMoveable := False - Else Begin - - If IsPureConsonent(LastChar) = True Then - RephMoveable := True - Else If IsKar(LastChar) = True Then Begin - If IsPureConsonent(LastChars[2]) = True Then - RephMoveable := True - Else - RephMoveable := False; - End - Else If (LastChar = b_Chandra) Then Begin - If IsPureConsonent(LastChars[2]) Then - RephMoveable := True - Else If ((IsKar(LastChars[2]) = True) And (IsPureConsonent(LastChars[3]) = True)) Then - RephMoveable := True - Else - RephMoveable := False; - End - Else - RephMoveable := False; - End; - - If Not RephMoveable Then Begin - InsertReph := b_R + b_Hasanta; + RephMoveable := False; + + If OldStyleReph = 'NO' Then + RephMoveable := False + Else + Begin + + If IsPureConsonent(LastChar) = True Then + RephMoveable := True + Else If IsKar(LastChar) = True Then + Begin + If IsPureConsonent(LastChars[2]) = True Then + RephMoveable := True + Else + RephMoveable := False; + End + Else If (LastChar = b_Chandra) Then + Begin + If IsPureConsonent(LastChars[2]) Then + RephMoveable := True + Else If ((IsKar(LastChars[2]) = True) And + (IsPureConsonent(LastChars[3]) = True)) Then + RephMoveable := True + Else + RephMoveable := False; + End + Else + RephMoveable := False; + End; + + If Not RephMoveable Then + Begin + InsertReph := b_R + b_Hasanta; + Exit; + End + Else + Begin + I := 1; + If ((IsKar(LastChar) = True) And (IsPureConsonent(LastChars[I + 1]) + = True)) Then + I := I + 1 + Else If LastChar = b_Chandra Then + Begin + If IsPureConsonent(LastChars[I + 1]) Then + I := I + 1 + Else If ((IsKar(LastChars[I + 1]) = True) And + (IsPureConsonent(LastChars[I + 2]) = True)) Then + I := I + 2; + End; + + Repeat + If LastChars[I + 1] = b_Hasanta Then + Begin + If IsPureConsonent(LastChars[I + 2]) = True Then + I := I + 2 + Else + Begin + For J := I Downto 1 Do + TmpStr := TmpStr + LastChars[J]; + + InternalBackspace(I); + InsertReph := b_R + b_Hasanta + TmpStr; Exit; - End - Else Begin - i := 1; - If ((IsKar(LastChar) = True) And (IsPureConsonent(LastChars[i + 1]) = True)) Then - i := i + 1 - Else If LastChar = b_Chandra Then Begin - If IsPureConsonent(LastChars[i + 1]) Then - i := i + 1 - Else If ((IsKar(LastChars[i + 1]) = True) And (IsPureConsonent(LastChars[i + 2]) = True)) Then - i := i + 2; - End; - - Repeat - If LastChars[i + 1] = b_Hasanta Then Begin - If IsPureConsonent(LastChars[i + 2]) = True Then - i := i + 2 - Else Begin - For J := i Downto 1 Do - TmpStr := TmpStr + LastChars[J]; - - InternalBackspace(i); - InsertReph := b_R + b_Hasanta + TmpStr; - Exit; - End; - End - Else Begin - For J := i Downto 1 Do - TmpStr := TmpStr + LastChars[J]; - InternalBackspace(i); - InsertReph := b_R + b_Hasanta + TmpStr; - Exit; - End; - Until (i >= TrackL); - - End; + End; + End + Else + Begin + For J := I Downto 1 Do + TmpStr := TmpStr + LastChars[J]; + InternalBackspace(I); + InsertReph := b_R + b_Hasanta + TmpStr; + Exit; + End; + Until (I >= TrackL); + + End; End; -{===============================================================================} - +{ =============================================================================== } Procedure TGenericLayoutModern.InternalBackspace(KeyRepeat: Integer); Begin - If KeyRepeat <= 0 Then KeyRepeat := 1; - If KeyRepeat > TrackL Then KeyRepeat := TrackL; + If KeyRepeat <= 0 Then + KeyRepeat := 1; + If KeyRepeat > TrackL Then + KeyRepeat := TrackL; - - NewBanglaText := Midstr(PrevBanglaT, 1, Length(PrevBanglaT) - KeyRepeat); - DeleteLastCharSteps_Ex(KeyRepeat); + NewBanglaText := MidStr(PrevBanglaT, 1, Length(PrevBanglaT) - KeyRepeat); + DeleteLastCharSteps_Ex(KeyRepeat); End; {$HINTS ON} -{===============================================================================} +{ =============================================================================== } {$HINTS Off} Function TGenericLayoutModern.IsDeadKeyChar(Const CheckS: String): Boolean; Begin - Result := False; + Result := False; - If CheckS = '' Then Begin - IsDeadKeyChar := False; - Exit; - End; + If CheckS = '' Then + Begin + IsDeadKeyChar := False; + Exit; + End; - //Check only the most right letter - If pos(String(RightStr(CheckS, 1)), DeadKeyChars) > 0 Then - IsDeadKeyChar := True - Else - IsDeadKeyChar := False; + // Check only the most right letter + If pos(String(RightStr(CheckS, 1)), DeadKeyChars) > 0 Then + IsDeadKeyChar := True + Else + IsDeadKeyChar := False; End; {$HINTS ON} -{===============================================================================} +{ =============================================================================== } Function TGenericLayoutModern.MyProcessVKeyDown(Const KeyCode: Integer; - Var Block: Boolean; Const var_IfShift, var_IfTrueShift, var_IfAltGr: Boolean): String; + Var Block: Boolean; Const var_IfShift, var_IfTrueShift, + var_IfAltGr: Boolean): String; Var - CharForKey : String; + CharForKey: String; Begin - If AvroMainForm1.GetMyCurrentKeyboardMode = SysDefault Then Begin + If AvroMainForm1.GetMyCurrentKeyboardMode = SysDefault Then + Begin + Block := False; + MyProcessVKeyDown := ''; + Exit; + End + Else If AvroMainForm1.GetMyCurrentKeyboardMode = bangla Then + Begin + CharForKey := GetCharForKey(KeyCode, var_IfShift, var_IfTrueShift, + var_IfAltGr); + + If VowelFormating = 'NO' Then + DeadKey := False; + + If DeadKey Then + Begin + If CharForKey = b_AAkar Then + Begin + MyProcessVKeyDown := b_AA; + DeadKey := True; + Exit; + End + Else If CharForKey = b_Ikar Then + Begin + MyProcessVKeyDown := b_I; + DeadKey := True; + Exit; + End + Else If CharForKey = b_IIkar Then + Begin + MyProcessVKeyDown := b_II; + DeadKey := True; + Exit; + End + Else If CharForKey = b_Ukar Then + Begin + MyProcessVKeyDown := b_U; + DeadKey := True; + Exit; + End + Else If CharForKey = b_UUkar Then + Begin + MyProcessVKeyDown := b_UU; + DeadKey := True; + Exit; + End + Else If CharForKey = b_RRIkar Then + Begin + MyProcessVKeyDown := b_RRI; + DeadKey := True; + Exit; + End + Else If CharForKey = b_Ekar Then + Begin + MyProcessVKeyDown := b_E; + DeadKey := True; + Exit; + End + Else If CharForKey = b_OIkar Then + Begin + MyProcessVKeyDown := b_OI; + DeadKey := True; + Exit; + End + Else If CharForKey = b_Okar Then + Begin + MyProcessVKeyDown := b_O; + DeadKey := True; + Exit; + End + Else If CharForKey = b_OUkar Then + Begin + MyProcessVKeyDown := b_OU; + DeadKey := True; + Exit; + End + // ElseIf KeyCode = VK_LSHIFT Or KeyCode = VK_RSHIFT Or KeyCode = VK_CAPITAL Or KeyCode = VK_NUMLOCK Or KeyCode = VK_LCONTROL Or KeyCode = VK_RCONTROL Or KeyCode = VK_CONTROL Or KeyCode = VK_MENU Or KeyCode = VK_LMENU Or KeyCode = VK_RMENU Then + // DeadKey = True + // MyProcessVKeyDown = "" + // Block = False + // Exit Function + Else + DeadKey := False; + End; + + If LastChar = b_Hasanta Then + Begin + If CharForKey = b_AAkar Then + Begin + InternalBackspace; + MyProcessVKeyDown := b_AA; + DeadKey := True; + Exit; + End + Else If CharForKey = b_Ikar Then + Begin + InternalBackspace; + MyProcessVKeyDown := b_I; + DeadKey := True; + Exit; + End + Else If CharForKey = b_IIkar Then + Begin + InternalBackspace; + MyProcessVKeyDown := b_II; + DeadKey := True; + Exit; + End + Else If CharForKey = b_Ukar Then + Begin + InternalBackspace; + MyProcessVKeyDown := b_U; + DeadKey := True; + Exit; + End + Else If CharForKey = b_UUkar Then + Begin + InternalBackspace; + MyProcessVKeyDown := b_UU; + DeadKey := True; + Exit; + End + Else If CharForKey = b_RRIkar Then + Begin + InternalBackspace; + MyProcessVKeyDown := b_RRI; + DeadKey := True; + Exit; + End + Else If CharForKey = b_Ekar Then + Begin + InternalBackspace; + MyProcessVKeyDown := b_E; + DeadKey := True; + Exit; + End + Else If CharForKey = b_OIkar Then + Begin + InternalBackspace; + MyProcessVKeyDown := b_OI; + DeadKey := True; + Exit; + End + Else If CharForKey = b_Okar Then + Begin + InternalBackspace; + MyProcessVKeyDown := b_O; + DeadKey := True; + Exit; + End + Else If CharForKey = b_OUkar Then + Begin + InternalBackspace; + MyProcessVKeyDown := b_OU; + DeadKey := True; + Exit; + End + Else If CharForKey = b_Hasanta Then + Begin + MyProcessVKeyDown := ZWNJ; + DeadKey := True; + Exit; + End; + End; + + Case KeyCode Of + VK_RETURN: + Begin Block := False; + DeadKey := True; + ResetLastChar; MyProcessVKeyDown := ''; Exit; - End - Else If AvroMainForm1.GetMyCurrentKeyboardMode = bangla Then Begin - CharForKey := GetCharForKey(KeyCode, var_IfShift, var_IfTrueShift, var_IfAltGr); - - If VowelFormating = 'NO' Then DeadKey := False; - - If DeadKey Then Begin - If CharForKey = b_AAkar Then Begin - MyProcessVKeyDown := b_AA; - DeadKey := True; - Exit; - End - Else If CharForKey = b_Ikar Then Begin - MyProcessVKeyDown := b_I; - DeadKey := True; - Exit; - End - Else If CharForKey = b_IIkar Then Begin - MyProcessVKeyDown := b_II; - DeadKey := True; - Exit; - End - Else If CharForKey = b_Ukar Then Begin - MyProcessVKeyDown := b_U; - DeadKey := True; - Exit; - End - Else If CharForKey = b_UUkar Then Begin - MyProcessVKeyDown := b_UU; - DeadKey := True; - Exit; - End - Else If CharForKey = b_RRIkar Then Begin - MyProcessVKeyDown := b_RRI; - DeadKey := True; - Exit; - End - Else If CharForKey = b_Ekar Then Begin - MyProcessVKeyDown := b_E; - DeadKey := True; - Exit; - End - Else If CharForKey = b_OIkar Then Begin - MyProcessVKeyDown := b_OI; - DeadKey := True; - Exit; - End - Else If CharForKey = b_Okar Then Begin - MyProcessVKeyDown := b_O; - DeadKey := True; - Exit; - End - Else If CharForKey = b_OUkar Then Begin - MyProcessVKeyDown := b_OU; - DeadKey := True; - Exit; - End - //ElseIf KeyCode = VK_LSHIFT Or KeyCode = VK_RSHIFT Or KeyCode = VK_CAPITAL Or KeyCode = VK_NUMLOCK Or KeyCode = VK_LCONTROL Or KeyCode = VK_RCONTROL Or KeyCode = VK_CONTROL Or KeyCode = VK_MENU Or KeyCode = VK_LMENU Or KeyCode = VK_RMENU Then - // DeadKey = True - // MyProcessVKeyDown = "" - // Block = False - // Exit Function - Else - DeadKey := False; - End; - - - If LastChar = b_Hasanta Then Begin - If CharForKey = b_AAkar Then Begin - InternalBackspace; - MyProcessVKeyDown := b_AA; - DeadKey := True; - Exit; - End - Else If CharForKey = b_Ikar Then Begin - InternalBackspace; - MyProcessVKeyDown := b_I; - DeadKey := True; - Exit; - End - Else If CharForKey = b_IIkar Then Begin - InternalBackspace; - MyProcessVKeyDown := b_II; - DeadKey := True; - Exit; - End - Else If CharForKey = b_Ukar Then Begin - InternalBackspace; - MyProcessVKeyDown := b_U; - DeadKey := True; - Exit; - End - Else If CharForKey = b_UUkar Then Begin - InternalBackspace; - MyProcessVKeyDown := b_UU; - DeadKey := True; - Exit; - End - Else If CharForKey = b_RRIkar Then Begin - InternalBackspace; - MyProcessVKeyDown := b_RRI; - DeadKey := True; - Exit; - End - Else If CharForKey = b_Ekar Then Begin - InternalBackspace; - MyProcessVKeyDown := b_E; - DeadKey := True; - Exit; - End - Else If CharForKey = b_OIkar Then Begin - InternalBackspace; - MyProcessVKeyDown := b_OI; - DeadKey := True; - Exit; - End - Else If CharForKey = b_Okar Then Begin - InternalBackspace; - MyProcessVKeyDown := b_O; - DeadKey := True; - Exit; - End - Else If CharForKey = b_OUkar Then Begin - InternalBackspace; - MyProcessVKeyDown := b_OU; - DeadKey := True; - Exit; - End - Else If CharForKey = b_Hasanta Then Begin - MyProcessVKeyDown := ZWNJ; - DeadKey := True; - Exit; - End; + End; + VK_SPACE: + Begin + Block := False; + DeadKey := True; + ResetLastChar; + MyProcessVKeyDown := ''; + Exit; + End; + VK_TAB: + Begin + Block := False; + DeadKey := True; + ResetLastChar; + MyProcessVKeyDown := ''; + Exit; + End; + VK_BACK: + Begin + DoBackspace(Block); + MyProcessVKeyDown := ''; + Exit; + End; + Else + Begin + If CharForKey = b_R + b_Hasanta Then + Begin + MyProcessVKeyDown := InsertReph; + Exit; + End + Else If CharForKey = '' Then + Begin + DeadKey := False; + Block := False; + MyProcessVKeyDown := ''; + ResetLastChar; + Exit; + End + Else If CharForKey = b_Hasanta + b_Z Then + Begin + If (LastChar = b_R) And (LastChars[2] <> b_Hasanta) Then + Begin + MyProcessVKeyDown := DetermineZWNJ_ZWJ + b_Hasanta + b_Z; + Exit; + End + Else + Begin + MyProcessVKeyDown := b_Hasanta + b_Z; + Exit; End; - - - - Case KeyCode Of - VK_RETURN: Begin - Block := False; - DeadKey := True; - ResetLastChar; - MyProcessVKeyDown := ''; - Exit; - End; - VK_SPACE: Begin - Block := False; - DeadKey := True; - ResetLastChar; - MyProcessVKeyDown := ''; - Exit; - End; - VK_TAB: Begin - Block := False; - DeadKey := True; - ResetLastChar; - MyProcessVKeyDown := ''; - Exit; - End; - VK_BACK: Begin - DoBackspace(Block); - MyProcessVKeyDown := ''; - Exit; - End; - Else Begin - If CharForKey = b_R + b_Hasanta Then Begin - MyProcessVKeyDown := InsertReph; - Exit; - End - Else If CharForKey = '' Then Begin - DeadKey := False; - Block := False; - MyProcessVKeyDown := ''; - ResetLastChar; - Exit; - End - Else If CharForKey = b_Hasanta + b_Z Then Begin - If (LastChar = b_R) And (LastChars[2] <> b_Hasanta) Then Begin - MyProcessVKeyDown := DetermineZWNJ_ZWJ + b_Hasanta + b_Z; - Exit; - End - Else Begin - MyProcessVKeyDown := b_Hasanta + b_Z; - Exit; - End; - End - Else Begin - If IsDeadKeyChar(CharForKey) Then Begin - If IsKar(CharForKey) Then Begin - DeadKey := True; - MyProcessVKeyDown := InsertKar(CharForKey); - Exit; - End - Else Begin - DeadKey := True; - MyProcessVKeyDown := CharForKey; - Exit; - End; - End - Else Begin - MyProcessVKeyDown := CharForKey; - Exit; - End; - End; - End; + End + Else + Begin + If IsDeadKeyChar(CharForKey) Then + Begin + If IsKar(CharForKey) Then + Begin + DeadKey := True; + MyProcessVKeyDown := InsertKar(CharForKey); + Exit; + End + Else + Begin + DeadKey := True; + MyProcessVKeyDown := CharForKey; + Exit; + End; + End + Else + Begin + MyProcessVKeyDown := CharForKey; + Exit; End; - End; + End; + End; + End; + End; End; -{===============================================================================} +{ =============================================================================== } Procedure TGenericLayoutModern.MyProcessVKeyUP(Const KeyCode: Integer; - Var Block: Boolean; Const var_IfShift, var_IfTrueShift, var_IfAltGr: Boolean); + Var Block: Boolean; Const var_IfShift, var_IfTrueShift, var_IfAltGr: Boolean); Var - CharForKey : String; + CharForKey: String; Begin - If AvroMainForm1.GetMyCurrentKeyboardMode = SysDefault Then Begin - - Block := False; - Exit; - End - Else If AvroMainForm1.GetMyCurrentKeyboardMode = bangla Then Begin - - CharForKey := GetCharForKey(KeyCode, var_IfShift, var_IfTrueShift, var_IfAltGr); - - If CharForKey = '' Then - Block := False - Else Begin - Block := True; - Exit; - End; - - End; + If AvroMainForm1.GetMyCurrentKeyboardMode = SysDefault Then + Begin + + Block := False; + Exit; + End + Else If AvroMainForm1.GetMyCurrentKeyboardMode = bangla Then + Begin + + CharForKey := GetCharForKey(KeyCode, var_IfShift, var_IfTrueShift, + var_IfAltGr); + + If CharForKey = '' Then + Block := False + Else + Begin + Block := True; + Exit; + End; + + End; End; -{===============================================================================} +{ =============================================================================== } Procedure TGenericLayoutModern.ParseAndSendNow; Var - I, Matched, UnMatched : Integer; - BijoyPrevBanglaT, BijoyNewBanglaText: String; + I, Matched, UnMatched: Integer; + BijoyPrevBanglaT, BijoyNewBanglaText: String; Begin - Matched := 0; - - If OutputIsBijoy <> 'YES' Then Begin - {Output to Unicode} - If PrevBanglaT = '' Then Begin - SendKey_Char(NewBanglaText); - PrevBanglaT := NewBanglaText; - End - Else Begin - For I := 1 To Length(PrevBanglaT) Do Begin - If MidStr(PrevBanglaT, I, 1) = MidStr(NewBanglaText, i, 1) Then - Matched := Matched + 1 - Else - Break; - End; - UnMatched := Length(PrevBanglaT) - Matched; - - If UnMatched >= 1 Then Backspace(UnMatched); - SendKey_Char(MidStr(NewBanglaText, Matched + 1, Length(NewBanglaText))); - PrevBanglaT := NewBanglaText; - End; - - End - Else Begin - {Output to Bijoy} - BijoyPrevBanglaT := Bijoy.Convert(PrevBanglaT); - BijoyNewBanglaText := Bijoy.Convert(NewBanglaText); - - If BijoyPrevBanglaT = '' Then Begin - SendKey_Char(BijoyNewBanglaText); - PrevBanglaT := NewBanglaText; - End - Else Begin - For I := 1 To Length(BijoyPrevBanglaT) Do Begin - If MidStr(BijoyPrevBanglaT, I, 1) = MidStr(BijoyNewBanglaText, i, 1) Then - Matched := Matched + 1 - Else - Break; - End; - UnMatched := Length(BijoyPrevBanglaT) - Matched; - - If UnMatched >= 1 Then Backspace(UnMatched); - SendKey_Char(MidStr(BijoyNewBanglaText, Matched + 1, Length(BijoyNewBanglaText))); - PrevBanglaT := NewBanglaText; - End; - - End; + Matched := 0; + + If OutputIsBijoy <> 'YES' Then + Begin + { Output to Unicode } + If PrevBanglaT = '' Then + Begin + SendKey_Char(NewBanglaText); + PrevBanglaT := NewBanglaText; + End + Else + Begin + For I := 1 To Length(PrevBanglaT) Do + Begin + If MidStr(PrevBanglaT, I, 1) = MidStr(NewBanglaText, I, 1) Then + Matched := Matched + 1 + Else + Break; + End; + UnMatched := Length(PrevBanglaT) - Matched; + + If UnMatched >= 1 Then + Backspace(UnMatched); + SendKey_Char(MidStr(NewBanglaText, Matched + 1, Length(NewBanglaText))); + PrevBanglaT := NewBanglaText; + End; + + End + Else + Begin + { Output to Bijoy } + BijoyPrevBanglaT := Bijoy.Convert(PrevBanglaT); + BijoyNewBanglaText := Bijoy.Convert(NewBanglaText); + + If BijoyPrevBanglaT = '' Then + Begin + SendKey_Char(BijoyNewBanglaText); + PrevBanglaT := NewBanglaText; + End + Else + Begin + For I := 1 To Length(BijoyPrevBanglaT) Do + Begin + If MidStr(BijoyPrevBanglaT, I, 1) = MidStr(BijoyNewBanglaText, + I, 1) Then + Matched := Matched + 1 + Else + Break; + End; + UnMatched := Length(BijoyPrevBanglaT) - Matched; + + If UnMatched >= 1 Then + Backspace(UnMatched); + SendKey_Char(MidStr(BijoyNewBanglaText, Matched + 1, + Length(BijoyNewBanglaText))); + PrevBanglaT := NewBanglaText; + End; + + End; End; -{===============================================================================} +{ =============================================================================== } Function TGenericLayoutModern.ProcessVKeyDown(Const KeyCode: Integer; - Var Block: Boolean): String; + Var Block: Boolean): String; Var - m_Block : Boolean; - m_Str : String; + m_Block: Boolean; + m_Str: String; Begin - m_Block := False; - - If (IfWinKey = True) Or (IfOnlyCtrlKey = True) Or (IfOnlyLeftAltKey = True) Then Begin - Block := False; - ProcessVKeyDown := ''; - Exit; - End; - - If IfIgnorableModifierKey(KeyCode) Then Begin - Block := False; - ProcessVKeyDown := ''; - Exit; - End; - - m_Str := MyProcessVKeyDown(KeyCode, m_Block, IfShift, IfTrueShift, IfAltGr); - If m_Str <> '' Then Begin - m_Block := True; - SetLastChar(m_Str); - End; - - NewBanglaText := NewBanglaText + m_Str; - ParseAndSendNow; - - Block := m_Block; - ProcessVKeyDown := ''; + m_Block := False; + + If (IfWinKey = True) Or (IfOnlyCtrlKey = True) Or + (IfOnlyLeftAltKey = True) Then + Begin + Block := False; + ProcessVKeyDown := ''; + Exit; + End; + + If IfIgnorableModifierKey(KeyCode) Then + Begin + Block := False; + ProcessVKeyDown := ''; + Exit; + End; + + m_Str := MyProcessVKeyDown(KeyCode, m_Block, IfShift, IfTrueShift, IfAltGr); + If m_Str <> '' Then + Begin + m_Block := True; + SetLastChar(m_Str); + End; + + NewBanglaText := NewBanglaText + m_Str; + ParseAndSendNow; + + Block := m_Block; + ProcessVKeyDown := ''; End; -{===============================================================================} +{ =============================================================================== } Procedure TGenericLayoutModern.ProcessVKeyUP(Const KeyCode: Integer; - Var Block: Boolean); + Var Block: Boolean); Begin - If ((IfWinKey = True) Or (IfOnlyCtrlKey = True) Or (IfOnlyLeftAltKey = True)) Then Begin - Block := False; - Exit; - End; - - If IfIgnorableModifierKey(KeyCode) = True Then Begin - Block := False; - Exit; - End; - - MyProcessVKeyUP(KeyCode, Block, IfShift, IfTrueShift, IfAltGr); + If ((IfWinKey = True) Or (IfOnlyCtrlKey = True) Or + (IfOnlyLeftAltKey = True)) Then + Begin + Block := False; + Exit; + End; + + If IfIgnorableModifierKey(KeyCode) = True Then + Begin + Block := False; + Exit; + End; + + MyProcessVKeyUP(KeyCode, Block, IfShift, IfTrueShift, IfAltGr); End; -{===============================================================================} +{ =============================================================================== } Procedure TGenericLayoutModern.ResetDeadKey; Begin - DeadKey := False; - ResetLastChar; + DeadKey := False; + ResetLastChar; End; -{===============================================================================} +{ =============================================================================== } Procedure TGenericLayoutModern.ResetLastChar; Var - i : integer; + I: Integer; Begin - For i := 1 To TrackL Do - LastChars[i] := ' '; + For I := 1 To TrackL Do + LastChars[I] := ' '; - LastChar := ' '; - PrevBanglaT := ''; - NewBanglaText := ''; + LastChar := ' '; + PrevBanglaT := ''; + NewBanglaText := ''; End; -{===============================================================================} +{ =============================================================================== } Procedure TGenericLayoutModern.SetLastChar(Const wChar: String); Var - t1, t2 : String; - I, J : Integer; + t1, t2: String; + I, J: Integer; Begin - For i := TrackL Downto 1 Do - t1 := t1 + LastChars[i]; - - - t1 := t1 + wChar; - t2 := RightStr(t1, TrackL); - - For i := TrackL Downto 1 Do Begin - J := TrackL + 1 - i; - LastChars[i] := MidStr(t2, J, 1); - End; - LastChar := LastChars[1]; + For I := TrackL Downto 1 Do + t1 := t1 + LastChars[I]; + + t1 := t1 + wChar; + t2 := RightStr(t1, TrackL); + + For I := TrackL Downto 1 Do + Begin + J := TrackL + 1 - I; + LastChars[I] := MidStr(t2, J, 1); + End; + LastChar := LastChars[1]; End; -{===============================================================================} +{ =============================================================================== } End. - diff --git a/Keyboard and Spell checker/Classes/clsGenericLayoutOld.pas b/Keyboard and Spell checker/Classes/clsGenericLayoutOld.pas index e328023..2d2d31f 100644 --- a/Keyboard and Spell checker/Classes/clsGenericLayoutOld.pas +++ b/Keyboard and Spell checker/Classes/clsGenericLayoutOld.pas @@ -1,834 +1,946 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - -{COMPLETE TRANSFERING!} +{ COMPLETE TRANSFERING! } Unit clsGenericLayoutOld; Interface Uses - classes, - sysutils, - StrUtils, - clsUnicodeToBijoy2000; + classes, + sysutils, + StrUtils, + clsUnicodeToBijoy2000; Const - TrackL = 100; + TrackL = 100; - //Skeleton of Class TGenericLayoutOld + // Skeleton of Class TGenericLayoutOld Type - TGenericLayoutOld = Class - Private - Bijoy: TUnicodeToBijoy2000; - LastChar: String; - DetermineZWNJ_ZWJ: String; - LastChars: Array[1..TrackL] Of String; - PrevBanglaT, NewBanglaText: String; - - //Kar Variables for Full Old Style Typing - EKarActive, IKarActive, OIKarActive: Boolean; - - Procedure InternalBackspace(KeyRepeat: Integer = 1); - Procedure DoBackspace(Var Block: Boolean); - Procedure ParseAndSendNow; - Function InsertKar(Const sKar: String): String; - Function InsertReph: String; - Procedure SetLastChar(Const wChar: String); - Procedure DeleteLastCharSteps_Ex(StepCount: Integer); - Procedure ResetLastChar; - Function MyProcessVKeyDown(Const KeyCode: Integer; - Var Block: Boolean; Const var_IfShift, var_IfTrueShift, var_IfAltGr: Boolean): String; - Procedure MyProcessVKeyUP(Const KeyCode: Integer; - Var Block: Boolean; Const var_IfShift: Boolean; Const var_IfTrueShift: Boolean; Const var_IfAltGr: Boolean); - Procedure ResetAllKarsToInactive; - Public - Constructor Create; //Initializer - Destructor Destroy; Override; //Destructor - - Function ProcessVKeyDown(Const KeyCode: Integer; Var Block: Boolean): String; - Procedure ProcessVKeyUP(Const KeyCode: Integer; Var Block: Boolean); - Procedure ResetDeadKey; - End; + TGenericLayoutOld = Class + Private + Bijoy: TUnicodeToBijoy2000; + LastChar: String; + DetermineZWNJ_ZWJ: String; + LastChars: Array [1 .. TrackL] Of String; + PrevBanglaT, NewBanglaText: String; + + // Kar Variables for Full Old Style Typing + EKarActive, IKarActive, OIKarActive: Boolean; + + Procedure InternalBackspace(KeyRepeat: Integer = 1); + Procedure DoBackspace(Var Block: Boolean); + Procedure ParseAndSendNow; + Function InsertKar(Const sKar: String): String; + Function InsertReph: String; + Procedure SetLastChar(Const wChar: String); + Procedure DeleteLastCharSteps_Ex(StepCount: Integer); + Procedure ResetLastChar; + Function MyProcessVKeyDown(Const KeyCode: Integer; Var Block: Boolean; + Const var_IfShift, var_IfTrueShift, var_IfAltGr: Boolean): String; + Procedure MyProcessVKeyUP(Const KeyCode: Integer; Var Block: Boolean; + Const var_IfShift: Boolean; Const var_IfTrueShift: Boolean; + Const var_IfAltGr: Boolean); + Procedure ResetAllKarsToInactive; + Public + Constructor Create; // Initializer + Destructor Destroy; Override; // Destructor + + Function ProcessVKeyDown(Const KeyCode: Integer; + Var Block: Boolean): String; + Procedure ProcessVKeyUP(Const KeyCode: Integer; Var Block: Boolean); + Procedure ResetDeadKey; + End; Implementation Uses - Banglachars, - KeyboardFunctions, - uForm1, - KeyboardLayoutLoader, - clsLayout, - VirtualKeycode, - WindowsVersion, - uRegistrySettings; + Banglachars, + KeyboardFunctions, + uForm1, + KeyboardLayoutLoader, + clsLayout, + VirtualKeycode, + WindowsVersion, + uRegistrySettings; -{===============================================================================} +{ =============================================================================== } { TGenericLayoutOld } Constructor TGenericLayoutOld.Create; Begin - Inherited; - ResetLastChar; + Inherited; + ResetLastChar; - // If IsWinVistaOrLater Then - DetermineZWNJ_ZWJ := ZWJ; - // Else - // DetermineZWNJ_ZWJ := ZWNJ; + // If IsWinVistaOrLater Then + DetermineZWNJ_ZWJ := ZWJ; + // Else + // DetermineZWNJ_ZWJ := ZWNJ; - Bijoy := TUnicodeToBijoy2000.Create; + Bijoy := TUnicodeToBijoy2000.Create; End; -{===============================================================================} +{ =============================================================================== } Procedure TGenericLayoutOld.DeleteLastCharSteps_Ex(StepCount: Integer); Var - I, J : integer; - t1 : String; + I, J: Integer; + t1: String; Begin - For i := TrackL Downto 1 Do - t1 := t1 + LastChars[i]; + For I := TrackL Downto 1 Do + t1 := t1 + LastChars[I]; - If StepCount > TrackL Then StepCount := TrackL; + If StepCount > TrackL Then + StepCount := TrackL; - t1 := StringOfChar(' ', StepCount) + LeftStr(t1, Length(t1) - StepCount); + t1 := StringOfChar(' ', StepCount) + LeftStr(t1, Length(t1) - StepCount); - For i := TrackL Downto 1 Do Begin - J := TrackL + 1 - i; - LastChars[i] := MidStr(t1, J, 1); - End; - LastChar := LastChars[1]; + For I := TrackL Downto 1 Do + Begin + J := TrackL + 1 - I; + LastChars[I] := MidStr(t1, J, 1); + End; + LastChar := LastChars[1]; End; -{===============================================================================} +{ =============================================================================== } Destructor TGenericLayoutOld.Destroy; Begin - FreeAndNil(Bijoy); + FreeAndNil(Bijoy); - Inherited; + Inherited; End; -{===============================================================================} +{ =============================================================================== } Procedure TGenericLayoutOld.DoBackspace(Var Block: Boolean); Var - BijoyNewBanglaText : String; + BijoyNewBanglaText: String; Begin - If (Length(PrevBanglaT) - 1) <= 0 Then Begin - - If OutputIsBijoy <> 'YES' Then Begin - If (Length(NewBanglaText) - 1) >= 1 Then - Backspace(Length(NewBanglaText) - 1); - End - Else Begin - BijoyNewBanglaText := Bijoy.Convert(NewBanglaText); - If (Length(BijoyNewBanglaText) - 1) >= 1 Then - Backspace(Length(BijoyNewBanglaText) - 1); - End; - - ResetDeadKey; - Block := False; - End - Else Begin - Block := True; - InternalBackspace; - //ParseAndSendNow; - End; + If (Length(PrevBanglaT) - 1) <= 0 Then + Begin + + If OutputIsBijoy <> 'YES' Then + Begin + If (Length(NewBanglaText) - 1) >= 1 Then + Backspace(Length(NewBanglaText) - 1); + End + Else + Begin + BijoyNewBanglaText := Bijoy.Convert(NewBanglaText); + If (Length(BijoyNewBanglaText) - 1) >= 1 Then + Backspace(Length(BijoyNewBanglaText) - 1); + End; + + ResetDeadKey; + Block := False; + End + Else + Begin + Block := True; + InternalBackspace; + // ParseAndSendNow; + End; End; -{===============================================================================} +{ =============================================================================== } Function TGenericLayoutOld.InsertKar(Const sKar: String): String; Begin - If LastChar = b_Chandra Then Begin - If LastChars[2] = b_Ekar Then Begin - If sKar = b_AAkar Then Begin - InternalBackspace(2); - InsertKar := b_Okar + b_Chandra; - End - Else If sKar = b_LengthMark Then Begin - InternalBackspace(2); - InsertKar := b_OUkar + b_Chandra; - End - Else - InsertKar := sKar; - End - Else Begin - InsertKar := sKar; - End; - End - Else - InsertKar := sKar; + If LastChar = b_Chandra Then + Begin + If LastChars[2] = b_Ekar Then + Begin + If sKar = b_AAkar Then + Begin + InternalBackspace(2); + InsertKar := b_Okar + b_Chandra; + End + Else If sKar = b_LengthMark Then + Begin + InternalBackspace(2); + InsertKar := b_OUkar + b_Chandra; + End + Else + InsertKar := sKar; + End + Else + Begin + InsertKar := sKar; + End; + End + Else + InsertKar := sKar; End; -{===============================================================================} +{ =============================================================================== } {$HINTS Off} Function TGenericLayoutOld.InsertReph: String; Var - RephMoveable : Boolean; - TmpStr : String; - I, J : Integer; + RephMoveable: Boolean; + TmpStr: String; + I, J: Integer; Begin - RephMoveable := False; - - If IsPureConsonent(LastChar) = True Then - RephMoveable := True - Else If IsKar(LastChar) = true Then Begin - If IsPureConsonent(LastChars[2]) Then - RephMoveable := True - Else - RephMoveable := False; - End - Else If LastChar = b_Chandra Then Begin - If IsPureConsonent(LastChars[2]) = true Then - RephMoveable := True - Else If (IsKar(LastChars[2]) = true) And (IsPureConsonent(LastChars[3]) = true) Then - RephMoveable := True - Else - RephMoveable := False; - End - Else - RephMoveable := False; - - - If Not RephMoveable Then Begin - InsertReph := b_R + b_Hasanta; + RephMoveable := False; + + If IsPureConsonent(LastChar) = True Then + RephMoveable := True + Else If IsKar(LastChar) = True Then + Begin + If IsPureConsonent(LastChars[2]) Then + RephMoveable := True + Else + RephMoveable := False; + End + Else If LastChar = b_Chandra Then + Begin + If IsPureConsonent(LastChars[2]) = True Then + RephMoveable := True + Else If (IsKar(LastChars[2]) = True) And + (IsPureConsonent(LastChars[3]) = True) Then + RephMoveable := True + Else + RephMoveable := False; + End + Else + RephMoveable := False; + + If Not RephMoveable Then + Begin + InsertReph := b_R + b_Hasanta; + Exit; + End + Else + Begin + I := 1; + + If (IsKar(LastChar) = True) And + (IsPureConsonent(LastChars[I + 1]) = True) Then + I := I + 1 + Else If LastChar = b_Chandra Then + Begin + If IsPureConsonent(LastChars[I + 1]) = True Then + I := I + 1 + Else If (IsKar(LastChars[I + 1]) = True) And + (IsPureConsonent(LastChars[I + 2]) = True) Then + I := I + 2; + End; + + Repeat + If LastChars[I + 1] = b_Hasanta Then + Begin + If IsPureConsonent(LastChars[I + 2]) Then + I := I + 2 + Else + Begin + For J := I Downto 1 Do + TmpStr := TmpStr + LastChars[J]; + + InternalBackspace(I); + InsertReph := b_R + b_Hasanta + TmpStr; Exit; - End - Else Begin - i := 1; - - If (IsKar(LastChar) = True) And (IsPureConsonent(LastChars[i + 1]) = True) Then - i := i + 1 - Else If LastChar = b_Chandra Then Begin - If IsPureConsonent(LastChars[i + 1]) = True Then - i := i + 1 - Else If (IsKar(LastChars[i + 1]) = True) And (IsPureConsonent(LastChars[i + 2]) = True) Then - i := i + 2; - End; - - Repeat - If LastChars[i + 1] = b_Hasanta Then Begin - If IsPureConsonent(LastChars[i + 2]) Then - i := i + 2 - Else Begin - For J := i Downto 1 Do - TmpStr := TmpStr + LastChars[J]; - - InternalBackspace(i); - InsertReph := b_R + b_Hasanta + TmpStr; - Exit; - End; - End - Else Begin - For J := i Downto 1 Do - TmpStr := TmpStr + LastChars[J]; - - InternalBackspace(i); - InsertReph := b_R + b_Hasanta + TmpStr; - Exit; - End; - Until i >= TrackL; - - End; + End; + End + Else + Begin + For J := I Downto 1 Do + TmpStr := TmpStr + LastChars[J]; + + InternalBackspace(I); + InsertReph := b_R + b_Hasanta + TmpStr; + Exit; + End; + Until I >= TrackL; + + End; End; -{===============================================================================} +{ =============================================================================== } Procedure TGenericLayoutOld.InternalBackspace(KeyRepeat: Integer); Begin - If KeyRepeat <= 0 Then KeyRepeat := 1; - If KeyRepeat > TrackL Then KeyRepeat := TrackL; + If KeyRepeat <= 0 Then + KeyRepeat := 1; + If KeyRepeat > TrackL Then + KeyRepeat := TrackL; - - NewBanglaText := Midstr(PrevBanglaT, 1, Length(PrevBanglaT) - KeyRepeat); - DeleteLastCharSteps_Ex(KeyRepeat); + NewBanglaText := MidStr(PrevBanglaT, 1, Length(PrevBanglaT) - KeyRepeat); + DeleteLastCharSteps_Ex(KeyRepeat); End; {$HINTS ON} -{===============================================================================} +{ =============================================================================== } Function TGenericLayoutOld.MyProcessVKeyDown(Const KeyCode: Integer; - Var Block: Boolean; Const var_IfShift, var_IfTrueShift, var_IfAltGr: Boolean): String; + Var Block: Boolean; Const var_IfShift, var_IfTrueShift, + var_IfAltGr: Boolean): String; Var - CharForKey, tmpString, PendingKar: String; + CharForKey, tmpString, PendingKar: String; Begin - If AvroMainForm1.GetMyCurrentKeyboardMode = SysDefault Then Begin - + If AvroMainForm1.GetMyCurrentKeyboardMode = SysDefault Then + Begin + + Block := False; + MyProcessVKeyDown := ''; + Exit; + End + Else If AvroMainForm1.GetMyCurrentKeyboardMode = bangla Then + Begin + CharForKey := GetCharForKey(KeyCode, var_IfShift, var_IfTrueShift, + var_IfAltGr); + + If LastChar = b_Hasanta Then + Begin + + If EKarActive Then + PendingKar := b_Ekar + Else If IKarActive Then + PendingKar := b_Ikar + Else If OIKarActive Then + PendingKar := b_OIkar + Else + PendingKar := ''; + + If CharForKey = b_AAkar Then + Begin + InternalBackspace; + MyProcessVKeyDown := InsertKar(PendingKar) + b_AA; + ResetAllKarsToInactive; + Exit; + End + Else If CharForKey = b_Ikar Then + Begin + InternalBackspace; + MyProcessVKeyDown := InsertKar(PendingKar) + b_I; + ResetAllKarsToInactive; + Exit; + End + Else If CharForKey = b_IIkar Then + Begin + InternalBackspace; + MyProcessVKeyDown := InsertKar(PendingKar) + b_II; + ResetAllKarsToInactive; + Exit; + End + Else If CharForKey = b_Ukar Then + Begin + InternalBackspace; + MyProcessVKeyDown := InsertKar(PendingKar) + b_U; + ResetAllKarsToInactive; + Exit; + End + Else If CharForKey = b_UUkar Then + Begin + InternalBackspace; + MyProcessVKeyDown := InsertKar(PendingKar) + b_UU; + ResetAllKarsToInactive; + Exit; + End + Else If CharForKey = b_RRIkar Then + Begin + InternalBackspace; + MyProcessVKeyDown := InsertKar(PendingKar) + b_RRI; + ResetAllKarsToInactive; + Exit; + End + Else If CharForKey = b_Ekar Then + Begin + InternalBackspace; + MyProcessVKeyDown := InsertKar(PendingKar) + b_E; + ResetAllKarsToInactive; + Exit; + End + Else If CharForKey = b_OIkar Then + Begin + InternalBackspace; + MyProcessVKeyDown := InsertKar(PendingKar) + b_OI; + ResetAllKarsToInactive; + Exit; + End + Else If CharForKey = b_Okar Then + Begin + InternalBackspace; + MyProcessVKeyDown := InsertKar(PendingKar) + b_O; + ResetAllKarsToInactive; + Exit; + End + Else If CharForKey = b_OUkar Then + Begin + InternalBackspace; + MyProcessVKeyDown := InsertKar(PendingKar) + b_OU; + ResetAllKarsToInactive; + Exit; + End + Else If CharForKey = b_LengthMark Then + Begin + InternalBackspace; + MyProcessVKeyDown := InsertKar(PendingKar) + b_OU; + ResetAllKarsToInactive; + Exit; + End + Else If CharForKey = b_Hasanta Then + Begin + MyProcessVKeyDown := ZWNJ; + ResetAllKarsToInactive; + Exit; + End; + End; + + If CharForKey = b_Ekar Then + Begin + If EKarActive = True Then + Begin + EKarActive := False; + MyProcessVKeyDown := b_Ekar; + Exit; + End + Else + Begin + ResetAllKarsToInactive; + EKarActive := True; + Block := True; + MyProcessVKeyDown := ''; + Exit; + End; + End; + + If CharForKey = b_Ikar Then + Begin + If IKarActive = True Then + Begin + IKarActive := False; + MyProcessVKeyDown := b_Ikar; + Exit; + End + Else + Begin + ResetAllKarsToInactive; + IKarActive := True; + Block := True; + MyProcessVKeyDown := ''; + Exit; + End; + End; + + If CharForKey = b_OIkar Then + Begin + If OIKarActive = True Then + Begin + OIKarActive := False; + MyProcessVKeyDown := b_OIkar; + Exit; + End + Else + Begin + ResetAllKarsToInactive; + OIKarActive := True; + Block := True; + MyProcessVKeyDown := ''; + Exit; + End; + End; + + If CharForKey = b_AAkar Then + Begin + If LastChar = b_Ekar Then + Begin + ResetAllKarsToInactive; + InternalBackspace; + MyProcessVKeyDown := InsertKar(b_Okar); + Exit; + End; + End; + + If CharForKey = b_LengthMark Then + Begin + If LastChar = b_Ekar Then + Begin + ResetAllKarsToInactive; + InternalBackspace; + MyProcessVKeyDown := InsertKar(b_OUkar); + Exit; + End; + End; + + If CharForKey = b_Hasanta Then + Begin + If LastChar = b_Ekar Then + Begin + InternalBackspace; + EKarActive := True; + MyProcessVKeyDown := b_Hasanta; + Exit; + End + Else If LastChar = b_Ikar Then + Begin + InternalBackspace; + IKarActive := True; + MyProcessVKeyDown := b_Hasanta; + Exit; + End + Else If LastChar = b_OIkar Then + Begin + InternalBackspace; + OIKarActive := True; + MyProcessVKeyDown := b_Hasanta; + Exit; + End + Else + Begin + MyProcessVKeyDown := b_Hasanta; + Exit; + End; + End; + + Case KeyCode Of + VK_RETURN: + Begin Block := False; + ResetLastChar; MyProcessVKeyDown := ''; Exit; - End - Else If AvroMainForm1.GetMyCurrentKeyboardMode = bangla Then Begin - CharForKey := GetCharForKey(KeyCode, var_IfShift, var_IfTrueShift, var_IfAltGr); - - - If LastChar = b_Hasanta Then Begin - - If EKarActive Then - PendingKar := b_Ekar - Else If IKarActive Then - PendingKar := b_Ikar - Else If OIKarActive Then - PendingKar := b_OIkar - Else - PendingKar := ''; - - If CharForKey = b_AAkar Then Begin - InternalBackspace; - MyProcessVKeyDown := InsertKar(PendingKar) + b_AA; - ResetAllKarsToInactive; - Exit; - End - Else If CharForKey = b_Ikar Then Begin - InternalBackspace; - MyProcessVKeyDown := InsertKar(PendingKar) + b_I; - ResetAllKarsToInactive; - Exit; - End - Else If CharForKey = b_IIkar Then Begin - InternalBackspace; - MyProcessVKeyDown := InsertKar(PendingKar) + b_II; - ResetAllKarsToInactive; - Exit; - End - Else If CharForKey = b_Ukar Then Begin - InternalBackspace; - MyProcessVKeyDown := InsertKar(PendingKar) + b_U; - ResetAllKarsToInactive; - Exit; - End - Else If CharForKey = b_UUkar Then Begin - InternalBackspace; - MyProcessVKeyDown := InsertKar(PendingKar) + b_UU; - ResetAllKarsToInactive; - Exit; - End - Else If CharForKey = b_RRIkar Then Begin - InternalBackspace; - MyProcessVKeyDown := InsertKar(PendingKar) + b_RRI; - ResetAllKarsToInactive; - Exit; - End - Else If CharForKey = b_Ekar Then Begin - InternalBackspace; - MyProcessVKeyDown := InsertKar(PendingKar) + b_E; - ResetAllKarsToInactive; - Exit; - End - Else If CharForKey = b_OIkar Then Begin - InternalBackspace; - MyProcessVKeyDown := InsertKar(PendingKar) + b_OI; - ResetAllKarsToInactive; - Exit; - End - Else If CharForKey = b_Okar Then Begin - InternalBackspace; - MyProcessVKeyDown := InsertKar(PendingKar) + b_O; - ResetAllKarsToInactive; - Exit; - End - Else If CharForKey = b_OUkar Then Begin - InternalBackspace; - MyProcessVKeyDown := InsertKar(PendingKar) + b_OU; - ResetAllKarsToInactive; - Exit; - End - Else If CharForKey = b_LengthMark Then Begin - InternalBackspace; - MyProcessVKeyDown := InsertKar(PendingKar) + b_OU; - ResetAllKarsToInactive; - Exit; - End - Else If CharForKey = b_Hasanta Then Begin - MyProcessVKeyDown := ZWNJ; - ResetAllKarsToInactive; - Exit; - End; - End; - - If CharForKey = b_Ekar Then Begin - If EKarActive = True Then Begin - EKarActive := False; - MyProcessVKeyDown := b_Ekar; - Exit; - End - Else Begin - ResetAllKarsToInactive; - EKarActive := True; - Block := True; - MyProcessVKeyDown := ''; - Exit; - End; - End; - - - If CharForKey = b_Ikar Then Begin - If IKarActive = True Then Begin - IKarActive := False; - MyProcessVKeyDown := b_Ikar; - Exit; - End - Else Begin - ResetAllKarsToInactive; - IKarActive := True; - Block := True; - MyProcessVKeyDown := ''; - Exit; - End; - End; - - - If CharForKey = b_OIkar Then Begin - If OIKarActive = True Then Begin - OIKarActive := False; - MyProcessVKeyDown := b_OIkar; - Exit; - End - Else Begin - ResetAllKarsToInactive; - OIKarActive := True; - Block := True; - MyProcessVKeyDown := ''; - Exit; - End; - End; - - - If CharForKey = b_AAkar Then Begin - If LastChar = b_Ekar Then Begin - ResetAllKarsToInactive; - InternalBackspace; - MyProcessVKeyDown := InsertKar(b_Okar); - Exit; - End; + End; + VK_SPACE: + Begin + Block := False; + ResetLastChar; + MyProcessVKeyDown := ''; + Exit; + End; + VK_TAB: + Begin + Block := False; + ResetLastChar; + MyProcessVKeyDown := ''; + Exit; + End; + VK_BACK: + Begin + DoBackspace(Block); + MyProcessVKeyDown := ''; + Exit; + End; + Else + Begin + If EKarActive = True Then + Begin + If CharForKey = b_R + b_Hasanta Then + Begin + EKarActive := False; + MyProcessVKeyDown := InsertReph + InsertKar(b_Ekar); + Exit; + End + Else If CharForKey = b_AAkar Then + Begin + EKarActive := False; + MyProcessVKeyDown := InsertKar(b_Okar); + Exit; + End + Else If CharForKey = b_LengthMark Then + Begin + EKarActive := False; + MyProcessVKeyDown := InsertKar(b_OUkar); + Exit; + End + Else If CharForKey = '' Then + Begin + ResetLastChar; + Block := False; + MyProcessVKeyDown := ''; + Exit; + End + Else + Begin + EKarActive := False; + MyProcessVKeyDown := CharForKey + InsertKar(b_Ekar); + Exit; End; - - - If CharForKey = b_LengthMark Then Begin - If LastChar = b_Ekar Then Begin - ResetAllKarsToInactive; - InternalBackspace; - MyProcessVKeyDown := InsertKar(b_OUkar); - Exit; - End; + End + Else If IKarActive = True Then + Begin + If CharForKey = b_R + b_Hasanta Then + Begin + IKarActive := False; + MyProcessVKeyDown := InsertReph + InsertKar(b_Ikar); + Exit; + End + Else If CharForKey = '' Then + Begin + ResetLastChar; + Block := False; + MyProcessVKeyDown := ''; + Exit; + End + Else + Begin + IKarActive := False; + MyProcessVKeyDown := CharForKey + InsertKar(b_Ikar); + Exit; End; - - - If CharForKey = b_Hasanta Then Begin - If LastChar = b_Ekar Then Begin - InternalBackspace; - EKarActive := True; - MyProcessVKeyDown := b_Hasanta; - Exit; - End - Else If LastChar = b_Ikar Then Begin - InternalBackspace; - IKarActive := True; - MyProcessVKeyDown := b_Hasanta; - Exit; - End - Else If LastChar = b_OIkar Then Begin - InternalBackspace; - OIKarActive := True; - MyProcessVKeyDown := b_Hasanta; - Exit; - End - Else Begin - MyProcessVKeyDown := b_Hasanta; - Exit; - End; + End + Else If OIKarActive = True Then + Begin + If CharForKey = b_R + b_Hasanta Then + Begin + OIKarActive := False; + MyProcessVKeyDown := InsertReph + InsertKar(b_OIkar); + Exit; + End + Else If CharForKey = '' Then + Begin + ResetLastChar; + Block := False; + MyProcessVKeyDown := ''; + Exit; + End + Else + Begin + OIKarActive := False; + MyProcessVKeyDown := CharForKey + InsertKar(b_OIkar); + Exit; End; + End + Else + Begin + If CharForKey = b_R + b_Hasanta Then + Begin + MyProcessVKeyDown := InsertReph; + Exit; + End + Else If CharForKey = b_AAkar Then + Begin + If LastChar = b_A Then + Begin + InternalBackspace; + MyProcessVKeyDown := b_AA; + Exit; + End + Else + Begin + MyProcessVKeyDown := b_AAkar; + Exit; + End; + End + Else If CharForKey = b_Hasanta + b_Z Then + Begin + + If (LastChar = b_R) And (LastChars[2] <> b_Hasanta) Then + Begin + MyProcessVKeyDown := DetermineZWNJ_ZWJ + b_Hasanta + b_Z; + Exit; + End + Else If IsKar(LastChar) Then + Begin + If (LastChars[2] = b_R) And (LastChars[3] <> b_Hasanta) Then + Begin + tmpString := LastChar; + InternalBackspace; + MyProcessVKeyDown := DetermineZWNJ_ZWJ + CharForKey + tmpString; + Exit; + End + Else + Begin + tmpString := LastChar; + InternalBackspace; + MyProcessVKeyDown := CharForKey + tmpString; + Exit; + End; + End + Else + Begin + MyProcessVKeyDown := b_Hasanta + b_Z; + Exit; + End; - - Case Keycode Of - VK_RETURN: Begin - Block := False; - ResetLastChar; - MyProcessVKeyDown := ''; - Exit; - End; - VK_SPACE: Begin - Block := False; - ResetLastChar; - MyProcessVKeyDown := ''; - Exit; - End; - VK_TAB: Begin - Block := False; - ResetLastChar; - MyProcessVKeyDown := ''; - Exit; - End; - VK_BACK: Begin - DoBackspace(Block); - MyProcessVKeyDown := ''; - Exit; - End; - Else Begin - If EKarActive = True Then Begin - If CharForKey = b_R + b_Hasanta Then Begin - EKarActive := False; - MyProcessVKeyDown := InsertReph + InsertKar(b_Ekar); - Exit; - End - Else If CharForKey = b_AAkar Then Begin - EKarActive := False; - MyProcessVKeyDown := InsertKar(b_Okar); - Exit; - End - Else If CharForKey = b_LengthMark Then Begin - EKarActive := False; - MyProcessVKeyDown := InsertKar(b_OUkar); - Exit; - End - Else If CharForKey = '' Then Begin - ResetLastChar; - Block := False; - MyProcessVKeyDown := ''; - Exit; - End - Else Begin - EKarActive := False; - MyProcessVKeyDown := CharForKey + InsertKar(b_Ekar); - Exit; - End; - End - Else If IKarActive = True Then Begin - If CharForKey = b_R + b_Hasanta Then Begin - IKarActive := False; - MyProcessVKeyDown := InsertReph + InsertKar(b_Ikar); - Exit; - End - Else If CharForKey = '' Then Begin - ResetLastChar; - Block := False; - MyProcessVKeyDown := ''; - Exit; - End - Else Begin - IKarActive := False; - MyProcessVKeyDown := CharForKey + InsertKar(b_Ikar); - Exit; - End; - End - Else If OIKarActive = True Then Begin - If CharForKey = b_R + b_Hasanta Then Begin - OIKarActive := False; - MyProcessVKeyDown := InsertReph + InsertKar(b_OIkar); - Exit; - End - Else If CharForKey = '' Then Begin - ResetLastChar; - Block := False; - MyProcessVKeyDown := ''; - Exit; - End - Else Begin - OIKarActive := False; - MyProcessVKeyDown := CharForKey + InsertKar(b_OIkar); - Exit; - End; - End - Else Begin - If CharForKey = b_R + b_Hasanta Then Begin - MyProcessVKeyDown := InsertReph; - Exit; - End - Else If CharForKey = b_AAkar Then Begin - If LastChar = b_A Then Begin - InternalBackspace; - MyProcessVKeyDown := b_AA; - Exit; - End - Else Begin - MyProcessVKeyDown := b_AAkar; - Exit; - End; - End - Else If CharForKey = b_Hasanta + b_Z Then Begin - - If (LastChar = b_R) And (LastChars[2] <> b_Hasanta) Then Begin - MyProcessVKeyDown := DetermineZWNJ_ZWJ + b_Hasanta + b_Z; - Exit; - End - Else If IsKar(LastChar) Then Begin - If (LastChars[2] = b_R) And (LastChars[3] <> b_Hasanta) Then Begin - tmpString := LastChar; - InternalBackspace; - MyProcessVKeyDown := DetermineZWNJ_ZWJ + CharForKey + tmpString; - Exit; - End - Else Begin - tmpString := LastChar; - InternalBackspace; - MyProcessVKeyDown := CharForKey + tmpString; - Exit; - End; - End - Else Begin - MyProcessVKeyDown := b_Hasanta + b_Z; - Exit; - End; - - End - Else If CharForKey = '' Then Begin - ResetLastChar; - Block := False; - MyProcessVKeyDown := ''; - Exit; - End - Else Begin - If (Length(CharForKey) > 1) And (LeftStr(CharForKey, 1) = b_Hasanta) Then Begin - If IsKar(LastChar) Then Begin - tmpString := LastChar; - InternalBackspace; - MyProcessVKeyDown := CharForKey + tmpString; - Exit; - End; - End; - - If IsKar(CharForKey) Then Begin - MyProcessVKeyDown := InsertKar(CharForKey); - Exit; - End - Else Begin - MyProcessVKeyDown := CharForKey; - Exit; - End; - End; - End; - End; + End + Else If CharForKey = '' Then + Begin + ResetLastChar; + Block := False; + MyProcessVKeyDown := ''; + Exit; + End + Else + Begin + If (Length(CharForKey) > 1) And + (LeftStr(CharForKey, 1) = b_Hasanta) Then + Begin + If IsKar(LastChar) Then + Begin + tmpString := LastChar; + InternalBackspace; + MyProcessVKeyDown := CharForKey + tmpString; + Exit; + End; + End; + + If IsKar(CharForKey) Then + Begin + MyProcessVKeyDown := InsertKar(CharForKey); + Exit; + End + Else + Begin + MyProcessVKeyDown := CharForKey; + Exit; + End; End; - End; + End; + End; + End; + End; End; -{===============================================================================} +{ =============================================================================== } Procedure TGenericLayoutOld.MyProcessVKeyUP(Const KeyCode: Integer; - Var Block: Boolean; Const var_IfShift, var_IfTrueShift, var_IfAltGr: Boolean); + Var Block: Boolean; Const var_IfShift, var_IfTrueShift, var_IfAltGr: Boolean); Var - CharForKey : String; + CharForKey: String; Begin - If AvroMainForm1.GetMyCurrentKeyboardMode = SysDefault Then Begin - Block := False; - Exit; - End - Else If AvroMainForm1.GetMyCurrentKeyboardMode = bangla Then Begin - CharForKey := GetCharForKey(KeyCode, var_IfShift, var_IfTrueShift, var_IfAltGr); - - If CharForKey = '' Then Begin - Block := False; - Exit; - End - Else Begin - Block := True; - Exit; - End; - End; + If AvroMainForm1.GetMyCurrentKeyboardMode = SysDefault Then + Begin + Block := False; + Exit; + End + Else If AvroMainForm1.GetMyCurrentKeyboardMode = bangla Then + Begin + CharForKey := GetCharForKey(KeyCode, var_IfShift, var_IfTrueShift, + var_IfAltGr); + + If CharForKey = '' Then + Begin + Block := False; + Exit; + End + Else + Begin + Block := True; + Exit; + End; + End; End; -{===============================================================================} +{ =============================================================================== } Procedure TGenericLayoutOld.ParseAndSendNow; Var - I, Matched, UnMatched : Integer; - BijoyPrevBanglaT, BijoyNewBanglaText: String; + I, Matched, UnMatched: Integer; + BijoyPrevBanglaT, BijoyNewBanglaText: String; Begin - Matched := 0; - - If OutputIsBijoy <> 'YES' Then Begin - {Output to Unicode} - If PrevBanglaT = '' Then Begin - SendKey_Char(NewBanglaText); - PrevBanglaT := NewBanglaText; - End - Else Begin - For I := 1 To Length(PrevBanglaT) Do Begin - If MidStr(PrevBanglaT, I, 1) = MidStr(NewBanglaText, i, 1) Then - Matched := Matched + 1 - Else - Break; - End; - UnMatched := Length(PrevBanglaT) - Matched; - - If UnMatched >= 1 Then Backspace(UnMatched); - SendKey_Char(MidStr(NewBanglaText, Matched + 1, Length(NewBanglaText))); - PrevBanglaT := NewBanglaText; - End; - - End - Else Begin - {Output to Bijoy} - BijoyPrevBanglaT := Bijoy.Convert(PrevBanglaT); - BijoyNewBanglaText := Bijoy.Convert(NewBanglaText); - - If BijoyPrevBanglaT = '' Then Begin - SendKey_Char(BijoyNewBanglaText); - PrevBanglaT := NewBanglaText; - End - Else Begin - For I := 1 To Length(BijoyPrevBanglaT) Do Begin - If MidStr(BijoyPrevBanglaT, I, 1) = MidStr(BijoyNewBanglaText, i, 1) Then - Matched := Matched + 1 - Else - Break; - End; - UnMatched := Length(BijoyPrevBanglaT) - Matched; - - If UnMatched >= 1 Then Backspace(UnMatched); - SendKey_Char(MidStr(BijoyNewBanglaText, Matched + 1, Length(BijoyNewBanglaText))); - PrevBanglaT := NewBanglaText; - End; - - End; + Matched := 0; + + If OutputIsBijoy <> 'YES' Then + Begin + { Output to Unicode } + If PrevBanglaT = '' Then + Begin + SendKey_Char(NewBanglaText); + PrevBanglaT := NewBanglaText; + End + Else + Begin + For I := 1 To Length(PrevBanglaT) Do + Begin + If MidStr(PrevBanglaT, I, 1) = MidStr(NewBanglaText, I, 1) Then + Matched := Matched + 1 + Else + Break; + End; + UnMatched := Length(PrevBanglaT) - Matched; + + If UnMatched >= 1 Then + Backspace(UnMatched); + SendKey_Char(MidStr(NewBanglaText, Matched + 1, Length(NewBanglaText))); + PrevBanglaT := NewBanglaText; + End; + + End + Else + Begin + { Output to Bijoy } + BijoyPrevBanglaT := Bijoy.Convert(PrevBanglaT); + BijoyNewBanglaText := Bijoy.Convert(NewBanglaText); + + If BijoyPrevBanglaT = '' Then + Begin + SendKey_Char(BijoyNewBanglaText); + PrevBanglaT := NewBanglaText; + End + Else + Begin + For I := 1 To Length(BijoyPrevBanglaT) Do + Begin + If MidStr(BijoyPrevBanglaT, I, 1) = MidStr(BijoyNewBanglaText, + I, 1) Then + Matched := Matched + 1 + Else + Break; + End; + UnMatched := Length(BijoyPrevBanglaT) - Matched; + + If UnMatched >= 1 Then + Backspace(UnMatched); + SendKey_Char(MidStr(BijoyNewBanglaText, Matched + 1, + Length(BijoyNewBanglaText))); + PrevBanglaT := NewBanglaText; + End; + + End; End; -{===============================================================================} +{ =============================================================================== } Function TGenericLayoutOld.ProcessVKeyDown(Const KeyCode: Integer; - Var Block: Boolean): String; + Var Block: Boolean): String; Var - m_Block : Boolean; - m_Str : String; + m_Block: Boolean; + m_Str: String; Begin - m_Block := False; - - If (IfWinKey = True) Or (IfOnlyCtrlKey = True) Or (IfOnlyLeftAltKey = True) Then Begin - Block := False; - ProcessVKeyDown := ''; - Exit; - End; - - If IfIgnorableModifierKey(KeyCode) Then Begin - Block := False; - ProcessVKeyDown := ''; - Exit; - End; - - m_Str := MyProcessVKeyDown(KeyCode, m_Block, IfShift, IfTrueShift, IfAltGr); - If m_Str <> '' Then Begin - m_Block := True; - SetLastChar(m_Str); - End; - - NewBanglaText := NewBanglaText + m_Str; - ParseAndSendNow; - - Block := m_Block; - ProcessVKeyDown := ''; + m_Block := False; + + If (IfWinKey = True) Or (IfOnlyCtrlKey = True) Or + (IfOnlyLeftAltKey = True) Then + Begin + Block := False; + ProcessVKeyDown := ''; + Exit; + End; + + If IfIgnorableModifierKey(KeyCode) Then + Begin + Block := False; + ProcessVKeyDown := ''; + Exit; + End; + + m_Str := MyProcessVKeyDown(KeyCode, m_Block, IfShift, IfTrueShift, IfAltGr); + If m_Str <> '' Then + Begin + m_Block := True; + SetLastChar(m_Str); + End; + + NewBanglaText := NewBanglaText + m_Str; + ParseAndSendNow; + + Block := m_Block; + ProcessVKeyDown := ''; End; -{===============================================================================} +{ =============================================================================== } Procedure TGenericLayoutOld.ProcessVKeyUP(Const KeyCode: Integer; - Var Block: Boolean); + Var Block: Boolean); Begin - If (IfWinKey = True) Or (IfOnlyCtrlKey = True) Or (IfOnlyLeftAltKey = True) Then Begin - Block := False; - Exit; - End; - - If IfIgnorableModifierKey(KeyCode) = True Then Begin - Block := False; - Exit; - End; - - // If BlockedLast Then - // Block = True - // Else - // Block = False - // End If - - MyProcessVKeyUP(KeyCode, Block, IfShift, IfTrueShift, IfAltGr); + If (IfWinKey = True) Or (IfOnlyCtrlKey = True) Or + (IfOnlyLeftAltKey = True) Then + Begin + Block := False; + Exit; + End; + + If IfIgnorableModifierKey(KeyCode) = True Then + Begin + Block := False; + Exit; + End; + + // If BlockedLast Then + // Block = True + // Else + // Block = False + // End If + + MyProcessVKeyUP(KeyCode, Block, IfShift, IfTrueShift, IfAltGr); End; -{===============================================================================} +{ =============================================================================== } Procedure TGenericLayoutOld.ResetAllKarsToInactive; Begin - EKarActive := False; - IKarActive := False; - OIKarActive := False; + EKarActive := False; + IKarActive := False; + OIKarActive := False; End; -{===============================================================================} +{ =============================================================================== } Procedure TGenericLayoutOld.ResetDeadKey; Begin - ResetLastChar; + ResetLastChar; End; -{===============================================================================} +{ =============================================================================== } Procedure TGenericLayoutOld.ResetLastChar; Var - i : Integer; + I: Integer; Begin - For i := 1 To TrackL Do - LastChars[i] := ' '; + For I := 1 To TrackL Do + LastChars[I] := ' '; - LastChar := ' '; - ResetAllKarsToInactive; - PrevBanglaT := ''; - NewBanglaText := ''; + LastChar := ' '; + ResetAllKarsToInactive; + PrevBanglaT := ''; + NewBanglaText := ''; End; -{===============================================================================} +{ =============================================================================== } Procedure TGenericLayoutOld.SetLastChar(Const wChar: String); Var - t1, t2 : String; - I, J : Integer; + t1, t2: String; + I, J: Integer; Begin - For i := TrackL Downto 1 Do - t1 := t1 + LastChars[i]; - - t1 := t1 + wChar; - t2 := RightStr(t1, TrackL); - - For i := TrackL Downto 1 Do Begin - J := TrackL + 1 - i; - LastChars[i] := MidStr(t2, J, 1); - End; - LastChar := LastChars[1]; + For I := TrackL Downto 1 Do + t1 := t1 + LastChars[I]; + + t1 := t1 + wChar; + t2 := RightStr(t1, TrackL); + + For I := TrackL Downto 1 Do + Begin + J := TrackL + 1 - I; + LastChars[I] := MidStr(t2, J, 1); + End; + LastChar := LastChars[1]; End; -{===============================================================================} +{ =============================================================================== } End. - diff --git a/Keyboard and Spell checker/Classes/clsLayout.pas b/Keyboard and Spell checker/Classes/clsLayout.pas index a164f43..c746c95 100644 --- a/Keyboard and Spell checker/Classes/clsLayout.pas +++ b/Keyboard and Spell checker/Classes/clsLayout.pas @@ -1,316 +1,321 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - -{COMPLETE TRANSFERING!} +{ COMPLETE TRANSFERING! } Unit clsLayout; Interface Uses - classes, - sysutils, - StrUtils, - clsAvroPhonetic, - clsGenericLayoutModern, - clsGenericLayoutOld, - Forms, - Windows; - - -//-------------------------------------------------------------- -//Enumarated types + classes, + sysutils, + StrUtils, + clsAvroPhonetic, + clsGenericLayoutModern, + clsGenericLayoutOld, + Forms, + Windows; + +// -------------------------------------------------------------- +// Enumarated types Type - enumMode = (SysDefault, Bangla); - - + enumMode = (SysDefault, Bangla); Type - //Event types - //-------------------------------------------------------------- - TKeyboardModeChanged = Procedure(CurrentMode: enumMode) Of Object; - TWordTrackingLost = Procedure Of Object; //Special for Avro phonetic - TKeyboardLayoutChanged = Procedure(CurrentKeyboardLayout: String) Of Object; - THookSet = Procedure Of Object; - THookSettingFailed = Procedure Of Object; - //-------------------------------------------------------------- - + // Event types + // -------------------------------------------------------------- + TKeyboardModeChanged = Procedure(CurrentMode: enumMode) Of Object; + TWordTrackingLost = Procedure Of Object; // Special for Avro phonetic + TKeyboardLayoutChanged = Procedure(CurrentKeyboardLayout: String) Of Object; + THookSet = Procedure Of Object; + THookSettingFailed = Procedure Of Object; + // -------------------------------------------------------------- Type - //Skeleton of TLayout class - //-------------------------------------------------------------- - TLayout = Class - Private - AvroPhonetic: TAvroPhonetic; - GenericModernFixed: TGenericLayoutModern; - GenericOldFixed: TGenericLayoutOld; - - k_Layout: String; - k_Mode: enumMode; - - //-------------------------------------------------------------- - //Event types - FKeyboardModeChanged: TKeyboardModeChanged; - FWordTrackingLost: TWordTrackingLost; - FKeyboardLayoutChanged: TKeyboardLayoutChanged; - FHookSet: THookSet; - FHookSettingFailed: THookSettingFailed; - //-------------------------------------------------------------- - - - Procedure SetAutoCorrectEnabled(Const Value: Boolean); - Function GetAutoCorrectEnabled: Boolean; - Procedure SetCurrentKeyboardLayout(Value: String); - Function GetCurrentKeyboardLayout: String; - Procedure SetKeyboardMode(Const Value: enumMode); - Function GetKeyboardMode: enumMode; - Public - Constructor Create; //Initializer - Destructor Destroy; Override; //Destructor - - Function ProcessVKeyDown(Const KeyCode: Integer; Var Block: Boolean): String; - Procedure ProcessVKeyUP(Const KeyCode: Integer; Var Block: Boolean); - Procedure ResetDeadKey; - Procedure ToggleMode; - Procedure BanglaMode; - Procedure SysMode; - Procedure SelectCandidate(Const Item: String); //For Phonetic - - //Published - //-------------------------------------------------------------- - // event properties - Property OnKeyboardModeChanged: TKeyboardModeChanged - Read FKeyboardModeChanged Write FKeyboardModeChanged; - Property OnWordTrackingLost: TWordTrackingLost - Read FWordTrackingLost Write FWordTrackingLost; - Property OnKeyboardLayoutChanged: TKeyboardLayoutChanged - Read FKeyboardLayoutChanged Write FKeyboardLayoutChanged; - Property OnHookSet: THookSet - Read FHookSet Write FHookSet; - Property OnHookSettingFailed: THookSettingFailed - Read FHookSettingFailed Write FHookSettingFailed; - //-------------------------------------------------------------- - - - Property AutoCorrectEnabled: Boolean - Read GetAutoCorrectEnabled Write SetAutoCorrectEnabled; - Property CurrentKeyboardLayout: String - Read GetCurrentKeyboardLayout Write SetCurrentKeyboardLayout; - Property KeyboardMode: enumMode - Read GetKeyboardMode Write SetKeyboardMode; - - - End; - + // Skeleton of TLayout class + // -------------------------------------------------------------- + TLayout = Class + Private + AvroPhonetic: TAvroPhonetic; + GenericModernFixed: TGenericLayoutModern; + GenericOldFixed: TGenericLayoutOld; + + k_Layout: String; + k_Mode: enumMode; + + // -------------------------------------------------------------- + // Event types + FKeyboardModeChanged: TKeyboardModeChanged; + FWordTrackingLost: TWordTrackingLost; + FKeyboardLayoutChanged: TKeyboardLayoutChanged; + FHookSet: THookSet; + FHookSettingFailed: THookSettingFailed; + // -------------------------------------------------------------- + + Procedure SetAutoCorrectEnabled(Const Value: Boolean); + Function GetAutoCorrectEnabled: Boolean; + Procedure SetCurrentKeyboardLayout(Value: String); + Function GetCurrentKeyboardLayout: String; + Procedure SetKeyboardMode(Const Value: enumMode); + Function GetKeyboardMode: enumMode; + Public + Constructor Create; // Initializer + Destructor Destroy; Override; // Destructor + + Function ProcessVKeyDown(Const KeyCode: Integer; + Var Block: Boolean): String; + Procedure ProcessVKeyUP(Const KeyCode: Integer; Var Block: Boolean); + Procedure ResetDeadKey; + Procedure ToggleMode; + Procedure BanglaMode; + Procedure SysMode; + Procedure SelectCandidate(Const Item: String); // For Phonetic + + // Published + // -------------------------------------------------------------- + // event properties + Property OnKeyboardModeChanged: TKeyboardModeChanged + Read FKeyboardModeChanged Write FKeyboardModeChanged; + Property OnWordTrackingLost: TWordTrackingLost Read FWordTrackingLost + Write FWordTrackingLost; + Property OnKeyboardLayoutChanged: TKeyboardLayoutChanged + Read FKeyboardLayoutChanged Write FKeyboardLayoutChanged; + Property OnHookSet: THookSet Read FHookSet Write FHookSet; + Property OnHookSettingFailed: THookSettingFailed Read FHookSettingFailed + Write FHookSettingFailed; + // -------------------------------------------------------------- + + Property AutoCorrectEnabled: Boolean Read GetAutoCorrectEnabled + Write SetAutoCorrectEnabled; + Property CurrentKeyboardLayout: String Read GetCurrentKeyboardLayout + Write SetCurrentKeyboardLayout; + Property KeyboardMode: enumMode Read GetKeyboardMode Write SetKeyboardMode; + + End; Implementation Uses - KeyboardHook, - KeyboardLayoutLoader, - uRegistrySettings; + KeyboardHook, + KeyboardLayoutLoader, + uRegistrySettings; { TLayout } -{===============================================================================} +{ =============================================================================== } Procedure TLayout.BanglaMode; Begin - Self.KeyboardMode := bangla; + Self.KeyboardMode := Bangla; End; -{===============================================================================} +{ =============================================================================== } Constructor TLayout.Create; Var - RetVal : Integer; + RetVal: Integer; Begin - Inherited; - RetVal := Sethook; - - If RetVal > 0 Then Begin - If Assigned(FHookSet) Then FHookSet; - End - Else Begin - If Assigned(FHookSettingFailed) Then FHookSettingFailed; - End; - - AvroPhonetic := TAvroPhonetic.Create; - GenericModernFixed := TGenericLayoutModern.Create; - GenericOldFixed := TGenericLayoutOld.Create; - - Self.KeyboardMode := SysDefault; - k_Layout := 'avrophonetic*'; + Inherited; + RetVal := Sethook; + + If RetVal > 0 Then + Begin + If Assigned(FHookSet) Then + FHookSet; + End + Else + Begin + If Assigned(FHookSettingFailed) Then + FHookSettingFailed; + End; + + AvroPhonetic := TAvroPhonetic.Create; + GenericModernFixed := TGenericLayoutModern.Create; + GenericOldFixed := TGenericLayoutOld.Create; + + Self.KeyboardMode := SysDefault; + k_Layout := 'avrophonetic*'; End; -{===============================================================================} +{ =============================================================================== } Destructor TLayout.Destroy; Begin - Removehook; + Removehook; - FreeAndNil(AvroPhonetic); - FreeAndNil(GenericModernFixed); - FreeAndNil(GenericOldFixed); - Inherited; + FreeAndNil(AvroPhonetic); + FreeAndNil(GenericModernFixed); + FreeAndNil(GenericOldFixed); + Inherited; End; -{===============================================================================} +{ =============================================================================== } Function TLayout.GetAutoCorrectEnabled: Boolean; Begin - Result := AvroPhonetic.AutoCorrectEnabled; + Result := AvroPhonetic.AutoCorrectEnabled; End; -{===============================================================================} +{ =============================================================================== } Function TLayout.GetCurrentKeyboardLayout: String; Begin - Result := k_Layout; + Result := k_Layout; End; -{===============================================================================} +{ =============================================================================== } Function TLayout.GetKeyboardMode: enumMode; Begin - Result := k_Mode; + Result := k_Mode; End; -{===============================================================================} +{ =============================================================================== } Function TLayout.ProcessVKeyDown(Const KeyCode: Integer; - Var Block: Boolean): String; + Var Block: Boolean): String; Begin - If Lowercase(k_Layout) = 'avrophonetic*' Then - ProcessVKeyDown := AvroPhonetic.ProcessVKeyDown(KeyCode, Block) - Else Begin - If FullOldStyleTyping <> 'YES' Then - ProcessVKeyDown := GenericModernFixed.ProcessVKeyDown(KeyCode, Block) - Else - ProcessVKeyDown := GenericOldFixed.ProcessVKeyDown(KeyCode, Block); - End; + If Lowercase(k_Layout) = 'avrophonetic*' Then + ProcessVKeyDown := AvroPhonetic.ProcessVKeyDown(KeyCode, Block) + Else + Begin + If FullOldStyleTyping <> 'YES' Then + ProcessVKeyDown := GenericModernFixed.ProcessVKeyDown(KeyCode, Block) + Else + ProcessVKeyDown := GenericOldFixed.ProcessVKeyDown(KeyCode, Block); + End; End; -{===============================================================================} +{ =============================================================================== } Procedure TLayout.ProcessVKeyUP(Const KeyCode: Integer; Var Block: Boolean); Begin - If Lowercase(k_Layout) = 'avrophonetic*' Then - AvroPhonetic.ProcessVKeyUP(KeyCode, Block) - Else Begin - If FullOldStyleTyping <> 'YES' Then - GenericModernFixed.ProcessVKeyUP(KeyCode, Block) - Else - GenericOldFixed.ProcessVKeyUP(KeyCode, Block); - End; + If Lowercase(k_Layout) = 'avrophonetic*' Then + AvroPhonetic.ProcessVKeyUP(KeyCode, Block) + Else + Begin + If FullOldStyleTyping <> 'YES' Then + GenericModernFixed.ProcessVKeyUP(KeyCode, Block) + Else + GenericOldFixed.ProcessVKeyUP(KeyCode, Block); + End; End; -{===============================================================================} +{ =============================================================================== } Procedure TLayout.ResetDeadKey; Begin - AvroPhonetic.ResetDeadKey; - GenericModernFixed.ResetDeadKey; - GenericOldFixed.ResetDeadKey; + AvroPhonetic.ResetDeadKey; + GenericModernFixed.ResetDeadKey; + GenericOldFixed.ResetDeadKey; End; -{===============================================================================} +{ =============================================================================== } Procedure TLayout.SelectCandidate(Const Item: String); Begin - AvroPhonetic.SelectCandidate(Item); + AvroPhonetic.SelectCandidate(Item); End; Procedure TLayout.SetAutoCorrectEnabled(Const Value: Boolean); Begin - AvroPhonetic.AutoCorrectEnabled := Value; + AvroPhonetic.AutoCorrectEnabled := Value; End; -{===============================================================================} +{ =============================================================================== } Procedure TLayout.SetCurrentKeyboardLayout(Value: String); Var - RetVal : Integer; + RetVal: Integer; Begin - Removehook; - - If Lowercase(Value) <> 'avrophonetic*' Then Begin - If Init_KeyboardLayout(Value) = False Then Begin - Application.MessageBox(PChar('Error Loading ' + Value + ' keyboard layout!' + #10 + '' + #10 + 'Layout switched back to Avro Phonetic.'), 'Avro Keyboard', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - Value := 'AvroPhonetic*'; - End; - End; - - ResetDeadKey; - k_Layout := Value; - - If Assigned(FKeyboardLayoutChanged) Then FKeyboardLayoutChanged(k_Layout); - - - RetVal := Sethook; - - If RetVal > 0 Then Begin - If Assigned(FHookSet) Then FHookSet; - End - Else Begin - If Assigned(FHookSettingFailed) Then FHookSettingFailed; - End; + Removehook; + + If Lowercase(Value) <> 'avrophonetic*' Then + Begin + If Init_KeyboardLayout(Value) = False Then + Begin + Application.MessageBox(PChar('Error Loading ' + Value + + ' keyboard layout!' + #10 + '' + #10 + + 'Layout switched back to Avro Phonetic.'), 'Avro Keyboard', + MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); + Value := 'AvroPhonetic*'; + End; + End; + + ResetDeadKey; + k_Layout := Value; + + If Assigned(FKeyboardLayoutChanged) Then + FKeyboardLayoutChanged(k_Layout); + + RetVal := Sethook; + + If RetVal > 0 Then + Begin + If Assigned(FHookSet) Then + FHookSet; + End + Else + Begin + If Assigned(FHookSettingFailed) Then + FHookSettingFailed; + End; End; -{===============================================================================} +{ =============================================================================== } Procedure TLayout.SetKeyboardMode(Const Value: enumMode); Begin - k_Mode := Value; - If Assigned(FKeyboardModeChanged) Then FKeyboardModeChanged(k_Mode); - ResetDeadKey; + k_Mode := Value; + If Assigned(FKeyboardModeChanged) Then + FKeyboardModeChanged(k_Mode); + ResetDeadKey; End; -{===============================================================================} +{ =============================================================================== } Procedure TLayout.SysMode; Begin - Self.KeyboardMode := SysDefault; + Self.KeyboardMode := SysDefault; End; -{===============================================================================} +{ =============================================================================== } Procedure TLayout.ToggleMode; Begin - If Self.KeyboardMode = SysDefault Then - Self.KeyboardMode := bangla - Else - Self.KeyboardMode := SysDefault; + If Self.KeyboardMode = SysDefault Then + Self.KeyboardMode := Bangla + Else + Self.KeyboardMode := SysDefault; End; -{===============================================================================} +{ =============================================================================== } End. - diff --git a/Keyboard and Spell checker/Classes/clsPhoneticRegExBuilder.pas b/Keyboard and Spell checker/Classes/clsPhoneticRegExBuilder.pas index 9e91fd1..46b2fa7 100644 --- a/Keyboard and Spell checker/Classes/clsPhoneticRegExBuilder.pas +++ b/Keyboard and Spell checker/Classes/clsPhoneticRegExBuilder.pas @@ -1,28 +1,28 @@ { - ============================================================================= - ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + ============================================================================= + ***************************************************************************** + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. - ***************************************************************************** - ============================================================================= + ***************************************************************************** + ============================================================================= } Unit clsPhoneticRegExBuilder; @@ -30,200 +30,205 @@ Interface Uses - classes, - sysutils, - StrUtils; + classes, + sysutils, + StrUtils; // Skeleton of Class TEnglishToRegEx Type - TEnglishToRegEx = Class - pEnglishText: String; - ln: Integer; // Length of English String - pos: Integer; // Position of processing at English String - RS: String; // Result String - - Private - Function MyConvert(): String; - Function Cnv(Const Compare: String; Const IfTrue: String): Boolean; - Procedure AddRs(Const T: String); - Function PrevT: String; - Function NextT: String; - Function Vowel(Const T: String): Boolean; - Function Consonent(Const T: String): Boolean; - Function Begining: Boolean; - Procedure A; - Procedure B; - Procedure C; - Procedure D; - Procedure E; - Procedure F; - Procedure G; - Procedure H; - Procedure I; - Procedure J; - Procedure K; - Procedure L; - Procedure M; - Procedure N; - Procedure O; - Procedure P; - Procedure Q; - Procedure R; - Procedure S; - Procedure T; - Procedure U; - Procedure V; - Procedure W; - Procedure X; - Procedure Y; - Procedure Z; - - Public - Constructor Create; // Initializer - Function Convert(Const EnglishT: String): String; - Function CorrectCase(Const inputT: String): String; - Function EscapeSpecialCharacters(Const inputT: String): String; - End; + TEnglishToRegEx = Class + pEnglishText: String; + ln: Integer; // Length of English String + pos: Integer; // Position of processing at English String + RS: String; // Result String + + Private + Function MyConvert(): String; + Function Cnv(Const Compare: String; Const IfTrue: String): Boolean; + Procedure AddRs(Const T: String); + Function PrevT: String; + Function NextT: String; + Function Vowel(Const T: String): Boolean; + Function Consonent(Const T: String): Boolean; + Function Begining: Boolean; + Procedure A; + Procedure B; + Procedure C; + Procedure D; + Procedure E; + Procedure F; + Procedure G; + Procedure H; + Procedure I; + Procedure J; + Procedure K; + Procedure L; + Procedure M; + Procedure N; + Procedure O; + Procedure P; + Procedure Q; + Procedure R; + Procedure S; + Procedure T; + Procedure U; + Procedure V; + Procedure W; + Procedure X; + Procedure Y; + Procedure Z; + + Public + Constructor Create; // Initializer + Function Convert(Const EnglishT: String): String; + Function CorrectCase(Const inputT: String): String; + Function EscapeSpecialCharacters(Const inputT: String): String; + End; Implementation Uses - Phonetic_RegExp_Constants, - BanglaChars; + Phonetic_RegExp_Constants, + BanglaChars; { TEnglishToRegEx } Procedure TEnglishToRegEx.A; Begin - If Cnv('aa', r_AA) = True Then - Exit; - If Cnv('au', r_AU) = True Then - Exit; - If Cnv('az', r_AZ) = True Then - Exit; - If Cnv('ai', r_AI) = True Then - Exit; + If Cnv('aa', r_AA) = True Then + Exit; + If Cnv('au', r_AU) = True Then + Exit; + If Cnv('az', r_AZ) = True Then + Exit; + If Cnv('ai', r_AI) = True Then + Exit; - - If Cnv('a', r_A) = True Then - Exit; + If Cnv('a', r_A) = True Then + Exit; End; Procedure TEnglishToRegEx.AddRs(Const T: String); Begin - If (Consonent(PrevT) = True) And (Consonent(NextT) = True) Then - RS := RS + T + r_InjectHasanta - Else Begin - If NextT <> '' Then - RS := RS + T + r_InjectFola + r_InjectChandraBisharga - Else - RS := RS + T + r_InjectChandraBisharga; - End; + If (Consonent(PrevT) = True) And (Consonent(NextT) = True) Then + RS := RS + T + r_InjectHasanta + Else + Begin + If NextT <> '' Then + RS := RS + T + r_InjectFola + r_InjectChandraBisharga + Else + RS := RS + T + r_InjectChandraBisharga; + End; - pos := pos + 1; + pos := pos + 1; End; Procedure TEnglishToRegEx.B; Begin - If Cnv('bdh', r_BDH) = True Then - Exit; - If Cnv('bhl', r_BHL) = True Then - Exit; + If Cnv('bdh', r_BDH) = True Then + Exit; + If Cnv('bhl', r_BHL) = True Then + Exit; - If Cnv('bh', r_BH) = True Then - Exit; - If Cnv('bb', r_BB) = True Then - Exit; - If Cnv('bd', r_BD) = True Then - Exit; - If Cnv('bv', r_BV) = True Then - Exit; + If Cnv('bh', r_BH) = True Then + Exit; + If Cnv('bb', r_BB) = True Then + Exit; + If Cnv('bd', r_BD) = True Then + Exit; + If Cnv('bv', r_BV) = True Then + Exit; - If Cnv('b', r_B) = True Then - Exit; + If Cnv('b', r_B) = True Then + Exit; End; Function TEnglishToRegEx.Begining: Boolean; Var - T: Char; - temp: String; -Begin - temp := PrevT; - T := #0; - If length(temp) > 0 Then - T := temp[1]; - - If length(T) > 0 Then Begin - Case T Of - '0' .. '9': - Begining := False; - 'A' .. 'Z': - Begining := False; - 'a' .. 'z': - Begining := False; - Else - Begining := True; - End; - End - Else - Begining := True; + T: Char; + temp: String; +Begin + temp := PrevT; + T := #0; + If length(temp) > 0 Then + T := temp[1]; + + If length(T) > 0 Then + Begin + Case T Of + '0' .. '9': + Begining := False; + 'A' .. 'Z': + Begining := False; + 'a' .. 'z': + Begining := False; + Else + Begining := True; + End; + End + Else + Begining := True; End; Procedure TEnglishToRegEx.C; Begin - If Cnv('chchh', r_CHCHH) = True Then - Exit; + If Cnv('chchh', r_CHCHH) = True Then + Exit; - If Cnv('cch', r_CCH) = True Then - Exit; - If Cnv('chh', r_CHH) = True Then - Exit; - If Cnv('cng', r_CNG) = True Then - Exit; + If Cnv('cch', r_CCH) = True Then + Exit; + If Cnv('chh', r_CHH) = True Then + Exit; + If Cnv('cng', r_CNG) = True Then + Exit; - If Cnv('ch', r_CH) = True Then - Exit; - If Cnv('ck', r_CK) = True Then - Exit; - If Cnv('cc', r_CC) = True Then - Exit; - If Cnv('cn', r_CN) = True Then - Exit; + If Cnv('ch', r_CH) = True Then + Exit; + If Cnv('ck', r_CK) = True Then + Exit; + If Cnv('cc', r_CC) = True Then + Exit; + If Cnv('cn', r_CN) = True Then + Exit; - If Cnv('c', r_C) = True Then - Exit; + If Cnv('c', r_C) = True Then + Exit; End; {$HINTS Off} -Function TEnglishToRegEx.Cnv(Const Compare: String; Const IfTrue: String): Boolean; +Function TEnglishToRegEx.Cnv(Const Compare: String; + Const IfTrue: String): Boolean; Var - I: Integer; - tmp: String; - NextCharacterAfterBlock, LastCharacterOfBlock: String; -Begin - Result := False; - I := length(Compare); - tmp := MidStr(pEnglishText, pos, I); - - If Compare = tmp Then Begin - Result := True; - NextCharacterAfterBlock := MidStr(pEnglishText, pos + I, 1); - LastCharacterOfBlock := MidStr(pEnglishText, pos + I - 1, 1); - - If (Consonent(LastCharacterOfBlock) = True) And (Consonent(NextCharacterAfterBlock) = True) Then - RS := RS + IfTrue + r_InjectHasanta - Else Begin - If NextCharacterAfterBlock <> '' Then - RS := RS + IfTrue + r_InjectFola + r_InjectChandraBisharga - Else - RS := RS + IfTrue + r_InjectChandraBisharga; - End; - - pos := pos + I; - End - Else - Result := False; + I: Integer; + tmp: String; + NextCharacterAfterBlock, LastCharacterOfBlock: String; +Begin + Result := False; + I := length(Compare); + tmp := MidStr(pEnglishText, pos, I); + + If Compare = tmp Then + Begin + Result := True; + NextCharacterAfterBlock := MidStr(pEnglishText, pos + I, 1); + LastCharacterOfBlock := MidStr(pEnglishText, pos + I - 1, 1); + + If (Consonent(LastCharacterOfBlock) = True) And + (Consonent(NextCharacterAfterBlock) = True) Then + RS := RS + IfTrue + r_InjectHasanta + Else + Begin + If NextCharacterAfterBlock <> '' Then + RS := RS + IfTrue + r_InjectFola + r_InjectChandraBisharga + Else + RS := RS + IfTrue + r_InjectChandraBisharga; + End; + + pos := pos + I; + End + Else + Result := False; End; {$HINTS On} @@ -231,648 +236,654 @@ Function TEnglishToRegEx.Consonent(Const T: String): Boolean; Var - temp: Char; - myT: String; + temp: Char; + myT: String; Begin - Result := False; - myT := LowerCase(T); - temp := #0; - If length(myT) > 0 Then - temp := myT[1]; + Result := False; + myT := LowerCase(T); + temp := #0; + If length(myT) > 0 Then + temp := myT[1]; - Case temp Of - 'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z': - Consonent := True; - Else - Consonent := False; - End; + Case temp Of + 'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', + 't', 'v', 'w', 'x', 'y', 'z': + Consonent := True; + Else + Consonent := False; + End; End; {$HINTS On} Function TEnglishToRegEx.Convert(Const EnglishT: String): String; Begin - If EnglishT = '' Then - Exit; - pEnglishText := EscapeSpecialCharacters(CorrectCase(EnglishT)); - Result := MyConvert; + If EnglishT = '' Then + Exit; + pEnglishText := EscapeSpecialCharacters(CorrectCase(EnglishT)); + Result := MyConvert; End; Function TEnglishToRegEx.CorrectCase(Const inputT: String): String; Begin - Result := LowerCase(inputT); + Result := LowerCase(inputT); End; Constructor TEnglishToRegEx.Create; Begin - Initialize_RVals; - ln := 0; - pos := 0; + Initialize_RVals; + ln := 0; + pos := 0; End; Procedure TEnglishToRegEx.D; Begin - If Cnv('dhm', r_DHM) = True Then - Exit; - If Cnv('dhn', r_DHN) = True Then - Exit; - If Cnv('dbh', r_DBH) = True Then - Exit; - If Cnv('ddh', r_DDH) = True Then - Exit; - If Cnv('dgh', r_DGH) = True Then - Exit; - - If Cnv('db', r_DB) = True Then - Exit; - If Cnv('dd', r_DD) = True Then - Exit; - If Cnv('dg', r_DG) = True Then - Exit; - If Cnv('dh', r_DH) = True Then - Exit; - - If Cnv('d', r_D) = True Then - Exit; + If Cnv('dhm', r_DHM) = True Then + Exit; + If Cnv('dhn', r_DHN) = True Then + Exit; + If Cnv('dbh', r_DBH) = True Then + Exit; + If Cnv('ddh', r_DDH) = True Then + Exit; + If Cnv('dgh', r_DGH) = True Then + Exit; + + If Cnv('db', r_DB) = True Then + Exit; + If Cnv('dd', r_DD) = True Then + Exit; + If Cnv('dg', r_DG) = True Then + Exit; + If Cnv('dh', r_DH) = True Then + Exit; + + If Cnv('d', r_D) = True Then + Exit; End; Procedure TEnglishToRegEx.E; Begin - If Cnv('ey', r_EY) = True Then - Exit; - If Cnv('ee', r_EE) = True Then - Exit; + If Cnv('ey', r_EY) = True Then + Exit; + If Cnv('ee', r_EE) = True Then + Exit; - If Cnv('e', r_E) = True Then - Exit; + If Cnv('e', r_E) = True Then + Exit; End; {$WARN NO_RETVAL OFF} Function TEnglishToRegEx.EscapeSpecialCharacters(Const inputT: String): String; Var - T: String; -Begin - (* - We need to escape the following 14 metacharacters: - \ | ( ) [ ] { } ^ $ * + ? . - *) - - T := inputT; - T := ReplaceStr(T, '\', ''); - T := ReplaceStr(T, '|', ''); - T := ReplaceStr(T, '(', ''); - T := ReplaceStr(T, ')', ''); - T := ReplaceStr(T, '[', ''); - T := ReplaceStr(T, ']', ''); - T := ReplaceStr(T, '{', ''); - T := ReplaceStr(T, '}', ''); - T := ReplaceStr(T, '^', ''); - T := ReplaceStr(T, '$', ''); - T := ReplaceStr(T, '*', ''); - T := ReplaceStr(T, '+', ''); - T := ReplaceStr(T, '?', ''); - T := ReplaceStr(T, '.', ''); - - // Additional characters - T := ReplaceStr(T, '~', ''); - T := ReplaceStr(T, '!', ''); - T := ReplaceStr(T, '@', ''); - T := ReplaceStr(T, '#', ''); - T := ReplaceStr(T, '%', ''); - T := ReplaceStr(T, '&', ''); - T := ReplaceStr(T, '-', ''); - T := ReplaceStr(T, '_', ''); - T := ReplaceStr(T, '=', ''); - T := ReplaceStr(T, #39, ''); - T := ReplaceStr(T, '"', ''); - T := ReplaceStr(T, ';', ''); - T := ReplaceStr(T, '<', ''); - T := ReplaceStr(T, '>', ''); - T := ReplaceStr(T, '/', ''); - T := ReplaceStr(T, '\', ''); - T := ReplaceStr(T, ',', ''); - T := ReplaceStr(T, ':', ''); - T := ReplaceStr(T, '`', ''); - - Result := T; + T: String; +Begin + (* + We need to escape the following 14 metacharacters: + \ | ( ) [ ] { } ^ $ * + ? . + *) + + T := inputT; + T := ReplaceStr(T, '\', ''); + T := ReplaceStr(T, '|', ''); + T := ReplaceStr(T, '(', ''); + T := ReplaceStr(T, ')', ''); + T := ReplaceStr(T, '[', ''); + T := ReplaceStr(T, ']', ''); + T := ReplaceStr(T, '{', ''); + T := ReplaceStr(T, '}', ''); + T := ReplaceStr(T, '^', ''); + T := ReplaceStr(T, '$', ''); + T := ReplaceStr(T, '*', ''); + T := ReplaceStr(T, '+', ''); + T := ReplaceStr(T, '?', ''); + T := ReplaceStr(T, '.', ''); + + // Additional characters + T := ReplaceStr(T, '~', ''); + T := ReplaceStr(T, '!', ''); + T := ReplaceStr(T, '@', ''); + T := ReplaceStr(T, '#', ''); + T := ReplaceStr(T, '%', ''); + T := ReplaceStr(T, '&', ''); + T := ReplaceStr(T, '-', ''); + T := ReplaceStr(T, '_', ''); + T := ReplaceStr(T, '=', ''); + T := ReplaceStr(T, #39, ''); + T := ReplaceStr(T, '"', ''); + T := ReplaceStr(T, ';', ''); + T := ReplaceStr(T, '<', ''); + T := ReplaceStr(T, '>', ''); + T := ReplaceStr(T, '/', ''); + T := ReplaceStr(T, '\', ''); + T := ReplaceStr(T, ',', ''); + T := ReplaceStr(T, ':', ''); + T := ReplaceStr(T, '`', ''); + + Result := T; End; {$WARN NO_RETVAL On} Procedure TEnglishToRegEx.F; Begin - If Cnv('ff', r_FF) = True Then - Exit; + If Cnv('ff', r_FF) = True Then + Exit; - If Cnv('f', r_F) = True Then - Exit; + If Cnv('f', r_F) = True Then + Exit; End; Procedure TEnglishToRegEx.G; Begin - If Cnv('ggh', r_GGH) = True Then - Exit; - If Cnv('gdh', r_GDH) = True Then - Exit; - If Cnv('ghn', r_GHN) = True Then - Exit; + If Cnv('ggh', r_GGH) = True Then + Exit; + If Cnv('gdh', r_GDH) = True Then + Exit; + If Cnv('ghn', r_GHN) = True Then + Exit; - If Cnv('gh', r_GH) = True Then - Exit; - If Cnv('gg', r_GG) = True Then - Exit; + If Cnv('gh', r_GH) = True Then + Exit; + If Cnv('gg', r_GG) = True Then + Exit; - If Cnv('g', r_G) = True Then - Exit; + If Cnv('g', r_G) = True Then + Exit; End; Procedure TEnglishToRegEx.H; Begin - If Cnv('hl', r_HL) = True Then - Exit; - If Cnv('hh', r_HH) = True Then - Exit; - If Cnv('hm', r_HM) = True Then - Exit; - If Cnv('hn', r_HN) = True Then - Exit; + If Cnv('hl', r_HL) = True Then + Exit; + If Cnv('hh', r_HH) = True Then + Exit; + If Cnv('hm', r_HM) = True Then + Exit; + If Cnv('hn', r_HN) = True Then + Exit; - If Cnv('h', r_H) = True Then - Exit; + If Cnv('h', r_H) = True Then + Exit; End; Procedure TEnglishToRegEx.I; Begin - If Cnv('ia', r_IA) = True Then - Exit; + If Cnv('ia', r_IA) = True Then + Exit; - If Cnv('i', r_I) = True Then - Exit; + If Cnv('i', r_I) = True Then + Exit; End; Procedure TEnglishToRegEx.J; Begin - If Cnv('jng', r_JNG) = True Then - Exit; - If Cnv('jjh', r_JJH) = True Then - Exit; + If Cnv('jng', r_JNG) = True Then + Exit; + If Cnv('jjh', r_JJH) = True Then + Exit; - If Cnv('jj', r_JJ) = True Then - Exit; - If Cnv('jh', r_JH) = True Then - Exit; + If Cnv('jj', r_JJ) = True Then + Exit; + If Cnv('jh', r_JH) = True Then + Exit; - If Cnv('j', r_J) = True Then - Exit; + If Cnv('j', r_J) = True Then + Exit; End; Procedure TEnglishToRegEx.K; Begin - If Cnv('kshm', r_KSHM) = True Then - Exit; - If Cnv('kkhm', r_KKHM) = True Then - Exit; - If Cnv('kshn', r_KSHN) = True Then - Exit; - If Cnv('kkhn', r_KKHN) = True Then - Exit; - - If Cnv('ksh', r_KSH) = True Then - Exit; - If Cnv('kkh', r_KKH) = True Then - Exit; - If Cnv('kxm', r_KXM) = True Then - Exit; - If Cnv('kxn', r_KXN) = True Then - Exit; - - If Cnv('kh', r_KH) = True Then - Exit; - If Cnv('kk', r_KK) = True Then - Exit; - If Cnv('ks', r_KS) = True Then - Exit; - If Cnv('kx', r_KX) = True Then - Exit; - - If Cnv('k', r_K) = True Then - Exit; + If Cnv('kshm', r_KSHM) = True Then + Exit; + If Cnv('kkhm', r_KKHM) = True Then + Exit; + If Cnv('kshn', r_KSHN) = True Then + Exit; + If Cnv('kkhn', r_KKHN) = True Then + Exit; + + If Cnv('ksh', r_KSH) = True Then + Exit; + If Cnv('kkh', r_KKH) = True Then + Exit; + If Cnv('kxm', r_KXM) = True Then + Exit; + If Cnv('kxn', r_KXN) = True Then + Exit; + + If Cnv('kh', r_KH) = True Then + Exit; + If Cnv('kk', r_KK) = True Then + Exit; + If Cnv('ks', r_KS) = True Then + Exit; + If Cnv('kx', r_KX) = True Then + Exit; + + If Cnv('k', r_K) = True Then + Exit; End; Procedure TEnglishToRegEx.L; Begin - If Cnv('lkh', r_LKH) = True Then - Exit; - If Cnv('lgh', r_LGH) = True Then - Exit; - If Cnv('lph', r_LPH) = True Then - Exit; - If Cnv('ldh', r_LDH) = True Then - Exit; - If Cnv('lbh', r_LBH) = True Then - Exit; - - If Cnv('ll', r_LL) = True Then - Exit; - If Cnv('lk', r_LK) = True Then - Exit; - If Cnv('lg', r_LG) = True Then - Exit; - If Cnv('lp', r_LP) = True Then - Exit; - If Cnv('ld', r_LD) = True Then - Exit; - If Cnv('lb', r_LB) = True Then - Exit; - - If Cnv('l', r_L) = True Then - Exit; + If Cnv('lkh', r_LKH) = True Then + Exit; + If Cnv('lgh', r_LGH) = True Then + Exit; + If Cnv('lph', r_LPH) = True Then + Exit; + If Cnv('ldh', r_LDH) = True Then + Exit; + If Cnv('lbh', r_LBH) = True Then + Exit; + + If Cnv('ll', r_LL) = True Then + Exit; + If Cnv('lk', r_LK) = True Then + Exit; + If Cnv('lg', r_LG) = True Then + Exit; + If Cnv('lp', r_LP) = True Then + Exit; + If Cnv('ld', r_LD) = True Then + Exit; + If Cnv('lb', r_LB) = True Then + Exit; + + If Cnv('l', r_L) = True Then + Exit; End; Procedure TEnglishToRegEx.M; Begin - If Cnv('mbh', r_MBH) = True Then - Exit; - If Cnv('mph', r_MPH) = True Then - Exit; - If Cnv('mth', r_MTH) = True Then - Exit; + If Cnv('mbh', r_MBH) = True Then + Exit; + If Cnv('mph', r_MPH) = True Then + Exit; + If Cnv('mth', r_MTH) = True Then + Exit; - If Cnv('mm', r_MM) = True Then - Exit; - If Cnv('mb', r_MB) = True Then - Exit; - If Cnv('mp', r_MP) = True Then - Exit; - If Cnv('mt', r_MT) = True Then - Exit; + If Cnv('mm', r_MM) = True Then + Exit; + If Cnv('mb', r_MB) = True Then + Exit; + If Cnv('mp', r_MP) = True Then + Exit; + If Cnv('mt', r_MT) = True Then + Exit; - If Cnv('m', r_M) = True Then - Exit; + If Cnv('m', r_M) = True Then + Exit; End; Function TEnglishToRegEx.MyConvert: String; Var - tt: Char; - tString: String; -Begin - ln := length(pEnglishText); - pos := 1; - RS := ''; - - Repeat - tString := MidStr(pEnglishText, pos, 1); - tt := #0; - If length(tString) > 0 Then - tt := tString[1]; - - Case tt Of - - // --------START Number Generation--------------- - // 1st, we'll convert numbers. Hassel free :) - '0': - AddRs('((' + b_0 + ')|(0)|(' + b_Sh + b_UUkar + b_N + b_Hasanta + b_Z + '))'); - '1': - AddRs('((' + b_1 + ')|(1)|(' + b_E + b_K + '))'); - '2': - AddRs('((' + b_2 + ')|(2)|(' + b_D + b_Ukar + b_I + '))'); - '3': - AddRs('((' + b_3 + ')|(3)|(' + b_T + b_Ikar + b_N + '))'); - '4': - AddRs('((' + b_4 + ')|(4)|(' + b_C + b_AAkar + b_R + '))'); - '5': - AddRs('((' + b_5 + ')|(5)|(' + b_P + b_AAkar + b_Chandra + b_C + '))'); - '6': - AddRs('((6)|(' + b_6 + ')|(' + b_CH + b_Y + '))'); - '7': - AddRs('((' + b_7 + ')|(7)|(' + b_S + b_AAkar + b_T + '))'); - '8': - AddRs('((' + b_8 + ')|(8)|(' + b_AA + b_Tt + '))'); - '9': - AddRs('((' + b_9 + ')|(9)|(' + b_N + b_Y + '))'); - // ------------End Number Generation------------- - - 'a': - A(); - 'b': - B(); - 'c': - C(); - 'd': - D(); - 'e': - E(); - 'f': - F(); - 'g': - G(); - 'h': - H(); - 'i': - I(); - 'j': - J(); - 'k': - K(); - 'l': - L(); - 'm': - M(); - 'n': - N(); - 'o': - O(); - 'p': - P(); - 'q': - Q(); - 'r': - R(); - 's': - S(); - 't': - T(); - 'u': - U(); - 'v': - V(); - 'w': - W(); - 'x': - X(); - 'y': - Y(); - 'z': - Z(); - - // ` - Make sure it is just above case else! - '`': - pos := pos + 1; // No change made here,just to bypass juktakkhar making - - Else - AddRs(tt); - - End; - - Until pos > ln; - - MyConvert := RS; + tt: Char; + tString: String; +Begin + ln := length(pEnglishText); + pos := 1; + RS := ''; + + Repeat + tString := MidStr(pEnglishText, pos, 1); + tt := #0; + If length(tString) > 0 Then + tt := tString[1]; + + Case tt Of + + // --------START Number Generation--------------- + // 1st, we'll convert numbers. Hassel free :) + '0': + AddRs('((' + b_0 + ')|(0)|(' + b_Sh + b_UUkar + b_N + b_Hasanta + + b_Z + '))'); + '1': + AddRs('((' + b_1 + ')|(1)|(' + b_E + b_K + '))'); + '2': + AddRs('((' + b_2 + ')|(2)|(' + b_D + b_Ukar + b_I + '))'); + '3': + AddRs('((' + b_3 + ')|(3)|(' + b_T + b_Ikar + b_N + '))'); + '4': + AddRs('((' + b_4 + ')|(4)|(' + b_C + b_AAkar + b_R + '))'); + '5': + AddRs('((' + b_5 + ')|(5)|(' + b_P + b_AAkar + b_Chandra + b_C + '))'); + '6': + AddRs('((6)|(' + b_6 + ')|(' + b_CH + b_Y + '))'); + '7': + AddRs('((' + b_7 + ')|(7)|(' + b_S + b_AAkar + b_T + '))'); + '8': + AddRs('((' + b_8 + ')|(8)|(' + b_AA + b_Tt + '))'); + '9': + AddRs('((' + b_9 + ')|(9)|(' + b_N + b_Y + '))'); + // ------------End Number Generation------------- + + 'a': + A(); + 'b': + B(); + 'c': + C(); + 'd': + D(); + 'e': + E(); + 'f': + F(); + 'g': + G(); + 'h': + H(); + 'i': + I(); + 'j': + J(); + 'k': + K(); + 'l': + L(); + 'm': + M(); + 'n': + N(); + 'o': + O(); + 'p': + P(); + 'q': + Q(); + 'r': + R(); + 's': + S(); + 't': + T(); + 'u': + U(); + 'v': + V(); + 'w': + W(); + 'x': + X(); + 'y': + Y(); + 'z': + Z(); + + // ` - Make sure it is just above case else! + '`': + pos := pos + 1; // No change made here,just to bypass juktakkhar making + + Else + AddRs(tt); + + End; + + Until pos > ln; + + MyConvert := RS; End; Procedure TEnglishToRegEx.N; Begin - If Cnv('ngksh', r_NGKSH) = True Then - Exit; - If Cnv('ngkkh', r_NGKKH) = True Then - Exit; - - If Cnv('ngch', r_NGCH) = True Then - Exit; - If Cnv('nggh', r_NGGH) = True Then - Exit; - If Cnv('ngkx', r_NGKX) = True Then - Exit; - If Cnv('ngjh', r_NGJH) = True Then - Exit; - If Cnv('ngkh', r_NGKH) = True Then - Exit; - - If Cnv('nsh', r_NSH) = True Then - Exit; - If Cnv('ndh', r_NDH) = True Then - Exit; - If Cnv('nkh', r_NKH) = True Then - Exit; - If Cnv('nth', r_NTH) = True Then - Exit; - If Cnv('ngj', r_NGJ) = True Then - Exit; - If Cnv('ngm', r_NGM) = True Then - Exit; - If Cnv('ngg', r_NGG) = True Then - Exit; - If Cnv('ngx', r_NGX) = True Then - Exit; - If Cnv('ngk', r_NGK) = True Then - Exit; - If Cnv('ngh', r_NGH) = True Then - Exit; - If Cnv('nch', r_NCH) = True Then - Exit; - If Cnv('njh', r_NJH) = True Then - Exit; - If Cnv('ngc', r_NGC) = True Then - Exit; - - If Cnv('nc', r_NC) = True Then - Exit; - If Cnv('nn', r_NN) = True Then - Exit; - If Cnv('ng', r_NG) = True Then - Exit; - If Cnv('nk', r_NK) = True Then - Exit; - If Cnv('nj', r_NJ) = True Then - Exit; - If Cnv('nd', r_ND) = True Then - Exit; - If Cnv('nt', r_NT) = True Then - Exit; - - If Cnv('n', r_N) = True Then - Exit; + If Cnv('ngksh', r_NGKSH) = True Then + Exit; + If Cnv('ngkkh', r_NGKKH) = True Then + Exit; + + If Cnv('ngch', r_NGCH) = True Then + Exit; + If Cnv('nggh', r_NGGH) = True Then + Exit; + If Cnv('ngkx', r_NGKX) = True Then + Exit; + If Cnv('ngjh', r_NGJH) = True Then + Exit; + If Cnv('ngkh', r_NGKH) = True Then + Exit; + + If Cnv('nsh', r_NSH) = True Then + Exit; + If Cnv('ndh', r_NDH) = True Then + Exit; + If Cnv('nkh', r_NKH) = True Then + Exit; + If Cnv('nth', r_NTH) = True Then + Exit; + If Cnv('ngj', r_NGJ) = True Then + Exit; + If Cnv('ngm', r_NGM) = True Then + Exit; + If Cnv('ngg', r_NGG) = True Then + Exit; + If Cnv('ngx', r_NGX) = True Then + Exit; + If Cnv('ngk', r_NGK) = True Then + Exit; + If Cnv('ngh', r_NGH) = True Then + Exit; + If Cnv('nch', r_NCH) = True Then + Exit; + If Cnv('njh', r_NJH) = True Then + Exit; + If Cnv('ngc', r_NGC) = True Then + Exit; + + If Cnv('nc', r_NC) = True Then + Exit; + If Cnv('nn', r_NN) = True Then + Exit; + If Cnv('ng', r_NG) = True Then + Exit; + If Cnv('nk', r_NK) = True Then + Exit; + If Cnv('nj', r_NJ) = True Then + Exit; + If Cnv('nd', r_ND) = True Then + Exit; + If Cnv('nt', r_NT) = True Then + Exit; + + If Cnv('n', r_N) = True Then + Exit; End; Function TEnglishToRegEx.NextT: String; Begin - NextT := MidStr(pEnglishText, pos + 1, 1); + NextT := MidStr(pEnglishText, pos + 1, 1); End; Procedure TEnglishToRegEx.O; Begin - If Cnv('oo', r_OO) = True Then - Exit; - If Cnv('oi', r_OI) = True Then - Exit; - If Cnv('ou', r_OU) = True Then - Exit; + If Cnv('oo', r_OO) = True Then + Exit; + If Cnv('oi', r_OI) = True Then + Exit; + If Cnv('ou', r_OU) = True Then + Exit; - If Begining Then Begin - If Cnv('o', r_OFirst) = True Then - Exit; - End - Else Begin - If Cnv('o', r_O) = True Then - Exit; - End; + If Begining Then + Begin + If Cnv('o', r_OFirst) = True Then + Exit; + End + Else + Begin + If Cnv('o', r_O) = True Then + Exit; + End; End; Procedure TEnglishToRegEx.P; Begin - If Cnv('phl', r_PHL) = True Then - Exit; + If Cnv('phl', r_PHL) = True Then + Exit; - If Cnv('ph', r_PH) = True Then - Exit; - If Cnv('pp', r_PP) = True Then - Exit; + If Cnv('ph', r_PH) = True Then + Exit; + If Cnv('pp', r_PP) = True Then + Exit; - If Cnv('p', r_P) = True Then - Exit; + If Cnv('p', r_P) = True Then + Exit; End; Function TEnglishToRegEx.PrevT: String; Var - I: Integer; + I: Integer; Begin - I := pos - 1; - If I < 1 Then Begin - PrevT := ''; - Exit; - End; + I := pos - 1; + If I < 1 Then + Begin + PrevT := ''; + Exit; + End; - PrevT := MidStr(pEnglishText, I, 1); + PrevT := MidStr(pEnglishText, I, 1); End; Procedure TEnglishToRegEx.Q; Begin - If Cnv('qq', r_QQ) = True Then - Exit; + If Cnv('qq', r_QQ) = True Then + Exit; - If Cnv('q', r_Q) = True Then - Exit; + If Cnv('q', r_Q) = True Then + Exit; End; Procedure TEnglishToRegEx.R; Begin - If Cnv('rri', r_RRI) = True Then - Exit; + If Cnv('rri', r_RRI) = True Then + Exit; - If Cnv('ri', r_RI) = True Then - Exit; - If Cnv('rh', r_RH) = True Then - Exit; + If Cnv('ri', r_RI) = True Then + Exit; + If Cnv('rh', r_RH) = True Then + Exit; - If Cnv('r', r_R) = True Then - Exit; + If Cnv('r', r_R) = True Then + Exit; End; Procedure TEnglishToRegEx.S; Begin - If Cnv('shsh', r_SHSH) = True Then - Exit; + If Cnv('shsh', r_SHSH) = True Then + Exit; - If Cnv('ssh', r_SSH) = True Then - Exit; - If Cnv('shm', r_SHM) = True Then - Exit; - If Cnv('shn', r_SHN) = True Then - Exit; + If Cnv('ssh', r_SSH) = True Then + Exit; + If Cnv('shm', r_SHM) = True Then + Exit; + If Cnv('shn', r_SHN) = True Then + Exit; - If Cnv('ss', r_SS) = True Then - Exit; - If Cnv('sh', r_SH) = True Then - Exit; + If Cnv('ss', r_SS) = True Then + Exit; + If Cnv('sh', r_SH) = True Then + Exit; - If Cnv('s', r_S) = True Then - Exit; + If Cnv('s', r_S) = True Then + Exit; End; Procedure TEnglishToRegEx.T; Begin - If Cnv('thth', r_THTH) = True Then - Exit; + If Cnv('thth', r_THTH) = True Then + Exit; - If Cnv('tth', r_TTH) = True Then - Exit; - If Cnv('t``', r_T_Acnt_Acnt) = True Then - Exit; - If Cnv('tth', r_TTH) = True Then - Exit; + If Cnv('tth', r_TTH) = True Then + Exit; + If Cnv('t``', r_T_Acnt_Acnt) = True Then + Exit; + If Cnv('tth', r_TTH) = True Then + Exit; - If Cnv('tt', r_TT) = True Then - Exit; - If Cnv('th', r_TH) = True Then - Exit; + If Cnv('tt', r_TT) = True Then + Exit; + If Cnv('th', r_TH) = True Then + Exit; - If Cnv('t', r_T) = True Then - Exit; + If Cnv('t', r_T) = True Then + Exit; End; Procedure TEnglishToRegEx.U; Begin - If Cnv('uu', r_UU) = True Then - Exit; - If Cnv('u', r_U) = True Then - Exit; + If Cnv('uu', r_UU) = True Then + Exit; + If Cnv('u', r_U) = True Then + Exit; End; Procedure TEnglishToRegEx.V; Begin - If Cnv('vv', r_VV) = True Then - Exit; - If Cnv('v', r_V) = True Then - Exit; + If Cnv('vv', r_VV) = True Then + Exit; + If Cnv('v', r_V) = True Then + Exit; End; {$HINTS Off} Function TEnglishToRegEx.Vowel(Const T: String): Boolean; Var - myT: String; + myT: String; Begin - Result := False; - myT := LowerCase(T); - If length(myT) > 0 Then - myT := myT[1]; + Result := False; + myT := LowerCase(T); + If length(myT) > 0 Then + myT := myT[1]; - If (myT = 'a') Or (myT = 'e') Or (myT = 'i') Or (myT = 'o') Or (myT = 'u') Then - Vowel := True - Else - Vowel := False; + If (myT = 'a') Or (myT = 'e') Or (myT = 'i') Or (myT = 'o') Or + (myT = 'u') Then + Vowel := True + Else + Vowel := False; End; {$HINTS On} Procedure TEnglishToRegEx.W; Begin - If Cnv('w', r_W) = True Then - Exit; + If Cnv('w', r_W) = True Then + Exit; End; Procedure TEnglishToRegEx.X; Begin - If Cnv('xm', r_XM) = True Then - Exit; - If Cnv('xn', r_XN) = True Then - Exit; + If Cnv('xm', r_XM) = True Then + Exit; + If Cnv('xn', r_XN) = True Then + Exit; - If Cnv('x', r_X) = True Then - Exit; + If Cnv('x', r_X) = True Then + Exit; End; Procedure TEnglishToRegEx.Y; Begin - If Cnv('y', r_Y) = True Then - Exit; + If Cnv('y', r_Y) = True Then + Exit; End; Procedure TEnglishToRegEx.Z; Begin - If Cnv('zzh', r_ZZH) = True Then - Exit; + If Cnv('zzh', r_ZZH) = True Then + Exit; - If Cnv('zh', r_ZH) = True Then - Exit; - If Cnv('zz', r_ZZ) = True Then - Exit; + If Cnv('zh', r_ZH) = True Then + Exit; + If Cnv('zz', r_ZZ) = True Then + Exit; - If Cnv('z', r_Z) = True Then - Exit; + If Cnv('z', r_Z) = True Then + Exit; End; End. diff --git a/Keyboard and Spell checker/Classes/clsRegistry_XMLSetting.pas b/Keyboard and Spell checker/Classes/clsRegistry_XMLSetting.pas index 8c31cef..3307d12 100644 --- a/Keyboard and Spell checker/Classes/clsRegistry_XMLSetting.pas +++ b/Keyboard and Spell checker/Classes/clsRegistry_XMLSetting.pas @@ -36,42 +36,49 @@ Interface Uses - classes, - sysutils, - StrUtils, - NativeXML, - Forms, - Registry, - uFileFolderHandling; + classes, + sysutils, + StrUtils, + windows, + XMLIntf, XMLDoc, + Forms, + Registry, + dialogs, + system.Variants, + uFileFolderHandling; // Custom Registry class Type - TMyRegistry = Class(TRegistry) - Public - Function ReadStringDef(Const Name: String; DefaultVal: String = ''): String; - Function ReadDateDef(Const Name: String; DefaultVal: TDateTime): TDateTime; - End; + TMyRegistry = Class(TRegistry) + Public + Function ReadStringDef(Const Name: String; DefaultVal: String = ''): String; + Function ReadDateDef(Const Name: String; DefaultVal: TDateTime): TDateTime; + End; - // Skeleton of Class TXMLSetting + // Skeleton of Class TXMLSetting Type - TXMLSetting = Class - Private - XML: TNativeXml; - child: TXmlNode; - - Public - Constructor Create; // Initializer - Destructor Destroy; Override; // Destructor - - Function LoadXMLData(): Boolean; - Function GetValue(Const ValueName: UTF8String; DefaultValue: String = ''): String; Overload; - Function GetValue(Const ValueName: UTF8String; DefaultValue: TDateTime): TDateTime; Overload; - Procedure CreateNewXMLData; - Procedure SetValue(Const ValueName: UTF8String; Const ValueData: String); Overload; - Procedure SetValue(Const ValueName: UTF8String; Const ValueData: TDateTime); Overload; - Procedure SaveXMLData; - - End; + TXMLSetting = Class + Private + XML: IXMLDocument; + child: IXMLNode; + + Public + Constructor Create; // Initializer + Destructor Destroy; Override; // Destructor + + Function LoadXMLData(): Boolean; + Function GetValue(Const ValueName: UTF8String; DefaultValue: String = '') + : String; Overload; + Function GetValue(Const ValueName: UTF8String; DefaultValue: TDateTime) + : TDateTime; Overload; + Procedure CreateNewXMLData; + Procedure SetValue(Const ValueName: UTF8String; + Const ValueData: String); Overload; + Procedure SetValue(Const ValueName: UTF8String; + Const ValueData: TDateTime); Overload; + Procedure SaveXMLData; + + End; Implementation @@ -81,10 +88,12 @@ Constructor TXMLSetting.Create; Begin - Inherited; + Inherited; - XML := TNativeXml.Create; - XML.ExternalEncoding := seUTF8; + XML := TXMLDocument.Create(nil); + XML.Active := true; + XML.Encoding := 'UTF-8'; + XML.AddChild('Settings'); End; @@ -92,48 +101,66 @@ Procedure TXMLSetting.CreateNewXMLData; Begin - XML.Free; - XML := TNativeXml.Create; - XML.EncodingString := 'UTF-8'; - XML.ExternalEncoding := seUTF8; - XML.Root.Name := 'Settings'; + + if XML <> nil then + XML := nil; + + XML := TXMLDocument.Create(nil); + XML.Active := true; + + XML.Encoding := 'UTF-8'; + XML.AddChild('Settings'); End; { =============================================================================== } Destructor TXMLSetting.Destroy; Begin - FreeAndNil(XML); - Inherited; + XML.Active := false; + XML := nil; + Inherited; End; { =============================================================================== } -Function TXMLSetting.GetValue(Const ValueName: UTF8String; DefaultValue: TDateTime): TDateTime; +Function TXMLSetting.GetValue(Const ValueName: UTF8String; + DefaultValue: TDateTime): TDateTime; Begin - Try - child := XML.Root.FindNode(ValueName); - Result := child.Nodes[0].ValueAsDateTimeDef(DefaultValue); - Except - On E: Exception Do - Result := DefaultValue; - End; + Try + child := XML.DocumentElement.ChildNodes.FindNode(ValueName); + if assigned(child) then + Result := VarToDateTime((child.ChildNodes.Nodes[0].NodeValue)) + else + Result := DefaultValue; + + Except + On E: Exception Do + Result := DefaultValue; + End; End; { =============================================================================== } -Function TXMLSetting.GetValue(Const ValueName: UTF8String; DefaultValue: String): String; +Function TXMLSetting.GetValue(Const ValueName: UTF8String; + DefaultValue: String): String; Begin - Try - child := XML.Root.FindNode(ValueName); - If Length(Trim(child.Nodes[0].ValueAsUnicodeString)) <= 0 Then - Result := DefaultValue - Else - Result := Trim(child.Nodes[0].ValueAsUnicodeString); - Except - On E: Exception Do - Result := DefaultValue; - End; + Try + + child := XML.DocumentElement.ChildNodes.FindNode(ValueName); + + if assigned(child) then + begin + If Length(Trim(child.ChildNodes.Nodes[0].NodeValue)) <= 0 Then + Result := DefaultValue + Else + Result := VarToStr(Trim(child.ChildNodes.Nodes[0].NodeValue)); + end + else + Result := DefaultValue + Except + On E: Exception Do + Result := DefaultValue; + End; End; { =============================================================================== } @@ -141,56 +168,65 @@ Function TXMLSetting.LoadXMLData(): Boolean; Begin - Result := False; - Try - If FileExists(ExtractFilePath(Application.ExeName) + 'Settings.xml') = True Then Begin - XML.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Settings.xml'); - Result := True; - End - Else - Result := False; - Except - On E: Exception Do - Result := False; - End; + Result := false; + Try + If FileExists(ExtractFilePath(Application.ExeName) + 'Settings.xml') + = true Then + Begin + XML.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Settings.xml'); + Result := true; + End + Else + Result := false; + Except + On E: Exception Do + Result := false; + End; End; {$HINTS On} { =============================================================================== } Procedure TXMLSetting.SaveXMLData; Begin - XML.XmlFormat := xfReadable; - Try - XML.SaveToFile(GetAvroDataDir + 'Settings.xml'); - Except - On E: Exception Do Begin - // Nothing - End; - End; + // XML.XmlFormat := xfReadable; + + XML.XML.Text := XMLDoc.FormatXMLData(XML.XML.Text); + XML.Active := true; + Try + XML.SaveToFile(GetAvroDataDir + 'Settings.xml'); + Except + On E: Exception Do + Begin + // Nothing + End; + End; End; { =============================================================================== } -Procedure TXMLSetting.SetValue(Const ValueName: UTF8String; Const ValueData: TDateTime); +Procedure TXMLSetting.SetValue(Const ValueName: UTF8String; + Const ValueData: TDateTime); Var - CdataChild: TXmlNode; + CdataChild: IXMLNode; Begin - child := XML.Root.NodeNew(ValueName); - CdataChild := child.NodeNew(ValueName); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsDateTime := ValueData; + child := XML.DocumentElement.AddChild(ValueName); + CdataChild := XML.CreateNode(DateTimeToStr(ValueData), ntCDATA); + XML.DocumentElement.ChildNodes.Nodes[ValueName].ChildNodes.Add(CdataChild); + End; { =============================================================================== } -Procedure TXMLSetting.SetValue(Const ValueName: UTF8String; const ValueData: String); +Procedure TXMLSetting.SetValue(Const ValueName: UTF8String; + const ValueData: String); Var - CdataChild: TXmlNode; + CdataChild: IXMLNode; Begin - child := XML.Root.NodeNew(ValueName); - CdataChild := child.NodeNew(ValueName); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := ValueData; + + child := XML.DocumentElement.AddChild(ValueName); + CdataChild := XML.CreateNode(ValueData, ntCDATA); + XML.DocumentElement.ChildNodes.Nodes[ValueName].ChildNodes.Add(CdataChild); + End; { =============================================================================== } @@ -201,37 +237,43 @@ { =============================================================================== } -Function TMyRegistry.ReadDateDef(Const Name: String; DefaultVal: TDateTime): TDateTime; +Function TMyRegistry.ReadDateDef(Const Name: String; DefaultVal: TDateTime) + : TDateTime; Begin - Try - If ValueExists(Name) = True Then Begin - Result := ReadDateTime(Name); - End - Else Begin - Result := DefaultVal; - End; - Except - On E: Exception Do - Result := DefaultVal; - End; + Try + If ValueExists(Name) = true Then + Begin + Result := ReadDateTime(Name); + End + Else + Begin + Result := DefaultVal; + End; + Except + On E: Exception Do + Result := DefaultVal; + End; End; { =============================================================================== } -Function TMyRegistry.ReadStringDef(Const Name: String; DefaultVal: String = ''): String; +Function TMyRegistry.ReadStringDef(Const Name: String; + DefaultVal: String = ''): String; Begin - Try - If ValueExists(Name) = True Then Begin - Result := ReadString(Name); - End - Else Begin - Result := DefaultVal; - End; - Except - On E: Exception Do - If Trim(Result) = '' Then - Result := DefaultVal; - End; + Try + If ValueExists(Name) = true Then + Begin + Result := ReadString(Name); + End + Else + Begin + Result := DefaultVal; + End; + Except + On E: Exception Do + If Trim(Result) = '' Then + Result := DefaultVal; + End; End; End. diff --git a/Keyboard and Spell checker/Classes/clsSkinLayoutConverter.pas b/Keyboard and Spell checker/Classes/clsSkinLayoutConverter.pas index 5d67285..f726dba 100644 --- a/Keyboard and Spell checker/Classes/clsSkinLayoutConverter.pas +++ b/Keyboard and Spell checker/Classes/clsSkinLayoutConverter.pas @@ -1,25 +1,25 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= @@ -28,499 +28,566 @@ Unit clsSkinLayoutConverter; Interface + Uses - classes, - NativeXml, - jpeg, - GIFImg, - Graphics, - SysUtils, - StrUtils, - Forms; + classes, + dialogs, + XMLIntf, XMLDoc, + Soap.EncdDecd, + jpeg, + GIFImg, + Graphics, + SysUtils, + StrUtils, + Forms; Type - TSkinLayoutConverter = Class - Private - mPath: String; - OldXML, NewXML: TNativeXML; - OldNode: TXmlNode; - - child: TXmlNode; - CdataChild: TXmlNode; - KeyData: TXmlNode; - - Procedure CopyCDataNode(Nodename: UTF8String); - Procedure CopyNode(Nodename: UTF8String); - Procedure CreateVersionNode; - Procedure CopyImageNode(Nodename: UTF8String); - Procedure CopyKeyDataNodes; - Function NeedConversion: Boolean; - Procedure CheckCreateXMLObject; - Public - Constructor Create; //Initializer - Destructor Destroy; Override; - Function CheckConvertSkin(Path: String): Boolean; - Function CheckConvertLayout(Path: String): Boolean; - End; + TSkinLayoutConverter = Class + Private + mPath: String; + OldXML, NewXML: IXMLDocument; + OldNode: IXmlNode; + + child: IXmlNode; + CdataChild: IXmlNode; + KeyData: IXmlNode; + + Procedure CopyCDataNode(Nodename: UTF8String); + Procedure CopyNode(Nodename: UTF8String); + Procedure CreateVersionNode; + Procedure CopyImageNode(Nodename: UTF8String); + Procedure CopyKeyDataNodes; + Function NeedConversion: Boolean; + Procedure CheckCreateXMLObject; + Public + Constructor Create; // Initializer + Destructor Destroy; Override; + Function CheckConvertSkin(Path: String): Boolean; + Function CheckConvertLayout(Path: String): Boolean; + End; Const - AvroKeyboardVersion :String = '5'; - + AvroKeyboardVersion: String = '5'; Implementation { TSkinLayoutConverter } -{===============================================================================} +{ =============================================================================== } Function TSkinLayoutConverter.CheckConvertLayout(Path: String): Boolean; Begin - result := False; - mPath := Path; - CheckCreateXMLObject; - - Try - Try - OldXML.LoadFromFile(mPath); - Application.ProcessMessages; - - If Not NeedConversion Then exit; - - - NewXML.Root.Name := 'Layout'; - CreateVersionNode; - CopyCDataNode('LayoutName'); - CopyCDataNode('LayoutVersion'); - CopyCDataNode('DeveloperName'); - CopyCDataNode('DeveloperComment'); - - CopyImageNode('ImageNormalShift'); - CopyImageNode('ImageAltGrShift'); - - CopyKeyDataNodes; - - FreeAndNil(OldXML); - NewXML.SaveToFile(Path); - Result := True; - Except - On E: Exception Do Begin - Result := false; - End; - End; - Finally - FreeAndNil(OldXML); - FreeAndNil(NewXML); - Application.ProcessMessages; - End; + result := False; + mPath := Path; + CheckCreateXMLObject; + + Try + Try + OldXML.LoadFromFile(mPath); + Application.ProcessMessages; + + If Not NeedConversion Then + exit; + + // NewXML.Root.Name := 'Layout'; + NewXML.AddChild('Layout'); + CreateVersionNode; + CopyCDataNode('LayoutName'); + CopyCDataNode('LayoutVersion'); + CopyCDataNode('DeveloperName'); + CopyCDataNode('DeveloperComment'); + + CopyImageNode('ImageNormalShift'); + CopyImageNode('ImageAltGrShift'); + + CopyKeyDataNodes; + + OldXML.Active := False; + OldXML := Nil; + NewXML.XML.Text := XMLDoc.FormatXMLData(NewXML.XML.Text); + NewXML.Active := true; + NewXML.SaveToFile(Path); + result := true; + Except + On E: Exception Do + Begin + result := False; + End; + End; + Finally + OldXML.Active := False; + OldXML := Nil; + NewXML.Active := False; + NewXML := Nil; + Application.ProcessMessages; + End; End; -{===============================================================================} +{ =============================================================================== } Function TSkinLayoutConverter.CheckConvertSkin(Path: String): Boolean; Begin - result := False; - mPath := Path; - CheckCreateXMLObject; - - Try - Try - OldXML.LoadFromFile(mPath); - - If Not NeedConversion Then exit; - - NewXML.Root.Name := 'Layout'; - CreateVersionNode; - - CopyCDataNode('SkinName'); - CopyCDataNode('SkinVersion'); - CopyCDataNode('DesignerName'); - CopyCDataNode('DesignerComment'); - - CopyImageNode('Preview'); - - CopyNode('AvroIconAdded'); - CopyNode('KeyboardModeAdded'); - CopyNode('KeyboardLayoutAdded'); - CopyNode('LayoutViewerAdded'); - CopyNode('AvroMouseAdded'); - CopyNode('ToolsAdded'); - CopyNode('WebAdded'); - CopyNode('HelpAdded'); - CopyNode('ExitAdded'); - - //Main Image - CopyImageNode('TopBarMain'); - CopyNode('TopBarHeight'); - CopyNode('TopBarWidth'); - - //Avro icon - CopyImageNode('AvroIconNormal'); - CopyImageNode('AvroIconOver'); - CopyImageNode('AvroIconDown'); - CopyNode('AvroIconHeight'); - CopyNode('AvroIconWidth'); - CopyNode('AvroIconLeft'); - CopyNode('AvroIconTop'); - - - //Keyboard Mode - CopyImageNode('KeyboardModeEnglishNormal'); - CopyImageNode('KeyboardModeEnglishOver'); - CopyImageNode('KeyboardModeEnglishDown'); - CopyImageNode('KeyboardModeBanglaNormal'); - CopyImageNode('KeyboardModeBanglaOver'); - CopyImageNode('KeyboardModeBanglaDown'); - CopyNode('KeyboardModeHeight'); - CopyNode('KeyboardModeWidth'); - CopyNode('KeyboardModeLeft'); - CopyNode('KeyboardModeTop'); - - //Keyboard Layout - CopyImageNode('KeyboardLayoutNormal'); - CopyImageNode('KeyboardLayoutOver'); - CopyImageNode('KeyboardLayoutDown'); - CopyNode('KeyboardLayoutHeight'); - CopyNode('KeyboardLayoutWidth'); - CopyNode('KeyboardLayoutLeft'); - CopyNode('KeyboardLayoutTop'); - - //LayoutViewer - CopyImageNode('LayoutViewerNormal'); - CopyImageNode('LayoutViewerOver'); - CopyImageNode('LayoutViewerDown'); - CopyNode('LayoutViewerHeight'); - CopyNode('LayoutViewerWidth'); - CopyNode('LayoutViewerLeft'); - CopyNode('LayoutViewerTop'); - - //AvroMouse - CopyImageNode('AvroMouseNormal'); - CopyImageNode('AvroMouseOver'); - CopyImageNode('AvroMouseDown'); - CopyNode('AvroMouseHeight'); - CopyNode('AvroMouseWidth'); - CopyNode('AvroMouseLeft'); - CopyNode('AvroMouseTop'); - - //Tools - CopyImageNode('ToolsNormal'); - CopyImageNode('ToolsOver'); - CopyImageNode('ToolsDown'); - CopyNode('ToolsHeight'); - CopyNode('ToolsWidth'); - CopyNode('ToolsLeft'); - CopyNode('ToolsTop'); - - //Web - CopyImageNode('WebNormal'); - CopyImageNode('WebOver'); - CopyImageNode('WebDown'); - CopyNode('WebHeight'); - CopyNode('WebWidth'); - CopyNode('WebLeft'); - CopyNode('WebTop'); - - //Help - CopyImageNode('HelpNormal'); - CopyImageNode('HelpOver'); - CopyImageNode('HelpDown'); - CopyNode('HelpHeight'); - CopyNode('HelpWidth'); - CopyNode('HelpLeft'); - CopyNode('HelpTop'); - - //Exit - CopyImageNode('ExitNormal'); - CopyImageNode('ExitOver'); - CopyImageNode('ExitDown'); - CopyNode('ExitHeight'); - CopyNode('ExitWidth'); - CopyNode('ExitLeft'); - CopyNode('ExitTop'); - - FreeAndNil(OldXML); - NewXML.SaveToFile(Path); - Result := True; - Except - On E: Exception Do Begin - Result := false; - End; - End; - Finally - - End; + result := False; + mPath := Path; + CheckCreateXMLObject; + + Try + Try + OldXML.LoadFromFile(mPath); + + If Not NeedConversion Then + exit; + + // NewXML.Root.Name := 'Layout'; + NewXML.AddChild('Layout'); + CreateVersionNode; + + CopyCDataNode('SkinName'); + CopyCDataNode('SkinVersion'); + CopyCDataNode('DesignerName'); + CopyCDataNode('DesignerComment'); + + CopyImageNode('Preview'); + + CopyNode('AvroIconAdded'); + CopyNode('KeyboardModeAdded'); + CopyNode('KeyboardLayoutAdded'); + CopyNode('LayoutViewerAdded'); + CopyNode('AvroMouseAdded'); + CopyNode('ToolsAdded'); + CopyNode('WebAdded'); + CopyNode('HelpAdded'); + CopyNode('ExitAdded'); + + // Main Image + CopyImageNode('TopBarMain'); + CopyNode('TopBarHeight'); + CopyNode('TopBarWidth'); + + // Avro icon + CopyImageNode('AvroIconNormal'); + CopyImageNode('AvroIconOver'); + CopyImageNode('AvroIconDown'); + CopyNode('AvroIconHeight'); + CopyNode('AvroIconWidth'); + CopyNode('AvroIconLeft'); + CopyNode('AvroIconTop'); + + // Keyboard Mode + CopyImageNode('KeyboardModeEnglishNormal'); + CopyImageNode('KeyboardModeEnglishOver'); + CopyImageNode('KeyboardModeEnglishDown'); + CopyImageNode('KeyboardModeBanglaNormal'); + CopyImageNode('KeyboardModeBanglaOver'); + CopyImageNode('KeyboardModeBanglaDown'); + CopyNode('KeyboardModeHeight'); + CopyNode('KeyboardModeWidth'); + CopyNode('KeyboardModeLeft'); + CopyNode('KeyboardModeTop'); + + // Keyboard Layout + CopyImageNode('KeyboardLayoutNormal'); + CopyImageNode('KeyboardLayoutOver'); + CopyImageNode('KeyboardLayoutDown'); + CopyNode('KeyboardLayoutHeight'); + CopyNode('KeyboardLayoutWidth'); + CopyNode('KeyboardLayoutLeft'); + CopyNode('KeyboardLayoutTop'); + + // LayoutViewer + CopyImageNode('LayoutViewerNormal'); + CopyImageNode('LayoutViewerOver'); + CopyImageNode('LayoutViewerDown'); + CopyNode('LayoutViewerHeight'); + CopyNode('LayoutViewerWidth'); + CopyNode('LayoutViewerLeft'); + CopyNode('LayoutViewerTop'); + + // AvroMouse + CopyImageNode('AvroMouseNormal'); + CopyImageNode('AvroMouseOver'); + CopyImageNode('AvroMouseDown'); + CopyNode('AvroMouseHeight'); + CopyNode('AvroMouseWidth'); + CopyNode('AvroMouseLeft'); + CopyNode('AvroMouseTop'); + + // Tools + CopyImageNode('ToolsNormal'); + CopyImageNode('ToolsOver'); + CopyImageNode('ToolsDown'); + CopyNode('ToolsHeight'); + CopyNode('ToolsWidth'); + CopyNode('ToolsLeft'); + CopyNode('ToolsTop'); + + // Web + CopyImageNode('WebNormal'); + CopyImageNode('WebOver'); + CopyImageNode('WebDown'); + CopyNode('WebHeight'); + CopyNode('WebWidth'); + CopyNode('WebLeft'); + CopyNode('WebTop'); + + // Help + CopyImageNode('HelpNormal'); + CopyImageNode('HelpOver'); + CopyImageNode('HelpDown'); + CopyNode('HelpHeight'); + CopyNode('HelpWidth'); + CopyNode('HelpLeft'); + CopyNode('HelpTop'); + + // Exit + CopyImageNode('ExitNormal'); + CopyImageNode('ExitOver'); + CopyImageNode('ExitDown'); + CopyNode('ExitHeight'); + CopyNode('ExitWidth'); + CopyNode('ExitLeft'); + CopyNode('ExitTop'); + + OldXML.Active := False; + OldXML := Nil; + NewXML.XML.Text := XMLDoc.FormatXMLData(NewXML.XML.Text); + NewXML.Active := true; + NewXML.SaveToFile(Path); + result := true; + Except + On E: Exception Do + Begin + result := False; + End; + End; + Finally + + End; End; -{===============================================================================} +{ =============================================================================== } Procedure TSkinLayoutConverter.CheckCreateXMLObject; Begin - FreeAndNil(OldXML); - FreeAndNil(NewXML); + if OldXML <> nil then + begin - OldXML := TNativeXML.Create; - OldXML.EncodingString := 'UTF-8'; - OldXML.ExternalEncoding := seUTF8; + OldXML.Active := False; + OldXML := Nil; + end; + if NewXML <> nil then + begin + NewXML.Active := False; + NewXML := Nil; + end; + OldXML := TXMLDocument.Create(nil); + OldXML.Active := true; + OldXML.Encoding := 'UTF-8'; + NewXML := TXMLDocument.Create(nil); + NewXML.Active := true; + // NewXML.XmlFormat := xfReadable; - NewXML := TNativeXML.Create; - NewXML.EncodingString := 'UTF-8'; - NewXML.XmlFormat := xfReadable; - NewXML.ExternalEncoding := seUTF8; + NewXML.Encoding := 'UTF-8'; - Application.ProcessMessages; + Application.ProcessMessages; End; -{===============================================================================} +{ =============================================================================== } Procedure TSkinLayoutConverter.CopyCDataNode(Nodename: UTF8String); Begin - Try - Child := NewXML.Root.NodeNew(Nodename); - CdataChild := Child.NodeNew(Nodename); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := OldXML.Root.FindNode(Nodename).Nodes[0].ValueAsUnicodeString; - Except - On e: Exception Do Begin - - End; - End; - Application.ProcessMessages; + Try + child := NewXML.DocumentElement.AddChild(Nodename); + CdataChild := child.AddChild(Nodename); + // CdataChild.ElementType := xeCData; + CdataChild.NodeValue := OldXML.DocumentElement.ChildNodes.Nodes[0] + .ChildNodes.FindNode(Nodename).ChildNodes.Nodes[0].NodeValue; + Except + On E: Exception Do + Begin + + End; + End; + Application.ProcessMessages; End; -{===============================================================================} +{ =============================================================================== } Procedure TSkinLayoutConverter.CopyImageNode(Nodename: UTF8String); Var - OldSStream, NewSStream : TStringStream; - JpegImg : TjpegImage; - GifImg : TGifImage; - BMPImg, Bitmap : TBitmap; - Successful : Boolean; + OldSStream, NewSStream: TStringStream; + JpegImg: TjpegImage; + GIFImg: TGifImage; + BMPImg, Bitmap: TBitmap; + Successful: Boolean; + +var + s, Encoded: string; + Begin - Try - OldSStream := TStringStream.Create(OldXML.Root.FindNode(Nodename).BinaryString); - Except - On e: Exception Do Begin + Try + + s := OldXML.DocumentElement.ChildNodes.Nodes[0].ChildNodes.FindNode + (Nodename).NodeValue; + + OldSStream := TStringStream.Create(EncodeBase64(pchar(s), length(s))); + Except + On E: Exception Do + Begin + + End; + End; + Application.ProcessMessages; + + If OldSStream.Size > 0 Then + Begin + Successful := False; + + // Try Gif + If Not Successful Then + Begin + Try + GIFImg := TGifImage.Create; + OldSStream.Position := 0; + GIFImg.LoadFromStream(OldSStream); + Bitmap := TBitmap.Create; + Bitmap.Assign(GIFImg); + + NewSStream := TStringStream.Create(''); + Bitmap.SaveToStream(NewSStream); + FreeAndNil(GIFImg); + FreeAndNil(Bitmap); + Successful := true; + Except + On E: Exception Do + Begin + Successful := False; + End; + End; + End; + Application.ProcessMessages; + + // Try JPG + If Not Successful Then + Begin + Try + JpegImg := TjpegImage.Create; + OldSStream.Position := 0; + JpegImg.LoadFromStream(OldSStream); + Bitmap := TBitmap.Create; + Bitmap.Assign(JpegImg); + + NewSStream := TStringStream.Create(''); + Bitmap.SaveToStream(NewSStream); + FreeAndNil(JpegImg); + FreeAndNil(Bitmap); + Successful := true; + Except + On E: Exception Do + Begin + Successful := False; + End; + End; + End; + Application.ProcessMessages; + + // Try BMP + If Not Successful Then + Begin + Try + BMPImg := TBitmap.Create; + OldSStream.Position := 0; + BMPImg.LoadFromStream(OldSStream); + + NewSStream := TStringStream.Create(''); + BMPImg.SaveToStream(NewSStream); + FreeAndNil(BMPImg); + Successful := true; + Except + On E: Exception Do + Begin + Successful := False; + End; + End; + End; - End; - End; - Application.ProcessMessages; + Application.ProcessMessages; + End; - If OldSStream.Size > 0 Then Begin - Successful := False; + Try + child := NewXML.DocumentElement.AddChild(Nodename); + // child.BinaryEncoding := xbeBase64; + child.NodeValue := NewSStream.DataString; + Except + On E: Exception Do + Begin - //Try Gif - If Not Successful Then Begin - Try - GifImg := TGifImage.Create; - OldSStream.Position := 0; - GifImg.LoadFromStream(OldSStream); - Bitmap := TBitmap.Create; - Bitmap.Assign(GifImg); - - NewSStream := TStringStream.Create(''); - Bitmap.SaveToStream(NewSStream); - FreeAndNil(GifImg); - FreeAndNil(Bitmap); - Successful := True; - Except - On e: Exception Do Begin - Successful := False; - End; - End; - End; - Application.ProcessMessages; - - //Try JPG - If Not Successful Then Begin - Try - JpegImg := TjpegImage.Create; - OldSStream.Position := 0; - JpegImg.LoadFromStream(OldSStream); - Bitmap := TBitmap.Create; - Bitmap.Assign(JpegImg); - - NewSStream := TStringStream.Create(''); - Bitmap.SaveToStream(NewSStream); - FreeAndNil(JpegImg); - FreeAndNil(Bitmap); - Successful := True; - Except - On e: Exception Do Begin - Successful := False; - End; - End; - End; - Application.ProcessMessages; - - - //Try BMP - If Not Successful Then Begin - Try - BMPImg := TBitmap.Create; - OldSStream.Position := 0; - BMPImg.LoadFromStream(OldSStream); - - NewSStream := TStringStream.Create(''); - BMPImg.SaveToStream(NewSStream); - FreeAndNil(BMPImg); - Successful := True; - Except - On e: Exception Do Begin - Successful := False; - End; - End; - End; - - Application.ProcessMessages; - - End; - - Try - Child := NewXML.Root.NodeNew(Nodename); - Child.BinaryEncoding := xbeBase64; - Child.BinaryString := NewSStream.DataString; - Except - On e: Exception Do Begin - - End; - End; - Application.ProcessMessages; + End; + End; + Application.ProcessMessages; End; -{===============================================================================} +{ =============================================================================== } Procedure TSkinLayoutConverter.CopyKeyDataNodes; Var - I : Integer; + I: Integer; Begin - Try - KeyData := NewXML.Root.NodeNew('KeyData'); - OldNode := OldXML.Root.FindNode('KeyData'); - - For I := 0 To OldNode.NodeCount - 1 Do Begin - - Application.ProcessMessages; - - If LowerCase(LeftStr(String(OldNode.Nodes[i].Name), 3)) <> 'num' Then Begin - If OldNode.Nodes[i].NodeCount <= 0 Then Begin - //If item has no cdata - Child := KeyData.NodeNew('Key_' + OldNode.Nodes[i].Name); - CdataChild := Child.NodeNew('Key_' + OldNode.Nodes[i].Name); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := ''; - End - Else Begin - //if item has cdata - Child := KeyData.NodeNew('Key_' + OldNode.Nodes[i].Name); - CdataChild := Child.NodeNew('Key_' + OldNode.Nodes[i].Name); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := OldNode.Nodes[i].Nodes[0].ValueAsUnicodeString; - End; - End - Else Begin - If OldNode.Nodes[i].NodeCount <= 0 Then Begin - //If item has no cdata - Child := KeyData.NodeNew(OldNode.Nodes[i].Name); - CdataChild := Child.NodeNew(OldNode.Nodes[i].Name); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := ''; - End - Else Begin - //if item has cdata - Child := KeyData.NodeNew(OldNode.Nodes[i].Name); - CdataChild := Child.NodeNew(OldNode.Nodes[i].Name); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := OldNode.Nodes[i].Nodes[0].ValueAsUnicodeString; - End; - End; - End; - Except - On e: Exception Do Begin - - End; - - End; - - Application.ProcessMessages; + Try + KeyData := NewXML.DocumentElement.AddChild('KeyData'); + OldNode := OldXML.DocumentElement.ChildNodes.FindNode('KeyData'); + + For I := 0 To OldNode.ChildNodes.Count - 1 Do + Begin + + Application.ProcessMessages; + + If LowerCase(LeftStr(String(OldNode.ChildNodes.Nodes[I].Nodename), 3)) <> + 'num' Then + Begin + If OldNode.ChildNodes.Nodes[I].ChildNodes.Count <= 0 Then + Begin + // If item has no cdata + child := KeyData.AddChild('Key_' + OldNode.ChildNodes.Nodes[I] + .Nodename); + CdataChild := child.AddChild('Key_' + OldNode.ChildNodes.Nodes[I] + .Nodename); + // CdataChild.ElementType := xeCData; + CdataChild.NodeValue := ''; + End + Else + Begin + // if item has cdata + child := KeyData.AddChild('Key_' + OldNode.ChildNodes.Nodes[I] + .Nodename); + CdataChild := child.AddChild('Key_' + OldNode.ChildNodes.Nodes[I] + .Nodename); + // CdataChild.ElementType := xeCData; + CdataChild.NodeValue := OldNode.ChildNodes.Nodes[I].ChildNodes.Nodes + [0].NodeValue; + End; + End + Else + Begin + If OldNode.ChildNodes.Nodes[I].ChildNodes.Count <= 0 Then + Begin + // If item has no cdata + child := KeyData.AddChild(OldNode.ChildNodes.Nodes[I].Nodename); + CdataChild := child.AddChild(OldNode.ChildNodes.Nodes[I].Nodename); + // CdataChild.ElementType := xeCData; + CdataChild.NodeValue := ''; + End + Else + Begin + // if item has cdata + child := KeyData.AddChild(OldNode.ChildNodes.Nodes[I].Nodename); + CdataChild := child.AddChild(OldNode.ChildNodes.Nodes[I].Nodename); + // CdataChild.ElementType := xeCData; + CdataChild.NodeValue := OldNode.ChildNodes.Nodes[I].ChildNodes.Nodes + [0].NodeValue; + End; + End; + End; + Except + On E: Exception Do + Begin + + End; + + End; + + Application.ProcessMessages; End; -{===============================================================================} +{ =============================================================================== } Procedure TSkinLayoutConverter.CopyNode(Nodename: UTF8String); Begin - Try - Child := NewXML.Root.NodeNew(Nodename); - Child.ValueAsUnicodeString := OldXML.Root.FindNode(Nodename).ValueAsUnicodeString; - Except - On e: Exception Do Begin - - End; - End; + Try + child := NewXML.DocumentElement.AddChild(Nodename); + child.NodeValue := OldXML.DocumentElement.ChildNodes.Nodes[0] + .ChildNodes.FindNode(Nodename).NodeValue; + Except + On E: Exception Do + Begin + + End; + End; End; -{===============================================================================} +{ =============================================================================== } Constructor TSkinLayoutConverter.Create; Begin - Inherited; // Call the parent Create method + Inherited; // Call the parent Create method - CheckCreateXMLObject; + CheckCreateXMLObject; End; -{===============================================================================} +{ =============================================================================== } Procedure TSkinLayoutConverter.CreateVersionNode; Begin - Try - Child := NewXML.Root.NodeNew('AvroKeyboardVersion'); - Child.ValueAsUnicodeString := AvroKeyboardVersion; - Except - On e: Exception Do Begin - - End; - End; - Application.ProcessMessages; + Try + child := NewXML.DocumentElement.AddChild('AvroKeyboardVersion'); + child.NodeValue := AvroKeyboardVersion; + Except + On E: Exception Do + Begin + + End; + End; + Application.ProcessMessages; End; -{===============================================================================} +{ =============================================================================== } Destructor TSkinLayoutConverter.Destroy; Begin - FreeAndNil(OldXML); - FreeAndNil(NewXML); - // Always call the parent destructor after running all codes - Inherited; + if OldXML <> nil then + begin + OldXML.Active := False; + OldXML := Nil; + end; + if NewXML <> nil then + begin + NewXML.Active := False; + NewXML := Nil; + end; + // Always call the parent destructor after running all codes + Inherited; End; -{===============================================================================} +{ =============================================================================== } Function TSkinLayoutConverter.NeedConversion: Boolean; Var - AvroVer : String; + AvroVer: String; Begin - Try - AvroVer := trim(OldXML.Root.FindNode('AvroKeyboardVersion').ValueAsUnicodeString); - Except - On e: Exception Do Begin + Try - End; - End; + AvroVer := trim(OldXML.DocumentElement.ChildNodes.FindNode + ('AvroKeyboardVersion').NodeValue); + Except + On E: Exception Do + Begin - If AvroVer = '4' Then - Result := True - Else If AvroVer = '5' Then - Result := False - Else - Result := False; + End; + End; + + If AvroVer = '4' Then + result := true + Else If AvroVer = '5' Then + result := False + Else + result := False; End; -{===============================================================================} +{ =============================================================================== } End. - diff --git a/Keyboard and Spell checker/Classes/clsUpdateInfoDownloader.pas b/Keyboard and Spell checker/Classes/clsUpdateInfoDownloader.pas index 5fc1ace..1d49010 100644 --- a/Keyboard and Spell checker/Classes/clsUpdateInfoDownloader.pas +++ b/Keyboard and Spell checker/Classes/clsUpdateInfoDownloader.pas @@ -1,276 +1,304 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - Unit clsUpdateInfoDownloader; Interface -Uses NativeXml, - SysUtils, - Classes, - Windows, - DateUtils, - Forms, - OverbyteIcsWndControl, - OverbyteIcsHttpProt, - Wininet; +Uses + SysUtils, + Classes, + Windows, + DateUtils, + Forms, + XMLIntf, XMLDoc, + system.Variants, + OverbyteIcsWndControl, + OverbyteIcsHttpProt, + Wininet; Type - TUpdateCheck = Class - Private - Downloader: THttpCli; - MemS: TMemoryStream; - XML: TNativeXML; - StillDownloading: Boolean; - Verbose: Boolean; - - Function IsUpdate(Const Major, Minor, Release, Build: Integer): Boolean; - Procedure FinishDownload(Sender: TObject; RqType: THttpRequest; Error: Word); - Public - - - Function IsConnected: Boolean; - Procedure Check; - Procedure CheckSilent; - Constructor Create; - Destructor Destroy; Override; - End; + TUpdateCheck = Class + Private + Downloader: THttpCli; + MemS: TMemoryStream; + XML: IXMLDocument; + root: IXMLNode; + child: IXMLNode; + StillDownloading: Boolean; + Verbose: Boolean; + + Function IsUpdate(Const Major, Minor, Release, Build: Integer): Boolean; + Procedure FinishDownload(Sender: TObject; RqType: THttpRequest; + Error: Word); + Public + + Function IsConnected: Boolean; + Procedure Check; + Procedure CheckSilent; + Constructor Create; + Destructor Destroy; Override; + End; Var - Updater : TUpdateCheck; + Updater: TUpdateCheck; Const - {$IFDEF BetaVersion} - - {$IFDEF PortableOn} - UpdateInfo = 'http://www.omicronlab.com/download/liveupdate/portable_avrokeyboard/versioninfo_beta.xml'; - {$ELSE} - UpdateInfo = 'http://www.omicronlab.com/download/liveupdate/avrokeyboard/versioninfo_beta.xml'; - {$ENDIF} - - {$ELSE} - - {$IFDEF PortableOn} - UpdateInfo = 'http://www.omicronlab.com/download/liveupdate/portable_avrokeyboard/versioninfo.xml'; - {$ELSE} - UpdateInfo = 'http://www.omicronlab.com/download/liveupdate/avrokeyboard/versioninfo.xml'; - {$ENDIF} - - {$ENDIF} +{$IFDEF BetaVersion} +{$IFDEF PortableOn} + UpdateInfo = + 'http://www.omicronlab.com/download/liveupdate/portable_avrokeyboard/versioninfo_beta.xml'; +{$ELSE} + UpdateInfo = + 'http://www.omicronlab.com/download/liveupdate/avrokeyboard/versioninfo_beta.xml'; +{$ENDIF} +{$ELSE} +{$IFDEF PortableOn} + UpdateInfo = + 'http://www.omicronlab.com/download/liveupdate/portable_avrokeyboard/versioninfo.xml'; +{$ELSE} + UpdateInfo = + 'http://www.omicronlab.com/download/liveupdate/avrokeyboard/versioninfo.xml'; +{$ENDIF} +{$ENDIF} Implementation Uses - clsFileVersion, - ufrmUpdateNotify, - uWindowHandlers; - - + clsFileVersion, + ufrmUpdateNotify, + uWindowHandlers; { TUpdateCheck } -{===============================================================================} +{ =============================================================================== } -Procedure TUpdateCheck.check; +Procedure TUpdateCheck.Check; Begin - If StillDownloading Then - exit - Else Begin - MemS := TMemoryStream.Create; - - Verbose := True; - Downloader.URL := UpdateInfo; - Downloader.RcvdStream := MemS; - Downloader.GetASync; - StillDownloading := True; - End; + If StillDownloading Then + exit + Else + Begin + MemS := TMemoryStream.Create; + + Verbose := True; + Downloader.URL := UpdateInfo; + Downloader.RcvdStream := MemS; + Downloader.GetASync; + StillDownloading := True; + End; End; -{===============================================================================} +{ =============================================================================== } Procedure TUpdateCheck.CheckSilent; Begin - If StillDownloading Then - exit - Else Begin - MemS := TMemoryStream.Create; - - Verbose := False; - Downloader.URL := UpdateInfo; - Downloader.RcvdStream := MemS; - Downloader.GetASync; - StillDownloading := True; - End; + If StillDownloading Then + exit + Else + Begin + MemS := TMemoryStream.Create; + + Verbose := False; + Downloader.URL := UpdateInfo; + Downloader.RcvdStream := MemS; + Downloader.GetASync; + StillDownloading := True; + End; End; -{===============================================================================} +{ =============================================================================== } Constructor TUpdateCheck.Create; Begin - // Execute the parent (TObject) constructor first - Inherited; // Call the parent Create method - Downloader := THttpCli.Create(Nil); - Downloader.RequestVer := '1.0'; - Downloader.Agent := 'User-Agent: Avro Keyboard'; - Downloader.NoCache := True; - Downloader.OnRequestDone := FinishDownload; - - StillDownloading := False; + // Execute the parent (TObject) constructor first + Inherited; // Call the parent Create method + Downloader := THttpCli.Create(Nil); + Downloader.RequestVer := '1.0'; + Downloader.Agent := 'User-Agent: Avro Keyboard'; + Downloader.NoCache := True; + Downloader.OnRequestDone := FinishDownload; + + StillDownloading := False; End; -{===============================================================================} +{ =============================================================================== } Destructor TUpdateCheck.Destroy; Begin - FreeAndNil(Downloader); - Inherited; + FreeAndNil(Downloader); + Inherited; End; -{===============================================================================} - {$HINTS Off} -Procedure TUpdateCheck.FinishDownload(Sender: TObject; RqType: THttpRequest; Error: Word); +{ =============================================================================== } +{$HINTS Off} + +Procedure TUpdateCheck.FinishDownload(Sender: TObject; RqType: THttpRequest; + Error: Word); Var - Major, Minor, Release, Build: Integer; - changelogurl, downloadurl, productpageurl, releasedate: String; + Major, Minor, Release, Build: Integer; + changelogurl, downloadurl, productpageurl, releasedate: String; Begin - Major := 0; - Minor := 0; - Release := 0; - Build := 0; - - StillDownloading := False; - - If (Downloader.StatusCode = 200) And (Error = 0) Then Begin - XML := TNativeXML.Create; - XML.ExternalEncoding := seUTF8; - XML.LoadFromStream(MemS); - - Try - Try - Major := XML.Root.FindNode('versionmajor').ValueAsInteger; - Minor := XML.Root.FindNode('versionminor').ValueAsInteger; - Release := XML.Root.FindNode('versionrevision').ValueAsInteger; - If XML.Root.FindNode('versionbuild') <> Nil Then //Avro 4.x compatibility - Build := XML.Root.FindNode('versionbuild').ValueAsInteger; - - changelogurl := XML.Root.FindNode('changelogurl').ValueAsUnicodeString; - downloadurl := XML.Root.FindNode('downloadurl').ValueAsUnicodeString; - productpageurl := XML.Root.FindNode('productpageurl').ValueAsUnicodeString; - releasedate := XML.Root.FindNode('releasedate').ValueAsUnicodeString; - Except - On e: exception Do Begin - If Verbose Then - Application.MessageBox('There was an error checking update for Avro Keyboard.' - + #10 + 'Please try again later.', 'Ooops!', - MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_SYSTEMMODAL); - Exit; - End; - End; - Finally - FreeAndNil(XML); - FreeAndNil(MemS); - End; - - If IsUpdate(Major, Minor, Release, Build) = True Then Begin - CheckCreateForm(TfrmUpdateNotify, frmUpdateNotify, 'frmUpdateNotify'); - frmUpdateNotify.SetupAndShow(IntToStr(Major) + '.' + IntToStr(Minor) + '.' + - IntToStr(Release) + '.' + IntToStr(Build), releasedate, changelogurl, downloadurl); - End - Else Begin - If Verbose Then - Application.MessageBox('You are using the latest version of Avro Keyboard.' - + #10 + 'No update is available at this moment', 'Avro Keyboard', MB_OK + MB_ICONEXCLAMATION + MB_DEFBUTTON1 + MB_SYSTEMMODAL); - End; - End - Else Begin + Major := 0; + Minor := 0; + Release := 0; + Build := 0; + + StillDownloading := False; + + If (Downloader.StatusCode = 200) And (Error = 0) Then + Begin + XML := TXMLDocument.Create(nil); + XML.Active := True; + XML.Encoding := 'UTF-8'; + XML.LoadFromStream(MemS); + + Try + Try + // int + Major := (XML.DocumentElement.ChildNodes.FindNode('versionmajor') + .NodeValue); + Minor := (XML.DocumentElement.ChildNodes.FindNode('versionminor') + .NodeValue); + Release := (XML.DocumentElement.ChildNodes.FindNode('versionrevision') + .NodeValue); + If XML.DocumentElement.ChildNodes.FindNode('versionbuild') <> Nil Then + // Avro 4.x compatibility + Build := XML.DocumentElement.ChildNodes.FindNode('versionbuild') + .NodeValue; + // str + changelogurl := (XML.DocumentElement.ChildNodes.FindNode('changelogurl') + .NodeValue); + downloadurl := (XML.DocumentElement.ChildNodes.FindNode('downloadurl') + .NodeValue); + productpageurl := + (XML.DocumentElement.ChildNodes.FindNode('productpageurl').NodeValue); + releasedate := (XML.DocumentElement.ChildNodes.FindNode('releasedate') + .NodeValue); + Except + On e: exception Do + Begin If Verbose Then - Application.MessageBox('There was an error checking update for Avro Keyboard.' - + #10 + 'Please try again later.', 'Ooops!', - MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_SYSTEMMODAL); - End; - - - + Application.MessageBox + ('There was an error checking update for Avro Keyboard.' + #10 + + 'Please try again later.', 'Ooops!', MB_OK + MB_ICONHAND + + MB_DEFBUTTON1 + MB_SYSTEMMODAL); + exit; + End; + End; + Finally + XML.Active := False; + XML := nil; + FreeAndNil(MemS); + End; + + If IsUpdate(Major, Minor, Release, Build) = True Then + Begin + CheckCreateForm(TfrmUpdateNotify, frmUpdateNotify, 'frmUpdateNotify'); + frmUpdateNotify.SetupAndShow(IntToStr(Major) + '.' + IntToStr(Minor) + '.' + + IntToStr(Release) + '.' + IntToStr(Build), releasedate, changelogurl, + downloadurl); + End + Else + Begin + If Verbose Then + Application.MessageBox + ('You are using the latest version of Avro Keyboard.' + #10 + + 'No update is available at this moment', 'Avro Keyboard', + MB_OK + MB_ICONEXCLAMATION + MB_DEFBUTTON1 + MB_SYSTEMMODAL); + End; + End + Else + Begin + If Verbose Then + Application.MessageBox + ('There was an error checking update for Avro Keyboard.' + #10 + + 'Please try again later.', 'Ooops!', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + + MB_SYSTEMMODAL); + End; End; -{===============================================================================} +{ =============================================================================== } Function TUpdateCheck.IsConnected: Boolean; Var - dwConnectionTypes : DWORD; + dwConnectionTypes: DWORD; Begin - Result := False; - dwConnectionTypes := - INTERNET_CONNECTION_MODEM + - INTERNET_CONNECTION_LAN + - INTERNET_CONNECTION_PROXY; + Result := False; + dwConnectionTypes := INTERNET_CONNECTION_MODEM + INTERNET_CONNECTION_LAN + + INTERNET_CONNECTION_PROXY; - Result := InternetGetConnectedState(@dwConnectionTypes, 0); + Result := InternetGetConnectedState(@dwConnectionTypes, 0); End; -{===============================================================================} +{ =============================================================================== } Function TUpdateCheck.IsUpdate(Const Major, Minor, Release, - Build: Integer): Boolean; + Build: Integer): Boolean; Var - Version : TFileVersion; + Version: TFileVersion; Begin - Version := TFileVersion.Create(); - Result := False; - - Try - If Major > Version.VerMajor Then Begin - Result := True; - End - Else If Major = Version.VerMajor Then Begin - If Minor > Version.VerMinor Then Begin - Result := True; - End - Else If Minor = Version.VerMinor Then Begin - If Release > Version.VerRelease Then Begin - Result := True; - End - Else If Release = Version.VerRelease Then Begin - If Build > Version.VerBuild Then Begin - Result := True; - End; - End; - End; + Version := TFileVersion.Create(); + Result := False; + + Try + If Major > Version.VerMajor Then + Begin + Result := True; + End + Else If Major = Version.VerMajor Then + Begin + If Minor > Version.VerMinor Then + Begin + Result := True; + End + Else If Minor = Version.VerMinor Then + Begin + If Release > Version.VerRelease Then + Begin + Result := True; + End + Else If Release = Version.VerRelease Then + Begin + If Build > Version.VerBuild Then + Begin + Result := True; End; + End; + End; + End; - Finally - Version.Free; - End; + Finally + Version.Free; + End; End; - {$HINTS On} - -End. +{$HINTS On} +End. diff --git a/Keyboard and Spell checker/Forms/uForm1.dfm b/Keyboard and Spell checker/Forms/uForm1.dfm index 91f2168..6b4fd99 100644 --- a/Keyboard and Spell checker/Forms/uForm1.dfm +++ b/Keyboard and Spell checker/Forms/uForm1.dfm @@ -127,7 +127,7 @@ object AvroMainForm1: TAvroMainForm1 Left = 24 Top = 224 Bitmap = { - 494C01011E00B8004C0110001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 + 494C01011E00B800040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 0000000000003600000028000000400000008000000001002000000000000080 000000000000000000000000000000000000FBF9EE1EDFCC6CEDDBC256FFDBC2 56FFDBC256FFDBC256FFDBC256FFDBC256FFDBC256FFDBC256FFDBC256FFDBC2 diff --git a/Keyboard and Spell checker/Forms/uForm1.pas b/Keyboard and Spell checker/Forms/uForm1.pas index 8ff9a0d..6a3415d 100644 --- a/Keyboard and Spell checker/Forms/uForm1.pas +++ b/Keyboard and Spell checker/Forms/uForm1.pas @@ -1,759 +1,755 @@ { - ============================================================================= - ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + ============================================================================= + ***************************************************************************** + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. - ***************************************************************************** - ============================================================================= + ***************************************************************************** + ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - Unit uForm1; Interface Uses - Windows, - Messages, - SysUtils, - Variants, - Classes, - Graphics, - Controls, - Forms, - Dialogs, - StdCtrls, - ImgList, - ExtCtrls, - Menus, - clsLayout, - Generics.Collections, - StrUtils, - clsUpdateInfoDownloader, - DateUtils; + Windows, + Messages, + SysUtils, + Variants, + Classes, + Graphics, + Controls, + Forms, + Dialogs, + StdCtrls, + ImgList, + ExtCtrls, + Menus, + clsLayout, + Generics.Collections, + StrUtils, + clsUpdateInfoDownloader, + DateUtils, System.ImageList; Type - TMenuItemExtended = Class(TMenuItem) - Private - fValue: String; - Published - Property Value: String Read fValue Write fValue; - End; + TMenuItemExtended = Class(TMenuItem) + Private + fValue: String; + Published + Property Value: String Read fValue Write fValue; + End; Type - TWindowRecord = Record - Mode: String; - Locale: Cardinal; - End; + TWindowRecord = Record + Mode: String; + Locale: Cardinal; + End; Type - TAvroMainForm1 = Class(TForm) - Tray: TTrayIcon; - ImageList1: TImageList; - Popup_Web: TPopupMenu; - Popup_LayoutList: TPopupMenu; - Popup_Exit: TPopupMenu; - Popup_Help: TPopupMenu; - Popup_Main: TPopupMenu; - Popup_Tools: TPopupMenu; - AvroPhonetic1: TMenuItem; - EnableAutoCorrect1: TMenuItem; - ManageAutoCorrectentries1: TMenuItem; - LayoutViewerShowactivekeyboardlayout1: TMenuItem; - AvroMouseClicknType1: TMenuItem; - KeyboardLayoutEditorBuildcustomlayouts1: TMenuItem; - SkinDesignerDesignyourownskin1: TMenuItem; - N3: TMenuItem; - Options1: TMenuItem; - N4: TMenuItem; - N5: TMenuItem; - CheckupdateforAvroKeyboard1: TMenuItem; - N6: TMenuItem; - MoreFreeDownloads1: TMenuItem; - FreeBanglaFonts1: TMenuItem; - UsefultoolsforBangla1: TMenuItem; - Downloadmoreskins1: TMenuItem; - Downloadmorekeyboardlayouts1: TMenuItem; - AvroKeyboardontheweb1: TMenuItem; - PortableAvroKeyboardontheweb1: TMenuItem; - wwwOmicronLabcom1: TMenuItem; - UserForum1: TMenuItem; - AvroPhoneticEnglishtoBangla1: TMenuItem; - N7: TMenuItem; - Showactivekeyboardlayout1: TMenuItem; - N8: TMenuItem; - AvroMouseClicknType2: TMenuItem; - Jumptosystemtray1: TMenuItem; - Exit1: TMenuItem; - Configuringyoursystem1: TMenuItem; - OTFBanglaFontscamewithAvroKeyboard1: TMenuItem; - Helponhelp1: TMenuItem; - N9: TMenuItem; - BeforeYouStart1: TMenuItem; - Overview1: TMenuItem; - CustomizingAvroKeyboard1: TMenuItem; - BanglaTypingwithAvroPhonetic1: TMenuItem; - BanglaTypingwithFixedKeyboardLayouts1: TMenuItem; - BanglaTypingwithAvroMouse1: TMenuItem; - FrequentlyAskedQuestionsFAQ1: TMenuItem; - N10: TMenuItem; - CreatingEditingFixedKeyboardLayouts1: TMenuItem; - N11: TMenuItem; - Moredocumentsontheweb1: TMenuItem; - N15: TMenuItem; - Aboutcurrentkeyboardlayout1: TMenuItem; - AboutAvroKeyboard1: TMenuItem; - ogglekeyboardmode1: TMenuItem; - Docktotop1: TMenuItem; - Jumptosystemtray2: TMenuItem; - N16: TMenuItem; - Selectkeyboardlayout1: TMenuItem; - AvroPhoneticEnglishtoBangla2: TMenuItem; - N17: TMenuItem; - Showactivekeyboardlayout2: TMenuItem; - AvroMouseClicknType3: TMenuItem; - N18: TMenuItem; - Ontheweb1: TMenuItem; - CheckupdateforAvroKeyboard2: TMenuItem; - N19: TMenuItem; - MoreFreeDownloads2: TMenuItem; - FreeBanglaFonts2: TMenuItem; - AvroConverter2: TMenuItem; - UsefultoolsforBangla2: TMenuItem; - Downloadmoreskins2: TMenuItem; - Downloadmorekeyboardlayouts2: TMenuItem; - AvroKeyboardontheweb2: TMenuItem; - PortableAvroKeyboardontheweb2: TMenuItem; - wwwOmicronLabcom2: TMenuItem; - UserForum2: TMenuItem; - N20: TMenuItem; - CustomizeAvroKeyboard1: TMenuItem; - N21: TMenuItem; - Helpfiles1: TMenuItem; - Configuringyoursystem2: TMenuItem; - OTFBanglaFontscamewithAvroKeyboard2: TMenuItem; - Helponhelp2: TMenuItem; - N22: TMenuItem; - BeforeYouStart2: TMenuItem; - Overview2: TMenuItem; - CustomizingAvroKeyboard2: TMenuItem; - BanglaTypingwithAvroPhonetic2: TMenuItem; - BanglaTypingwithFixedKeyboardLayouts2: TMenuItem; - BanglaTypingwithAvroMouse2: TMenuItem; - FrequentlyAskedQuestionsFAQ2: TMenuItem; - N23: TMenuItem; - CreatingEditingFixedKeyboardLayouts2: TMenuItem; - N24: TMenuItem; - HowtoBanglaFileFolderName2: TMenuItem; - HowtoBanglaChat2: TMenuItem; - HowtoSearchingwebinBangla2: TMenuItem; - N25: TMenuItem; - HowtoDevelopBanglaWebPage2: TMenuItem; - HowtoEmbedBanglaFontinWebPages2: TMenuItem; - N26: TMenuItem; - Moredocumentsontheweb2: TMenuItem; - FreeOnlineSupport2: TMenuItem; - N27: TMenuItem; - GetAcrobatReader2: TMenuItem; - AboutAvroKeyboard2: TMenuItem; - N28: TMenuItem; - Exit2: TMenuItem; - Popup_Tray: TPopupMenu; - MenuItem26: TMenuItem; - ogglekeyboardmode2: TMenuItem; - RestoreAvroTopBar1: TMenuItem; - N29: TMenuItem; - Selectkeyboardlayout2: TMenuItem; - AvroMouseClicknType4: TMenuItem; - Ontheweb2: TMenuItem; - N30: TMenuItem; - N31: TMenuItem; - Helpfiles2: TMenuItem; - AboutAvroKeyboard3: TMenuItem; - N32: TMenuItem; - Exit3: TMenuItem; - CheckupdateforAvroKeyboard3: TMenuItem; - MoreFreeDownloads3: TMenuItem; - AvroKeyboardontheweb3: TMenuItem; - PortableAvroKeyboardontheweb3: TMenuItem; - wwwOmicronLabcom3: TMenuItem; - UserForum3: TMenuItem; - N33: TMenuItem; - FreeBanglaFonts3: TMenuItem; - AvroConverter3: TMenuItem; - UsefultoolsforBangla3: TMenuItem; - Downloadmoreskins3: TMenuItem; - Downloadmorekeyboardlayouts3: TMenuItem; - AvroPhoneticEnglishtoBangla3: TMenuItem; - N34: TMenuItem; - Showactivekeyboardlayout3: TMenuItem; - Configuringyoursystem3: TMenuItem; - OTFBanglaFontscamewithAvroKeyboard3: TMenuItem; - Helponhelp3: TMenuItem; - N35: TMenuItem; - BeforeYouStart3: TMenuItem; - Overview3: TMenuItem; - CustomizingAvroKeyboard3: TMenuItem; - BanglaTypingwithAvroPhonetic3: TMenuItem; - BanglaTypingwithFixedKeyboardLayouts3: TMenuItem; - BanglaTypingwithAvroMouse3: TMenuItem; - FrequentlyAskedQuestionsFAQ3: TMenuItem; - N36: TMenuItem; - CreatingEditingFixedKeyboardLayouts3: TMenuItem; - N37: TMenuItem; - HowtoBanglaFileFolderName3: TMenuItem; - HowtoBanglaChat3: TMenuItem; - HowtoSearchingwebinBangla3: TMenuItem; - N38: TMenuItem; - HowtoDevelopBanglaWebPage3: TMenuItem; - HowtoEmbedBanglaFontinWebPages3: TMenuItem; - N39: TMenuItem; - Moredocumentsontheweb3: TMenuItem; - FreeOnlineSupport3: TMenuItem; - N40: TMenuItem; - GetAcrobatReader3: TMenuItem; - WindowCheck: TTimer; - InternetCheck: TTimer; - Spellcheck1: TMenuItem; - N41: TMenuItem; - Spellcheck2: TMenuItem; - Spellcheck3: TMenuItem; - N43: TMenuItem; - IdleTimer: TTimer; - AboutCurrentskin1: TMenuItem; - N2: TMenuItem; - Aboutcurrentkeyboardlayout2: TMenuItem; - Aboutcurrentskin2: TMenuItem; - UnicodetoBijoytextconverter1: TMenuItem; - ools1: TMenuItem; - N46: TMenuItem; - AvroPhonetic2: TMenuItem; - EnableAutoCorrect2: TMenuItem; - ManageAutoCorrectentries2: TMenuItem; - UnicodetoBijoytextconverter2: TMenuItem; - KeyboardLayoutEditorBuildcustomlayouts2: TMenuItem; - SkinDesignerDesignyourownskin2: TMenuItem; - LayoutViewerShowactivekeyboardlayout2: TMenuItem; - AvroMouseClicknType5: TMenuItem; - N48: TMenuItem; - Options2: TMenuItem; - FixedKeyboardLayout1: TMenuItem; - UseModernStyleTyping1: TMenuItem; - UseOldStyleTyping1: TMenuItem; - N1: TMenuItem; - EnableOldStyleRephInModernTypingStyle1: TMenuItem; - AutomaticVowelFormatingInModernTypingStyle1: TMenuItem; - AutomaticallyfixChandrapositionInModernTypingStyle1: TMenuItem; - EnableBanglainNumberPadInFixedkeyboardLayouts1: TMenuItem; - FixedKeyboardLayout2: TMenuItem; - UseModernStyleTyping2: TMenuItem; - UseOldStyleTyping2: TMenuItem; - N44: TMenuItem; - EnableOldStyleRephInModernTypingStyle2: TMenuItem; - AutomaticVowelFormatingInModernTypingStyle2: TMenuItem; - AutomaticallyfixChandrapositionInModernTypingStyle2: TMenuItem; - EnableBanglainNumberPadInFixedkeyboardLayouts2: TMenuItem; - ShowPreviewWindow1: TMenuItem; - Dictionarymodeisdefault1: TMenuItem; - Charactermodeisdefault1: TMenuItem; - Classicphoneticnohint1: TMenuItem; - UseTabforBrowsingSuggestions1: TMenuItem; - N45: TMenuItem; - N47: TMenuItem; - Remembermychoiceamongsuggestions1: TMenuItem; - UseVerticalLinePipekeytotypeDot1: TMenuItem; - TypeJoNuktawithShiftJ1: TMenuItem; - ShowPreviewWindow2: TMenuItem; - Dictionarymodeisdefault2: TMenuItem; - Charactermodeisdefault2: TMenuItem; - Classicphoneticnohint2: TMenuItem; - UseTabforbrowsingsuggestions2: TMenuItem; - Remembermychoiceamongsuggestions2: TMenuItem; - N42: TMenuItem; - UseVerticalLinePipekeytotypeDot2: TMenuItem; - TypeJoNuktawithShiftJ2: TMenuItem; - N49: TMenuItem; - OutputasUnicodeRecommended1: TMenuItem; - OutputasANSIAreyousure1: TMenuItem; - N50: TMenuItem; - N51: TMenuItem; - OutputasUnicodeRecommended2: TMenuItem; - OutputasANSIAreyousure2: TMenuItem; - N52: TMenuItem; - AvroKeyboardonFacebook1: TMenuItem; - OmicronLabonTwitter1: TMenuItem; - N53: TMenuItem; - AvroKeyboardonFacebook2: TMenuItem; - OmicronLabonTwitter2: TMenuItem; - N54: TMenuItem; - AvroKeyboardonFacebook3: TMenuItem; - OmicronLabonTwitter3: TMenuItem; - Procedure FormKeyDown(Sender: TObject; Var Key: Word; Shift: TShiftState); - Procedure FormCreate(Sender: TObject); - Procedure AvroPhoneticEnglishtoBangla3Click(Sender: TObject); - Procedure Exit1Click(Sender: TObject); - Procedure ogglekeyboardmode2Click(Sender: TObject); - Procedure Docktotop1Click(Sender: TObject); - Procedure Showactivekeyboardlayout1Click(Sender: TObject); - Procedure AvroMouseClicknType2Click(Sender: TObject); - Procedure PortableAvroKeyboardontheweb1Click(Sender: TObject); - Procedure AvroKeyboardontheweb1Click(Sender: TObject); - Procedure wwwOmicronLabcom1Click(Sender: TObject); - Procedure UserForum1Click(Sender: TObject); - Procedure CheckupdateforAvroKeyboard1Click(Sender: TObject); - Procedure FreeBanglaFonts1Click(Sender: TObject); - Procedure UsefultoolsforBangla1Click(Sender: TObject); - Procedure Downloadmoreskins1Click(Sender: TObject); - Procedure Downloadmorekeyboardlayouts1Click(Sender: TObject); - Procedure Jumptosystemtray1Click(Sender: TObject); - Procedure Options1Click(Sender: TObject); - Procedure Configuringyoursystem1Click(Sender: TObject); - Procedure OTFBanglaFontscamewithAvroKeyboard1Click(Sender: TObject); - Procedure Helponhelp1Click(Sender: TObject); - Procedure BeforeYouStart1Click(Sender: TObject); - Procedure Overview1Click(Sender: TObject); - Procedure CustomizingAvroKeyboard1Click(Sender: TObject); - Procedure BanglaTypingwithAvroPhonetic1Click(Sender: TObject); - Procedure BanglaTypingwithFixedKeyboardLayouts1Click(Sender: TObject); - Procedure BanglaTypingwithAvroMouse1Click(Sender: TObject); - Procedure FrequentlyAskedQuestionsFAQ1Click(Sender: TObject); - Procedure CreatingEditingFixedKeyboardLayouts1Click(Sender: TObject); - Procedure Moredocumentsontheweb1Click(Sender: TObject); - Procedure GetAcrobatReader1Click(Sender: TObject); - Procedure Aboutcurrentkeyboardlayout1Click(Sender: TObject); - Procedure AboutAvroKeyboard1Click(Sender: TObject); - Procedure RestoreAvroTopBar1Click(Sender: TObject); - Procedure EnableOldStyleRephInModernTypingStyle1Click(Sender: TObject); - Procedure UseOldStyleTyping1Click(Sender: TObject); - Procedure UseModernStyleTyping1Click(Sender: TObject); - Procedure AutomaticallyfixChandrapositionInModernTypingStyle1Click(Sender: TObject); - Procedure AutomaticVowelFormatingInModernTypingStyle1Click(Sender: TObject); - Procedure EnableBanglainNumberPadInFixedkeyboardLayouts1Click(Sender: TObject); - Procedure EnableAutoCorrect1Click(Sender: TObject); - Procedure ManageAutoCorrectentries1Click(Sender: TObject); - Procedure KeyboardLayoutEditorBuildcustomlayouts1Click(Sender: TObject); - Procedure SkinDesignerDesignyourownskin1Click(Sender: TObject); - Procedure InternetCheckTimer(Sender: TObject); - Procedure TrayDblClick(Sender: TObject); - Procedure TrayClick(Sender: TObject); - Procedure WindowCheckTimer(Sender: TObject); - Procedure FormClose(Sender: TObject; Var Action: TCloseAction); - Procedure Spellcheck1Click(Sender: TObject); - Procedure IdleTimerTimer(Sender: TObject); - Procedure AboutCurrentskin1Click(Sender: TObject); - Procedure UnicodetoBijoytextconverter1Click(Sender: TObject); - Procedure FormCloseQuery(Sender: TObject; Var CanClose: Boolean); - Procedure ShowPreviewWindow1Click(Sender: TObject); - Procedure Dictionarymodeisdefault1Click(Sender: TObject); - Procedure Charactermodeisdefault1Click(Sender: TObject); - Procedure Classicphoneticnohint1Click(Sender: TObject); - Procedure UseTabforBrowsingSuggestions1Click(Sender: TObject); - Procedure Remembermychoiceamongsuggestions1Click(Sender: TObject); - Procedure UseVerticalLinePipekeytotypeDot1Click(Sender: TObject); - Procedure TypeJoNuktawithShiftJ1Click(Sender: TObject); - Procedure OutputasUnicodeRecommended1Click(Sender: TObject); - Procedure OutputasANSIAreyousure1Click(Sender: TObject); - Procedure AvroKeyboardonFacebook1Click(Sender: TObject); - Procedure OmicronLabonTwitter1Click(Sender: TObject); - Private - { Private declarations } - WindowDict: TDictionary; - MyCurrentLayout: String; - MyCurrentKeyboardMode: enumMode; - LastWindow: HWND; - - - Procedure ChangeTypingStyle(Const sStyle: String); - Function IgnorableWindow(Const lngHWND: HWND): Boolean; - - Procedure ToggleAutoCorrect; - Procedure ToggleFixChandra; - Procedure ToggleNumPadBangla; - Procedure ToggleOldStyleReph; - Procedure ToggleVowelFormat; - Procedure LoadApp; - Procedure MenuFixedLayoutClick(Sender: TObject); - Procedure KeyLayout_KeyboardLayoutChanged(CurrentKeyboardLayout: String); - Procedure KeyLayout_KeyboardModeChanged(CurrentMode: enumMode); - Procedure ResetAllWindowLocale; - - - - Procedure WMCopyData(Var Msg: TWMCopyData); Message WM_COPYDATA; - Public - { Public declarations } - KeyboardModeChanged: Boolean; - KeyLayout: TLayout; - Updater: TUpdateCheck; - - Function GetMyCurrentKeyboardMode: enumMode; - Procedure ExitApp; - Function GetMyCurrentLayout: String; - Procedure RefreshSettings; - Procedure RestoreFromTray; - Procedure OpenHelpFile(Const HelpID: Integer); - Procedure ShowOnTray; - Procedure ToggleMode; - Procedure TopBarDocToTop; - Function TransferKeyDown(Const KeyCode: Integer; Var Block: Boolean): String; - Procedure TransferKeyUp(Const KeyCode: Integer; Var Block: Boolean); - Procedure TrimAppMemorySize; - Procedure Initmenu; - Procedure ToggleOutputEncoding; - Protected - Procedure CreateParams(Var Params: TCreateParams); Override; - End; + TAvroMainForm1 = Class(TForm) + Tray: TTrayIcon; + ImageList1: TImageList; + Popup_Web: TPopupMenu; + Popup_LayoutList: TPopupMenu; + Popup_Exit: TPopupMenu; + Popup_Help: TPopupMenu; + Popup_Main: TPopupMenu; + Popup_Tools: TPopupMenu; + AvroPhonetic1: TMenuItem; + EnableAutoCorrect1: TMenuItem; + ManageAutoCorrectentries1: TMenuItem; + LayoutViewerShowactivekeyboardlayout1: TMenuItem; + AvroMouseClicknType1: TMenuItem; + KeyboardLayoutEditorBuildcustomlayouts1: TMenuItem; + SkinDesignerDesignyourownskin1: TMenuItem; + N3: TMenuItem; + Options1: TMenuItem; + N4: TMenuItem; + N5: TMenuItem; + CheckupdateforAvroKeyboard1: TMenuItem; + N6: TMenuItem; + MoreFreeDownloads1: TMenuItem; + FreeBanglaFonts1: TMenuItem; + UsefultoolsforBangla1: TMenuItem; + Downloadmoreskins1: TMenuItem; + Downloadmorekeyboardlayouts1: TMenuItem; + AvroKeyboardontheweb1: TMenuItem; + PortableAvroKeyboardontheweb1: TMenuItem; + wwwOmicronLabcom1: TMenuItem; + UserForum1: TMenuItem; + AvroPhoneticEnglishtoBangla1: TMenuItem; + N7: TMenuItem; + Showactivekeyboardlayout1: TMenuItem; + N8: TMenuItem; + AvroMouseClicknType2: TMenuItem; + Jumptosystemtray1: TMenuItem; + Exit1: TMenuItem; + Configuringyoursystem1: TMenuItem; + OTFBanglaFontscamewithAvroKeyboard1: TMenuItem; + Helponhelp1: TMenuItem; + N9: TMenuItem; + BeforeYouStart1: TMenuItem; + Overview1: TMenuItem; + CustomizingAvroKeyboard1: TMenuItem; + BanglaTypingwithAvroPhonetic1: TMenuItem; + BanglaTypingwithFixedKeyboardLayouts1: TMenuItem; + BanglaTypingwithAvroMouse1: TMenuItem; + FrequentlyAskedQuestionsFAQ1: TMenuItem; + N10: TMenuItem; + CreatingEditingFixedKeyboardLayouts1: TMenuItem; + N11: TMenuItem; + Moredocumentsontheweb1: TMenuItem; + N15: TMenuItem; + Aboutcurrentkeyboardlayout1: TMenuItem; + AboutAvroKeyboard1: TMenuItem; + ogglekeyboardmode1: TMenuItem; + Docktotop1: TMenuItem; + Jumptosystemtray2: TMenuItem; + N16: TMenuItem; + Selectkeyboardlayout1: TMenuItem; + AvroPhoneticEnglishtoBangla2: TMenuItem; + N17: TMenuItem; + Showactivekeyboardlayout2: TMenuItem; + AvroMouseClicknType3: TMenuItem; + N18: TMenuItem; + Ontheweb1: TMenuItem; + CheckupdateforAvroKeyboard2: TMenuItem; + N19: TMenuItem; + MoreFreeDownloads2: TMenuItem; + FreeBanglaFonts2: TMenuItem; + AvroConverter2: TMenuItem; + UsefultoolsforBangla2: TMenuItem; + Downloadmoreskins2: TMenuItem; + Downloadmorekeyboardlayouts2: TMenuItem; + AvroKeyboardontheweb2: TMenuItem; + PortableAvroKeyboardontheweb2: TMenuItem; + wwwOmicronLabcom2: TMenuItem; + UserForum2: TMenuItem; + N20: TMenuItem; + CustomizeAvroKeyboard1: TMenuItem; + N21: TMenuItem; + Helpfiles1: TMenuItem; + Configuringyoursystem2: TMenuItem; + OTFBanglaFontscamewithAvroKeyboard2: TMenuItem; + Helponhelp2: TMenuItem; + N22: TMenuItem; + BeforeYouStart2: TMenuItem; + Overview2: TMenuItem; + CustomizingAvroKeyboard2: TMenuItem; + BanglaTypingwithAvroPhonetic2: TMenuItem; + BanglaTypingwithFixedKeyboardLayouts2: TMenuItem; + BanglaTypingwithAvroMouse2: TMenuItem; + FrequentlyAskedQuestionsFAQ2: TMenuItem; + N23: TMenuItem; + CreatingEditingFixedKeyboardLayouts2: TMenuItem; + N24: TMenuItem; + HowtoBanglaFileFolderName2: TMenuItem; + HowtoBanglaChat2: TMenuItem; + HowtoSearchingwebinBangla2: TMenuItem; + N25: TMenuItem; + HowtoDevelopBanglaWebPage2: TMenuItem; + HowtoEmbedBanglaFontinWebPages2: TMenuItem; + N26: TMenuItem; + Moredocumentsontheweb2: TMenuItem; + FreeOnlineSupport2: TMenuItem; + N27: TMenuItem; + GetAcrobatReader2: TMenuItem; + AboutAvroKeyboard2: TMenuItem; + N28: TMenuItem; + Exit2: TMenuItem; + Popup_Tray: TPopupMenu; + MenuItem26: TMenuItem; + ogglekeyboardmode2: TMenuItem; + RestoreAvroTopBar1: TMenuItem; + N29: TMenuItem; + Selectkeyboardlayout2: TMenuItem; + AvroMouseClicknType4: TMenuItem; + Ontheweb2: TMenuItem; + N30: TMenuItem; + N31: TMenuItem; + Helpfiles2: TMenuItem; + AboutAvroKeyboard3: TMenuItem; + N32: TMenuItem; + Exit3: TMenuItem; + CheckupdateforAvroKeyboard3: TMenuItem; + MoreFreeDownloads3: TMenuItem; + AvroKeyboardontheweb3: TMenuItem; + PortableAvroKeyboardontheweb3: TMenuItem; + wwwOmicronLabcom3: TMenuItem; + UserForum3: TMenuItem; + N33: TMenuItem; + FreeBanglaFonts3: TMenuItem; + AvroConverter3: TMenuItem; + UsefultoolsforBangla3: TMenuItem; + Downloadmoreskins3: TMenuItem; + Downloadmorekeyboardlayouts3: TMenuItem; + AvroPhoneticEnglishtoBangla3: TMenuItem; + N34: TMenuItem; + Showactivekeyboardlayout3: TMenuItem; + Configuringyoursystem3: TMenuItem; + OTFBanglaFontscamewithAvroKeyboard3: TMenuItem; + Helponhelp3: TMenuItem; + N35: TMenuItem; + BeforeYouStart3: TMenuItem; + Overview3: TMenuItem; + CustomizingAvroKeyboard3: TMenuItem; + BanglaTypingwithAvroPhonetic3: TMenuItem; + BanglaTypingwithFixedKeyboardLayouts3: TMenuItem; + BanglaTypingwithAvroMouse3: TMenuItem; + FrequentlyAskedQuestionsFAQ3: TMenuItem; + N36: TMenuItem; + CreatingEditingFixedKeyboardLayouts3: TMenuItem; + N37: TMenuItem; + HowtoBanglaFileFolderName3: TMenuItem; + HowtoBanglaChat3: TMenuItem; + HowtoSearchingwebinBangla3: TMenuItem; + N38: TMenuItem; + HowtoDevelopBanglaWebPage3: TMenuItem; + HowtoEmbedBanglaFontinWebPages3: TMenuItem; + N39: TMenuItem; + Moredocumentsontheweb3: TMenuItem; + FreeOnlineSupport3: TMenuItem; + N40: TMenuItem; + GetAcrobatReader3: TMenuItem; + WindowCheck: TTimer; + InternetCheck: TTimer; + Spellcheck1: TMenuItem; + N41: TMenuItem; + Spellcheck2: TMenuItem; + Spellcheck3: TMenuItem; + N43: TMenuItem; + IdleTimer: TTimer; + AboutCurrentskin1: TMenuItem; + N2: TMenuItem; + Aboutcurrentkeyboardlayout2: TMenuItem; + Aboutcurrentskin2: TMenuItem; + UnicodetoBijoytextconverter1: TMenuItem; + ools1: TMenuItem; + N46: TMenuItem; + AvroPhonetic2: TMenuItem; + EnableAutoCorrect2: TMenuItem; + ManageAutoCorrectentries2: TMenuItem; + UnicodetoBijoytextconverter2: TMenuItem; + KeyboardLayoutEditorBuildcustomlayouts2: TMenuItem; + SkinDesignerDesignyourownskin2: TMenuItem; + LayoutViewerShowactivekeyboardlayout2: TMenuItem; + AvroMouseClicknType5: TMenuItem; + N48: TMenuItem; + Options2: TMenuItem; + FixedKeyboardLayout1: TMenuItem; + UseModernStyleTyping1: TMenuItem; + UseOldStyleTyping1: TMenuItem; + N1: TMenuItem; + EnableOldStyleRephInModernTypingStyle1: TMenuItem; + AutomaticVowelFormatingInModernTypingStyle1: TMenuItem; + AutomaticallyfixChandrapositionInModernTypingStyle1: TMenuItem; + EnableBanglainNumberPadInFixedkeyboardLayouts1: TMenuItem; + FixedKeyboardLayout2: TMenuItem; + UseModernStyleTyping2: TMenuItem; + UseOldStyleTyping2: TMenuItem; + N44: TMenuItem; + EnableOldStyleRephInModernTypingStyle2: TMenuItem; + AutomaticVowelFormatingInModernTypingStyle2: TMenuItem; + AutomaticallyfixChandrapositionInModernTypingStyle2: TMenuItem; + EnableBanglainNumberPadInFixedkeyboardLayouts2: TMenuItem; + ShowPreviewWindow1: TMenuItem; + Dictionarymodeisdefault1: TMenuItem; + Charactermodeisdefault1: TMenuItem; + Classicphoneticnohint1: TMenuItem; + UseTabforBrowsingSuggestions1: TMenuItem; + N45: TMenuItem; + N47: TMenuItem; + Remembermychoiceamongsuggestions1: TMenuItem; + UseVerticalLinePipekeytotypeDot1: TMenuItem; + TypeJoNuktawithShiftJ1: TMenuItem; + ShowPreviewWindow2: TMenuItem; + Dictionarymodeisdefault2: TMenuItem; + Charactermodeisdefault2: TMenuItem; + Classicphoneticnohint2: TMenuItem; + UseTabforbrowsingsuggestions2: TMenuItem; + Remembermychoiceamongsuggestions2: TMenuItem; + N42: TMenuItem; + UseVerticalLinePipekeytotypeDot2: TMenuItem; + TypeJoNuktawithShiftJ2: TMenuItem; + N49: TMenuItem; + OutputasUnicodeRecommended1: TMenuItem; + OutputasANSIAreyousure1: TMenuItem; + N50: TMenuItem; + N51: TMenuItem; + OutputasUnicodeRecommended2: TMenuItem; + OutputasANSIAreyousure2: TMenuItem; + N52: TMenuItem; + AvroKeyboardonFacebook1: TMenuItem; + OmicronLabonTwitter1: TMenuItem; + N53: TMenuItem; + AvroKeyboardonFacebook2: TMenuItem; + OmicronLabonTwitter2: TMenuItem; + N54: TMenuItem; + AvroKeyboardonFacebook3: TMenuItem; + OmicronLabonTwitter3: TMenuItem; + Procedure FormKeyDown(Sender: TObject; Var Key: Word; Shift: TShiftState); + Procedure FormCreate(Sender: TObject); + Procedure AvroPhoneticEnglishtoBangla3Click(Sender: TObject); + Procedure Exit1Click(Sender: TObject); + Procedure ogglekeyboardmode2Click(Sender: TObject); + Procedure Docktotop1Click(Sender: TObject); + Procedure Showactivekeyboardlayout1Click(Sender: TObject); + Procedure AvroMouseClicknType2Click(Sender: TObject); + Procedure PortableAvroKeyboardontheweb1Click(Sender: TObject); + Procedure AvroKeyboardontheweb1Click(Sender: TObject); + Procedure wwwOmicronLabcom1Click(Sender: TObject); + Procedure UserForum1Click(Sender: TObject); + Procedure CheckupdateforAvroKeyboard1Click(Sender: TObject); + Procedure FreeBanglaFonts1Click(Sender: TObject); + Procedure UsefultoolsforBangla1Click(Sender: TObject); + Procedure Downloadmoreskins1Click(Sender: TObject); + Procedure Downloadmorekeyboardlayouts1Click(Sender: TObject); + Procedure Jumptosystemtray1Click(Sender: TObject); + Procedure Options1Click(Sender: TObject); + Procedure Configuringyoursystem1Click(Sender: TObject); + Procedure OTFBanglaFontscamewithAvroKeyboard1Click(Sender: TObject); + Procedure Helponhelp1Click(Sender: TObject); + Procedure BeforeYouStart1Click(Sender: TObject); + Procedure Overview1Click(Sender: TObject); + Procedure CustomizingAvroKeyboard1Click(Sender: TObject); + Procedure BanglaTypingwithAvroPhonetic1Click(Sender: TObject); + Procedure BanglaTypingwithFixedKeyboardLayouts1Click(Sender: TObject); + Procedure BanglaTypingwithAvroMouse1Click(Sender: TObject); + Procedure FrequentlyAskedQuestionsFAQ1Click(Sender: TObject); + Procedure CreatingEditingFixedKeyboardLayouts1Click(Sender: TObject); + Procedure Moredocumentsontheweb1Click(Sender: TObject); + Procedure GetAcrobatReader1Click(Sender: TObject); + Procedure Aboutcurrentkeyboardlayout1Click(Sender: TObject); + Procedure AboutAvroKeyboard1Click(Sender: TObject); + Procedure RestoreAvroTopBar1Click(Sender: TObject); + Procedure EnableOldStyleRephInModernTypingStyle1Click(Sender: TObject); + Procedure UseOldStyleTyping1Click(Sender: TObject); + Procedure UseModernStyleTyping1Click(Sender: TObject); + Procedure AutomaticallyfixChandrapositionInModernTypingStyle1Click + (Sender: TObject); + Procedure AutomaticVowelFormatingInModernTypingStyle1Click(Sender: TObject); + Procedure EnableBanglainNumberPadInFixedkeyboardLayouts1Click + (Sender: TObject); + Procedure EnableAutoCorrect1Click(Sender: TObject); + Procedure ManageAutoCorrectentries1Click(Sender: TObject); + Procedure KeyboardLayoutEditorBuildcustomlayouts1Click(Sender: TObject); + Procedure SkinDesignerDesignyourownskin1Click(Sender: TObject); + Procedure InternetCheckTimer(Sender: TObject); + Procedure TrayDblClick(Sender: TObject); + Procedure TrayClick(Sender: TObject); + Procedure WindowCheckTimer(Sender: TObject); + Procedure FormClose(Sender: TObject; Var Action: TCloseAction); + Procedure Spellcheck1Click(Sender: TObject); + Procedure IdleTimerTimer(Sender: TObject); + Procedure AboutCurrentskin1Click(Sender: TObject); + Procedure UnicodetoBijoytextconverter1Click(Sender: TObject); + Procedure FormCloseQuery(Sender: TObject; Var CanClose: Boolean); + Procedure ShowPreviewWindow1Click(Sender: TObject); + Procedure Dictionarymodeisdefault1Click(Sender: TObject); + Procedure Charactermodeisdefault1Click(Sender: TObject); + Procedure Classicphoneticnohint1Click(Sender: TObject); + Procedure UseTabforBrowsingSuggestions1Click(Sender: TObject); + Procedure Remembermychoiceamongsuggestions1Click(Sender: TObject); + Procedure UseVerticalLinePipekeytotypeDot1Click(Sender: TObject); + Procedure TypeJoNuktawithShiftJ1Click(Sender: TObject); + Procedure OutputasUnicodeRecommended1Click(Sender: TObject); + Procedure OutputasANSIAreyousure1Click(Sender: TObject); + Procedure AvroKeyboardonFacebook1Click(Sender: TObject); + Procedure OmicronLabonTwitter1Click(Sender: TObject); + Private + { Private declarations } + WindowDict: TDictionary; + MyCurrentLayout: String; + MyCurrentKeyboardMode: enumMode; + LastWindow: HWND; + + Procedure ChangeTypingStyle(Const sStyle: String); + Function IgnorableWindow(Const lngHWND: HWND): Boolean; + + Procedure ToggleAutoCorrect; + Procedure ToggleFixChandra; + Procedure ToggleNumPadBangla; + Procedure ToggleOldStyleReph; + Procedure ToggleVowelFormat; + Procedure LoadApp; + Procedure MenuFixedLayoutClick(Sender: TObject); + Procedure KeyLayout_KeyboardLayoutChanged(CurrentKeyboardLayout: String); + Procedure KeyLayout_KeyboardModeChanged(CurrentMode: enumMode); + Procedure ResetAllWindowLocale; + + Procedure WMCopyData(Var Msg: TWMCopyData); Message WM_COPYDATA; + Public + { Public declarations } + KeyboardModeChanged: Boolean; + KeyLayout: TLayout; + Updater: TUpdateCheck; + + Function GetMyCurrentKeyboardMode: enumMode; + Procedure ExitApp; + Function GetMyCurrentLayout: String; + Procedure RefreshSettings; + Procedure RestoreFromTray; + Procedure OpenHelpFile(Const HelpID: Integer); + Procedure ShowOnTray; + Procedure ToggleMode; + Procedure TopBarDocToTop; + Function TransferKeyDown(Const KeyCode: Integer; + Var Block: Boolean): String; + Procedure TransferKeyUp(Const KeyCode: Integer; Var Block: Boolean); + Procedure TrimAppMemorySize; + Procedure Initmenu; + Procedure ToggleOutputEncoding; + Protected + Procedure CreateParams(Var Params: TCreateParams); Override; + End; Var - AvroMainForm1: TAvroMainForm1; + AvroMainForm1: TAvroMainForm1; Implementation {$R *.dfm} Uses - uRegistrySettings, - uProcessHandler, - uAutoCorrect, - KeyboardLayoutLoader, - uFileFolderHandling, - WindowsVersion, - uWindowHandlers, - uTopBar, - uLayoutViewer, - ufrmAvroMouse, - ufrmOptions, - ufrmAboutSkinLayout, - ufrmAbout, - ufrmAutoCorrect, - clsRegistry_XMLSetting, - KeyboardHook, - uFrmSplash, - uLocale, - ufrmPrevW, - uDBase, - SkinLoader, - u_VirtualFontInstall, - ufrmEncodingWarning; - + uRegistrySettings, + uProcessHandler, + uAutoCorrect, + KeyboardLayoutLoader, + uFileFolderHandling, + WindowsVersion, + uWindowHandlers, + uTopBar, + uLayoutViewer, + ufrmAvroMouse, + ufrmOptions, + ufrmAboutSkinLayout, + ufrmAbout, + ufrmAutoCorrect, + clsRegistry_XMLSetting, + KeyboardHook, + uFrmSplash, + uLocale, + ufrmPrevW, + uDBase, + SkinLoader, + u_VirtualFontInstall, + ufrmEncodingWarning; { =============================================================================== } Procedure TAvroMainForm1.AboutAvroKeyboard1Click(Sender: TObject); Begin - CheckCreateForm(TfrmAbout, frmAbout, 'frmAbout'); - frmAbout.Show; + CheckCreateForm(TfrmAbout, frmAbout, 'frmAbout'); + frmAbout.Show; End; Procedure TAvroMainForm1.Aboutcurrentkeyboardlayout1Click(Sender: TObject); Var - KeyboardLayoutPath, KeyboardLayout: String; + KeyboardLayoutPath, KeyboardLayout: String; Begin - KeyboardLayout := AvroMainForm1.GetMyCurrentLayout; - If Lowercase(KeyboardLayout) = 'avrophonetic*' Then - KeyboardLayoutPath := KeyboardLayout - Else - KeyboardLayoutPath := GetAvroDataDir + 'Keyboard Layouts\' + KeyboardLayout + '.avrolayout'; + KeyboardLayout := AvroMainForm1.GetMyCurrentLayout; + If Lowercase(KeyboardLayout) = 'avrophonetic*' Then + KeyboardLayoutPath := KeyboardLayout + Else + KeyboardLayoutPath := GetAvroDataDir + 'Keyboard Layouts\' + KeyboardLayout + + '.avrolayout'; - ShowLayoutDescription(KeyboardLayoutPath); + ShowLayoutDescription(KeyboardLayoutPath); End; Procedure TAvroMainForm1.AboutCurrentskin1Click(Sender: TObject); Var - SkinPath: String; + SkinPath: String; Begin - If Lowercase(InterfaceSkin) = 'internalskin*' Then - SkinPath := InterfaceSkin - Else - SkinPath := GetAvroDataDir + 'Skin\' + InterfaceSkin + '.avroskin'; + If Lowercase(InterfaceSkin) = 'internalskin*' Then + SkinPath := InterfaceSkin + Else + SkinPath := GetAvroDataDir + 'Skin\' + InterfaceSkin + '.avroskin'; - GetSkinDescription(SkinPath); + GetSkinDescription(SkinPath); End; - -Procedure TAvroMainForm1.AutomaticallyfixChandrapositionInModernTypingStyle1Click(Sender: TObject); +Procedure TAvroMainForm1. + AutomaticallyfixChandrapositionInModernTypingStyle1Click(Sender: TObject); Begin - ToggleFixChandra; + ToggleFixChandra; End; -Procedure TAvroMainForm1.AutomaticVowelFormatingInModernTypingStyle1Click(Sender: TObject); +Procedure TAvroMainForm1.AutomaticVowelFormatingInModernTypingStyle1Click + (Sender: TObject); Begin - ToggleVowelFormat; + ToggleVowelFormat; End; - Procedure TAvroMainForm1.AvroKeyboardonFacebook1Click(Sender: TObject); Begin - Execute_Something('http://www.omicronlab.com/go.php?id=39'); + Execute_Something('http://www.omicronlab.com/go.php?id=39'); End; Procedure TAvroMainForm1.AvroKeyboardontheweb1Click(Sender: TObject); Begin - Execute_Something('http://www.omicronlab.com/go.php?id=1'); + Execute_Something('http://www.omicronlab.com/go.php?id=1'); End; Procedure TAvroMainForm1.AvroMouseClicknType2Click(Sender: TObject); Begin - CheckCreateForm(TfrmAvroMouse, frmAvroMouse, 'frmAvroMouse'); - frmAvroMouse.Show; + CheckCreateForm(TfrmAvroMouse, frmAvroMouse, 'frmAvroMouse'); + frmAvroMouse.Show; End; Procedure TAvroMainForm1.AvroPhoneticEnglishtoBangla3Click(Sender: TObject); Begin - KeyLayout.CurrentKeyboardLayout := 'avrophonetic*'; + KeyLayout.CurrentKeyboardLayout := 'avrophonetic*'; End; Procedure TAvroMainForm1.BanglaTypingwithAvroMouse1Click(Sender: TObject); Begin - OpenHelpFile(28); + OpenHelpFile(28); End; Procedure TAvroMainForm1.BanglaTypingwithAvroPhonetic1Click(Sender: TObject); Begin - OpenHelpFile(26); + OpenHelpFile(26); End; -Procedure TAvroMainForm1.BanglaTypingwithFixedKeyboardLayouts1Click(Sender: TObject); +Procedure TAvroMainForm1.BanglaTypingwithFixedKeyboardLayouts1Click + (Sender: TObject); Begin - OpenHelpFile(27); + OpenHelpFile(27); End; Procedure TAvroMainForm1.BeforeYouStart1Click(Sender: TObject); Begin - OpenHelpFile(23); + OpenHelpFile(23); End; Procedure TAvroMainForm1.ChangeTypingStyle(Const sStyle: String); Begin - If Lowercase(sStyle) = Lowercase('ModernStyle') Then - FullOldStyleTyping := 'NO' - Else If Lowercase(sStyle) = Lowercase('OldStyle') Then - FullOldStyleTyping := 'YES'; - RefreshSettings; + If Lowercase(sStyle) = Lowercase('ModernStyle') Then + FullOldStyleTyping := 'NO' + Else If Lowercase(sStyle) = Lowercase('OldStyle') Then + FullOldStyleTyping := 'YES'; + RefreshSettings; End; Procedure TAvroMainForm1.Charactermodeisdefault1Click(Sender: TObject); Begin - PhoneticMode := 'CHAR'; - RefreshSettings; + PhoneticMode := 'CHAR'; + RefreshSettings; End; Procedure TAvroMainForm1.CheckupdateforAvroKeyboard1Click(Sender: TObject); Begin - Updater.Check; - AvroUpdateLastCheck := Now; + Updater.Check; + AvroUpdateLastCheck := Now; End; - Procedure TAvroMainForm1.Classicphoneticnohint1Click(Sender: TObject); Begin - PhoneticMode := 'ONLYCHAR'; - RefreshSettings; + PhoneticMode := 'ONLYCHAR'; + RefreshSettings; End; - Procedure TAvroMainForm1.Configuringyoursystem1Click(Sender: TObject); Begin - Execute_Something(ExtractFilePath(Application.ExeName) + 'Configuring_system.htm'); + Execute_Something(ExtractFilePath(Application.ExeName) + + 'Configuring_system.htm'); End; Procedure TAvroMainForm1.CreateParams(Var Params: TCreateParams); Begin - Inherited CreateParams(Params); - Params.ExStyle := Params.ExStyle Or WS_EX_TOOLWINDOW And Not WS_EX_APPWINDOW; + Inherited CreateParams(Params); + Params.ExStyle := Params.ExStyle Or WS_EX_TOOLWINDOW And Not WS_EX_APPWINDOW; End; -Procedure TAvroMainForm1.CreatingEditingFixedKeyboardLayouts1Click(Sender: TObject); +Procedure TAvroMainForm1.CreatingEditingFixedKeyboardLayouts1Click + (Sender: TObject); Begin - OpenHelpFile(35); + OpenHelpFile(35); End; Procedure TAvroMainForm1.CustomizingAvroKeyboard1Click(Sender: TObject); Begin - OpenHelpFile(25); + OpenHelpFile(25); End; Procedure TAvroMainForm1.Dictionarymodeisdefault1Click(Sender: TObject); Begin - PhoneticMode := 'DICT'; - RefreshSettings; + PhoneticMode := 'DICT'; + RefreshSettings; End; Procedure TAvroMainForm1.Docktotop1Click(Sender: TObject); Begin - TopBarDocToTop; + TopBarDocToTop; End; Procedure TAvroMainForm1.Downloadmorekeyboardlayouts1Click(Sender: TObject); Begin - Execute_Something('http://www.omicronlab.com/go.php?id=6'); + Execute_Something('http://www.omicronlab.com/go.php?id=6'); End; Procedure TAvroMainForm1.Downloadmoreskins1Click(Sender: TObject); Begin - Execute_Something('http://www.omicronlab.com/go.php?id=8'); + Execute_Something('http://www.omicronlab.com/go.php?id=8'); End; { =============================================================================== } Procedure TAvroMainForm1.EnableAutoCorrect1Click(Sender: TObject); Begin - ToggleAutoCorrect; + ToggleAutoCorrect; End; -Procedure TAvroMainForm1.EnableBanglainNumberPadInFixedkeyboardLayouts1Click(Sender: TObject); +Procedure TAvroMainForm1.EnableBanglainNumberPadInFixedkeyboardLayouts1Click + (Sender: TObject); Begin - ToggleNumPadBangla; + ToggleNumPadBangla; End; - -Procedure TAvroMainForm1.EnableOldStyleRephInModernTypingStyle1Click(Sender: TObject); +Procedure TAvroMainForm1.EnableOldStyleRephInModernTypingStyle1Click + (Sender: TObject); Begin - ToggleOldStyleReph; + ToggleOldStyleReph; End; Procedure TAvroMainForm1.Exit1Click(Sender: TObject); Begin - Self.Close; + Self.Close; End; Procedure TAvroMainForm1.ExitApp; Begin - // Dont show any page fault error during shut down - - {$IFDEF RELEASE} - - SetErrorMode(SEM_NOGPFAULTERRORBOX); - - {$ENDIF} + // Dont show any page fault error during shut down - ResetAllWindowLocale; +{$IFDEF RELEASE} + SetErrorMode(SEM_NOGPFAULTERRORBOX); - {$IFDEF PortableOn} +{$ENDIF} + ResetAllWindowLocale; - RemoveVirtualFont(ExtractFilePath(Application.ExeName) + 'Virtual Font\Siyamrupali.ttf'); +{$IFDEF PortableOn} + RemoveVirtualFont(ExtractFilePath(Application.ExeName) + + 'Virtual Font\Siyamrupali.ttf'); - {$ENDIF} +{$ENDIF} + SaveSettings; - SaveSettings; + WindowCheck.Enabled := False; + InternetCheck.Enabled := False; - WindowCheck.Enabled := False; - InternetCheck.Enabled := False; + Tray.Visible := False; - Tray.Visible := False; + FreeAndNil(WindowDict); + FreeAndNil(KeyLayout); + RemoveHook; + FreeAndNil(Updater); + DestroyDict; + Destroy_KeyboardLayoutData; + FreeAndNil(KeyboardLayouts); + UnloadWordDatabase; - FreeAndNil(WindowDict); - FreeAndNil(KeyLayout); - RemoveHook; - FreeAndNil(Updater); - DestroyDict; - Destroy_KeyboardLayoutData; - FreeAndNil(KeyboardLayouts); - UnloadWordDatabase; - - Topbar.ApplicationClosing := True; - If Assigned(Topbar) Then - Topbar.Close; - If Assigned(frmPrevW) Then - frmPrevW.Close; - Application.Terminate; + Topbar.ApplicationClosing := True; + If Assigned(Topbar) Then + Topbar.Close; + If Assigned(frmPrevW) Then + frmPrevW.Close; + Application.Terminate; End; { =============================================================================== } - Procedure TAvroMainForm1.FormClose(Sender: TObject; Var Action: TCloseAction); Begin - Action := caFree; + Action := caFree; - AvroMainForm1 := Nil; + AvroMainForm1 := Nil; End; Procedure TAvroMainForm1.FormCloseQuery(Sender: TObject; Var CanClose: Boolean); Begin - ExitApp; - CanClose := True; + ExitApp; + CanClose := True; End; Procedure TAvroMainForm1.FormCreate(Sender: TObject); Begin - // Hide the form - Left := Screen.Width + 5000; - Show; - Application.ProcessMessages; + // Hide the form + Left := Screen.Width + 5000; + Show; + Application.ProcessMessages; - LoadSettings; + LoadSettings; - { TODO : - If DontShowStartupWizard <> 'YES Then - ConfigurationWizard.Show; - End If } + { TODO : + If DontShowStartupWizard <> 'YES Then + ConfigurationWizard.Show; + End If } - LoadApp; + LoadApp; End; { =============================================================================== } -Procedure TAvroMainForm1.FormKeyDown(Sender: TObject; Var Key: Word; Shift: TShiftState); +Procedure TAvroMainForm1.FormKeyDown(Sender: TObject; Var Key: Word; + Shift: TShiftState); Begin - If (Key = VK_F4) { And (ssAlt In Shift) } Then - Key := 0; + If (Key = VK_F4) { And (ssAlt In Shift) } Then + Key := 0; End; Procedure TAvroMainForm1.FreeBanglaFonts1Click(Sender: TObject); Begin - Execute_Something('http://www.omicronlab.com/go.php?id=4'); + Execute_Something('http://www.omicronlab.com/go.php?id=4'); End; Procedure TAvroMainForm1.FrequentlyAskedQuestionsFAQ1Click(Sender: TObject); Begin - OpenHelpFile(29); + OpenHelpFile(29); End; { =============================================================================== } - - Procedure TAvroMainForm1.GetAcrobatReader1Click(Sender: TObject); Begin - Execute_Something('http://www.omicronlab.com/go.php?id=13'); + Execute_Something('http://www.omicronlab.com/go.php?id=13'); End; Function TAvroMainForm1.GetMyCurrentKeyboardMode: enumMode; Begin - result := MyCurrentKeyboardMode; + result := MyCurrentKeyboardMode; End; { =============================================================================== } Function TAvroMainForm1.GetMyCurrentLayout: String; Begin - result := MyCurrentLayout; + result := MyCurrentLayout; End; Procedure TAvroMainForm1.Helponhelp1Click(Sender: TObject); Begin - Execute_Something(ExtractFilePath(Application.ExeName) + 'help_on_help.htm'); + Execute_Something(ExtractFilePath(Application.ExeName) + 'help_on_help.htm'); End; { =============================================================================== } @@ -762,544 +758,608 @@ Procedure TAvroMainForm1.IdleTimerTimer(Sender: TObject); Var - liInfo: TLastInputInfo; - SecondsIdle: DWord; + liInfo: TLastInputInfo; + SecondsIdle: DWord; Begin - liInfo.cbSize := SizeOf(TLastInputInfo); - GetLastInputInfo(liInfo); - SecondsIdle := (GetTickCount - liInfo.dwTime) Div 1000; - If SecondsIdle > 30 Then - TrimAppMemorySize; + liInfo.cbSize := SizeOf(TLastInputInfo); + GetLastInputInfo(liInfo); + SecondsIdle := (GetTickCount - liInfo.dwTime) Div 1000; + If SecondsIdle > 30 Then + TrimAppMemorySize; End; Function TAvroMainForm1.IgnorableWindow(Const lngHWND: HWND): Boolean; Begin - result := False; - - // System tray - If (lngHWND = FindWindow('Shell_TrayWnd', Nil)) Or (lngHWND = FindWindowEx(FindWindow('Shell_TrayWnd', Nil), 0, 'TrayNotifyWnd', Nil)) Then - result := True - Else If lngHWND = Self.Handle Then - result := True - Else If IsFormLoaded('TopBar') Then Begin - If lngHWND = Topbar.Handle Then - result := True; - End - Else If IsFormLoaded('frmEncodingWarning') Then Begin - If lngHWND = frmEncodingWarning.Handle Then - result := True; - End - // Photoshop drag window exception - Else If GetWindowClassName(lngHWND) = 'PSDocDragFeedback' Then - result := True; + result := False; + + // System tray + If (lngHWND = FindWindow('Shell_TrayWnd', Nil)) Or + (lngHWND = FindWindowEx(FindWindow('Shell_TrayWnd', Nil), 0, + 'TrayNotifyWnd', Nil)) Then + result := True + Else If lngHWND = Self.Handle Then + result := True + Else If IsFormLoaded('TopBar') Then + Begin + If lngHWND = Topbar.Handle Then + result := True; + End + Else If IsFormLoaded('frmEncodingWarning') Then + Begin + If lngHWND = frmEncodingWarning.Handle Then + result := True; + End + // Photoshop drag window exception + Else If GetWindowClassName(lngHWND) = 'PSDocDragFeedback' Then + result := True; End; {$HINTS ON} - { =============================================================================== } Procedure TAvroMainForm1.Initmenu; Var - I, J: Integer; - TempMenu1, TempMenu2, TempMenu3: TMenuItemExtended; - sCaption: String; - ItemFound: Boolean; -Begin - For I := KeyboardLayouts.Count - 1 Downto 0 Do Begin - - - sCaption := RemoveExtension(KeyboardLayouts[I]); - - - /// //// - ItemFound := False; - For J := 0 To Selectkeyboardlayout1.Count - 1 Do Begin - If Selectkeyboardlayout1.Items[J].Tag = 9903 Then - If Lowercase((Selectkeyboardlayout1.Items[J] As TMenuItemExtended).Value) = Lowercase(sCaption) Then - ItemFound := True; - End; - If Not(ItemFound) Then Begin - TempMenu1 := TMenuItemExtended.Create(Popup_Tray); - TempMenu1.Caption := sCaption; - TempMenu1.Value := sCaption; - TempMenu1.RadioItem := True; - TempMenu1.Tag := 9903; - TempMenu1.OnClick := MenuFixedLayoutClick; - Selectkeyboardlayout2.Insert(AvroPhoneticEnglishtoBangla3.MenuIndex + 1, TempMenu1); - End; - - - /// /// - ItemFound := False; - For J := 0 To Selectkeyboardlayout1.Count - 1 Do Begin - If Selectkeyboardlayout1.Items[J].Tag = 9903 Then - If Lowercase((Selectkeyboardlayout1.Items[J] As TMenuItemExtended).Value) = Lowercase(sCaption) Then - ItemFound := True; - End; - If Not(ItemFound) Then Begin - TempMenu2 := TMenuItemExtended.Create(Popup_Main); - TempMenu2.Caption := sCaption; - TempMenu2.Value := sCaption; - TempMenu2.RadioItem := True; - TempMenu2.Tag := 9903; - TempMenu2.OnClick := MenuFixedLayoutClick; - Selectkeyboardlayout1.Insert(AvroPhoneticEnglishtoBangla2.MenuIndex + 1, TempMenu2); - End; - - - /// //// - ItemFound := False; - For J := 0 To Popup_LayoutList.Items.Count - 1 Do Begin - If Popup_LayoutList.Items.Items[J].Tag = 9903 Then - If Lowercase((Popup_LayoutList.Items.Items[J] As TMenuItemExtended).Value) = Lowercase(sCaption) Then - ItemFound := True; - End; - If Not(ItemFound) Then Begin - TempMenu3 := TMenuItemExtended.Create(Popup_LayoutList); - TempMenu3.Caption := sCaption; - TempMenu3.Value := sCaption; - TempMenu3.RadioItem := True; - TempMenu3.Tag := 9903; - TempMenu3.OnClick := MenuFixedLayoutClick; - Popup_LayoutList.Items.Insert(AvroPhoneticEnglishtoBangla1.MenuIndex + 1, TempMenu3); - End; - End; + I, J: Integer; + TempMenu1, TempMenu2, TempMenu3: TMenuItemExtended; + sCaption: String; + ItemFound: Boolean; +Begin + For I := KeyboardLayouts.Count - 1 Downto 0 Do + Begin + + sCaption := RemoveExtension(KeyboardLayouts[I]); + + /// //// + ItemFound := False; + For J := 0 To Selectkeyboardlayout1.Count - 1 Do + Begin + If Selectkeyboardlayout1.Items[J].Tag = 9903 Then + If Lowercase((Selectkeyboardlayout1.Items[J] As TMenuItemExtended) + .Value) = Lowercase(sCaption) Then + ItemFound := True; + End; + If Not(ItemFound) Then + Begin + TempMenu1 := TMenuItemExtended.Create(Popup_Tray); + TempMenu1.Caption := sCaption; + TempMenu1.Value := sCaption; + TempMenu1.RadioItem := True; + TempMenu1.Tag := 9903; + TempMenu1.OnClick := MenuFixedLayoutClick; + Selectkeyboardlayout2.Insert(AvroPhoneticEnglishtoBangla3.MenuIndex + 1, + TempMenu1); + End; + + /// /// + ItemFound := False; + For J := 0 To Selectkeyboardlayout1.Count - 1 Do + Begin + If Selectkeyboardlayout1.Items[J].Tag = 9903 Then + If Lowercase((Selectkeyboardlayout1.Items[J] As TMenuItemExtended) + .Value) = Lowercase(sCaption) Then + ItemFound := True; + End; + If Not(ItemFound) Then + Begin + TempMenu2 := TMenuItemExtended.Create(Popup_Main); + TempMenu2.Caption := sCaption; + TempMenu2.Value := sCaption; + TempMenu2.RadioItem := True; + TempMenu2.Tag := 9903; + TempMenu2.OnClick := MenuFixedLayoutClick; + Selectkeyboardlayout1.Insert(AvroPhoneticEnglishtoBangla2.MenuIndex + 1, + TempMenu2); + End; + + /// //// + ItemFound := False; + For J := 0 To Popup_LayoutList.Items.Count - 1 Do + Begin + If Popup_LayoutList.Items.Items[J].Tag = 9903 Then + If Lowercase((Popup_LayoutList.Items.Items[J] As TMenuItemExtended) + .Value) = Lowercase(sCaption) Then + ItemFound := True; + End; + If Not(ItemFound) Then + Begin + TempMenu3 := TMenuItemExtended.Create(Popup_LayoutList); + TempMenu3.Caption := sCaption; + TempMenu3.Value := sCaption; + TempMenu3.RadioItem := True; + TempMenu3.Tag := 9903; + TempMenu3.OnClick := MenuFixedLayoutClick; + Popup_LayoutList.Items.Insert(AvroPhoneticEnglishtoBangla1.MenuIndex + 1, + TempMenu3); + End; + End; End; {$HINTS Off} Procedure TAvroMainForm1.InternetCheckTimer(Sender: TObject); Var - HowMayDay: Integer; + HowMayDay: Integer; Begin - HowMayDay := 0; - If AvroUpdateCheck <> 'YES' Then - exit; + HowMayDay := 0; + If AvroUpdateCheck <> 'YES' Then + exit; - Try - HowMayDay := DaysBetween(Now, AvroUpdateLastCheck); - Except - HowMayDay := 7; - End; + Try + HowMayDay := DaysBetween(Now, AvroUpdateLastCheck); + Except + HowMayDay := 7; + End; - If HowMayDay >= 7 Then Begin - If Updater.IsConnected = False Then - exit; + If HowMayDay >= 7 Then + Begin + If Updater.IsConnected = False Then + exit; - Updater.CheckSilent; - AvroUpdateLastCheck := Now; - End; + Updater.CheckSilent; + AvroUpdateLastCheck := Now; + End; End; {$HINTS On} Procedure TAvroMainForm1.Jumptosystemtray1Click(Sender: TObject); Begin - If Topbar.Visible = True Then Begin - Topbar.Hide; - ShowOnTray; - End; + If Topbar.Visible = True Then + Begin + Topbar.Hide; + ShowOnTray; + End; End; -Procedure TAvroMainForm1.KeyboardLayoutEditorBuildcustomlayouts1Click(Sender: TObject); +Procedure TAvroMainForm1.KeyboardLayoutEditorBuildcustomlayouts1Click + (Sender: TObject); Begin - Execute_Something(ExtractFilePath(Application.ExeName) + 'Layout Editor.exe'); + Execute_Something(ExtractFilePath(Application.ExeName) + 'Layout Editor.exe'); End; -Procedure TAvroMainForm1.KeyLayout_KeyboardLayoutChanged(CurrentKeyboardLayout: String); +Procedure TAvroMainForm1.KeyLayout_KeyboardLayoutChanged + (CurrentKeyboardLayout: String); Var - I: Integer; -Begin - If Lowercase(CurrentKeyboardLayout) = 'avrophonetic*' Then Begin - AvroPhoneticEnglishtoBangla3.Checked := True; - AvroPhoneticEnglishtoBangla2.Checked := True; - AvroPhoneticEnglishtoBangla1.Checked := True; - - End - Else Begin - For I := 0 To Selectkeyboardlayout2.Count - 1 Do Begin - If Selectkeyboardlayout2.Items[I].Tag = 9903 Then - If Lowercase((Selectkeyboardlayout2.Items[I] As TMenuItemExtended).Value) = Lowercase(CurrentKeyboardLayout) Then - Selectkeyboardlayout2.Items[I].Checked := True; - End; - - - For I := 0 To Selectkeyboardlayout1.Count - 1 Do Begin - If Selectkeyboardlayout1.Items[I].Tag = 9903 Then - If Lowercase((Selectkeyboardlayout1.Items[I] As TMenuItemExtended).Value) = Lowercase(CurrentKeyboardLayout) Then - Selectkeyboardlayout1.Items[I].Checked := True; - End; - - For I := 0 To Popup_LayoutList.Items.Count - 1 Do Begin - If Popup_LayoutList.Items[I].Tag = 9903 Then - If Lowercase((Popup_LayoutList.Items[I] As TMenuItemExtended).Value) = Lowercase(CurrentKeyboardLayout) Then - Popup_LayoutList.Items[I].Checked := True; - End; - - End; - MyCurrentLayout := CurrentKeyboardLayout; - If IsFormLoaded('LayoutViewer') Then - LayoutViewer.UpdateLayout; - DefaultLayout := CurrentKeyboardLayout; - - - RefreshSettings; + I: Integer; +Begin + If Lowercase(CurrentKeyboardLayout) = 'avrophonetic*' Then + Begin + AvroPhoneticEnglishtoBangla3.Checked := True; + AvroPhoneticEnglishtoBangla2.Checked := True; + AvroPhoneticEnglishtoBangla1.Checked := True; + + End + Else + Begin + For I := 0 To Selectkeyboardlayout2.Count - 1 Do + Begin + If Selectkeyboardlayout2.Items[I].Tag = 9903 Then + If Lowercase((Selectkeyboardlayout2.Items[I] As TMenuItemExtended) + .Value) = Lowercase(CurrentKeyboardLayout) Then + Selectkeyboardlayout2.Items[I].Checked := True; + End; + + For I := 0 To Selectkeyboardlayout1.Count - 1 Do + Begin + If Selectkeyboardlayout1.Items[I].Tag = 9903 Then + If Lowercase((Selectkeyboardlayout1.Items[I] As TMenuItemExtended) + .Value) = Lowercase(CurrentKeyboardLayout) Then + Selectkeyboardlayout1.Items[I].Checked := True; + End; + + For I := 0 To Popup_LayoutList.Items.Count - 1 Do + Begin + If Popup_LayoutList.Items[I].Tag = 9903 Then + If Lowercase((Popup_LayoutList.Items[I] As TMenuItemExtended).Value) + = Lowercase(CurrentKeyboardLayout) Then + Popup_LayoutList.Items[I].Checked := True; + End; + + End; + MyCurrentLayout := CurrentKeyboardLayout; + If IsFormLoaded('LayoutViewer') Then + LayoutViewer.UpdateLayout; + DefaultLayout := CurrentKeyboardLayout; + + RefreshSettings; End; Procedure TAvroMainForm1.KeyLayout_KeyboardModeChanged(CurrentMode: enumMode); Var - hforewnd: Integer; - ICN: TIcon; - Locale: Cardinal; - ParentHwnd: HWND; - WindowRecord, ParenWindowRecord, NewWindowRecord: TWindowRecord; -Begin - { This is for Top Bar, when Keyboard Mode is changed, - it removes transparency } - If CurrentMode <> MyCurrentKeyboardMode Then - KeyboardModeChanged := True; - hforewnd := GetForegroundWindow; - - If hforewnd = 0 Then - exit; - { Experimental use } - If IsWindow(hforewnd) = False Then - exit; - - If IgnorableWindow(hforewnd) Then Begin - hforewnd := LastWindow; - End; - - - - If Not WindowDict.TryGetValue(hforewnd, WindowRecord) Then Begin - - { This is a new window, so add it in Window collection - update/add process information } - - { Get locale information - The new window may be a messagebox, then if the parent window is in the list, - get its recorded locale } - ParentHwnd := GetParent(hforewnd); - - If ParentHwnd <> 0 Then Begin - If WindowDict.TryGetValue(ParentHwnd, ParenWindowRecord) Then Begin - Locale := ParenWindowRecord.Locale; - End - Else - Locale := GetForeignLocale(hforewnd); - End - Else - Locale := GetForeignLocale(hforewnd); - - If CurrentMode = bangla Then Begin - If (ChangeInputLocale = 'YES') Then - If OutputIsBijoy <> 'YES' Then - ChangeLocaleToBangla(hforewnd) - Else - ChangeLocaleToEnglish(hforewnd); - - NewWindowRecord.Locale := Locale; - NewWindowRecord.Mode := 'B'; - WindowDict.AddOrSetValue(hforewnd, NewWindowRecord); - MyCurrentKeyboardMode := bangla; - End - Else If CurrentMode = SysDefault Then Begin - - If WindowDict.ContainsKey(ParentHwnd) Then - If ChangeInputLocale = 'YES' Then - ChangeLocalToAny(hforewnd, Locale); - - NewWindowRecord.Locale := Locale; - NewWindowRecord.Mode := 'S'; - WindowDict.AddOrSetValue(hforewnd, NewWindowRecord); - - MyCurrentKeyboardMode := SysDefault; - End; - End - Else Begin - // The window already exist, so update information - If CurrentMode = bangla Then Begin - // sLocale := GetForeignLocale(hforewnd); - NewWindowRecord.Locale := WindowRecord.Locale; - NewWindowRecord.Mode := 'B'; - WindowDict.AddOrSetValue(hforewnd, NewWindowRecord); - - MyCurrentKeyboardMode := bangla; - If ChangeInputLocale = 'YES' Then - If OutputIsBijoy <> 'YES' Then - ChangeLocaleToBangla(hforewnd) - Else - ChangeLocaleToEnglish(hforewnd); - End - Else If CurrentMode = SysDefault Then Begin - NewWindowRecord.Locale := WindowRecord.Locale; - NewWindowRecord.Mode := 'S'; - WindowDict.AddOrSetValue(hforewnd, NewWindowRecord); - - MyCurrentKeyboardMode := SysDefault; - If ChangeInputLocale = 'YES' Then - ChangeLocalToAny(hforewnd, NewWindowRecord.Locale); - - { Experimental!!!!!!!! } - { We have changed the locale back in System Language Mode - now delete Window Data to record new locale info } - WindowDict.Remove(hforewnd); - End; - End; - - - { Update User inteface } - If IsFormVisible('TopBar') = False Then Begin - // now icon mode, so update system tray - ICN := TIcon.Create; - If CurrentMode = bangla Then Begin - If IsWin2000 = True Then - ImageList1.GetIcon(14, ICN) - Else - ImageList1.GetIcon(20, ICN); - - Tray.Hint := 'Avro Keyboard.' + #13 + 'Running Bangla Keyboard Mode.' + #13 + 'Press ' + ModeSwitchKey + ' to switch to System default.'; - End - Else If CurrentMode = SysDefault Then Begin - If IsWin2000 = True Then - ImageList1.GetIcon(19, ICN) - Else - ImageList1.GetIcon(21, ICN); - - Tray.Hint := 'Avro Keyboard.' + #13 + 'Running System default Keyboard Mode.' + #13 + 'Press ' + ModeSwitchKey + ' to switch to Bangla.'; - End; - Tray.Icon := ICN; - ICN.Free; - End - Else Begin - // Top Bar displayed, so update it - If CurrentMode = bangla Then - Topbar.SetButtonModeState(State2) - Else If CurrentMode = SysDefault Then - Topbar.SetButtonModeState(State1); - End; - - + hforewnd: Integer; + ICN: TIcon; + Locale: Cardinal; + ParentHwnd: HWND; + WindowRecord, ParenWindowRecord, NewWindowRecord: TWindowRecord; +Begin + { This is for Top Bar, when Keyboard Mode is changed, + it removes transparency } + If CurrentMode <> MyCurrentKeyboardMode Then + KeyboardModeChanged := True; + hforewnd := GetForegroundWindow; + + If hforewnd = 0 Then + exit; + { Experimental use } + If IsWindow(hforewnd) = False Then + exit; + + If IgnorableWindow(hforewnd) Then + Begin + hforewnd := LastWindow; + End; + + If Not WindowDict.TryGetValue(hforewnd, WindowRecord) Then + Begin + + { This is a new window, so add it in Window collection + update/add process information } + + { Get locale information + The new window may be a messagebox, then if the parent window is in the list, + get its recorded locale } + ParentHwnd := GetParent(hforewnd); + + If ParentHwnd <> 0 Then + Begin + If WindowDict.TryGetValue(ParentHwnd, ParenWindowRecord) Then + Begin + Locale := ParenWindowRecord.Locale; + End + Else + Locale := GetForeignLocale(hforewnd); + End + Else + Locale := GetForeignLocale(hforewnd); + + If CurrentMode = bangla Then + Begin + If (ChangeInputLocale = 'YES') Then + If OutputIsBijoy <> 'YES' Then + ChangeLocaleToBangla(hforewnd) + Else + ChangeLocaleToEnglish(hforewnd); + + NewWindowRecord.Locale := Locale; + NewWindowRecord.Mode := 'B'; + WindowDict.AddOrSetValue(hforewnd, NewWindowRecord); + MyCurrentKeyboardMode := bangla; + End + Else If CurrentMode = SysDefault Then + Begin + + If WindowDict.ContainsKey(ParentHwnd) Then + If ChangeInputLocale = 'YES' Then + ChangeLocalToAny(hforewnd, Locale); + + NewWindowRecord.Locale := Locale; + NewWindowRecord.Mode := 'S'; + WindowDict.AddOrSetValue(hforewnd, NewWindowRecord); + + MyCurrentKeyboardMode := SysDefault; + End; + End + Else + Begin + // The window already exist, so update information + If CurrentMode = bangla Then + Begin + // sLocale := GetForeignLocale(hforewnd); + NewWindowRecord.Locale := WindowRecord.Locale; + NewWindowRecord.Mode := 'B'; + WindowDict.AddOrSetValue(hforewnd, NewWindowRecord); + + MyCurrentKeyboardMode := bangla; + If ChangeInputLocale = 'YES' Then + If OutputIsBijoy <> 'YES' Then + ChangeLocaleToBangla(hforewnd) + Else + ChangeLocaleToEnglish(hforewnd); + End + Else If CurrentMode = SysDefault Then + Begin + NewWindowRecord.Locale := WindowRecord.Locale; + NewWindowRecord.Mode := 'S'; + WindowDict.AddOrSetValue(hforewnd, NewWindowRecord); + + MyCurrentKeyboardMode := SysDefault; + If ChangeInputLocale = 'YES' Then + ChangeLocalToAny(hforewnd, NewWindowRecord.Locale); + + { Experimental!!!!!!!! } + { We have changed the locale back in System Language Mode + now delete Window Data to record new locale info } + WindowDict.Remove(hforewnd); + End; + End; + + { Update User inteface } + If IsFormVisible('TopBar') = False Then + Begin + // now icon mode, so update system tray + ICN := TIcon.Create; + If CurrentMode = bangla Then + Begin + If IsWin2000 = True Then + ImageList1.GetIcon(14, ICN) + Else + ImageList1.GetIcon(20, ICN); + + Tray.Hint := 'Avro Keyboard.' + #13 + 'Running Bangla Keyboard Mode.' + + #13 + 'Press ' + ModeSwitchKey + ' to switch to System default.'; + End + Else If CurrentMode = SysDefault Then + Begin + If IsWin2000 = True Then + ImageList1.GetIcon(19, ICN) + Else + ImageList1.GetIcon(21, ICN); + + Tray.Hint := 'Avro Keyboard.' + #13 + + 'Running System default Keyboard Mode.' + #13 + 'Press ' + ModeSwitchKey + + ' to switch to Bangla.'; + End; + Tray.Icon := ICN; + ICN.Free; + End + Else + Begin + // Top Bar displayed, so update it + If CurrentMode = bangla Then + Topbar.SetButtonModeState(State2) + Else If CurrentMode = SysDefault Then + Topbar.SetButtonModeState(State1); + End; End; Procedure TAvroMainForm1.LoadApp; Var - tempLastUIMode: String; -Begin - InstallLocale; - Set_Process_Priority(HIGH_PRIORITY_CLASS); - - InitDict; - LoadKeyboardLayoutNames; - Initmenu; - - Updater := TUpdateCheck.Create; - WindowDict := TDictionary.Create; - WindowCheck.Enabled := True; - - Topbar := TTopBar.Create(Application); - Topbar.ApplicationClosing := False; - - { To solve focus loosing - problem of Preview window } - frmPrevW := TfrmPrevW.Create(Application); - - tempLastUIMode := LastUIMode; - KeyLayout := TLayout.Create; - KeyLayout.OnKeyboardLayoutChanged := KeyLayout_KeyboardLayoutChanged; - KeyLayout.OnKeyboardModeChanged := KeyLayout_KeyboardModeChanged; - KeyLayout.CurrentKeyboardLayout := DefaultLayout; - LastUIMode := tempLastUIMode; - - If DefaultUIMode = 'TOP BAR' Then Begin - Topbar.Visible := True; - Tray.Visible := False; - End - Else If DefaultUIMode = 'ICON' Then Begin - Topbar.Hide; - ShowOnTray; - End - Else If DefaultUIMode = 'LASTUI' Then Begin - If LastUIMode = 'TOP BAR' Then Begin - Topbar.Visible := True; - Tray.Visible := False; - End - Else If LastUIMode = 'ICON' Then Begin - Topbar.Hide; - ShowOnTray; - End - Else Begin - Topbar.Visible := True; - Tray.Visible := False; - End; - End - Else Begin - Topbar.Visible := True; - Tray.Visible := False; - End; - - {$IFDEF PortableOn} - - InstallVirtualFont(ExtractFilePath(Application.ExeName) + 'Virtual Font\Siyamrupali.ttf'); - - {$ENDIF} - - If AvroUpdateCheck = 'YES' Then - InternetCheck.Enabled := True - Else - InternetCheck.Enabled := False; - - If (ShowOutputwarning <> 'NO') And (OutputIsBijoy = 'YES') Then Begin - CheckCreateForm(TfrmEncodingWarning, frmEncodingWarning, 'frmEncodingWarning'); - frmEncodingWarning.ShowModal; - RefreshSettings; - End; - - Application.ProcessMessages; - If ShowSplash = 'YES' Then Begin - frmSplash := TfrmSplash.Create(Application); - frmSplash.Show; - End; + tempLastUIMode: String; +Begin + InstallLocale; + Set_Process_Priority(HIGH_PRIORITY_CLASS); + + InitDict; + LoadKeyboardLayoutNames; + Initmenu; + + Updater := TUpdateCheck.Create; + WindowDict := TDictionary.Create; + WindowCheck.Enabled := True; + + Topbar := TTopBar.Create(Application); + Topbar.ApplicationClosing := False; + + { To solve focus loosing + problem of Preview window } + frmPrevW := TfrmPrevW.Create(Application); + + tempLastUIMode := LastUIMode; + KeyLayout := TLayout.Create; + KeyLayout.OnKeyboardLayoutChanged := KeyLayout_KeyboardLayoutChanged; + KeyLayout.OnKeyboardModeChanged := KeyLayout_KeyboardModeChanged; + KeyLayout.CurrentKeyboardLayout := DefaultLayout; + LastUIMode := tempLastUIMode; + + If DefaultUIMode = 'TOP BAR' Then + Begin + Topbar.Visible := True; + Tray.Visible := False; + End + Else If DefaultUIMode = 'ICON' Then + Begin + Topbar.Hide; + ShowOnTray; + End + Else If DefaultUIMode = 'LASTUI' Then + Begin + If LastUIMode = 'TOP BAR' Then + Begin + Topbar.Visible := True; + Tray.Visible := False; + End + Else If LastUIMode = 'ICON' Then + Begin + Topbar.Hide; + ShowOnTray; + End + Else + Begin + Topbar.Visible := True; + Tray.Visible := False; + End; + End + Else + Begin + Topbar.Visible := True; + Tray.Visible := False; + End; + +{$IFDEF PortableOn} + InstallVirtualFont(ExtractFilePath(Application.ExeName) + + 'Virtual Font\Siyamrupali.ttf'); + +{$ENDIF} + If AvroUpdateCheck = 'YES' Then + InternetCheck.Enabled := True + Else + InternetCheck.Enabled := False; + + If (ShowOutputwarning <> 'NO') And (OutputIsBijoy = 'YES') Then + Begin + CheckCreateForm(TfrmEncodingWarning, frmEncodingWarning, + 'frmEncodingWarning'); + frmEncodingWarning.ShowModal; + RefreshSettings; + End; + + Application.ProcessMessages; + If ShowSplash = 'YES' Then + Begin + frmSplash := TfrmSplash.Create(Application); + frmSplash.Show; + End; End; Procedure TAvroMainForm1.ManageAutoCorrectentries1Click(Sender: TObject); Begin - CheckCreateForm(TfrmAutoCorrect, frmAutoCorrect, 'frmAutoCorrect'); - frmAutoCorrect.Show; + CheckCreateForm(TfrmAutoCorrect, frmAutoCorrect, 'frmAutoCorrect'); + frmAutoCorrect.Show; End; Procedure TAvroMainForm1.MenuFixedLayoutClick(Sender: TObject); Begin - KeyLayout.CurrentKeyboardLayout := (Sender As TMenuItemExtended).Value; + KeyLayout.CurrentKeyboardLayout := (Sender As TMenuItemExtended).Value; End; Procedure TAvroMainForm1.Moredocumentsontheweb1Click(Sender: TObject); Begin - Execute_Something('http://www.omicronlab.com/go.php?id=12'); + Execute_Something('http://www.omicronlab.com/go.php?id=12'); End; - - Procedure TAvroMainForm1.ogglekeyboardmode2Click(Sender: TObject); Begin - KeyLayout.ToggleMode; + KeyLayout.ToggleMode; End; { =============================================================================== } Procedure TAvroMainForm1.OmicronLabonTwitter1Click(Sender: TObject); Begin - Execute_Something('http://www.omicronlab.com/go.php?id=40'); + Execute_Something('http://www.omicronlab.com/go.php?id=40'); End; { =============================================================================== } Procedure TAvroMainForm1.OpenHelpFile(Const HelpID: Integer); Begin - Case HelpID Of - 23: - If FileExists(ExtractFilePath(Application.ExeName) + 'Before You Start.pdf') Then - Execute_Something(ExtractFilePath(Application.ExeName) + 'Before You Start.pdf') - Else - Execute_Something('http://www.omicronlab.com/go.php?id=' + IntToStr(HelpID)); - - 24: - If FileExists(ExtractFilePath(Application.ExeName) + 'Overview.pdf') Then - Execute_Something(ExtractFilePath(Application.ExeName) + 'Overview.pdf') - Else - Execute_Something('http://www.omicronlab.com/go.php?id=' + IntToStr(HelpID)); - - 25: - If FileExists(ExtractFilePath(Application.ExeName) + 'Customizing Avro Keyboard.pdf') Then - Execute_Something(ExtractFilePath(Application.ExeName) + 'Customizing Avro Keyboard.pdf') - Else - Execute_Something('http://www.omicronlab.com/go.php?id=' + IntToStr(HelpID)); - - 26: - If FileExists(ExtractFilePath(Application.ExeName) + 'Bangla Typing with Avro Phonetic.pdf') Then - Execute_Something(ExtractFilePath(Application.ExeName) + 'Bangla Typing with Avro Phonetic.pdf') - Else - Execute_Something('http://www.omicronlab.com/go.php?id=' + IntToStr(HelpID)); - - 27: - If FileExists(ExtractFilePath(Application.ExeName) + 'Bangla Typing with Fixed Keyboard Layouts.pdf') Then - Execute_Something(ExtractFilePath(Application.ExeName) + 'Bangla Typing with Fixed Keyboard Layouts.pdf') - Else - Execute_Something('http://www.omicronlab.com/go.php?id=' + IntToStr(HelpID)); - - 28: - If FileExists(ExtractFilePath(Application.ExeName) + 'Bangla Typing with Avro Mouse.pdf') Then - Execute_Something(ExtractFilePath(Application.ExeName) + 'Bangla Typing with Avro Mouse.pdf') - Else - Execute_Something('http://www.omicronlab.com/go.php?id=' + IntToStr(HelpID)); - - 29: - If FileExists(ExtractFilePath(Application.ExeName) + 'faq.pdf') Then - Execute_Something(ExtractFilePath(Application.ExeName) + 'faq.pdf') - Else - Execute_Something('http://www.omicronlab.com/go.php?id=' + IntToStr(HelpID)); - - 35: - If FileExists(ExtractFilePath(Application.ExeName) + 'Editing Keyboard Layout.pdf') Then - Execute_Something(ExtractFilePath(Application.ExeName) + 'Editing Keyboard Layout.pdf') - Else - Execute_Something('http://www.omicronlab.com/go.php?id=' + IntToStr(HelpID)); - End; + Case HelpID Of + 23: + If FileExists(ExtractFilePath(Application.ExeName) + + 'Before You Start.pdf') Then + Execute_Something(ExtractFilePath(Application.ExeName) + + 'Before You Start.pdf') + Else + Execute_Something('http://www.omicronlab.com/go.php?id=' + + IntToStr(HelpID)); + + 24: + If FileExists(ExtractFilePath(Application.ExeName) + 'Overview.pdf') Then + Execute_Something(ExtractFilePath(Application.ExeName) + 'Overview.pdf') + Else + Execute_Something('http://www.omicronlab.com/go.php?id=' + + IntToStr(HelpID)); + + 25: + If FileExists(ExtractFilePath(Application.ExeName) + + 'Customizing Avro Keyboard.pdf') Then + Execute_Something(ExtractFilePath(Application.ExeName) + + 'Customizing Avro Keyboard.pdf') + Else + Execute_Something('http://www.omicronlab.com/go.php?id=' + + IntToStr(HelpID)); + + 26: + If FileExists(ExtractFilePath(Application.ExeName) + + 'Bangla Typing with Avro Phonetic.pdf') Then + Execute_Something(ExtractFilePath(Application.ExeName) + + 'Bangla Typing with Avro Phonetic.pdf') + Else + Execute_Something('http://www.omicronlab.com/go.php?id=' + + IntToStr(HelpID)); + + 27: + If FileExists(ExtractFilePath(Application.ExeName) + + 'Bangla Typing with Fixed Keyboard Layouts.pdf') Then + Execute_Something(ExtractFilePath(Application.ExeName) + + 'Bangla Typing with Fixed Keyboard Layouts.pdf') + Else + Execute_Something('http://www.omicronlab.com/go.php?id=' + + IntToStr(HelpID)); + + 28: + If FileExists(ExtractFilePath(Application.ExeName) + + 'Bangla Typing with Avro Mouse.pdf') Then + Execute_Something(ExtractFilePath(Application.ExeName) + + 'Bangla Typing with Avro Mouse.pdf') + Else + Execute_Something('http://www.omicronlab.com/go.php?id=' + + IntToStr(HelpID)); + + 29: + If FileExists(ExtractFilePath(Application.ExeName) + 'faq.pdf') Then + Execute_Something(ExtractFilePath(Application.ExeName) + 'faq.pdf') + Else + Execute_Something('http://www.omicronlab.com/go.php?id=' + + IntToStr(HelpID)); + + 35: + If FileExists(ExtractFilePath(Application.ExeName) + + 'Editing Keyboard Layout.pdf') Then + Execute_Something(ExtractFilePath(Application.ExeName) + + 'Editing Keyboard Layout.pdf') + Else + Execute_Something('http://www.omicronlab.com/go.php?id=' + + IntToStr(HelpID)); + End; End; Procedure TAvroMainForm1.Options1Click(Sender: TObject); Begin - CheckCreateForm(TfrmOptions, frmOptions, 'frmOptions'); - frmOptions.Show; + CheckCreateForm(TfrmOptions, frmOptions, 'frmOptions'); + frmOptions.Show; End; -Procedure TAvroMainForm1.OTFBanglaFontscamewithAvroKeyboard1Click(Sender: TObject); +Procedure TAvroMainForm1.OTFBanglaFontscamewithAvroKeyboard1Click + (Sender: TObject); Begin - Execute_Something(ExtractFilePath(Application.ExeName) + 'open_type_font_list.htm'); + Execute_Something(ExtractFilePath(Application.ExeName) + + 'open_type_font_list.htm'); End; Procedure TAvroMainForm1.OutputasANSIAreyousure1Click(Sender: TObject); Begin - If ShowOutputwarning <> 'NO' Then Begin - CheckCreateForm(TfrmEncodingWarning, frmEncodingWarning, 'frmEncodingWarning'); - frmEncodingWarning.Show; - End - Else - OutputIsBijoy := 'YES'; + If ShowOutputwarning <> 'NO' Then + Begin + CheckCreateForm(TfrmEncodingWarning, frmEncodingWarning, + 'frmEncodingWarning'); + frmEncodingWarning.Show; + End + Else + OutputIsBijoy := 'YES'; - RefreshSettings; + RefreshSettings; - If MyCurrentKeyboardMode = bangla Then - If ChangeInputLocale = 'YES' Then - If OutputIsBijoy = 'YES' Then - ChangeLocaleToEnglish(LastWindow); + If MyCurrentKeyboardMode = bangla Then + If ChangeInputLocale = 'YES' Then + If OutputIsBijoy = 'YES' Then + ChangeLocaleToEnglish(LastWindow); End; Procedure TAvroMainForm1.OutputasUnicodeRecommended1Click(Sender: TObject); Begin - OutputIsBijoy := 'NO'; - RefreshSettings; + OutputIsBijoy := 'NO'; + RefreshSettings; - If MyCurrentKeyboardMode = bangla Then - If ChangeInputLocale = 'YES' Then - If OutputIsBijoy = 'NO' Then - ChangeLocaleToBangla(LastWindow); + If MyCurrentKeyboardMode = bangla Then + If ChangeInputLocale = 'YES' Then + If OutputIsBijoy = 'NO' Then + ChangeLocaleToBangla(LastWindow); End; Procedure TAvroMainForm1.Overview1Click(Sender: TObject); Begin - OpenHelpFile(24); + OpenHelpFile(24); End; { =============================================================================== } Procedure TAvroMainForm1.PortableAvroKeyboardontheweb1Click(Sender: TObject); Begin - Execute_Something('http://www.omicronlab.com/go.php?id=22'); + Execute_Something('http://www.omicronlab.com/go.php?id=22'); End; { =============================================================================== } @@ -1307,696 +1367,728 @@ Procedure TAvroMainForm1.RefreshSettings; Begin - // Update Spell Checker Shortcut in Menu - Spellcheck1.ShortCut := TextToShortcut('Ctrl+' + SpellerLauncherKey); - Spellcheck2.ShortCut := TextToShortcut('Ctrl+' + SpellerLauncherKey); - Spellcheck3.ShortCut := TextToShortcut('Ctrl+' + SpellerLauncherKey); - - If VowelFormating = 'NO' Then Begin - AutomaticVowelFormatingInModernTypingStyle1.Checked := False; - AutomaticVowelFormatingInModernTypingStyle2.Checked := False; - End - Else Begin - AutomaticVowelFormatingInModernTypingStyle1.Checked := True; - AutomaticVowelFormatingInModernTypingStyle2.Checked := True; - End; - - If OldStyleReph = 'NO' Then Begin - EnableOldStyleRephInModernTypingStyle1.Checked := False; - EnableOldStyleRephInModernTypingStyle2.Checked := False; - End - Else Begin - EnableOldStyleRephInModernTypingStyle1.Checked := True; - EnableOldStyleRephInModernTypingStyle2.Checked := True; - End; - - If NumPadBangla = 'NO' Then Begin - EnableBanglainNumberPadInFixedkeyboardLayouts1.Checked := False; - EnableBanglainNumberPadInFixedkeyboardLayouts2.Checked := False; - End - Else Begin - EnableBanglainNumberPadInFixedkeyboardLayouts1.Checked := True; - EnableBanglainNumberPadInFixedkeyboardLayouts2.Checked := True; - End; - - If ShowPrevWindow = 'YES' Then Begin - ShowPreviewWindow1.Checked := True; - ShowPreviewWindow2.Checked := True; - - Dictionarymodeisdefault1.Enabled := True; - Dictionarymodeisdefault2.Enabled := True; - Charactermodeisdefault1.Enabled := True; - Charactermodeisdefault2.Enabled := True; - Classicphoneticnohint1.Enabled := True; - Classicphoneticnohint2.Enabled := True; - UseTabforBrowsingSuggestions1.Enabled := True; - UseTabforbrowsingsuggestions2.Enabled := True; - Remembermychoiceamongsuggestions1.Enabled := True; - Remembermychoiceamongsuggestions2.Enabled := True; - End - Else Begin - ShowPreviewWindow1.Checked := False; - ShowPreviewWindow2.Checked := False; - - Dictionarymodeisdefault1.Enabled := False; - Dictionarymodeisdefault2.Enabled := False; - Charactermodeisdefault1.Enabled := False; - Charactermodeisdefault2.Enabled := False; - Classicphoneticnohint1.Enabled := False; - Classicphoneticnohint2.Enabled := False; - UseTabforBrowsingSuggestions1.Enabled := False; - UseTabforbrowsingsuggestions2.Enabled := False; - Remembermychoiceamongsuggestions1.Enabled := False; - Remembermychoiceamongsuggestions2.Enabled := False; - End; - - - If Lowercase(MyCurrentLayout) = 'avrophonetic*' Then Begin - UseModernStyleTyping1.Enabled := False; - UseModernStyleTyping2.Enabled := False; - UseOldStyleTyping1.Enabled := False; - UseOldStyleTyping2.Enabled := False; - EnableOldStyleRephInModernTypingStyle1.Enabled := False; - EnableOldStyleRephInModernTypingStyle2.Enabled := False; - AutomaticVowelFormatingInModernTypingStyle1.Enabled := False; - AutomaticVowelFormatingInModernTypingStyle2.Enabled := False; - AutomaticallyfixChandrapositionInModernTypingStyle1.Enabled := False; - AutomaticallyfixChandrapositionInModernTypingStyle2.Enabled := False; - EnableBanglainNumberPadInFixedkeyboardLayouts1.Enabled := False; - EnableBanglainNumberPadInFixedkeyboardLayouts2.Enabled := False; - - - ShowPreviewWindow1.Enabled := True; - ShowPreviewWindow2.Enabled := True; - Dictionarymodeisdefault1.Enabled := True; - Dictionarymodeisdefault2.Enabled := True; - Charactermodeisdefault1.Enabled := True; - Charactermodeisdefault2.Enabled := True; - Classicphoneticnohint1.Enabled := True; - Classicphoneticnohint2.Enabled := True; - UseTabforBrowsingSuggestions1.Enabled := True; - UseTabforbrowsingsuggestions2.Enabled := True; - Remembermychoiceamongsuggestions1.Enabled := True; - Remembermychoiceamongsuggestions2.Enabled := True; - UseVerticalLinePipekeytotypeDot1.Enabled := True; - UseVerticalLinePipekeytotypeDot2.Enabled := True; - TypeJoNuktawithShiftJ1.Enabled := True; - TypeJoNuktawithShiftJ2.Enabled := True; - - - - EnableAutoCorrect1.Enabled := True; - EnableAutoCorrect2.Enabled := True; - ManageAutoCorrectentries1.Enabled := True; - ManageAutoCorrectentries2.Enabled := True; - - - If ShowPrevWindow = 'NO' Then - UnloadWordDatabase - Else Begin - If PhoneticMode = 'ONLYCHAR' Then - UnloadWordDatabase - Else - LoadWordDatabase; - End; - End - Else Begin - UseModernStyleTyping1.Enabled := True; - UseModernStyleTyping2.Enabled := True; - UseOldStyleTyping1.Enabled := True; - UseOldStyleTyping2.Enabled := True; - - If FullOldStyleTyping = 'NO' Then Begin - UseOldStyleTyping1.Checked := False; - UseOldStyleTyping2.Checked := False; - UseModernStyleTyping1.Checked := True; - UseModernStyleTyping2.Checked := True; - EnableOldStyleRephInModernTypingStyle1.Enabled := True; - EnableOldStyleRephInModernTypingStyle2.Enabled := True; - AutomaticVowelFormatingInModernTypingStyle1.Enabled := True; - AutomaticVowelFormatingInModernTypingStyle2.Enabled := True; - AutomaticallyfixChandrapositionInModernTypingStyle1.Enabled := True; - AutomaticallyfixChandrapositionInModernTypingStyle2.Enabled := True; - End - Else Begin - UseOldStyleTyping1.Checked := True; - UseOldStyleTyping2.Checked := True; - UseModernStyleTyping1.Checked := False; - UseModernStyleTyping2.Checked := False; - EnableOldStyleRephInModernTypingStyle1.Enabled := False; - EnableOldStyleRephInModernTypingStyle2.Enabled := False; - AutomaticVowelFormatingInModernTypingStyle1.Enabled := False; - AutomaticVowelFormatingInModernTypingStyle2.Enabled := False; - AutomaticallyfixChandrapositionInModernTypingStyle1.Enabled := False; - AutomaticallyfixChandrapositionInModernTypingStyle2.Enabled := False; - End; - - EnableBanglainNumberPadInFixedkeyboardLayouts1.Enabled := True; - EnableBanglainNumberPadInFixedkeyboardLayouts2.Enabled := True; - - ShowPreviewWindow1.Enabled := False; - ShowPreviewWindow2.Enabled := False; - Dictionarymodeisdefault1.Enabled := False; - Dictionarymodeisdefault2.Enabled := False; - Charactermodeisdefault1.Enabled := False; - Charactermodeisdefault2.Enabled := False; - Classicphoneticnohint1.Enabled := False; - Classicphoneticnohint2.Enabled := False; - UseTabforBrowsingSuggestions1.Enabled := False; - UseTabforbrowsingsuggestions2.Enabled := False; - Remembermychoiceamongsuggestions1.Enabled := False; - Remembermychoiceamongsuggestions2.Enabled := False; - UseVerticalLinePipekeytotypeDot1.Enabled := False; - UseVerticalLinePipekeytotypeDot2.Enabled := False; - TypeJoNuktawithShiftJ1.Enabled := False; - TypeJoNuktawithShiftJ2.Enabled := False; - - - EnableAutoCorrect1.Enabled := False; - EnableAutoCorrect2.Enabled := False; - ManageAutoCorrectentries1.Enabled := False; - ManageAutoCorrectentries2.Enabled := False; - - UnloadWordDatabase; - End; - - If PhoneticMode = 'DICT' Then Begin - Dictionarymodeisdefault1.Checked := True; - Dictionarymodeisdefault2.Checked := True; - Charactermodeisdefault1.Checked := False; - Charactermodeisdefault2.Checked := False; - Classicphoneticnohint1.Checked := False; - Classicphoneticnohint2.Checked := False; - End - Else If PhoneticMode = 'CHAR' Then Begin - Dictionarymodeisdefault1.Checked := False; - Dictionarymodeisdefault2.Checked := False; - Charactermodeisdefault1.Checked := True; - Charactermodeisdefault2.Checked := True; - Classicphoneticnohint1.Checked := False; - Classicphoneticnohint2.Checked := False; - End - Else If PhoneticMode = 'ONLYCHAR' Then Begin - Dictionarymodeisdefault1.Checked := False; - Dictionarymodeisdefault2.Checked := False; - Charactermodeisdefault1.Checked := False; - Charactermodeisdefault2.Checked := False; - Classicphoneticnohint1.Checked := True; - Classicphoneticnohint2.Checked := True; - End; - - If SaveCandidate = 'YES' Then Begin - Remembermychoiceamongsuggestions1.Checked := True; - Remembermychoiceamongsuggestions2.Checked := True; - End - Else Begin - Remembermychoiceamongsuggestions1.Checked := False; - Remembermychoiceamongsuggestions2.Checked := False; - End; - - If TabBrowsing = 'YES' Then Begin - UseTabforBrowsingSuggestions1.Checked := True; - UseTabforbrowsingsuggestions2.Checked := True; - End - Else Begin - UseTabforBrowsingSuggestions1.Checked := False; - UseTabforbrowsingsuggestions2.Checked := False; - End; - - If PipeToDot = 'YES' Then Begin - UseVerticalLinePipekeytotypeDot1.Checked := True; - UseVerticalLinePipekeytotypeDot2.Checked := True; - End - Else Begin - UseVerticalLinePipekeytotypeDot1.Checked := False; - UseVerticalLinePipekeytotypeDot2.Checked := False; - End; - - If EnableJoNukta = 'YES' Then Begin - TypeJoNuktawithShiftJ1.Checked := True; - TypeJoNuktawithShiftJ2.Checked := True; - End - Else Begin - TypeJoNuktawithShiftJ1.Checked := False; - TypeJoNuktawithShiftJ2.Checked := False; - End; - - If AutomaticallyFixChandra = 'NO' Then Begin - AutomaticallyfixChandrapositionInModernTypingStyle1.Checked := False; - AutomaticallyfixChandrapositionInModernTypingStyle2.Checked := False; - End - Else Begin - AutomaticallyfixChandrapositionInModernTypingStyle1.Checked := True; - AutomaticallyfixChandrapositionInModernTypingStyle2.Checked := True; - End; - - If IsFormLoaded('LayoutViewer') Then - LayoutViewer.SetMyZOrder; - - If PhoneticAutoCorrect = 'YES' Then Begin - EnableAutoCorrect1.Checked := True; - EnableAutoCorrect2.Checked := True; - KeyLayout.AutoCorrectEnabled := True; - End - Else Begin - EnableAutoCorrect1.Checked := False; - EnableAutoCorrect2.Checked := False; - KeyLayout.AutoCorrectEnabled := False; - End; - - Topbar.ApplySkin; - - If TopBarTransparent = 'YES' Then - Topbar.TransparencyTimer.Enabled := True - Else - Topbar.TransparencyTimer.Enabled := False; - - - If AvroUpdateCheck = 'YES' Then - InternetCheck.Enabled := True - Else - InternetCheck.Enabled := False; - - - If OutputIsBijoy = 'YES' Then Begin - OutputasANSIAreyousure1.Checked := True; - OutputasANSIAreyousure2.Checked := True; - OutputasUnicodeRecommended1.Checked := False; - OutputasUnicodeRecommended2.Checked := False; - End - Else Begin - OutputasUnicodeRecommended1.Checked := True; - OutputasUnicodeRecommended2.Checked := True; - OutputasANSIAreyousure1.Checked := False; - OutputasANSIAreyousure2.Checked := False; - End; - - - SaveUISettings; - - - -End; - -Procedure TAvroMainForm1.Remembermychoiceamongsuggestions1Click(Sender: TObject); -Begin - If SaveCandidate = 'YES' Then - SaveCandidate := 'NO' - Else - SaveCandidate := 'YES'; - - RefreshSettings; + // Update Spell Checker Shortcut in Menu + Spellcheck1.ShortCut := TextToShortcut('Ctrl+' + SpellerLauncherKey); + Spellcheck2.ShortCut := TextToShortcut('Ctrl+' + SpellerLauncherKey); + Spellcheck3.ShortCut := TextToShortcut('Ctrl+' + SpellerLauncherKey); + + If VowelFormating = 'NO' Then + Begin + AutomaticVowelFormatingInModernTypingStyle1.Checked := False; + AutomaticVowelFormatingInModernTypingStyle2.Checked := False; + End + Else + Begin + AutomaticVowelFormatingInModernTypingStyle1.Checked := True; + AutomaticVowelFormatingInModernTypingStyle2.Checked := True; + End; + + If OldStyleReph = 'NO' Then + Begin + EnableOldStyleRephInModernTypingStyle1.Checked := False; + EnableOldStyleRephInModernTypingStyle2.Checked := False; + End + Else + Begin + EnableOldStyleRephInModernTypingStyle1.Checked := True; + EnableOldStyleRephInModernTypingStyle2.Checked := True; + End; + + If NumPadBangla = 'NO' Then + Begin + EnableBanglainNumberPadInFixedkeyboardLayouts1.Checked := False; + EnableBanglainNumberPadInFixedkeyboardLayouts2.Checked := False; + End + Else + Begin + EnableBanglainNumberPadInFixedkeyboardLayouts1.Checked := True; + EnableBanglainNumberPadInFixedkeyboardLayouts2.Checked := True; + End; + + If ShowPrevWindow = 'YES' Then + Begin + ShowPreviewWindow1.Checked := True; + ShowPreviewWindow2.Checked := True; + + Dictionarymodeisdefault1.Enabled := True; + Dictionarymodeisdefault2.Enabled := True; + Charactermodeisdefault1.Enabled := True; + Charactermodeisdefault2.Enabled := True; + Classicphoneticnohint1.Enabled := True; + Classicphoneticnohint2.Enabled := True; + UseTabforBrowsingSuggestions1.Enabled := True; + UseTabforbrowsingsuggestions2.Enabled := True; + Remembermychoiceamongsuggestions1.Enabled := True; + Remembermychoiceamongsuggestions2.Enabled := True; + End + Else + Begin + ShowPreviewWindow1.Checked := False; + ShowPreviewWindow2.Checked := False; + + Dictionarymodeisdefault1.Enabled := False; + Dictionarymodeisdefault2.Enabled := False; + Charactermodeisdefault1.Enabled := False; + Charactermodeisdefault2.Enabled := False; + Classicphoneticnohint1.Enabled := False; + Classicphoneticnohint2.Enabled := False; + UseTabforBrowsingSuggestions1.Enabled := False; + UseTabforbrowsingsuggestions2.Enabled := False; + Remembermychoiceamongsuggestions1.Enabled := False; + Remembermychoiceamongsuggestions2.Enabled := False; + End; + + If Lowercase(MyCurrentLayout) = 'avrophonetic*' Then + Begin + UseModernStyleTyping1.Enabled := False; + UseModernStyleTyping2.Enabled := False; + UseOldStyleTyping1.Enabled := False; + UseOldStyleTyping2.Enabled := False; + EnableOldStyleRephInModernTypingStyle1.Enabled := False; + EnableOldStyleRephInModernTypingStyle2.Enabled := False; + AutomaticVowelFormatingInModernTypingStyle1.Enabled := False; + AutomaticVowelFormatingInModernTypingStyle2.Enabled := False; + AutomaticallyfixChandrapositionInModernTypingStyle1.Enabled := False; + AutomaticallyfixChandrapositionInModernTypingStyle2.Enabled := False; + EnableBanglainNumberPadInFixedkeyboardLayouts1.Enabled := False; + EnableBanglainNumberPadInFixedkeyboardLayouts2.Enabled := False; + + ShowPreviewWindow1.Enabled := True; + ShowPreviewWindow2.Enabled := True; + Dictionarymodeisdefault1.Enabled := True; + Dictionarymodeisdefault2.Enabled := True; + Charactermodeisdefault1.Enabled := True; + Charactermodeisdefault2.Enabled := True; + Classicphoneticnohint1.Enabled := True; + Classicphoneticnohint2.Enabled := True; + UseTabforBrowsingSuggestions1.Enabled := True; + UseTabforbrowsingsuggestions2.Enabled := True; + Remembermychoiceamongsuggestions1.Enabled := True; + Remembermychoiceamongsuggestions2.Enabled := True; + UseVerticalLinePipekeytotypeDot1.Enabled := True; + UseVerticalLinePipekeytotypeDot2.Enabled := True; + TypeJoNuktawithShiftJ1.Enabled := True; + TypeJoNuktawithShiftJ2.Enabled := True; + + EnableAutoCorrect1.Enabled := True; + EnableAutoCorrect2.Enabled := True; + ManageAutoCorrectentries1.Enabled := True; + ManageAutoCorrectentries2.Enabled := True; + + If ShowPrevWindow = 'NO' Then + UnloadWordDatabase + Else + Begin + If PhoneticMode = 'ONLYCHAR' Then + UnloadWordDatabase + Else + LoadWordDatabase; + End; + End + Else + Begin + UseModernStyleTyping1.Enabled := True; + UseModernStyleTyping2.Enabled := True; + UseOldStyleTyping1.Enabled := True; + UseOldStyleTyping2.Enabled := True; + + If FullOldStyleTyping = 'NO' Then + Begin + UseOldStyleTyping1.Checked := False; + UseOldStyleTyping2.Checked := False; + UseModernStyleTyping1.Checked := True; + UseModernStyleTyping2.Checked := True; + EnableOldStyleRephInModernTypingStyle1.Enabled := True; + EnableOldStyleRephInModernTypingStyle2.Enabled := True; + AutomaticVowelFormatingInModernTypingStyle1.Enabled := True; + AutomaticVowelFormatingInModernTypingStyle2.Enabled := True; + AutomaticallyfixChandrapositionInModernTypingStyle1.Enabled := True; + AutomaticallyfixChandrapositionInModernTypingStyle2.Enabled := True; + End + Else + Begin + UseOldStyleTyping1.Checked := True; + UseOldStyleTyping2.Checked := True; + UseModernStyleTyping1.Checked := False; + UseModernStyleTyping2.Checked := False; + EnableOldStyleRephInModernTypingStyle1.Enabled := False; + EnableOldStyleRephInModernTypingStyle2.Enabled := False; + AutomaticVowelFormatingInModernTypingStyle1.Enabled := False; + AutomaticVowelFormatingInModernTypingStyle2.Enabled := False; + AutomaticallyfixChandrapositionInModernTypingStyle1.Enabled := False; + AutomaticallyfixChandrapositionInModernTypingStyle2.Enabled := False; + End; + + EnableBanglainNumberPadInFixedkeyboardLayouts1.Enabled := True; + EnableBanglainNumberPadInFixedkeyboardLayouts2.Enabled := True; + + ShowPreviewWindow1.Enabled := False; + ShowPreviewWindow2.Enabled := False; + Dictionarymodeisdefault1.Enabled := False; + Dictionarymodeisdefault2.Enabled := False; + Charactermodeisdefault1.Enabled := False; + Charactermodeisdefault2.Enabled := False; + Classicphoneticnohint1.Enabled := False; + Classicphoneticnohint2.Enabled := False; + UseTabforBrowsingSuggestions1.Enabled := False; + UseTabforbrowsingsuggestions2.Enabled := False; + Remembermychoiceamongsuggestions1.Enabled := False; + Remembermychoiceamongsuggestions2.Enabled := False; + UseVerticalLinePipekeytotypeDot1.Enabled := False; + UseVerticalLinePipekeytotypeDot2.Enabled := False; + TypeJoNuktawithShiftJ1.Enabled := False; + TypeJoNuktawithShiftJ2.Enabled := False; + + EnableAutoCorrect1.Enabled := False; + EnableAutoCorrect2.Enabled := False; + ManageAutoCorrectentries1.Enabled := False; + ManageAutoCorrectentries2.Enabled := False; + + UnloadWordDatabase; + End; + + If PhoneticMode = 'DICT' Then + Begin + Dictionarymodeisdefault1.Checked := True; + Dictionarymodeisdefault2.Checked := True; + Charactermodeisdefault1.Checked := False; + Charactermodeisdefault2.Checked := False; + Classicphoneticnohint1.Checked := False; + Classicphoneticnohint2.Checked := False; + End + Else If PhoneticMode = 'CHAR' Then + Begin + Dictionarymodeisdefault1.Checked := False; + Dictionarymodeisdefault2.Checked := False; + Charactermodeisdefault1.Checked := True; + Charactermodeisdefault2.Checked := True; + Classicphoneticnohint1.Checked := False; + Classicphoneticnohint2.Checked := False; + End + Else If PhoneticMode = 'ONLYCHAR' Then + Begin + Dictionarymodeisdefault1.Checked := False; + Dictionarymodeisdefault2.Checked := False; + Charactermodeisdefault1.Checked := False; + Charactermodeisdefault2.Checked := False; + Classicphoneticnohint1.Checked := True; + Classicphoneticnohint2.Checked := True; + End; + + If SaveCandidate = 'YES' Then + Begin + Remembermychoiceamongsuggestions1.Checked := True; + Remembermychoiceamongsuggestions2.Checked := True; + End + Else + Begin + Remembermychoiceamongsuggestions1.Checked := False; + Remembermychoiceamongsuggestions2.Checked := False; + End; + + If TabBrowsing = 'YES' Then + Begin + UseTabforBrowsingSuggestions1.Checked := True; + UseTabforbrowsingsuggestions2.Checked := True; + End + Else + Begin + UseTabforBrowsingSuggestions1.Checked := False; + UseTabforbrowsingsuggestions2.Checked := False; + End; + + If PipeToDot = 'YES' Then + Begin + UseVerticalLinePipekeytotypeDot1.Checked := True; + UseVerticalLinePipekeytotypeDot2.Checked := True; + End + Else + Begin + UseVerticalLinePipekeytotypeDot1.Checked := False; + UseVerticalLinePipekeytotypeDot2.Checked := False; + End; + + If EnableJoNukta = 'YES' Then + Begin + TypeJoNuktawithShiftJ1.Checked := True; + TypeJoNuktawithShiftJ2.Checked := True; + End + Else + Begin + TypeJoNuktawithShiftJ1.Checked := False; + TypeJoNuktawithShiftJ2.Checked := False; + End; + + If AutomaticallyFixChandra = 'NO' Then + Begin + AutomaticallyfixChandrapositionInModernTypingStyle1.Checked := False; + AutomaticallyfixChandrapositionInModernTypingStyle2.Checked := False; + End + Else + Begin + AutomaticallyfixChandrapositionInModernTypingStyle1.Checked := True; + AutomaticallyfixChandrapositionInModernTypingStyle2.Checked := True; + End; + + If IsFormLoaded('LayoutViewer') Then + LayoutViewer.SetMyZOrder; + + If PhoneticAutoCorrect = 'YES' Then + Begin + EnableAutoCorrect1.Checked := True; + EnableAutoCorrect2.Checked := True; + KeyLayout.AutoCorrectEnabled := True; + End + Else + Begin + EnableAutoCorrect1.Checked := False; + EnableAutoCorrect2.Checked := False; + KeyLayout.AutoCorrectEnabled := False; + End; + + Topbar.ApplySkin; + + If TopBarTransparent = 'YES' Then + Topbar.TransparencyTimer.Enabled := True + Else + Topbar.TransparencyTimer.Enabled := False; + + If AvroUpdateCheck = 'YES' Then + InternetCheck.Enabled := True + Else + InternetCheck.Enabled := False; + + If OutputIsBijoy = 'YES' Then + Begin + OutputasANSIAreyousure1.Checked := True; + OutputasANSIAreyousure2.Checked := True; + OutputasUnicodeRecommended1.Checked := False; + OutputasUnicodeRecommended2.Checked := False; + End + Else + Begin + OutputasUnicodeRecommended1.Checked := True; + OutputasUnicodeRecommended2.Checked := True; + OutputasANSIAreyousure1.Checked := False; + OutputasANSIAreyousure2.Checked := False; + End; + + SaveUISettings; + +End; + +Procedure TAvroMainForm1.Remembermychoiceamongsuggestions1Click + (Sender: TObject); +Begin + If SaveCandidate = 'YES' Then + SaveCandidate := 'NO' + Else + SaveCandidate := 'YES'; + + RefreshSettings; End; Procedure TAvroMainForm1.ResetAllWindowLocale; Var - I: HWND; + I: HWND; Begin - For I In WindowDict.Keys Do Begin - If IsWindow(I) Then - ChangeLocalToAny(I, WindowDict.Items[I].Locale); - End; + For I In WindowDict.Keys Do + Begin + If IsWindow(I) Then + ChangeLocalToAny(I, WindowDict.Items[I].Locale); + End; End; Procedure TAvroMainForm1.RestoreAvroTopBar1Click(Sender: TObject); Begin - RestoreFromTray; + RestoreFromTray; End; Procedure TAvroMainForm1.RestoreFromTray; Begin - If Topbar.Visible = False Then Begin + If Topbar.Visible = False Then + Begin - If KeyLayout.KeyboardMode = bangla Then - Topbar.SetButtonModeState(State2) - Else If KeyLayout.KeyboardMode = SysDefault Then - Topbar.SetButtonModeState(State1); + If KeyLayout.KeyboardMode = bangla Then + Topbar.SetButtonModeState(State2) + Else If KeyLayout.KeyboardMode = SysDefault Then + Topbar.SetButtonModeState(State1); - Tray.Visible := False; - { Setasmainform(TopBar); }{ Required to maintain Topbar's Topmost behaviour } - SaveUISettings; - Topbar.Visible := True; - // SetForegroundWindow(TopBar.Handle); + Tray.Visible := False; + { Setasmainform(TopBar); }{ Required to maintain Topbar's Topmost behaviour } + SaveUISettings; + Topbar.Visible := True; + // SetForegroundWindow(TopBar.Handle); - End; + End; End; { =============================================================================== } Procedure TAvroMainForm1.Showactivekeyboardlayout1Click(Sender: TObject); Begin - CheckCreateForm(TLayoutViewer, LayoutViewer, 'LayoutViewer'); - LayoutViewer.Show; + CheckCreateForm(TLayoutViewer, LayoutViewer, 'LayoutViewer'); + LayoutViewer.Show; End; Procedure TAvroMainForm1.ShowOnTray; Var - ICN: TIcon; -Begin - ICN := TIcon.Create; - If KeyLayout.KeyboardMode = bangla Then Begin - If IsWin2000 = True Then - ImageList1.GetIcon(14, ICN) - Else - ImageList1.GetIcon(20, ICN); - - Tray.Hint := 'Avro Keyboard.' + #13 + 'Running Bangla Keyboard Mode.' + #13 + 'Press ' + ModeSwitchKey + ' to switch to System default.'; - End - Else If KeyLayout.KeyboardMode = SysDefault Then Begin - If IsWin2000 = True Then - ImageList1.GetIcon(19, ICN) - Else - ImageList1.GetIcon(21, ICN); - - Tray.Hint := 'Avro Keyboard.' + #13 + 'Running System default Keyboard Mode.' + #13 + 'Press ' + ModeSwitchKey + ' to switch to Bangla.'; - End; - - - - Tray.Icon := ICN; - ICN.Free; - Tray.Visible := True; - - If StrToInt(TrayHintShowTimes) < NumberOfVisibleHints Then Begin - Tray.BalloonHint := 'Avro Keyboard is running here.'; - Tray.BalloonTimeout := 5000; - Tray.BalloonTitle := 'Avro Keyboard'; - Tray.ShowBalloonHint; - TrayHintShowTimes := IntToStr(StrToInt(TrayHintShowTimes) + 1); - End; - - SaveUISettings; + ICN: TIcon; +Begin + ICN := TIcon.Create; + If KeyLayout.KeyboardMode = bangla Then + Begin + If IsWin2000 = True Then + ImageList1.GetIcon(14, ICN) + Else + ImageList1.GetIcon(20, ICN); + + Tray.Hint := 'Avro Keyboard.' + #13 + 'Running Bangla Keyboard Mode.' + #13 + + 'Press ' + ModeSwitchKey + ' to switch to System default.'; + End + Else If KeyLayout.KeyboardMode = SysDefault Then + Begin + If IsWin2000 = True Then + ImageList1.GetIcon(19, ICN) + Else + ImageList1.GetIcon(21, ICN); + + Tray.Hint := 'Avro Keyboard.' + #13 + + 'Running System default Keyboard Mode.' + #13 + 'Press ' + ModeSwitchKey + + ' to switch to Bangla.'; + End; + + Tray.Icon := ICN; + ICN.Free; + Tray.Visible := True; + + If StrToInt(TrayHintShowTimes) < NumberOfVisibleHints Then + Begin + Tray.BalloonHint := 'Avro Keyboard is running here.'; + Tray.BalloonTimeout := 5000; + Tray.BalloonTitle := 'Avro Keyboard'; + Tray.ShowBalloonHint; + TrayHintShowTimes := IntToStr(StrToInt(TrayHintShowTimes) + 1); + End; + + SaveUISettings; End; Procedure TAvroMainForm1.ShowPreviewWindow1Click(Sender: TObject); Begin - If ShowPrevWindow = 'YES' Then - ShowPrevWindow := 'NO' - Else - ShowPrevWindow := 'YES'; + If ShowPrevWindow = 'YES' Then + ShowPrevWindow := 'NO' + Else + ShowPrevWindow := 'YES'; - RefreshSettings; + RefreshSettings; End; Procedure TAvroMainForm1.SkinDesignerDesignyourownskin1Click(Sender: TObject); Begin - Execute_Something(ExtractFilePath(Application.ExeName) + 'Skin Designer.exe'); + Execute_Something(ExtractFilePath(Application.ExeName) + 'Skin Designer.exe'); End; Procedure TAvroMainForm1.Spellcheck1Click(Sender: TObject); Begin - Execute_Something(ExtractFilePath(Application.ExeName) + 'Avro Spell checker.exe'); + Execute_Something(ExtractFilePath(Application.ExeName) + + 'Avro Spell checker.exe'); End; { =============================================================================== } Procedure TAvroMainForm1.ToggleAutoCorrect; Begin - If PhoneticAutoCorrect = 'YES' Then - PhoneticAutoCorrect := 'NO' - Else - PhoneticAutoCorrect := 'YES'; - RefreshSettings; + If PhoneticAutoCorrect = 'YES' Then + PhoneticAutoCorrect := 'NO' + Else + PhoneticAutoCorrect := 'YES'; + RefreshSettings; End; { =============================================================================== } Procedure TAvroMainForm1.ToggleFixChandra; Begin - If AutomaticallyFixChandra = 'YES' Then - AutomaticallyFixChandra := 'NO' - Else - AutomaticallyFixChandra := 'YES'; - RefreshSettings; + If AutomaticallyFixChandra = 'YES' Then + AutomaticallyFixChandra := 'NO' + Else + AutomaticallyFixChandra := 'YES'; + RefreshSettings; End; { =============================================================================== } Procedure TAvroMainForm1.ToggleMode; Begin - KeyLayout.ToggleMode; + KeyLayout.ToggleMode; End; { =============================================================================== } Procedure TAvroMainForm1.ToggleNumPadBangla; Begin - If NumPadBangla = 'YES' Then - NumPadBangla := 'NO' - Else - NumPadBangla := 'YES'; - RefreshSettings; + If NumPadBangla = 'YES' Then + NumPadBangla := 'NO' + Else + NumPadBangla := 'YES'; + RefreshSettings; End; { =============================================================================== } Procedure TAvroMainForm1.ToggleOldStyleReph; Begin - If OldStyleReph = 'YES' Then - OldStyleReph := 'NO' - Else - OldStyleReph := 'YES'; - RefreshSettings; + If OldStyleReph = 'YES' Then + OldStyleReph := 'NO' + Else + OldStyleReph := 'YES'; + RefreshSettings; End; { =============================================================================== } Procedure TAvroMainForm1.ToggleOutputEncoding; Begin - If OutputIsBijoy = 'YES' Then - OutputasUnicodeRecommended1Click(Nil) - Else - OutputasANSIAreyousure1Click(Nil); + If OutputIsBijoy = 'YES' Then + OutputasUnicodeRecommended1Click(Nil) + Else + OutputasANSIAreyousure1Click(Nil); End; { =============================================================================== } Procedure TAvroMainForm1.ToggleVowelFormat; Begin - If VowelFormating = 'YES' Then - VowelFormating := 'NO' - Else - VowelFormating := 'YES'; - RefreshSettings; + If VowelFormating = 'YES' Then + VowelFormating := 'NO' + Else + VowelFormating := 'YES'; + RefreshSettings; End; { =============================================================================== } Procedure TAvroMainForm1.TopBarDocToTop; Begin - Topbar.Top := 0; - If (Topbar.Left + Topbar.Width > Screen.Width) Or (Topbar.Left < 0) Then - Topbar.Left := Screen.Width - Topbar.Width - 250; + Topbar.Top := 0; + If (Topbar.Left + Topbar.Width > Screen.Width) Or (Topbar.Left < 0) Then + Topbar.Left := Screen.Width - Topbar.Width - 250; End; { =============================================================================== } -Function TAvroMainForm1.TransferKeyDown(Const KeyCode: Integer; Var Block: Boolean): String; +Function TAvroMainForm1.TransferKeyDown(Const KeyCode: Integer; + Var Block: Boolean): String; Begin - result := KeyLayout.ProcessVKeyDown(KeyCode, Block); + result := KeyLayout.ProcessVKeyDown(KeyCode, Block); End; { =============================================================================== } -Procedure TAvroMainForm1.TransferKeyUp(Const KeyCode: Integer; Var Block: Boolean); +Procedure TAvroMainForm1.TransferKeyUp(Const KeyCode: Integer; + Var Block: Boolean); Begin - KeyLayout.ProcessVKeyUP(KeyCode, Block); + KeyLayout.ProcessVKeyUP(KeyCode, Block); End; Procedure TAvroMainForm1.TrayClick(Sender: TObject); Begin - KeyLayout.ToggleMode; + KeyLayout.ToggleMode; End; Procedure TAvroMainForm1.TrayDblClick(Sender: TObject); Begin - KeyLayout.ToggleMode; - RestoreFromTray; + KeyLayout.ToggleMode; + RestoreFromTray; End; Procedure TAvroMainForm1.TrimAppMemorySize; Var - MainHandle: THandle; + MainHandle: THandle; Begin - Try - MainHandle := OpenProcess(PROCESS_ALL_ACCESS, False, GetCurrentProcessID); - SetProcessWorkingSetSize(MainHandle, $FFFFFFFF, $FFFFFFFF); - CloseHandle(MainHandle); - Except - End; - Application.ProcessMessages; + Try + MainHandle := OpenProcess(PROCESS_ALL_ACCESS, False, GetCurrentProcessID); + SetProcessWorkingSetSize(MainHandle, $FFFFFFFF, $FFFFFFFF); + CloseHandle(MainHandle); + Except + End; + Application.ProcessMessages; End; Procedure TAvroMainForm1.TypeJoNuktawithShiftJ1Click(Sender: TObject); Begin - If EnableJoNukta = 'YES' Then - EnableJoNukta := 'NO' - Else - EnableJoNukta := 'YES'; - RefreshSettings; + If EnableJoNukta = 'YES' Then + EnableJoNukta := 'NO' + Else + EnableJoNukta := 'YES'; + RefreshSettings; End; Procedure TAvroMainForm1.UnicodetoBijoytextconverter1Click(Sender: TObject); Begin - Execute_Something(ExtractFilePath(Application.ExeName) + 'Unicode to Bijoy.exe'); + Execute_Something(ExtractFilePath(Application.ExeName) + + 'Unicode to Bijoy.exe'); End; Procedure TAvroMainForm1.UsefultoolsforBangla1Click(Sender: TObject); Begin - Execute_Something('http://www.omicronlab.com/go.php?id=15'); + Execute_Something('http://www.omicronlab.com/go.php?id=15'); End; Procedure TAvroMainForm1.UseModernStyleTyping1Click(Sender: TObject); Begin - ChangeTypingStyle('ModernStyle'); + ChangeTypingStyle('ModernStyle'); End; Procedure TAvroMainForm1.UseOldStyleTyping1Click(Sender: TObject); Begin - ChangeTypingStyle('OldStyle'); + ChangeTypingStyle('OldStyle'); End; Procedure TAvroMainForm1.UserForum1Click(Sender: TObject); Begin - Execute_Something('http://www.omicronlab.com/go.php?id=3'); + Execute_Something('http://www.omicronlab.com/go.php?id=3'); End; Procedure TAvroMainForm1.UseTabforBrowsingSuggestions1Click(Sender: TObject); Begin - If TabBrowsing = 'YES' Then - TabBrowsing := 'NO' - Else - TabBrowsing := 'YES'; - RefreshSettings; + If TabBrowsing = 'YES' Then + TabBrowsing := 'NO' + Else + TabBrowsing := 'YES'; + RefreshSettings; End; Procedure TAvroMainForm1.UseVerticalLinePipekeytotypeDot1Click(Sender: TObject); Begin - If PipeToDot = 'YES' Then - PipeToDot := 'NO' - Else - PipeToDot := 'YES'; - RefreshSettings; + If PipeToDot = 'YES' Then + PipeToDot := 'NO' + Else + PipeToDot := 'YES'; + RefreshSettings; End; Procedure TAvroMainForm1.WindowCheckTimer(Sender: TObject); Var - WindoRecord: TWindowRecord; - hforewnd: HWND; -Begin - - hforewnd := GetForegroundWindow; - If hforewnd = 0 Then - exit; - If IsWindow(hforewnd) = False Then - exit; { Experimental use } - - - - - If IgnorableWindow(hforewnd) = True Then - exit; - If hforewnd = LastWindow Then - exit; - - - // window z-order has been changed - // ================================== - // Aggressive mode - RemoveHook; - Sethook; - - If Topbar.Visible = True Then - TOPMOST(Topbar.Handle); - // ================================== - - If Not WindowDict.TryGetValue(hforewnd, WindoRecord) Then Begin - // This is a new window, make the keyboard mode English Keyboard - // If DefaultKeyboardMode = 'SYSTEM' Then Begin - { Highly experimental! } - If KeyLayout.KeyboardMode <> SysDefault Then - KeyLayout.KeyboardMode := SysDefault; - // End - // Else Begin - { Highly experimental! } - // If KeyLayout.KeyboardMode <> bangla Then - // KeyLayout.KeyboardMode := bangla; - // End; - End - Else Begin - { This window is already being tracked, change keyboard mode - to the lastly recorded one } - If (WindoRecord.Mode = 'B') And (KeyLayout.KeyboardMode = SysDefault) Then - KeyLayout.KeyboardMode := bangla; - If (WindoRecord.Mode = 'S') And (KeyLayout.KeyboardMode = bangla) Then - KeyLayout.KeyboardMode := SysDefault; - End; - // A new window came to the top, we must reset dead key now - KeyLayout.ResetDeadKey; - LastWindow := hforewnd; + WindoRecord: TWindowRecord; + hforewnd: HWND; +Begin + + hforewnd := GetForegroundWindow; + If hforewnd = 0 Then + exit; + If IsWindow(hforewnd) = False Then + exit; { Experimental use } + + If IgnorableWindow(hforewnd) = True Then + exit; + If hforewnd = LastWindow Then + exit; + + // window z-order has been changed + // ================================== + // Aggressive mode + RemoveHook; + Sethook; + + If Topbar.Visible = True Then + TOPMOST(Topbar.Handle); + // ================================== + + If Not WindowDict.TryGetValue(hforewnd, WindoRecord) Then + Begin + // This is a new window, make the keyboard mode English Keyboard + // If DefaultKeyboardMode = 'SYSTEM' Then Begin + { Highly experimental! } + If KeyLayout.KeyboardMode <> SysDefault Then + KeyLayout.KeyboardMode := SysDefault; + // End + // Else Begin + { Highly experimental! } + // If KeyLayout.KeyboardMode <> bangla Then + // KeyLayout.KeyboardMode := bangla; + // End; + End + Else + Begin + { This window is already being tracked, change keyboard mode + to the lastly recorded one } + If (WindoRecord.Mode = 'B') And (KeyLayout.KeyboardMode = SysDefault) Then + KeyLayout.KeyboardMode := bangla; + If (WindoRecord.Mode = 'S') And (KeyLayout.KeyboardMode = bangla) Then + KeyLayout.KeyboardMode := SysDefault; + End; + // A new window came to the top, we must reset dead key now + KeyLayout.ResetDeadKey; + LastWindow := hforewnd; End; Procedure TAvroMainForm1.WMCopyData(Var Msg: TWMCopyData); Var - cmd: String; + cmd: String; Begin - cmd := PChar(Msg.CopyDataStruct.lpData); - cmd := Lowercase(cmd); - - If cmd = 'refresh_layout' Then Begin - FreeAndNil(KeyboardLayouts); - LoadKeyboardLayoutNames; - Initmenu; - - // Send something back - Msg.result := 21; - End; + cmd := PChar(Msg.CopyDataStruct.lpData); + cmd := Lowercase(cmd); - If cmd = 'toggle' Then Begin - KeyLayout.ToggleMode; + If cmd = 'refresh_layout' Then + Begin + FreeAndNil(KeyboardLayouts); + LoadKeyboardLayoutNames; + Initmenu; - // Send something back - Msg.result := 21; - End; + // Send something back + Msg.result := 21; + End; - If cmd = 'bn' Then Begin - KeyLayout.BanglaMode; + If cmd = 'toggle' Then + Begin + KeyLayout.ToggleMode; - // Send something back - Msg.result := 21; - End; + // Send something back + Msg.result := 21; + End; - If cmd = 'sys' Then Begin - KeyLayout.SysMode; + If cmd = 'bn' Then + Begin + KeyLayout.BanglaMode; - // Send something back - Msg.result := 21; - End; + // Send something back + Msg.result := 21; + End; - If cmd = 'minimize' Then Begin - Jumptosystemtray1Click(Nil); + If cmd = 'sys' Then + Begin + KeyLayout.SysMode; - // Send something back - Msg.result := 21; - End; + // Send something back + Msg.result := 21; + End; - If cmd = 'restore' Then Begin - RestoreFromTray; - Topbar.AlphaBlendValue := 255; + If cmd = 'minimize' Then + Begin + Jumptosystemtray1Click(Nil); - // Send something back - Msg.result := 21; - End; + // Send something back + Msg.result := 21; + End; + If cmd = 'restore' Then + Begin + RestoreFromTray; + Topbar.AlphaBlendValue := 255; + // Send something back + Msg.result := 21; + End; End; Procedure TAvroMainForm1.wwwOmicronLabcom1Click(Sender: TObject); Begin - Execute_Something('http://www.omicronlab.com/go.php?id=2'); + Execute_Something('http://www.omicronlab.com/go.php?id=2'); End; { =============================================================================== } diff --git a/Keyboard and Spell checker/Forms/uFrmSplash.pas b/Keyboard and Spell checker/Forms/uFrmSplash.pas index a90c19e..daa4caf 100644 --- a/Keyboard and Spell checker/Forms/uFrmSplash.pas +++ b/Keyboard and Spell checker/Forms/uFrmSplash.pas @@ -1,138 +1,137 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - Unit uFrmSplash; Interface Uses - Windows, - Messages, - SysUtils, - Variants, - Classes, - Graphics, - Controls, - Forms, - Dialogs, - jpeg, - ExtCtrls; - + Windows, + Messages, + SysUtils, + Variants, + Classes, + Graphics, + Controls, + Forms, + Dialogs, + jpeg, + ExtCtrls; Type - TfrmSplash = Class(TForm) - Image1: TImage; - SplashTimer: TTimer; - Procedure FormCreate(Sender: TObject); - Procedure SplashTimerTimer(Sender: TObject); - Procedure FormClose(Sender: TObject; Var Action: TCloseAction); - Procedure FormKeyDown(Sender: TObject; Var Key: Word; Shift: TShiftState); - Procedure Image1MouseDown(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); - Private - { Private declarations } - Public - { Public declarations } - Protected - Procedure CreateParams(Var Params: TCreateParams); Override; - End; + TfrmSplash = Class(TForm) + Image1: TImage; + SplashTimer: TTimer; + Procedure FormCreate(Sender: TObject); + Procedure SplashTimerTimer(Sender: TObject); + Procedure FormClose(Sender: TObject; Var Action: TCloseAction); + Procedure FormKeyDown(Sender: TObject; Var Key: Word; Shift: TShiftState); + Procedure Image1MouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + Private + { Private declarations } + Public + { Public declarations } + Protected + Procedure CreateParams(Var Params: TCreateParams); Override; + End; Var - frmSplash : TfrmSplash; - + frmSplash: TfrmSplash; Implementation {$R *.dfm} Const - Show_Window_in_Taskbar = False; + Show_Window_in_Taskbar = False; Procedure TfrmSplash.FormClose(Sender: TObject; Var Action: TCloseAction); Begin - Action := caFree; + Action := caFree; - frmSplash := Nil; + frmSplash := Nil; End; Procedure TfrmSplash.FormCreate(Sender: TObject); Begin - Self.Width := Image1.Width; - Self.Height := Image1.Height; - // Set Window to top - // SetWindowPos(Self.Handle, HWND_TOPMOST, 0, 0, 0, 0, - // SWP_NOMOVE Or SWP_NOSIZE Or SWP_NOACTIVATE); + Self.Width := Image1.Width; + Self.Height := Image1.Height; + // Set Window to top + // SetWindowPos(Self.Handle, HWND_TOPMOST, 0, 0, 0, 0, + // SWP_NOMOVE Or SWP_NOSIZE Or SWP_NOACTIVATE); { TODO : - If AppPortableEdition = True Then - lblPortable.Visible = True - Else - lblPortable.Visible = False - End If + If AppPortableEdition = True Then + lblPortable.Visible = True + Else + lblPortable.Visible = False + End If - lblVersion.Caption = "Version " & App.Major & "." & App.Minor & _ - "." & App.Revision } + lblVersion.Caption = "Version " & App.Major & "." & App.Minor & _ + "." & App.Revision } - //Show; - //Update; + // Show; + // Update; End; Procedure TfrmSplash.FormKeyDown(Sender: TObject; Var Key: Word; - Shift: TShiftState); + Shift: TShiftState); Begin - Close; + Close; End; Procedure TfrmSplash.Image1MouseDown(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); + Shift: TShiftState; X, Y: Integer); Begin - Close; + Close; End; Procedure TfrmSplash.SplashTimerTimer(Sender: TObject); Begin - Close; + Close; End; Procedure TfrmSplash.CreateParams(Var Params: TCreateParams); Begin - Inherited CreateParams(Params); - With Params Do Begin - If Show_Window_in_Taskbar Then Begin - ExStyle := ExStyle Or WS_EX_APPWINDOW And Not WS_EX_TOOLWINDOW; - WndParent := GetDesktopwindow; - End - Else If Not Show_Window_in_Taskbar Then Begin - ExStyle := ExStyle And Not WS_EX_APPWINDOW; - End; - End; + Inherited CreateParams(Params); + With Params Do + Begin + If Show_Window_in_Taskbar Then + Begin + ExStyle := ExStyle Or WS_EX_APPWINDOW And Not WS_EX_TOOLWINDOW; + WndParent := GetDesktopwindow; + End + Else If Not Show_Window_in_Taskbar Then + Begin + ExStyle := ExStyle And Not WS_EX_APPWINDOW; + End; + End; End; End. - diff --git a/Keyboard and Spell checker/Forms/uLayoutViewer.dfm b/Keyboard and Spell checker/Forms/uLayoutViewer.dfm index 9b8b136..4e5fec3 100644 --- a/Keyboard and Spell checker/Forms/uLayoutViewer.dfm +++ b/Keyboard and Spell checker/Forms/uLayoutViewer.dfm @@ -183,7 +183,6 @@ object LayoutViewer: TLayoutViewer Top = 0 Width = 33 Height = 25 - DoubleBuffered = True Glyph.Data = { 36030000424D3603000000000000360000002800000010000000100000000100 18000000000000030000880B0000880B00000000000000000000FFFFFFFFFFFF @@ -211,7 +210,6 @@ object LayoutViewer: TLayoutViewer B4B4B49E9E9EB3B3B3B9B9B9B4B4B3A1A1A1C0C0C0FEFEFEFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFC2C2C2B8B8B8C7C7C7F4 F4F4FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF} - ParentDoubleBuffered = False TabOrder = 0 OnClick = but_ZoomInClick end @@ -220,7 +218,6 @@ object LayoutViewer: TLayoutViewer Top = 0 Width = 33 Height = 25 - DoubleBuffered = True Glyph.Data = { 36030000424D3603000000000000360000002800000010000000100000000100 18000000000000030000880B0000880B00000000000000000000FFFFFFFFFFFF @@ -248,7 +245,6 @@ object LayoutViewer: TLayoutViewer B4B4B49E9E9EB3B3B3B9B9B9B4B4B3A1A1A1C0C0C0FEFEFEFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFC2C2C2B8B8B8C7C7C7F4 F4F4FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF} - ParentDoubleBuffered = False TabOrder = 1 OnClick = but_ZoomOutClick end @@ -258,8 +254,6 @@ object LayoutViewer: TLayoutViewer Width = 97 Height = 25 Caption = 'About layout...' - DoubleBuffered = True - ParentDoubleBuffered = False TabOrder = 2 OnClick = but_AboutClick end @@ -268,7 +262,6 @@ object LayoutViewer: TLayoutViewer Top = 0 Width = 33 Height = 25 - DoubleBuffered = True Glyph.Data = { 36030000424D3603000000000000360000002800000010000000100000000100 18000000000000030000880B0000880B00000000000000000000FFFFFFFFFFFF @@ -296,7 +289,6 @@ object LayoutViewer: TLayoutViewer FFFFFFFFFFFFABABABFAFAFAFFFFFFFFFFFFFFFFFFD1D1D18F8F8FE9E9E9FFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD0D0D0B7B7B7B8B8B8B8 B8B8B8B8B8ABABABD6D6D6FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF} - ParentDoubleBuffered = False TabOrder = 3 OnClick = but_PrintClick end diff --git a/Keyboard and Spell checker/Forms/uLayoutViewer.pas b/Keyboard and Spell checker/Forms/uLayoutViewer.pas index 8491628..91510ae 100644 --- a/Keyboard and Spell checker/Forms/uLayoutViewer.pas +++ b/Keyboard and Spell checker/Forms/uLayoutViewer.pas @@ -1,93 +1,93 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - Unit uLayoutViewer; Interface Uses - Windows, - Messages, - SysUtils, - Variants, - Classes, - Graphics, - Controls, - Forms, - Dialogs, - ComCtrls, - ToolWin, - StdCtrls, - ExtCtrls, - Buttons, - Printers; + Windows, + Messages, + SysUtils, + Variants, + Classes, + Graphics, + Controls, + Forms, + Dialogs, + ComCtrls, + ToolWin, + StdCtrls, + ExtCtrls, + Buttons, + Printers; Type - TLayoutViewer = Class(TForm) - picRSetMode: TImage; - tmpPicture: TImage; - but_Normal: TSpeedButton; - but_AltGr: TSpeedButton; - but_ZoomIn: TBitBtn; - but_ZoomOut: TBitBtn; - but_OnTop: TSpeedButton; - but_About: TBitBtn; - but_Print: TBitBtn; - PrintDialog1: TPrintDialog; - Procedure FormClose(Sender: TObject; Var Action: TCloseAction); - Procedure FormCreate(Sender: TObject); - Procedure but_NormalClick(Sender: TObject); - Procedure but_AltGrClick(Sender: TObject); - Procedure but_ZoomInClick(Sender: TObject); - Procedure but_ZoomOutClick(Sender: TObject); - Procedure but_OnTopClick(Sender: TObject); - Procedure but_PrintClick(Sender: TObject); - Procedure but_AboutClick(Sender: TObject); - Private - { Private declarations } - Pic_LayoutNormal, Pic_LayoutAltGr: TBitmap; - CurrentSize: Integer; - LayerDisplay: Integer; //1= Normal, 2= AltGr - KeyboardLayout: String; - Procedure ResizeMe(PICSRC: TImage; picSize: Integer); - Procedure ResizeImage(Var SourcePictureBox, DestinationPictureBox: TImage; oldx, oldy, NewX, NewY: Integer); - Public - { Public declarations } - Procedure SetMyZOrder; - Procedure UpdateLayout; - Procedure UpdateImageSize(picSize: Integer); - Protected - Procedure CreateParams(Var Params: TCreateParams); Override; - End; + TLayoutViewer = Class(TForm) + picRSetMode: TImage; + tmpPicture: TImage; + but_Normal: TSpeedButton; + but_AltGr: TSpeedButton; + but_ZoomIn: TBitBtn; + but_ZoomOut: TBitBtn; + but_OnTop: TSpeedButton; + but_About: TBitBtn; + but_Print: TBitBtn; + PrintDialog1: TPrintDialog; + Procedure FormClose(Sender: TObject; Var Action: TCloseAction); + Procedure FormCreate(Sender: TObject); + Procedure but_NormalClick(Sender: TObject); + Procedure but_AltGrClick(Sender: TObject); + Procedure but_ZoomInClick(Sender: TObject); + Procedure but_ZoomOutClick(Sender: TObject); + Procedure but_OnTopClick(Sender: TObject); + Procedure but_PrintClick(Sender: TObject); + Procedure but_AboutClick(Sender: TObject); + Private + { Private declarations } + Pic_LayoutNormal, Pic_LayoutAltGr: TBitmap; + CurrentSize: Integer; + LayerDisplay: Integer; // 1= Normal, 2= AltGr + KeyboardLayout: String; + Procedure ResizeMe(PICSRC: TImage; picSize: Integer); + Procedure ResizeImage(Var SourcePictureBox, DestinationPictureBox: TImage; + oldx, oldy, NewX, NewY: Integer); + Public + { Public declarations } + Procedure SetMyZOrder; + Procedure UpdateLayout; + Procedure UpdateImageSize(picSize: Integer); + Protected + Procedure CreateParams(Var Params: TCreateParams); Override; + End; Var - LayoutViewer : TLayoutViewer; + LayoutViewer: TLayoutViewer; Implementation @@ -95,356 +95,387 @@ {$R ../Layout/Internal_Layout.res} Uses - KeyboardLayoutLoader, - uForm1, - BanglaChars, - StrUtils, - uRegistrySettings, - uFileFolderHandling, - uWindowHandlers, - uTopBar; + KeyboardLayoutLoader, + uForm1, + BanglaChars, + StrUtils, + uRegistrySettings, + uFileFolderHandling, + uWindowHandlers, + uTopBar; Const - Show_Window_in_Taskbar = True; + Show_Window_in_Taskbar = True; - { TLayoutViewer } + { TLayoutViewer } - //////////////////////////////////////////////////////////////////////// + /// ///////////////////////////////////////////////////////////////////// Procedure TLayoutViewer.but_AboutClick(Sender: TObject); Var - KeyboardLayoutPath : String; + KeyboardLayoutPath: String; Begin - KeyboardLayout := AvroMainForm1.GetMyCurrentLayout; - If Lowercase(KeyboardLayout) = 'avrophonetic*' Then - KeyboardLayoutPath := KeyboardLayout - Else - KeyboardLayoutPath := GetAvroDataDir + 'Keyboard Layouts\' + KeyboardLayout + '.avrolayout'; + KeyboardLayout := AvroMainForm1.GetMyCurrentLayout; + If Lowercase(KeyboardLayout) = 'avrophonetic*' Then + KeyboardLayoutPath := KeyboardLayout + Else + KeyboardLayoutPath := GetAvroDataDir + 'Keyboard Layouts\' + KeyboardLayout + + '.avrolayout'; - ShowLayoutDescription(KeyboardLayoutPath); + ShowLayoutDescription(KeyboardLayoutPath); End; -//////////////////////////////////////////////////////////////////////// +/// ///////////////////////////////////////////////////////////////////// Procedure TLayoutViewer.but_AltGrClick(Sender: TObject); Begin - LayerDisplay := 2; - UpdateImageSize(CurrentSize); + LayerDisplay := 2; + UpdateImageSize(CurrentSize); End; -//////////////////////////////////////////////////////////////////////// +/// ///////////////////////////////////////////////////////////////////// Procedure TLayoutViewer.but_NormalClick(Sender: TObject); Begin - LayerDisplay := 1; - UpdateImageSize(CurrentSize); + LayerDisplay := 1; + UpdateImageSize(CurrentSize); End; Procedure TLayoutViewer.but_OnTopClick(Sender: TObject); Begin - If ShowLayoutOnTop = 'YES' Then - ShowLayoutOnTop := 'NO' - Else - ShowLayoutOnTop := 'YES'; - + If ShowLayoutOnTop = 'YES' Then + ShowLayoutOnTop := 'NO' + Else + ShowLayoutOnTop := 'YES'; - SetMyZOrder; + SetMyZOrder; End; Procedure TLayoutViewer.but_PrintClick(Sender: TObject); Var - ScaleX, ScaleY : Integer; - RR : TRect; - TempShowLayoutOnTop : String; + ScaleX, ScaleY: Integer; + RR: TRect; + TempShowLayoutOnTop: String; Begin - //Load printer dialog on top - TempShowLayoutOnTop := ShowLayoutOnTop; - ShowLayoutOnTop := 'NO'; - SetMyZOrder; - - //Open print dialog - If PrintDialog1.Execute Then Begin - - If Not (tmpPicture.Picture = Nil) Then Begin - // Print tmpPicture.Picture; - Printer.Orientation := poLandscape; - With Printer Do Begin - BeginDoc; - Try - ScaleX := GetDeviceCaps(Handle, logPixelsX) Div PixelsPerInch; - ScaleY := GetDeviceCaps(Handle, logPixelsY) Div PixelsPerInch; - RR := Rect(0, 0, tmpPicture.picture.Width * scaleX, tmpPicture.Picture.Height * ScaleY); - Canvas.StretchDraw(RR, tmpPicture.Picture.Graphic); - Finally - EndDoc; //Methode EndDoc beendet den aktuellen Druckauftrag und schließt die - End; - End; - End - Else Begin - - Application.MessageBox('This image is not available for Printing!', - 'Layout Viewer.', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - - End; - End; - - //Restore on top state - ShowLayoutOnTop := TempShowLayoutOnTop; - SetMyZOrder; + // Load printer dialog on top + TempShowLayoutOnTop := ShowLayoutOnTop; + ShowLayoutOnTop := 'NO'; + SetMyZOrder; + + // Open print dialog + If PrintDialog1.Execute Then + Begin + + If Not(tmpPicture.Picture = Nil) Then + Begin + // Print tmpPicture.Picture; + Printer.Orientation := poLandscape; + With Printer Do + Begin + BeginDoc; + Try + ScaleX := GetDeviceCaps(Handle, logPixelsX) Div PixelsPerInch; + ScaleY := GetDeviceCaps(Handle, logPixelsY) Div PixelsPerInch; + RR := Rect(0, 0, tmpPicture.Picture.Width * ScaleX, + tmpPicture.Picture.Height * ScaleY); + Canvas.StretchDraw(RR, tmpPicture.Picture.Graphic); + Finally + EndDoc; // Methode EndDoc beendet den aktuellen Druckauftrag und schließt die + End; + End; + End + Else + Begin + + Application.MessageBox('This image is not available for Printing!', + 'Layout Viewer.', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); + + End; + End; + + // Restore on top state + ShowLayoutOnTop := TempShowLayoutOnTop; + SetMyZOrder; End; -//////////////////////////////////////////////////////////////////////// +/// ///////////////////////////////////////////////////////////////////// Procedure TLayoutViewer.but_ZoomInClick(Sender: TObject); Begin - CurrentSize := CurrentSize + 10; - UpdateImageSize(CurrentSize); + CurrentSize := CurrentSize + 10; + UpdateImageSize(CurrentSize); End; -//////////////////////////////////////////////////////////////////////// +/// ///////////////////////////////////////////////////////////////////// Procedure TLayoutViewer.but_ZoomOutClick(Sender: TObject); Begin - If CurrentSize > 10 Then Begin - CurrentSize := CurrentSize - 10; - UpdateImageSize(CurrentSize); - End; + If CurrentSize > 10 Then + Begin + CurrentSize := CurrentSize - 10; + UpdateImageSize(CurrentSize); + End; End; -//////////////////////////////////////////////////////////////////////// +/// ///////////////////////////////////////////////////////////////////// Procedure TLayoutViewer.CreateParams(Var Params: TCreateParams); Begin - Inherited CreateParams(Params); - With Params Do Begin - If Show_Window_in_Taskbar Then Begin - ExStyle := ExStyle Or WS_EX_APPWINDOW And Not WS_EX_TOOLWINDOW; - ExStyle := ExStyle Or WS_EX_TOPMOST Or WS_EX_NOACTIVATE; - WndParent := GetDesktopwindow; - End - Else If Not Show_Window_in_Taskbar Then Begin - ExStyle := ExStyle And Not WS_EX_APPWINDOW; - End; - End; + Inherited CreateParams(Params); + With Params Do + Begin + If Show_Window_in_Taskbar Then + Begin + ExStyle := ExStyle Or WS_EX_APPWINDOW And Not WS_EX_TOOLWINDOW; + ExStyle := ExStyle Or WS_EX_TOPMOST Or WS_EX_NOACTIVATE; + WndParent := GetDesktopwindow; + End + Else If Not Show_Window_in_Taskbar Then + Begin + ExStyle := ExStyle And Not WS_EX_APPWINDOW; + End; + End; End; -//////////////////////////////////////////////////////////////////////// +/// ///////////////////////////////////////////////////////////////////// -Procedure TLayoutViewer.FormClose(Sender: TObject; - Var Action: TCloseAction); +Procedure TLayoutViewer.FormClose(Sender: TObject; Var Action: TCloseAction); Begin - If Self.Top >= 0 Then LayoutViewerPosY := IntToStr(Self.Top); - If Self.Left >= 0 Then LayoutViewerPosX := IntToStr(Self.Left); + If Self.Top >= 0 Then + LayoutViewerPosY := IntToStr(Self.Top); + If Self.Left >= 0 Then + LayoutViewerPosX := IntToStr(Self.Left); - Action := caFree; + Action := caFree; - LayoutViewer := Nil; + LayoutViewer := Nil; End; -//////////////////////////////////////////////////////////////////////// +/// ///////////////////////////////////////////////////////////////////// Procedure TLayoutViewer.FormCreate(Sender: TObject); Var - errorPos : Integer; - PosX, PosY : integer; + errorPos: Integer; + PosX, PosY: Integer; Begin - SetWindowLong(Application.Handle, GWL_EXSTYLE, - GetWindowLong(Application.Handle, GWL_EXSTYLE) Or WS_EX_APPWindow); - - - - Val(LayoutViewerSize, CurrentSize, errorPos); - PosX := StrToInt(LayoutViewerPosX); - PosY := StrToInt(LayoutViewerPosY); + SetWindowLong(Application.Handle, GWL_EXSTYLE, + GetWindowLong(Application.Handle, GWL_EXSTYLE) Or WS_EX_APPWINDOW); - If SavePosLayoutViewer = 'YES' Then Begin - If (PosX > Screen.Width) Or (PosX < 0) Then - PosX := (Screen.Width Div 2) - (Self.Width Div 2); + Val(LayoutViewerSize, CurrentSize, errorPos); + PosX := StrToInt(LayoutViewerPosX); + PosY := StrToInt(LayoutViewerPosY); - If (PosY > Screen.Height) Or (PosY < 0) Then - PosY := (Screen.Height Div 2) - (Self.Height Div 2); + If SavePosLayoutViewer = 'YES' Then + Begin + If (PosX > Screen.Width) Or (PosX < 0) Then + PosX := (Screen.Width Div 2) - (Self.Width Div 2); + If (PosY > Screen.Height) Or (PosY < 0) Then + PosY := (Screen.Height Div 2) - (Self.Height Div 2); - Self.Top := PosY; - Self.Left := PosX; - End - Else Begin - Self.Top := (Screen.Height Div 2) - (Self.Height Div 2); - Self.Left := (Screen.Width Div 2) - (Self.Width Div 2); - End; + Self.Top := PosY; + Self.Left := PosX; + End + Else + Begin + Self.Top := (Screen.Height Div 2) - (Self.Height Div 2); + Self.Left := (Screen.Width Div 2) - (Self.Width Div 2); + End; - LayerDisplay := 1; - UpdateLayout; + LayerDisplay := 1; + UpdateLayout; - SetMyZOrder; + SetMyZOrder; End; -//////////////////////////////////////////////////////////////////////// +/// ///////////////////////////////////////////////////////////////////// Procedure TLayoutViewer.ResizeMe(PICSRC: TImage; picSize: Integer); Var - X, Y : Integer; - J : Integer; - MinimumWidth, MinimumHeight: Integer; + X, Y: Integer; + J: Integer; + MinimumWidth, MinimumHeight: Integer; Begin - If Self.WindowState = wsMinimized Then - Self.WindowState := wsNormal; - - X := (tmpPicture.ClientWidth Div 100) * picSize; - y := (tmpPicture.ClientHeight Div 100) * picSize; - - If ((X) > Screen.Width) Then Begin - j := picSize; - While j >= 50 Do Begin - X := (tmpPicture.ClientWidth Div 100) * J; - y := (tmpPicture.ClientHeight Div 100) * J; - If (X < Screen.Width) Then Begin - LayoutViewerSize := IntToStr(J) + '%'; - CurrentSize := J; - Break; - End; - Dec(j, 10); - End; - End; - - picRSetMode.Width := X; - picRSetMode.Height := y; - ResizeImage(PICSRC, picRSetMode, tmpPicture.ClientWidth, tmpPicture.ClientHeight, X, y); - picRSetMode.Refresh; - - //======================================== - - - MinimumWidth := 560; - MinimumHeight := 70; - - If (picRSetMode.Width + 10) < MinimumWidth Then - Self.Width := MinimumWidth - Else - Self.Width := picRSetMode.Width + 10; - - - If (picRSetMode.Top + picRSetMode.Height + 30) < MinimumHeight Then - Self.Height := MinimumHeight - Else - Self.Height := picRSetMode.Top + picRSetMode.Height + 30; - - - - picRSetMode.Left := (Self.Width Div 2) - (picRSetMode.Width Div 2); + If Self.WindowState = wsMinimized Then + Self.WindowState := wsNormal; + + X := (tmpPicture.ClientWidth Div 100) * picSize; + Y := (tmpPicture.ClientHeight Div 100) * picSize; + + If ((X) > Screen.Width) Then + Begin + J := picSize; + While J >= 50 Do + Begin + X := (tmpPicture.ClientWidth Div 100) * J; + Y := (tmpPicture.ClientHeight Div 100) * J; + If (X < Screen.Width) Then + Begin + LayoutViewerSize := IntToStr(J) + '%'; + CurrentSize := J; + Break; + End; + Dec(J, 10); + End; + End; + + picRSetMode.Width := X; + picRSetMode.Height := Y; + ResizeImage(PICSRC, picRSetMode, tmpPicture.ClientWidth, + tmpPicture.ClientHeight, X, Y); + picRSetMode.Refresh; + + // ======================================== + + MinimumWidth := 560; + MinimumHeight := 70; + + If (picRSetMode.Width + 10) < MinimumWidth Then + Self.Width := MinimumWidth + Else + Self.Width := picRSetMode.Width + 10; + + If (picRSetMode.Top + picRSetMode.Height + 30) < MinimumHeight Then + Self.Height := MinimumHeight + Else + Self.Height := picRSetMode.Top + picRSetMode.Height + 30; + + picRSetMode.Left := (Self.Width Div 2) - (picRSetMode.Width Div 2); End; -//////////////////////////////////////////////////////////////////////// +/// ///////////////////////////////////////////////////////////////////// -Procedure TLayoutViewer.ResizeImage(Var SourcePictureBox, - DestinationPictureBox: TImage; oldx, oldy, NewX, NewY: Integer); +Procedure TLayoutViewer.ResizeImage(Var SourcePictureBox, DestinationPictureBox + : TImage; oldx, oldy, NewX, NewY: Integer); Begin - DestinationPictureBox.Picture := Nil; - SetStretchBltMode(DestinationPictureBox.Canvas.Handle, HALFTONE); - StretchBlt(DestinationPictureBox.Canvas.Handle, 0, 0, NewX, NewY, SourcePictureBox.Canvas.Handle, 0, 0, oldx, oldy, SRCCOPY); - DestinationPictureBox.Refresh; + DestinationPictureBox.Picture := Nil; + SetStretchBltMode(DestinationPictureBox.Canvas.Handle, HALFTONE); + StretchBlt(DestinationPictureBox.Canvas.Handle, 0, 0, NewX, NewY, + SourcePictureBox.Canvas.Handle, 0, 0, oldx, oldy, SRCCOPY); + DestinationPictureBox.Refresh; End; -//////////////////////////////////////////////////////////////////////// +/// ///////////////////////////////////////////////////////////////////// Procedure TLayoutViewer.SetMyZOrder; Begin - If ShowLayoutOnTop = 'YES' Then Begin - TOPMOST(Self.handle); - but_OnTop.Down := True; - End - Else Begin - NoTopMost(Self.handle); - but_OnTop.Down := False; - End; - If IsFormVisible('TopBar') = True Then TOPMOST(TopBar.handle); + If ShowLayoutOnTop = 'YES' Then + Begin + TOPMOST(Self.Handle); + but_OnTop.Down := True; + End + Else + Begin + NoTopMost(Self.Handle); + but_OnTop.Down := False; + End; + If IsFormVisible('TopBar') = True Then + TOPMOST(TopBar.Handle); End; -//////////////////////////////////////////////////////////////////////// +/// ///////////////////////////////////////////////////////////////////// Procedure TLayoutViewer.UpdateImageSize(picSize: Integer); Var - CurrentX, CurrentY : Integer; + CurrentX, CurrentY: Integer; Begin - LayoutViewerSize := IntToStr(picSize) + '%'; - CurrentSize := picSize; - - If Lowercase(KeyboardLayout) = 'avrophonetic*' Then Begin - If LayerDisplay = 1 Then Begin - tmpPicture.Picture.Assign(Pic_LayoutNormal); - ResizeMe(tmpPicture, picSize); - End - Else If LayerDisplay = 2 Then Begin - picRSetMode.Picture := Nil; - tmpPicture.Picture := Nil; - CurrentX := (picRSetMode.ClientWidth Div 2) - (picRSetMode.Canvas.TextWidth('No image To display!') Div 2); - CurrentY := (picRSetMode.ClientHeight Div 2) - (picRSetMode.Canvas.TextHeight('No image To display!') Div 2); - picRSetMode.Canvas.Brush.Style := bsClear; - picRSetMode.Canvas.TextOut(CurrentX, CurrentY, 'No image To display!'); - picRSetMode.Refresh; - End; - End - Else Begin - If LayerDisplay = 1 Then Begin - If Not (Pic_LayoutNormal = Nil) Then Begin - tmpPicture.Picture.Assign(Pic_LayoutNormal); - ResizeMe(tmpPicture, picSize); - End - Else Begin - picRSetMode.Picture := Nil; - tmpPicture.Picture := Nil; - CurrentX := (picRSetMode.ClientWidth Div 2) - (picRSetMode.Canvas.TextWidth('No image To display!') Div 2); - CurrentY := (picRSetMode.ClientHeight Div 2) - (picRSetMode.Canvas.TextHeight('No image To display!') Div 2); - picRSetMode.Canvas.Brush.Style := bsClear; - picRSetMode.Canvas.TextOut(CurrentX, CurrentY, 'No image To display!'); - picRSetMode.Refresh; - End; - End - Else If LayerDisplay = 2 Then Begin - If Not (Pic_LayoutAltGr = Nil) Then Begin - tmpPicture.Picture.Assign(Pic_LayoutAltGr); - ResizeMe(tmpPicture, picSize); - End - Else Begin - picRSetMode.Picture := Nil; - tmpPicture.Picture := Nil; - CurrentX := (picRSetMode.ClientWidth Div 2) - (picRSetMode.Canvas.TextWidth('No image To display!') Div 2); - CurrentY := (picRSetMode.ClientHeight Div 2) - (picRSetMode.Canvas.TextHeight('No image To display!') Div 2); - picRSetMode.Canvas.Brush.Style := bsClear; - picRSetMode.Canvas.TextOut(CurrentX, CurrentY, 'No image To display!'); - picRSetMode.Refresh; - End; - End; - End; + LayoutViewerSize := IntToStr(picSize) + '%'; + CurrentSize := picSize; + + If Lowercase(KeyboardLayout) = 'avrophonetic*' Then + Begin + If LayerDisplay = 1 Then + Begin + tmpPicture.Picture.Assign(Pic_LayoutNormal); + ResizeMe(tmpPicture, picSize); + End + Else If LayerDisplay = 2 Then + Begin + picRSetMode.Picture := Nil; + tmpPicture.Picture := Nil; + CurrentX := (picRSetMode.ClientWidth Div 2) - + (picRSetMode.Canvas.TextWidth('No image To display!') Div 2); + CurrentY := (picRSetMode.ClientHeight Div 2) - + (picRSetMode.Canvas.TextHeight('No image To display!') Div 2); + picRSetMode.Canvas.Brush.Style := bsClear; + picRSetMode.Canvas.TextOut(CurrentX, CurrentY, 'No image To display!'); + picRSetMode.Refresh; + End; + End + Else + Begin + If LayerDisplay = 1 Then + Begin + If Not(Pic_LayoutNormal = Nil) Then + Begin + tmpPicture.Picture.Assign(Pic_LayoutNormal); + ResizeMe(tmpPicture, picSize); + End + Else + Begin + picRSetMode.Picture := Nil; + tmpPicture.Picture := Nil; + CurrentX := (picRSetMode.ClientWidth Div 2) - + (picRSetMode.Canvas.TextWidth('No image To display!') Div 2); + CurrentY := (picRSetMode.ClientHeight Div 2) - + (picRSetMode.Canvas.TextHeight('No image To display!') Div 2); + picRSetMode.Canvas.Brush.Style := bsClear; + picRSetMode.Canvas.TextOut(CurrentX, CurrentY, 'No image To display!'); + picRSetMode.Refresh; + End; + End + Else If LayerDisplay = 2 Then + Begin + If Not(Pic_LayoutAltGr = Nil) Then + Begin + tmpPicture.Picture.Assign(Pic_LayoutAltGr); + ResizeMe(tmpPicture, picSize); + End + Else + Begin + picRSetMode.Picture := Nil; + tmpPicture.Picture := Nil; + CurrentX := (picRSetMode.ClientWidth Div 2) - + (picRSetMode.Canvas.TextWidth('No image To display!') Div 2); + CurrentY := (picRSetMode.ClientHeight Div 2) - + (picRSetMode.Canvas.TextHeight('No image To display!') Div 2); + picRSetMode.Canvas.Brush.Style := bsClear; + picRSetMode.Canvas.TextOut(CurrentX, CurrentY, 'No image To display!'); + picRSetMode.Refresh; + End; + End; + End; End; -//////////////////////////////////////////////////////////////////////// +/// ///////////////////////////////////////////////////////////////////// Procedure TLayoutViewer.UpdateLayout; Var - KeyboardLayoutPath : String; + KeyboardLayoutPath: String; Begin - KeyboardLayout := AvroMainForm1.GetMyCurrentLayout; - If Lowercase(KeyboardLayout) = 'avrophonetic*' Then Begin - Caption := 'Avro Phonetic :: Layout Viewer'; - KeyboardLayoutPath := KeyboardLayout; - End - Else Begin - Caption := KeyboardLayout + ' :: Layout Viewer'; - KeyboardLayoutPath := GetAvroDataDir + 'Keyboard Layouts\' + KeyboardLayout + '.avrolayout'; - End; - - LoadKeyboardLayoutImages(KeyboardLayoutPath, Pic_LayoutNormal, Pic_LayoutAltGr); - UpdateImageSize(CurrentSize); + KeyboardLayout := AvroMainForm1.GetMyCurrentLayout; + If Lowercase(KeyboardLayout) = 'avrophonetic*' Then + Begin + Caption := 'Avro Phonetic :: Layout Viewer'; + KeyboardLayoutPath := KeyboardLayout; + End + Else + Begin + Caption := KeyboardLayout + ' :: Layout Viewer'; + KeyboardLayoutPath := GetAvroDataDir + 'Keyboard Layouts\' + KeyboardLayout + + '.avrolayout'; + End; + + LoadKeyboardLayoutImages(KeyboardLayoutPath, Pic_LayoutNormal, + Pic_LayoutAltGr); + UpdateImageSize(CurrentSize); End; -//////////////////////////////////////////////////////////////////////// - +/// ///////////////////////////////////////////////////////////////////// End. - diff --git a/Keyboard and Spell checker/Forms/uTopBar.dfm b/Keyboard and Spell checker/Forms/uTopBar.dfm index 8cce604..f331530 100644 --- a/Keyboard and Spell checker/Forms/uTopBar.dfm +++ b/Keyboard and Spell checker/Forms/uTopBar.dfm @@ -303,13 +303,10 @@ object TopBar: TTopBar Left = 480 Top = 192 end - object JvBalloonHint1: TJvBalloonHint - CustomAnimationStyle = atNone - DefaultHeader = 'Avro Keyboard' - Options = [boUseDefaultIcon, boUseDefaultImageIndex, boShowCloseBtn] - UseBalloonAsApplicationHint = True - Left = 384 - Top = 200 + object BalloonHint1: TBalloonHint + HideAfter = 5000 + Left = 336 + Top = 184 end object HintTimer: TTimer Enabled = False diff --git a/Keyboard and Spell checker/Forms/uTopBar.pas b/Keyboard and Spell checker/Forms/uTopBar.pas index 78b27f1..aac1a26 100644 --- a/Keyboard and Spell checker/Forms/uTopBar.pas +++ b/Keyboard and Spell checker/Forms/uTopBar.pas @@ -30,280 +30,301 @@ Interface Uses - Windows, - Messages, - SysUtils, - Variants, - Classes, - Graphics, - Controls, - Forms, - Dialogs, - ExtCtrls, - Menus, - DateUtils, - JvComponentBase, - JvBalloonHint, - SHELLAPI; + Windows, + Messages, + SysUtils, + Variants, + Classes, + Graphics, + Controls, + Forms, + Dialogs, + ExtCtrls, + Menus, + DateUtils, + SHELLAPI; Type - ButtonState = (State1, State2); + ButtonState = (State1, State2); Const - m_GlowEffect: Boolean = True; - m_BlendingStep: Integer = 51; { 255/51=5 step } - m_TimerInterval: Integer = 30; { 5 step in 30*5=150 milisecond } + m_GlowEffect: Boolean = True; + m_BlendingStep: Integer = 51; { 255/51=5 step } + m_TimerInterval: Integer = 30; { 5 step in 30*5=150 milisecond } Type - TTopBar = Class(TForm) - ImgMain: TImage; - ImgAppIcon: TImage; - ImgButtonMode: TImage; - ImgButtonLayoutDown: TImage; - ImgButtonLayout: TImage; - ImgButtonMouse: TImage; - ImgButtonTools: TImage; - ImgButtonWWW: TImage; - ImgButtonHelp: TImage; - ImgButtonMinimize: TImage; - TmrAppIcon: TTimer; - TmrButtonMode: TTimer; - TmrButtonLayoutDown: TTimer; - TmrButtonLayout: TTimer; - TmrButtonMouse: TTimer; - TmrButtonTools: TTimer; - TmrButtonWWW: TTimer; - TmrButtonHelp: TTimer; - TmrButtonMinimize: TTimer; - TransparencyTimer: TTimer; - JvBalloonHint1: TJvBalloonHint; - HintTimer: TTimer; - Procedure FormCreate(Sender: TObject); - Procedure ImgAppIconMouseEnter(Sender: TObject); - Procedure ImgButtonModeMouseEnter(Sender: TObject); - Procedure ImgButtonLayoutDownMouseEnter(Sender: TObject); - Procedure ImgButtonLayoutMouseEnter(Sender: TObject); - Procedure ImgButtonMouseMouseEnter(Sender: TObject); - Procedure ImgButtonToolsMouseEnter(Sender: TObject); - Procedure ImgButtonWWWMouseEnter(Sender: TObject); - Procedure ImgButtonHelpMouseEnter(Sender: TObject); - Procedure ImgButtonMinimizeMouseEnter(Sender: TObject); - Procedure ImgAppIconMouseLeave(Sender: TObject); - Procedure ImgButtonModeMouseLeave(Sender: TObject); - Procedure ImgButtonLayoutDownMouseLeave(Sender: TObject); - Procedure ImgButtonLayoutMouseLeave(Sender: TObject); - Procedure ImgButtonMouseMouseLeave(Sender: TObject); - Procedure ImgButtonToolsMouseLeave(Sender: TObject); - Procedure ImgButtonWWWMouseLeave(Sender: TObject); - Procedure ImgButtonHelpMouseLeave(Sender: TObject); - Procedure ImgButtonMinimizeMouseLeave(Sender: TObject); - Procedure ImgAppIconDblClick(Sender: TObject); - Procedure ImgButtonModeDblClick(Sender: TObject); - Procedure ImgButtonLayoutDownDblClick(Sender: TObject); - Procedure ImgButtonLayoutDblClick(Sender: TObject); - Procedure ImgButtonMouseDblClick(Sender: TObject); - Procedure ImgButtonToolsDblClick(Sender: TObject); - Procedure ImgButtonWWWDblClick(Sender: TObject); - Procedure ImgButtonHelpDblClick(Sender: TObject); - Procedure ImgButtonMinimizeDblClick(Sender: TObject); - Procedure ImgAppIconMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - Procedure ImgButtonModeMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - Procedure ImgButtonLayoutDownMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - Procedure ImgButtonLayoutMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - Procedure ImgButtonMouseMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - Procedure ImgButtonToolsMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - Procedure ImgButtonWWWMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - Procedure ImgButtonHelpMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - Procedure ImgButtonMinimizeMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - Procedure ImgAppIconMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - Procedure ImgButtonModeMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - Procedure ImgButtonLayoutDownMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - Procedure ImgButtonLayoutMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - Procedure ImgButtonMouseMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - Procedure ImgButtonToolsMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - Procedure ImgButtonWWWMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - Procedure ImgButtonHelpMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - Procedure ImgButtonMinimizeMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - Procedure TmrButtonModeTimer(Sender: TObject); - Procedure TmrAppIconTimer(Sender: TObject); - Procedure TmrButtonLayoutTimer(Sender: TObject); - Procedure TmrButtonLayoutDownTimer(Sender: TObject); - Procedure TmrButtonMouseTimer(Sender: TObject); - Procedure TmrButtonToolsTimer(Sender: TObject); - Procedure TmrButtonWWWTimer(Sender: TObject); - Procedure TmrButtonHelpTimer(Sender: TObject); - Procedure TmrButtonMinimizeTimer(Sender: TObject); - Procedure FormClose(Sender: TObject; Var Action: TCloseAction); - Procedure FormKeyDown(Sender: TObject; Var Key: Word; Shift: TShiftState); - Procedure TransparencyTimerTimer(Sender: TObject); - Procedure FormShow(Sender: TObject); - Procedure FormHide(Sender: TObject); - Procedure HintTimerTimer(Sender: TObject); - - Private - { Private declarations } - - PrevSkin: String; - - ButtonMode_State: ButtonState; - - AppIcon_MouseIn: Boolean; - ButtonMode_MouseIn: Boolean; - ButtonLayoutDown_MouseIn: Boolean; - ButtonLayout_MouseIn: Boolean; - ButtonMouse_MouseIn: Boolean; - ButtonTools_MouseIn: Boolean; - ButtonWWW_MouseIn: Boolean; - ButtonHelp_MouseIn: Boolean; - ButtonMinimize_MouseIn: Boolean; - - AppIcon_MouseDown: Boolean; - ButtonMode_MouseDown: Boolean; - ButtonLayoutDown_MouseDown: Boolean; - ButtonLayout_MouseDown: Boolean; - ButtonMouse_MouseDown: Boolean; - ButtonTools_MouseDown: Boolean; - ButtonWWW_MouseDown: Boolean; - ButtonHelp_MouseDown: Boolean; - ButtonMinimize_MouseDown: Boolean; - - AppIcon_TranparentValue: Integer; - ButtonMode_TranparentValue: Integer; - ButtonLayoutDown_TranparentValue: Integer; - ButtonLayout_TranparentValue: Integer; - ButtonMouse_TranparentValue: Integer; - ButtonTools_TranparentValue: Integer; - ButtonWWW_TranparentValue: Integer; - ButtonHelp_TranparentValue: Integer; - ButtonMinimize_TranparentValue: Integer; - - Procedure AppIcon_DrawState; - Procedure ButtonMode_DrawState; - Procedure ButtonLayoutDown_DrawState; - Procedure ButtonLayout_DrawState; - Procedure ButtonMouse_DrawState; - Procedure ButtonTools_DrawState; - Procedure ButtonWWW_DrawState; - Procedure ButtonHelp_DrawState; - Procedure ButtonMinimize_DrawState; - - Procedure AppIcon_DrawDown; - Procedure ButtonMode_DrawDown; - Procedure ButtonLayoutDown_DrawDown; - Procedure ButtonLayout_DrawDown; - Procedure ButtonMouse_DrawDown; - Procedure ButtonTools_DrawDown; - Procedure ButtonWWW_DrawDown; - Procedure ButtonHelp_DrawDown; - Procedure ButtonMinimize_DrawDown; - - Procedure AppIcon_DrawUpOver; - Procedure ButtonMode_DrawUpOver; - Procedure ButtonLayoutDown_DrawUpOver; - Procedure ButtonLayout_DrawUpOver; - Procedure ButtonMouse_DrawUpOver; - Procedure ButtonTools_DrawUpOver; - Procedure ButtonWWW_DrawUpOver; - Procedure ButtonHelp_DrawUpOver; - Procedure ButtonMinimize_DrawUpOver; - - Procedure WMDROPFILES(Var msg: TWMDropFiles); Message WM_DROPFILES; - - Public - { Public declarations } - BMP_AppIcon: TBitmap; - BMP_AppIcon_Over: TBitmap; - BMP_AppIcon_Down: TBitmap; - - BMP_ButtonModeE: TBitmap; - BMP_ButtonModeE_Over: TBitmap; - BMP_ButtonModeE_Down: TBitmap; - BMP_ButtonModeB: TBitmap; - BMP_ButtonModeB_Over: TBitmap; - BMP_ButtonModeB_Down: TBitmap; - - BMP_ButtonLayoutDown: TBitmap; - BMP_ButtonLayoutDown_Over: TBitmap; - BMP_ButtonLayoutDown_Down: TBitmap; - - BMP_ButtonLayout: TBitmap; - BMP_ButtonLayout_Over: TBitmap; - BMP_ButtonLayout_Down: TBitmap; - - BMP_ButtonMouse: TBitmap; - BMP_ButtonMouse_Over: TBitmap; - BMP_ButtonMouse_Down: TBitmap; - - BMP_ButtonTools: TBitmap; - BMP_ButtonTools_Over: TBitmap; - BMP_ButtonTools_Down: TBitmap; - - BMP_ButtonWWW: TBitmap; - BMP_ButtonWWW_Over: TBitmap; - BMP_ButtonWWW_Down: TBitmap; - - BMP_ButtonHelp: TBitmap; - BMP_ButtonHelp_Over: TBitmap; - BMP_ButtonHelp_Down: TBitmap; - - BMP_ButtonMinimize: TBitmap; - BMP_ButtonMinimize_Over: TBitmap; - BMP_ButtonMinimize_Down: TBitmap; - - ApplicationClosing: Boolean; - - Procedure ApplySkin; - Procedure SetButtonModeState(ST: ButtonState); - Procedure InitHints; - Protected - Procedure CreateParams(Var Params: TCreateParams); Override; - - End; + TTopBar = Class(TForm) + ImgMain: TImage; + ImgAppIcon: TImage; + ImgButtonMode: TImage; + ImgButtonLayoutDown: TImage; + ImgButtonLayout: TImage; + ImgButtonMouse: TImage; + ImgButtonTools: TImage; + ImgButtonWWW: TImage; + ImgButtonHelp: TImage; + ImgButtonMinimize: TImage; + TmrAppIcon: TTimer; + TmrButtonMode: TTimer; + TmrButtonLayoutDown: TTimer; + TmrButtonLayout: TTimer; + TmrButtonMouse: TTimer; + TmrButtonTools: TTimer; + TmrButtonWWW: TTimer; + TmrButtonHelp: TTimer; + TmrButtonMinimize: TTimer; + TransparencyTimer: TTimer; + BalloonHint1: TBalloonHint; + HintTimer: TTimer; + Procedure FormCreate(Sender: TObject); + Procedure ImgAppIconMouseEnter(Sender: TObject); + Procedure ImgButtonModeMouseEnter(Sender: TObject); + Procedure ImgButtonLayoutDownMouseEnter(Sender: TObject); + Procedure ImgButtonLayoutMouseEnter(Sender: TObject); + Procedure ImgButtonMouseMouseEnter(Sender: TObject); + Procedure ImgButtonToolsMouseEnter(Sender: TObject); + Procedure ImgButtonWWWMouseEnter(Sender: TObject); + Procedure ImgButtonHelpMouseEnter(Sender: TObject); + Procedure ImgButtonMinimizeMouseEnter(Sender: TObject); + Procedure ImgAppIconMouseLeave(Sender: TObject); + Procedure ImgButtonModeMouseLeave(Sender: TObject); + Procedure ImgButtonLayoutDownMouseLeave(Sender: TObject); + Procedure ImgButtonLayoutMouseLeave(Sender: TObject); + Procedure ImgButtonMouseMouseLeave(Sender: TObject); + Procedure ImgButtonToolsMouseLeave(Sender: TObject); + Procedure ImgButtonWWWMouseLeave(Sender: TObject); + Procedure ImgButtonHelpMouseLeave(Sender: TObject); + Procedure ImgButtonMinimizeMouseLeave(Sender: TObject); + Procedure ImgAppIconDblClick(Sender: TObject); + Procedure ImgButtonModeDblClick(Sender: TObject); + Procedure ImgButtonLayoutDownDblClick(Sender: TObject); + Procedure ImgButtonLayoutDblClick(Sender: TObject); + Procedure ImgButtonMouseDblClick(Sender: TObject); + Procedure ImgButtonToolsDblClick(Sender: TObject); + Procedure ImgButtonWWWDblClick(Sender: TObject); + Procedure ImgButtonHelpDblClick(Sender: TObject); + Procedure ImgButtonMinimizeDblClick(Sender: TObject); + Procedure ImgAppIconMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + Procedure ImgButtonModeMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + Procedure ImgButtonLayoutDownMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + Procedure ImgButtonLayoutMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + Procedure ImgButtonMouseMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + Procedure ImgButtonToolsMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + Procedure ImgButtonWWWMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + Procedure ImgButtonHelpMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + Procedure ImgButtonMinimizeMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + Procedure ImgAppIconMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + Procedure ImgButtonModeMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + Procedure ImgButtonLayoutDownMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); + Procedure ImgButtonLayoutMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + Procedure ImgButtonMouseMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + Procedure ImgButtonToolsMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + Procedure ImgButtonWWWMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + Procedure ImgButtonHelpMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + Procedure ImgButtonMinimizeMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + Procedure TmrButtonModeTimer(Sender: TObject); + Procedure TmrAppIconTimer(Sender: TObject); + Procedure TmrButtonLayoutTimer(Sender: TObject); + Procedure TmrButtonLayoutDownTimer(Sender: TObject); + Procedure TmrButtonMouseTimer(Sender: TObject); + Procedure TmrButtonToolsTimer(Sender: TObject); + Procedure TmrButtonWWWTimer(Sender: TObject); + Procedure TmrButtonHelpTimer(Sender: TObject); + Procedure TmrButtonMinimizeTimer(Sender: TObject); + Procedure FormClose(Sender: TObject; Var Action: TCloseAction); + Procedure FormKeyDown(Sender: TObject; Var Key: Word; Shift: TShiftState); + Procedure TransparencyTimerTimer(Sender: TObject); + Procedure FormShow(Sender: TObject); + Procedure FormHide(Sender: TObject); + Procedure HintTimerTimer(Sender: TObject); + + Private + { Private declarations } + + PrevSkin: String; + + ButtonMode_State: ButtonState; + + AppIcon_MouseIn: Boolean; + ButtonMode_MouseIn: Boolean; + ButtonLayoutDown_MouseIn: Boolean; + ButtonLayout_MouseIn: Boolean; + ButtonMouse_MouseIn: Boolean; + ButtonTools_MouseIn: Boolean; + ButtonWWW_MouseIn: Boolean; + ButtonHelp_MouseIn: Boolean; + ButtonMinimize_MouseIn: Boolean; + + AppIcon_MouseDown: Boolean; + ButtonMode_MouseDown: Boolean; + ButtonLayoutDown_MouseDown: Boolean; + ButtonLayout_MouseDown: Boolean; + ButtonMouse_MouseDown: Boolean; + ButtonTools_MouseDown: Boolean; + ButtonWWW_MouseDown: Boolean; + ButtonHelp_MouseDown: Boolean; + ButtonMinimize_MouseDown: Boolean; + + AppIcon_TranparentValue: Integer; + ButtonMode_TranparentValue: Integer; + ButtonLayoutDown_TranparentValue: Integer; + ButtonLayout_TranparentValue: Integer; + ButtonMouse_TranparentValue: Integer; + ButtonTools_TranparentValue: Integer; + ButtonWWW_TranparentValue: Integer; + ButtonHelp_TranparentValue: Integer; + ButtonMinimize_TranparentValue: Integer; + + Procedure AppIcon_DrawState; + Procedure ButtonMode_DrawState; + Procedure ButtonLayoutDown_DrawState; + Procedure ButtonLayout_DrawState; + Procedure ButtonMouse_DrawState; + Procedure ButtonTools_DrawState; + Procedure ButtonWWW_DrawState; + Procedure ButtonHelp_DrawState; + Procedure ButtonMinimize_DrawState; + + Procedure AppIcon_DrawDown; + Procedure ButtonMode_DrawDown; + Procedure ButtonLayoutDown_DrawDown; + Procedure ButtonLayout_DrawDown; + Procedure ButtonMouse_DrawDown; + Procedure ButtonTools_DrawDown; + Procedure ButtonWWW_DrawDown; + Procedure ButtonHelp_DrawDown; + Procedure ButtonMinimize_DrawDown; + + Procedure AppIcon_DrawUpOver; + Procedure ButtonMode_DrawUpOver; + Procedure ButtonLayoutDown_DrawUpOver; + Procedure ButtonLayout_DrawUpOver; + Procedure ButtonMouse_DrawUpOver; + Procedure ButtonTools_DrawUpOver; + Procedure ButtonWWW_DrawUpOver; + Procedure ButtonHelp_DrawUpOver; + Procedure ButtonMinimize_DrawUpOver; + + Procedure WMDROPFILES(Var msg: TWMDropFiles); Message WM_DROPFILES; + + Public + { Public declarations } + BMP_AppIcon: TBitmap; + BMP_AppIcon_Over: TBitmap; + BMP_AppIcon_Down: TBitmap; + + BMP_ButtonModeE: TBitmap; + BMP_ButtonModeE_Over: TBitmap; + BMP_ButtonModeE_Down: TBitmap; + BMP_ButtonModeB: TBitmap; + BMP_ButtonModeB_Over: TBitmap; + BMP_ButtonModeB_Down: TBitmap; + + BMP_ButtonLayoutDown: TBitmap; + BMP_ButtonLayoutDown_Over: TBitmap; + BMP_ButtonLayoutDown_Down: TBitmap; + + BMP_ButtonLayout: TBitmap; + BMP_ButtonLayout_Over: TBitmap; + BMP_ButtonLayout_Down: TBitmap; + + BMP_ButtonMouse: TBitmap; + BMP_ButtonMouse_Over: TBitmap; + BMP_ButtonMouse_Down: TBitmap; + + BMP_ButtonTools: TBitmap; + BMP_ButtonTools_Over: TBitmap; + BMP_ButtonTools_Down: TBitmap; + + BMP_ButtonWWW: TBitmap; + BMP_ButtonWWW_Over: TBitmap; + BMP_ButtonWWW_Down: TBitmap; + + BMP_ButtonHelp: TBitmap; + BMP_ButtonHelp_Over: TBitmap; + BMP_ButtonHelp_Down: TBitmap; + + BMP_ButtonMinimize: TBitmap; + BMP_ButtonMinimize_Over: TBitmap; + BMP_ButtonMinimize_Down: TBitmap; + + ApplicationClosing: Boolean; + + Procedure ApplySkin; + Procedure SetButtonModeState(ST: ButtonState); + Procedure InitHints; + Protected + Procedure CreateParams(Var Params: TCreateParams); Override; + + End; Var - TopBar: TTopBar; + TopBar: TTopBar; Implementation {$R *.dfm} Uses - SkinLoader, - uForm1, - uFileFolderHandling, - uRegistrySettings, - uWindowHandlers, - KeyboardLayoutLoader; + SkinLoader, + uForm1, + uFileFolderHandling, + uRegistrySettings, + uWindowHandlers, + KeyboardLayoutLoader; { =============================================================================== } Procedure TTopBar.ApplySkin; Begin - If LowerCase(PrevSkin) = LowerCase(InterfaceSkin) Then - exit; + If LowerCase(PrevSkin) = LowerCase(InterfaceSkin) Then + exit; - If LowerCase(InterfaceSkin) = 'internalskin*' Then - LoadSkin('internalskin*') - Else Begin - If LoadSkin(GetAvroDataDir + 'Skin\' + InterfaceSkin + '.avroskin') = False Then Begin - Application.MessageBox(PChar('Error loading' + GetAvroDataDir + 'Skin\' + InterfaceSkin + '.avroskin' + #10 + '' + #10 + 'Skin switched back to Default one.'), 'Avro Keyboard', - MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - InterfaceSkin := 'internalskin*'; - LoadSkin('internalskin*'); - End; - End; - PrevSkin := InterfaceSkin; + If LowerCase(InterfaceSkin) = 'internalskin*' Then + LoadSkin('internalskin*') + Else + Begin + If LoadSkin(GetAvroDataDir + 'Skin\' + InterfaceSkin + '.avroskin') + = False Then + Begin + Application.MessageBox(PChar('Error loading' + GetAvroDataDir + 'Skin\' + + InterfaceSkin + '.avroskin' + #10 + '' + #10 + + 'Skin switched back to Default one.'), 'Avro Keyboard', + MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); + InterfaceSkin := 'internalskin*'; + LoadSkin('internalskin*'); + End; + End; + PrevSkin := InterfaceSkin; - ImgAppIcon.Picture.Bitmap.Assign(BMP_AppIcon); - ImgButtonMode.Picture.Bitmap.Assign(BMP_ButtonModeE); - ImgButtonLayoutDown.Picture.Bitmap.Assign(BMP_ButtonLayoutDown); - ImgButtonLayout.Picture.Bitmap.Assign(BMP_ButtonLayout); - ImgButtonMouse.Picture.Bitmap.Assign(BMP_ButtonMouse); - ImgButtonTools.Picture.Bitmap.Assign(BMP_ButtonTools); - ImgButtonWWW.Picture.Bitmap.Assign(BMP_ButtonWWW); - ImgButtonHelp.Picture.Bitmap.Assign(BMP_ButtonHelp); - ImgButtonMinimize.Picture.Bitmap.Assign(BMP_ButtonMinimize); + ImgAppIcon.Picture.Bitmap.Assign(BMP_AppIcon); + ImgButtonMode.Picture.Bitmap.Assign(BMP_ButtonModeE); + ImgButtonLayoutDown.Picture.Bitmap.Assign(BMP_ButtonLayoutDown); + ImgButtonLayout.Picture.Bitmap.Assign(BMP_ButtonLayout); + ImgButtonMouse.Picture.Bitmap.Assign(BMP_ButtonMouse); + ImgButtonTools.Picture.Bitmap.Assign(BMP_ButtonTools); + ImgButtonWWW.Picture.Bitmap.Assign(BMP_ButtonWWW); + ImgButtonHelp.Picture.Bitmap.Assign(BMP_ButtonHelp); + ImgButtonMinimize.Picture.Bitmap.Assign(BMP_ButtonMinimize); End; @@ -312,460 +333,505 @@ Procedure TTopBar.FormClose(Sender: TObject; Var Action: TCloseAction); Begin - SaveUISettings; + SaveUISettings; - BMP_AppIcon.Free; - BMP_AppIcon_Over.Free; - BMP_AppIcon_Down.Free; + BMP_AppIcon.Free; + BMP_AppIcon_Over.Free; + BMP_AppIcon_Down.Free; - BMP_ButtonModeE.Free; - BMP_ButtonModeE_Over.Free; - BMP_ButtonModeE_Down.Free; - BMP_ButtonModeB.Free; - BMP_ButtonModeB_Over.Free; - BMP_ButtonModeB_Down.Free; + BMP_ButtonModeE.Free; + BMP_ButtonModeE_Over.Free; + BMP_ButtonModeE_Down.Free; + BMP_ButtonModeB.Free; + BMP_ButtonModeB_Over.Free; + BMP_ButtonModeB_Down.Free; - BMP_ButtonLayoutDown.Free; - BMP_ButtonLayoutDown_Over.Free; - BMP_ButtonLayoutDown_Down.Free; + BMP_ButtonLayoutDown.Free; + BMP_ButtonLayoutDown_Over.Free; + BMP_ButtonLayoutDown_Down.Free; - BMP_ButtonLayout.Free; - BMP_ButtonLayout_Over.Free; - BMP_ButtonLayout_Down.Free; + BMP_ButtonLayout.Free; + BMP_ButtonLayout_Over.Free; + BMP_ButtonLayout_Down.Free; - BMP_ButtonMouse.Free; - BMP_ButtonMouse_Over.Free; - BMP_ButtonMouse_Down.Free; + BMP_ButtonMouse.Free; + BMP_ButtonMouse_Over.Free; + BMP_ButtonMouse_Down.Free; - BMP_ButtonTools.Free; - BMP_ButtonTools_Over.Free; - BMP_ButtonTools_Down.Free; + BMP_ButtonTools.Free; + BMP_ButtonTools_Over.Free; + BMP_ButtonTools_Down.Free; - BMP_ButtonWWW.Free; - BMP_ButtonWWW_Over.Free; - BMP_ButtonWWW_Down.Free; + BMP_ButtonWWW.Free; + BMP_ButtonWWW_Over.Free; + BMP_ButtonWWW_Down.Free; - BMP_ButtonHelp.Free; - BMP_ButtonHelp_Over.Free; - BMP_ButtonHelp_Down.Free; + BMP_ButtonHelp.Free; + BMP_ButtonHelp_Over.Free; + BMP_ButtonHelp_Down.Free; - BMP_ButtonMinimize.Free; - BMP_ButtonMinimize_Over.Free; - BMP_ButtonMinimize_Down.Free; + BMP_ButtonMinimize.Free; + BMP_ButtonMinimize_Over.Free; + BMP_ButtonMinimize_Down.Free; - Action := cafree; + Action := cafree; - TopBar := Nil + TopBar := Nil End; Procedure TTopBar.FormCreate(Sender: TObject); Begin - BMP_AppIcon := TBitmap.Create; - BMP_AppIcon_Over := TBitmap.Create; - BMP_AppIcon_Down := TBitmap.Create; + BMP_AppIcon := TBitmap.Create; + BMP_AppIcon_Over := TBitmap.Create; + BMP_AppIcon_Down := TBitmap.Create; - BMP_ButtonModeE := TBitmap.Create; - BMP_ButtonModeE_Over := TBitmap.Create; - BMP_ButtonModeE_Down := TBitmap.Create; - BMP_ButtonModeB := TBitmap.Create; - BMP_ButtonModeB_Over := TBitmap.Create; - BMP_ButtonModeB_Down := TBitmap.Create; + BMP_ButtonModeE := TBitmap.Create; + BMP_ButtonModeE_Over := TBitmap.Create; + BMP_ButtonModeE_Down := TBitmap.Create; + BMP_ButtonModeB := TBitmap.Create; + BMP_ButtonModeB_Over := TBitmap.Create; + BMP_ButtonModeB_Down := TBitmap.Create; - BMP_ButtonLayoutDown := TBitmap.Create; - BMP_ButtonLayoutDown_Over := TBitmap.Create; - BMP_ButtonLayoutDown_Down := TBitmap.Create; + BMP_ButtonLayoutDown := TBitmap.Create; + BMP_ButtonLayoutDown_Over := TBitmap.Create; + BMP_ButtonLayoutDown_Down := TBitmap.Create; - BMP_ButtonLayout := TBitmap.Create; - BMP_ButtonLayout_Over := TBitmap.Create; - BMP_ButtonLayout_Down := TBitmap.Create; + BMP_ButtonLayout := TBitmap.Create; + BMP_ButtonLayout_Over := TBitmap.Create; + BMP_ButtonLayout_Down := TBitmap.Create; - BMP_ButtonMouse := TBitmap.Create; - BMP_ButtonMouse_Over := TBitmap.Create; - BMP_ButtonMouse_Down := TBitmap.Create; + BMP_ButtonMouse := TBitmap.Create; + BMP_ButtonMouse_Over := TBitmap.Create; + BMP_ButtonMouse_Down := TBitmap.Create; - BMP_ButtonTools := TBitmap.Create; - BMP_ButtonTools_Over := TBitmap.Create; - BMP_ButtonTools_Down := TBitmap.Create; + BMP_ButtonTools := TBitmap.Create; + BMP_ButtonTools_Over := TBitmap.Create; + BMP_ButtonTools_Down := TBitmap.Create; - BMP_ButtonWWW := TBitmap.Create; - BMP_ButtonWWW_Over := TBitmap.Create; - BMP_ButtonWWW_Down := TBitmap.Create; + BMP_ButtonWWW := TBitmap.Create; + BMP_ButtonWWW_Over := TBitmap.Create; + BMP_ButtonWWW_Down := TBitmap.Create; - BMP_ButtonHelp := TBitmap.Create; - BMP_ButtonHelp_Over := TBitmap.Create; - BMP_ButtonHelp_Down := TBitmap.Create; + BMP_ButtonHelp := TBitmap.Create; + BMP_ButtonHelp_Over := TBitmap.Create; + BMP_ButtonHelp_Down := TBitmap.Create; - BMP_ButtonMinimize := TBitmap.Create; - BMP_ButtonMinimize_Over := TBitmap.Create; - BMP_ButtonMinimize_Down := TBitmap.Create; + BMP_ButtonMinimize := TBitmap.Create; + BMP_ButtonMinimize_Over := TBitmap.Create; + BMP_ButtonMinimize_Down := TBitmap.Create; - ImgMain.Top := 0; - ImgMain.Left := 0; + ImgMain.Top := 0; + ImgMain.Left := 0; - ButtonMode_State := State1; + ButtonMode_State := State1; - Left := StrToInt(TopBarPosX); - TmrAppIcon.Interval := m_TimerInterval; - TmrButtonMode.Interval := m_TimerInterval; - TmrButtonLayoutDown.Interval := m_TimerInterval; - TmrButtonLayout.Interval := m_TimerInterval; - TmrButtonMouse.Interval := m_TimerInterval; - TmrButtonTools.Interval := m_TimerInterval; - TmrButtonWWW.Interval := m_TimerInterval; - TmrButtonHelp.Interval := m_TimerInterval; - TmrButtonMinimize.Interval := m_TimerInterval; + Left := StrToInt(TopBarPosX); + TmrAppIcon.Interval := m_TimerInterval; + TmrButtonMode.Interval := m_TimerInterval; + TmrButtonLayoutDown.Interval := m_TimerInterval; + TmrButtonLayout.Interval := m_TimerInterval; + TmrButtonMouse.Interval := m_TimerInterval; + TmrButtonTools.Interval := m_TimerInterval; + TmrButtonWWW.Interval := m_TimerInterval; + TmrButtonHelp.Interval := m_TimerInterval; + TmrButtonMinimize.Interval := m_TimerInterval; - // Init Hints - InitHints; + // Init Hints + InitHints; - DragAcceptFiles(Handle, True); + DragAcceptFiles(Handle, True); - Self.Top := 0; - HintTimer.Enabled := True; + Self.Top := 0; + HintTimer.Enabled := True; End; Procedure TTopBar.FormHide(Sender: TObject); Begin - TransparencyTimer.Enabled := False; - if not ApplicationClosing then - SaveUISettings; + TransparencyTimer.Enabled := False; + if not ApplicationClosing then + SaveUISettings; End; -Procedure TTopBar.FormKeyDown(Sender: TObject; Var Key: Word; Shift: TShiftState); +Procedure TTopBar.FormKeyDown(Sender: TObject; Var Key: Word; + Shift: TShiftState); Begin - If (Key = VK_F4) { And (ssAlt In Shift) } Then - Key := 0; + If (Key = VK_F4) { And (ssAlt In Shift) } Then + Key := 0; End; Procedure TTopBar.FormShow(Sender: TObject); Begin - ApplySkin; + ApplySkin; - TransparencyTimer.Enabled := True; + TransparencyTimer.Enabled := True; - If (Left + Width > Screen.Width) Or (Left < 0) Then - Left := Screen.Width - Width - 250; + If (Left + Width > Screen.Width) Or (Left < 0) Then + Left := Screen.Width - Width - 250; - Application.ProcessMessages; - SaveUISettings; + Application.ProcessMessages; + SaveUISettings; End; { =============================================================================== } Procedure TTopBar.HintTimerTimer(Sender: TObject); Begin - HintTimer.Enabled := False; - If Self.Visible Then Begin - If StrToInt(TopHintShowTimes) < NumberOfVisibleHints Then Begin - JvBalloonHint1.ActivateHint(ImgButtonMode, 'Click here to start Bangla typing' + #13 + 'or Press ' + ModeSwitchKey, '', 5000); - TopHintShowTimes := IntToStr(StrToInt(TopHintShowTimes) + 1); - End; - End; + HintTimer.Enabled := False; + If Self.Visible Then + Begin + If StrToInt(TopHintShowTimes) < NumberOfVisibleHints Then + Begin + BalloonHint1.Title := 'Click here to start Bangla typing' + #13 + + 'or Press ' + ModeSwitchKey; + BalloonHint1.ShowHint(ImgButtonMode); + TopHintShowTimes := IntToStr(StrToInt(TopHintShowTimes) + 1); + End; + End; End; { =============================================================================== } -Procedure TTopBar.ImgAppIconMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +Procedure TTopBar.ImgAppIconMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); Var - MeTop, MeLeft: Integer; + MeTop, MeLeft: Integer; Begin - AppIcon_MouseDown := True; - AppIcon_DrawState; + AppIcon_MouseDown := True; + AppIcon_DrawState; - If Button = mbleft Then Begin - MeTop := Self.Top; - MeLeft := Self.Left; + If Button = mbleft Then + Begin + MeTop := Self.Top; + MeLeft := Self.Left; - ReleaseCapture; - SendMessage(Self.Handle, WM_SYSCOMMAND, $F012, 0); // SC_DRAGMOVE = $F012; + ReleaseCapture; + SendMessage(Self.Handle, WM_SYSCOMMAND, $F012, 0); // SC_DRAGMOVE = $F012; - If Not(GetKeyState(VK_LBUTTON) < 0) Then Begin - AppIcon_MouseDown := False; - AppIcon_DrawState; + If Not(GetKeyState(VK_LBUTTON) < 0) Then + Begin + AppIcon_MouseDown := False; + AppIcon_DrawState; - // Fix XP Snap window bug - If Self.Top < 0 Then - Self.Top := 0; + // Fix XP Snap window bug + If Self.Top < 0 Then + Self.Top := 0; - // Was form moved? If not, show menu - If ((MeTop = Self.Top) And (MeLeft = Self.Left)) Then - // Form wasn't moved. Show menu - AvroMainForm1.Popup_Main.Popup(ImgAppIcon.Left + Left, ImgAppIcon.Top + ImgAppIcon.Height + Top); + // Was form moved? If not, show menu + If ((MeTop = Self.Top) And (MeLeft = Self.Left)) Then + // Form wasn't moved. Show menu + AvroMainForm1.Popup_Main.Popup(ImgAppIcon.Left + Left, + ImgAppIcon.Top + ImgAppIcon.Height + Top); - End; + End; - End; + End; End; { =============================================================================== } -Procedure TTopBar.ImgAppIconMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +Procedure TTopBar.ImgAppIconMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); Begin - AppIcon_MouseDown := False; - AppIcon_DrawState; + AppIcon_MouseDown := False; + AppIcon_DrawState; - If Button <> mbleft Then - AvroMainForm1.Popup_Main.Popup(ImgAppIcon.Left + Left, ImgAppIcon.Top + ImgAppIcon.Height + Top); + If Button <> mbleft Then + AvroMainForm1.Popup_Main.Popup(ImgAppIcon.Left + Left, + ImgAppIcon.Top + ImgAppIcon.Height + Top); End; { =============================================================================== } -Procedure TTopBar.ImgButtonHelpMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +Procedure TTopBar.ImgButtonHelpMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); Begin - ButtonHelp_MouseDown := False; - ButtonHelp_DrawState; + ButtonHelp_MouseDown := False; + ButtonHelp_DrawState; - AvroMainForm1.Popup_Help.Popup(Left + ImgButtonHelp.Left, Top + ImgButtonHelp.Top + ImgButtonHelp.Height) + AvroMainForm1.Popup_Help.Popup(Left + ImgButtonHelp.Left, + Top + ImgButtonHelp.Top + ImgButtonHelp.Height) End; { =============================================================================== } -Procedure TTopBar.ImgButtonLayoutDownMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +Procedure TTopBar.ImgButtonLayoutDownMouseUp(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); Begin - ButtonLayoutDown_MouseDown := False; - ButtonLayoutDown_DrawState; + ButtonLayoutDown_MouseDown := False; + ButtonLayoutDown_DrawState; - AvroMainForm1.Popup_LayoutList.Popup(Left + ImgButtonLayoutDown.Left, ImgButtonLayoutDown.Top + ImgButtonLayoutDown.Height + Top); + AvroMainForm1.Popup_LayoutList.Popup(Left + ImgButtonLayoutDown.Left, + ImgButtonLayoutDown.Top + ImgButtonLayoutDown.Height + Top); End; { =============================================================================== } -Procedure TTopBar.ImgButtonLayoutMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +Procedure TTopBar.ImgButtonLayoutMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); Begin - ButtonLayout_MouseDown := False; - ButtonLayout_DrawState; + ButtonLayout_MouseDown := False; + ButtonLayout_DrawState; - If Button = mbleft Then - AvroMainForm1.Showactivekeyboardlayout1Click(Nil) - Else - AvroMainForm1.Popup_LayoutList.Popup(Left + ImgButtonLayout.Left, ImgButtonLayout.Top + ImgButtonLayout.Height + Top); + If Button = mbleft Then + AvroMainForm1.Showactivekeyboardlayout1Click(Nil) + Else + AvroMainForm1.Popup_LayoutList.Popup(Left + ImgButtonLayout.Left, + ImgButtonLayout.Top + ImgButtonLayout.Height + Top); End; { =============================================================================== } -Procedure TTopBar.ImgButtonMinimizeMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +Procedure TTopBar.ImgButtonMinimizeMouseUp(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); Begin - ButtonMinimize_MouseDown := False; - ButtonMinimize_DrawState; + ButtonMinimize_MouseDown := False; + ButtonMinimize_DrawState; - If TopBarXButton = 'SHOW MENU' Then - AvroMainForm1.Popup_Exit.Popup(Left + ImgButtonMinimize.Left, Top + ImgButtonMinimize.Top + ImgButtonMinimize.Height) - Else If TopBarXButton = 'MINIMIZE' Then Begin - TopBar.Hide; - AvroMainForm1.ShowOnTray; - End - Else If TopBarXButton = 'EXIT' Then - AvroMainForm1.ExitApp; + If TopBarXButton = 'SHOW MENU' Then + AvroMainForm1.Popup_Exit.Popup(Left + ImgButtonMinimize.Left, + Top + ImgButtonMinimize.Top + ImgButtonMinimize.Height) + Else If TopBarXButton = 'MINIMIZE' Then + Begin + TopBar.Hide; + AvroMainForm1.ShowOnTray; + End + Else If TopBarXButton = 'EXIT' Then + AvroMainForm1.ExitApp; End; { =============================================================================== } -Procedure TTopBar.ImgButtonModeMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +Procedure TTopBar.ImgButtonModeMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); Begin - ButtonMode_MouseDown := False; - ButtonMode_DrawState; + ButtonMode_MouseDown := False; + ButtonMode_DrawState; - AvroMainForm1.ToggleMode; + AvroMainForm1.ToggleMode; End; { =============================================================================== } -Procedure TTopBar.ImgButtonMouseMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +Procedure TTopBar.ImgButtonMouseMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); Begin - ButtonMouse_MouseDown := False; - ButtonMouse_DrawState; + ButtonMouse_MouseDown := False; + ButtonMouse_DrawState; - AvroMainForm1.AvroMouseClicknType2Click(Nil); + AvroMainForm1.AvroMouseClicknType2Click(Nil); End; { =============================================================================== } -Procedure TTopBar.ImgButtonToolsMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +Procedure TTopBar.ImgButtonToolsMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); Begin - ButtonTools_MouseDown := False; - ButtonTools_DrawState; + ButtonTools_MouseDown := False; + ButtonTools_DrawState; - AvroMainForm1.Popup_Tools.Popup(Left + ImgButtonTools.Left, Top + ImgButtonTools.Top + ImgButtonTools.Height); + AvroMainForm1.Popup_Tools.Popup(Left + ImgButtonTools.Left, + Top + ImgButtonTools.Top + ImgButtonTools.Height); End; { =============================================================================== } -Procedure TTopBar.ImgButtonWWWMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +Procedure TTopBar.ImgButtonWWWMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); Begin - ButtonWWW_MouseDown := False; - ButtonWWW_DrawState; + ButtonWWW_MouseDown := False; + ButtonWWW_DrawState; - AvroMainForm1.Popup_Web.Popup(Left + ImgButtonWWW.Left, Top + ImgButtonWWW.Top + ImgButtonWWW.Height); + AvroMainForm1.Popup_Web.Popup(Left + ImgButtonWWW.Left, + Top + ImgButtonWWW.Top + ImgButtonWWW.Height); End; Procedure TTopBar.InitHints; Begin - ImgAppIcon.Hint := 'Drag to move TopBar.' + #13 + 'Click for menu.'; - ImgButtonMode.Hint := 'Click to start typing Bangla' + #13 + 'or Press ' + ModeSwitchKey + '.'; - ImgButtonLayoutDown.Hint := 'Select your Bangla keyboard layout.'; - ImgButtonLayout.Hint := 'View current keyboard layout with Layout Viewer.'; - ImgButtonMouse.Hint := 'Click and type Bangla with Avro Mouse (onscreen Bangla keyboard).'; - ImgButtonTools.Hint := 'Tools and settings.'; - ImgButtonWWW.Hint := 'Check for update or visit OmicronLab'; - ImgButtonHelp.Hint := 'Help menu'; - ImgButtonMinimize.Hint := 'Minimize or exit Avro Keyboard'; + ImgAppIcon.Hint := 'Drag to move TopBar.' + #13 + 'Click for menu.'; + ImgButtonMode.Hint := 'Click to start typing Bangla' + #13 + 'or Press ' + + ModeSwitchKey + '.'; + ImgButtonLayoutDown.Hint := 'Select your Bangla keyboard layout.'; + ImgButtonLayout.Hint := 'View current keyboard layout with Layout Viewer.'; + ImgButtonMouse.Hint := + 'Click and type Bangla with Avro Mouse (onscreen Bangla keyboard).'; + ImgButtonTools.Hint := 'Tools and settings.'; + ImgButtonWWW.Hint := 'Check for update or visit OmicronLab'; + ImgButtonHelp.Hint := 'Help menu'; + ImgButtonMinimize.Hint := 'Minimize or exit Avro Keyboard'; End; Procedure TTopBar.SetButtonModeState(ST: ButtonState); Begin - ButtonMode_State := ST; - ButtonMode_DrawState; + ButtonMode_State := ST; + ButtonMode_DrawState; End; {$HINTS Off} Procedure TTopBar.TransparencyTimerTimer(Sender: TObject); Var - pos: TPoint; - X, Y, i: Integer; - ThisResult: Boolean; + pos: TPoint; + X, Y, i: Integer; + ThisResult: Boolean; Const - {$WRITEABLECONST ON} - EnableTime: TDateTime = 0; - LastResult: Boolean = True; - {$WRITEABLECONST OFF} -Begin - ThisResult := False; - If EnableTime = 0 Then - EnableTime := now; - - If TopBar.Visible = False Then - exit; - - GetCursorPos(pos); - Windows.ScreenToClient(Self.Handle, pos); - X := pos.X; - Y := pos.Y; - - If TopBarTransparent = 'NO' Then - ThisResult := True - Else Begin - If GetForegroundWindow = Self.Handle Then Begin - ThisResult := True; - EnableTime := now; - End - Else If AvroMainForm1.KeyboardModeChanged = True Then Begin - AvroMainForm1.KeyboardModeChanged := False; - ThisResult := True; - EnableTime := now; - End - Else Begin - If (X < 0) Or (Y < 0) Then - ThisResult := False - Else If (X > Self.Width) Or (Y > Self.Height) Then - ThisResult := False - Else Begin - ThisResult := True; - EnableTime := now; - End; - End; - End; - - If LastResult <> ThisResult Then Begin - If ThisResult = True Then Begin - While Self.AlphaBlendValue < 255 Do Begin - If (Self.AlphaBlendValue + 50) > 255 Then - Self.AlphaBlendValue := 255 - Else - Self.AlphaBlendValue := Self.AlphaBlendValue + 50; - Application.ProcessMessages; - SysUtils.Sleep(50); - End; - - LastResult := ThisResult; - End - Else Begin - If SecondsBetween(now, EnableTime) >= 5 Then Begin - While Self.AlphaBlendValue > StrToInt(TopBarTransparencyLevel) Do Begin - If (Self.AlphaBlendValue - 50) < StrToInt(TopBarTransparencyLevel) Then - Self.AlphaBlendValue := StrToInt(TopBarTransparencyLevel) - Else - Self.AlphaBlendValue := Self.AlphaBlendValue - 50; - Application.ProcessMessages; - SysUtils.Sleep(50); - End; - - LastResult := ThisResult; - End; - End; - End; +{$WRITEABLECONST ON} + EnableTime: TDateTime = 0; + LastResult: Boolean = True; +{$WRITEABLECONST OFF} +Begin + ThisResult := False; + If EnableTime = 0 Then + EnableTime := now; + + If TopBar.Visible = False Then + exit; + + GetCursorPos(pos); + Windows.ScreenToClient(Self.Handle, pos); + X := pos.X; + Y := pos.Y; + + If TopBarTransparent = 'NO' Then + ThisResult := True + Else + Begin + If GetForegroundWindow = Self.Handle Then + Begin + ThisResult := True; + EnableTime := now; + End + Else If AvroMainForm1.KeyboardModeChanged = True Then + Begin + AvroMainForm1.KeyboardModeChanged := False; + ThisResult := True; + EnableTime := now; + End + Else + Begin + If (X < 0) Or (Y < 0) Then + ThisResult := False + Else If (X > Self.Width) Or (Y > Self.Height) Then + ThisResult := False + Else + Begin + ThisResult := True; + EnableTime := now; + End; + End; + End; + + If LastResult <> ThisResult Then + Begin + If ThisResult = True Then + Begin + While Self.AlphaBlendValue < 255 Do + Begin + If (Self.AlphaBlendValue + 50) > 255 Then + Self.AlphaBlendValue := 255 + Else + Self.AlphaBlendValue := Self.AlphaBlendValue + 50; + Application.ProcessMessages; + SysUtils.Sleep(50); + End; + + LastResult := ThisResult; + End + Else + Begin + If SecondsBetween(now, EnableTime) >= 5 Then + Begin + While Self.AlphaBlendValue > StrToInt(TopBarTransparencyLevel) Do + Begin + If (Self.AlphaBlendValue - 50) < + StrToInt(TopBarTransparencyLevel) Then + Self.AlphaBlendValue := StrToInt(TopBarTransparencyLevel) + Else + Self.AlphaBlendValue := Self.AlphaBlendValue - 50; + Application.ProcessMessages; + SysUtils.Sleep(50); + End; + + LastResult := ThisResult; + End; + End; + End; End; Procedure TTopBar.WMDROPFILES(Var msg: TWMDropFiles); - Function CheckLayoutInstall(FileName: String): Boolean; - Var - FilePath, LayoutDir: String; - Begin - result := False; - If Not FileExists(FileName) Then - exit; + Function CheckLayoutInstall(FileName: String): Boolean; + Var + FilePath, LayoutDir: String; + Begin + result := False; + If Not FileExists(FileName) Then + exit; - If uppercase(ExtractFileExt(FileName)) = '.AVROLAYOUT' Then Begin + If uppercase(ExtractFileExt(FileName)) = '.AVROLAYOUT' Then + Begin - // Ignore already installed skins - FilePath := ExtractFilePath(FileName); - LayoutDir := GetAvroDataDir + 'Keyboard Layouts\'; + // Ignore already installed skins + FilePath := ExtractFilePath(FileName); + LayoutDir := GetAvroDataDir + 'Keyboard Layouts\'; - If (uppercase(LayoutDir) <> uppercase(FilePath)) Then Begin - result := InstallLayout(FileName); - End; + If (uppercase(LayoutDir) <> uppercase(FilePath)) Then + Begin + result := InstallLayout(FileName); + End; - FreeAndNil(KeyboardLayouts); - LoadKeyboardLayoutNames; - AvroMainForm1.InitMenu; - End; + FreeAndNil(KeyboardLayouts); + LoadKeyboardLayoutNames; + AvroMainForm1.InitMenu; + End; - End; + End; - Function CheckSkinInstall(FileName: String): Boolean; - Var - FilePath, SkinDir: String; - Begin - result := False; - If Not FileExists(FileName) Then - exit; + Function CheckSkinInstall(FileName: String): Boolean; + Var + FilePath, SkinDir: String; + Begin + result := False; + If Not FileExists(FileName) Then + exit; - If uppercase(ExtractFileExt(FileName)) = '.AVROSKIN' Then Begin + If uppercase(ExtractFileExt(FileName)) = '.AVROSKIN' Then + Begin - // Ignore already installed skins - FilePath := ExtractFilePath(FileName); - SkinDir := GetAvroDataDir + 'Skin\'; + // Ignore already installed skins + FilePath := ExtractFilePath(FileName); + SkinDir := GetAvroDataDir + 'Skin\'; - If (uppercase(SkinDir) <> uppercase(FilePath)) Then Begin - result := InstallSkin(FileName); - End; + If (uppercase(SkinDir) <> uppercase(FilePath)) Then + Begin + result := InstallSkin(FileName); + End; - End; - End; + End; + End; Const - MAXFILENAME = 255; + MAXFILENAME = 255; Var - cnt, fileCount: Integer; - FileName: Array [0 .. MAXFILENAME] Of char; + cnt, fileCount: Integer; + FileName: Array [0 .. MAXFILENAME] Of char; Begin - // how many files dropped? - fileCount := DragQueryFile(msg.Drop, $FFFFFFFF, FileName, MAXFILENAME); + // how many files dropped? + fileCount := DragQueryFile(msg.Drop, $FFFFFFFF, FileName, MAXFILENAME); - // query for file names - For cnt := 0 To fileCount - 1 Do Begin - DragQueryFile(msg.Drop, cnt, FileName, MAXFILENAME); + // query for file names + For cnt := 0 To fileCount - 1 Do + Begin + DragQueryFile(msg.Drop, cnt, FileName, MAXFILENAME); - CheckLayoutInstall(FileName); - CheckSkinInstall(FileName); - End; + CheckLayoutInstall(FileName); + CheckSkinInstall(FileName); + End; - // release memory - DragFinish(msg.Drop); + // release memory + DragFinish(msg.Drop); End; {$HINTS On} {$REGION 'Skining code only - TOPBAR SKINING SECTION '} @@ -779,48 +845,52 @@ Procedure TTopBar.AppIcon_DrawDown; Begin - TmrAppIcon.Enabled := False; + TmrAppIcon.Enabled := False; - ImgAppIcon.Picture.Bitmap.Assign(BMP_AppIcon_Down); + ImgAppIcon.Picture.Bitmap.Assign(BMP_AppIcon_Down); End; { =============================================================================== } Procedure TTopBar.AppIcon_DrawState; Begin - If AppIcon_MouseDown = False Then Begin - AppIcon_DrawUpOver; - End - Else Begin - AppIcon_DrawDown; - End; - ImgAppIcon.Refresh; + If AppIcon_MouseDown = False Then + Begin + AppIcon_DrawUpOver; + End + Else + Begin + AppIcon_DrawDown; + End; + ImgAppIcon.Refresh; End; { =============================================================================== } Procedure TTopBar.AppIcon_DrawUpOver; Begin - TmrAppIcon.Enabled := False; - If AppIcon_MouseIn Then Begin - // draw over state - ImgAppIcon.Picture.Bitmap.Assign(BMP_AppIcon_Over); + TmrAppIcon.Enabled := False; + If AppIcon_MouseIn Then + Begin + // draw over state + ImgAppIcon.Picture.Bitmap.Assign(BMP_AppIcon_Over); - End - Else Begin - // draw up state - ImgAppIcon.Picture.Bitmap.Assign(BMP_AppIcon); + End + Else + Begin + // draw up state + ImgAppIcon.Picture.Bitmap.Assign(BMP_AppIcon); - End; + End; End; { =============================================================================== } Procedure TTopBar.ButtonHelp_DrawDown; Begin - TmrButtonHelp.Enabled := False; + TmrButtonHelp.Enabled := False; - ImgButtonHelp.Picture.Bitmap.Assign(BMP_ButtonHelp_Down); + ImgButtonHelp.Picture.Bitmap.Assign(BMP_ButtonHelp_Down); End; @@ -828,1028 +898,1172 @@ Procedure TTopBar.ButtonHelp_DrawState; Begin - If ButtonHelp_MouseDown = False Then Begin - ButtonHelp_DrawUpOver; - End - Else Begin - ButtonHelp_DrawDown; - End; - ImgButtonHelp.Refresh; + If ButtonHelp_MouseDown = False Then + Begin + ButtonHelp_DrawUpOver; + End + Else + Begin + ButtonHelp_DrawDown; + End; + ImgButtonHelp.Refresh; End; { =============================================================================== } Procedure TTopBar.ButtonHelp_DrawUpOver; Begin - TmrButtonHelp.Enabled := False; - If ButtonHelp_MouseIn Then Begin - // draw over state - ImgButtonHelp.Picture.Bitmap.Assign(BMP_ButtonHelp_Over); + TmrButtonHelp.Enabled := False; + If ButtonHelp_MouseIn Then + Begin + // draw over state + ImgButtonHelp.Picture.Bitmap.Assign(BMP_ButtonHelp_Over); - End - Else Begin - // draw up state - ImgButtonHelp.Picture.Bitmap.Assign(BMP_ButtonHelp); + End + Else + Begin + // draw up state + ImgButtonHelp.Picture.Bitmap.Assign(BMP_ButtonHelp); - End; + End; End; { =============================================================================== } Procedure TTopBar.ButtonLayoutDown_DrawDown; Begin - TmrButtonLayoutDown.Enabled := False; + TmrButtonLayoutDown.Enabled := False; - ImgButtonLayoutDown.Picture.Bitmap.Assign(BMP_ButtonLayoutDown_Down); + ImgButtonLayoutDown.Picture.Bitmap.Assign(BMP_ButtonLayoutDown_Down); End; { =============================================================================== } Procedure TTopBar.ButtonLayoutDown_DrawState; Begin - If ButtonLayoutDown_MouseDown = False Then Begin - ButtonLayoutDown_DrawUpOver; - End - Else Begin - ButtonLayoutDown_DrawDown; - End; - ImgButtonLayoutDown.Refresh; + If ButtonLayoutDown_MouseDown = False Then + Begin + ButtonLayoutDown_DrawUpOver; + End + Else + Begin + ButtonLayoutDown_DrawDown; + End; + ImgButtonLayoutDown.Refresh; End; { =============================================================================== } Procedure TTopBar.ButtonLayoutDown_DrawUpOver; Begin - TmrButtonLayoutDown.Enabled := False; - If ButtonLayoutDown_MouseIn Then Begin - // draw over state - ImgButtonLayoutDown.Picture.Bitmap.Assign(BMP_ButtonLayoutDown_Over); - End - Else Begin - // draw up state - ImgButtonLayoutDown.Picture.Bitmap.Assign(BMP_ButtonLayoutDown); - End; + TmrButtonLayoutDown.Enabled := False; + If ButtonLayoutDown_MouseIn Then + Begin + // draw over state + ImgButtonLayoutDown.Picture.Bitmap.Assign(BMP_ButtonLayoutDown_Over); + End + Else + Begin + // draw up state + ImgButtonLayoutDown.Picture.Bitmap.Assign(BMP_ButtonLayoutDown); + End; End; { =============================================================================== } Procedure TTopBar.ButtonLayout_DrawDown; Begin - TmrButtonLayout.Enabled := False; + TmrButtonLayout.Enabled := False; - ImgButtonLayout.Picture.Bitmap.Assign(BMP_ButtonLayout_Down); + ImgButtonLayout.Picture.Bitmap.Assign(BMP_ButtonLayout_Down); End; { =============================================================================== } Procedure TTopBar.ButtonLayout_DrawState; Begin - If ButtonLayout_MouseDown = False Then Begin - ButtonLayout_DrawUpOver; - End - Else Begin - ButtonLayout_DrawDown; - End; - ImgButtonLayout.Refresh; + If ButtonLayout_MouseDown = False Then + Begin + ButtonLayout_DrawUpOver; + End + Else + Begin + ButtonLayout_DrawDown; + End; + ImgButtonLayout.Refresh; End; { =============================================================================== } Procedure TTopBar.ButtonLayout_DrawUpOver; Begin - TmrButtonLayout.Enabled := False; - If ButtonLayout_MouseIn = True Then Begin - // draw over state - ImgButtonLayout.Picture.Bitmap.Assign(BMP_ButtonLayout_Over); - End - Else Begin - // draw up state - ImgButtonLayout.Picture.Bitmap.Assign(BMP_ButtonLayout); - End; + TmrButtonLayout.Enabled := False; + If ButtonLayout_MouseIn = True Then + Begin + // draw over state + ImgButtonLayout.Picture.Bitmap.Assign(BMP_ButtonLayout_Over); + End + Else + Begin + // draw up state + ImgButtonLayout.Picture.Bitmap.Assign(BMP_ButtonLayout); + End; End; { =============================================================================== } Procedure TTopBar.ButtonMinimize_DrawDown; Begin - TmrButtonMinimize.Enabled := False; + TmrButtonMinimize.Enabled := False; - ImgButtonMinimize.Picture.Bitmap.Assign(BMP_ButtonMinimize_Down); + ImgButtonMinimize.Picture.Bitmap.Assign(BMP_ButtonMinimize_Down); End; { =============================================================================== } Procedure TTopBar.ButtonMinimize_DrawState; Begin - If ButtonMinimize_MouseDown = False Then Begin - ButtonMinimize_DrawUpOver; - End - Else Begin - ButtonMinimize_DrawDown; - End; - ImgButtonMinimize.Refresh; + If ButtonMinimize_MouseDown = False Then + Begin + ButtonMinimize_DrawUpOver; + End + Else + Begin + ButtonMinimize_DrawDown; + End; + ImgButtonMinimize.Refresh; End; { =============================================================================== } Procedure TTopBar.ButtonMinimize_DrawUpOver; Begin - TmrButtonMinimize.Enabled := False; - If ButtonMinimize_MouseIn Then Begin - // draw over state - ImgButtonMinimize.Picture.Bitmap.Assign(BMP_ButtonMinimize_Over); - End - Else Begin - // draw up state - ImgButtonMinimize.Picture.Bitmap.Assign(BMP_ButtonMinimize); - End; + TmrButtonMinimize.Enabled := False; + If ButtonMinimize_MouseIn Then + Begin + // draw over state + ImgButtonMinimize.Picture.Bitmap.Assign(BMP_ButtonMinimize_Over); + End + Else + Begin + // draw up state + ImgButtonMinimize.Picture.Bitmap.Assign(BMP_ButtonMinimize); + End; End; { =============================================================================== } Procedure TTopBar.ButtonMode_DrawDown; Begin - TmrButtonMode.Enabled := False; + TmrButtonMode.Enabled := False; - If ButtonMode_State = State1 Then Begin - ImgButtonMode.Picture.Bitmap.Assign(BMP_ButtonModeE_Down); - End - Else Begin - ImgButtonMode.Picture.Bitmap.Assign(BMP_ButtonModeB_Down); - End; + If ButtonMode_State = State1 Then + Begin + ImgButtonMode.Picture.Bitmap.Assign(BMP_ButtonModeE_Down); + End + Else + Begin + ImgButtonMode.Picture.Bitmap.Assign(BMP_ButtonModeB_Down); + End; End; { =============================================================================== } Procedure TTopBar.ButtonMode_DrawUpOver; Begin - TmrButtonMode.Enabled := False; - If ButtonMode_MouseIn Then Begin - // draw over state - If ButtonMode_State = State1 Then Begin - ImgButtonMode.Picture.Bitmap.Assign(BMP_ButtonModeE_Over); - End - Else Begin - ImgButtonMode.Picture.Bitmap.Assign(BMP_ButtonModeB_Over); - End; - End - Else Begin - // draw up state - If ButtonMode_State = State1 Then Begin - ImgButtonMode.Picture.Bitmap.Assign(BMP_ButtonModeE); - End - Else Begin - ImgButtonMode.Picture.Bitmap.Assign(BMP_ButtonModeB); - End; - End; + TmrButtonMode.Enabled := False; + If ButtonMode_MouseIn Then + Begin + // draw over state + If ButtonMode_State = State1 Then + Begin + ImgButtonMode.Picture.Bitmap.Assign(BMP_ButtonModeE_Over); + End + Else + Begin + ImgButtonMode.Picture.Bitmap.Assign(BMP_ButtonModeB_Over); + End; + End + Else + Begin + // draw up state + If ButtonMode_State = State1 Then + Begin + ImgButtonMode.Picture.Bitmap.Assign(BMP_ButtonModeE); + End + Else + Begin + ImgButtonMode.Picture.Bitmap.Assign(BMP_ButtonModeB); + End; + End; End; { =============================================================================== } Procedure TTopBar.ButtonMode_DrawState; Begin - If ButtonMode_MouseDown = False Then Begin - ButtonMode_DrawUpOver; - End - Else Begin - ButtonMode_DrawDown; - End; - ImgButtonMode.Refresh; + If ButtonMode_MouseDown = False Then + Begin + ButtonMode_DrawUpOver; + End + Else + Begin + ButtonMode_DrawDown; + End; + ImgButtonMode.Refresh; End; { =============================================================================== } Procedure TTopBar.ButtonMouse_DrawDown; Begin - TmrButtonMouse.Enabled := False; + TmrButtonMouse.Enabled := False; - ImgButtonMouse.Picture.Bitmap.Assign(BMP_ButtonMouse_Down); + ImgButtonMouse.Picture.Bitmap.Assign(BMP_ButtonMouse_Down); End; { =============================================================================== } Procedure TTopBar.ButtonMouse_DrawState; Begin - If ButtonMouse_MouseDown = False Then Begin - ButtonMouse_DrawUpOver; - End - Else Begin - ButtonMouse_DrawDown; - End; - ImgButtonMouse.Refresh; + If ButtonMouse_MouseDown = False Then + Begin + ButtonMouse_DrawUpOver; + End + Else + Begin + ButtonMouse_DrawDown; + End; + ImgButtonMouse.Refresh; End; { =============================================================================== } Procedure TTopBar.ButtonMouse_DrawUpOver; Begin - TmrButtonMouse.Enabled := False; - If ButtonMouse_MouseIn Then Begin - // draw over state - ImgButtonMouse.Picture.Bitmap.Assign(BMP_ButtonMouse_Over); - End - Else Begin - // draw up state - ImgButtonMouse.Picture.Bitmap.Assign(BMP_ButtonMouse); - End; + TmrButtonMouse.Enabled := False; + If ButtonMouse_MouseIn Then + Begin + // draw over state + ImgButtonMouse.Picture.Bitmap.Assign(BMP_ButtonMouse_Over); + End + Else + Begin + // draw up state + ImgButtonMouse.Picture.Bitmap.Assign(BMP_ButtonMouse); + End; End; { =============================================================================== } Procedure TTopBar.ButtonTools_DrawDown; Begin - TmrButtonTools.Enabled := False; + TmrButtonTools.Enabled := False; - ImgButtonTools.Picture.Bitmap.Assign(BMP_ButtonTools_Down); + ImgButtonTools.Picture.Bitmap.Assign(BMP_ButtonTools_Down); End; { =============================================================================== } Procedure TTopBar.ButtonTools_DrawState; Begin - If ButtonTools_MouseDown = False Then Begin - ButtonTools_DrawUpOver; - End - Else Begin - ButtonTools_DrawDown; - End; - ImgButtonTools.Refresh; + If ButtonTools_MouseDown = False Then + Begin + ButtonTools_DrawUpOver; + End + Else + Begin + ButtonTools_DrawDown; + End; + ImgButtonTools.Refresh; End; { =============================================================================== } Procedure TTopBar.ButtonTools_DrawUpOver; Begin - TmrButtonTools.Enabled := False; - If ButtonTools_MouseIn Then Begin - // draw over state - ImgButtonTools.Picture.Bitmap.Assign(BMP_ButtonTools_Over); - End - Else Begin - // draw up state - ImgButtonTools.Picture.Bitmap.Assign(BMP_ButtonTools); - End; + TmrButtonTools.Enabled := False; + If ButtonTools_MouseIn Then + Begin + // draw over state + ImgButtonTools.Picture.Bitmap.Assign(BMP_ButtonTools_Over); + End + Else + Begin + // draw up state + ImgButtonTools.Picture.Bitmap.Assign(BMP_ButtonTools); + End; End; { =============================================================================== } Procedure TTopBar.ButtonWWW_DrawDown; Begin - TmrButtonWWW.Enabled := False; + TmrButtonWWW.Enabled := False; - ImgButtonWWW.Picture.Bitmap.Assign(BMP_ButtonWWW_Down); + ImgButtonWWW.Picture.Bitmap.Assign(BMP_ButtonWWW_Down); End; { =============================================================================== } Procedure TTopBar.ButtonWWW_DrawState; Begin - If ButtonWWW_MouseDown = False Then Begin - ButtonWWW_DrawUpOver; - End - Else Begin - ButtonWWW_DrawDown; - End; - ImgButtonWWW.Refresh; + If ButtonWWW_MouseDown = False Then + Begin + ButtonWWW_DrawUpOver; + End + Else + Begin + ButtonWWW_DrawDown; + End; + ImgButtonWWW.Refresh; End; { =============================================================================== } Procedure TTopBar.ButtonWWW_DrawUpOver; Begin - TmrButtonWWW.Enabled := False; - If ButtonWWW_MouseIn Then Begin - // draw over state - ImgButtonWWW.Picture.Bitmap.Assign(BMP_ButtonWWW_Over); - End - Else Begin - // draw up state - ImgButtonWWW.Picture.Bitmap.Assign(BMP_ButtonWWW); - End; + TmrButtonWWW.Enabled := False; + If ButtonWWW_MouseIn Then + Begin + // draw over state + ImgButtonWWW.Picture.Bitmap.Assign(BMP_ButtonWWW_Over); + End + Else + Begin + // draw up state + ImgButtonWWW.Picture.Bitmap.Assign(BMP_ButtonWWW); + End; End; { =============================================================================== } Procedure TTopBar.CreateParams(Var Params: TCreateParams); Begin - Inherited CreateParams(Params); - Params.ExStyle := Params.ExStyle Or WS_EX_TOPMOST; - Params.ExStyle := Params.ExStyle Or WS_EX_TOOLWINDOW And Not WS_EX_APPWINDOW; - Params.WndParent := GetDesktopwindow; + Inherited CreateParams(Params); + Params.ExStyle := Params.ExStyle Or WS_EX_TOPMOST; + Params.ExStyle := Params.ExStyle Or WS_EX_TOOLWINDOW And Not WS_EX_APPWINDOW; + Params.WndParent := GetDesktopwindow; End; { =============================================================================== } Procedure TTopBar.ImgAppIconDblClick(Sender: TObject); Begin - AppIcon_DrawDown; - ImgAppIcon.Refresh; + AppIcon_DrawDown; + ImgAppIcon.Refresh; End; { =============================================================================== } Procedure TTopBar.ImgAppIconMouseEnter(Sender: TObject); Begin - AppIcon_MouseIn := True; - AppIcon_TranparentValue := 0; - If m_GlowEffect = True Then Begin - TmrAppIcon.Enabled := True; - End - Else Begin - AppIcon_DrawState; - End; + AppIcon_MouseIn := True; + AppIcon_TranparentValue := 0; + If m_GlowEffect = True Then + Begin + TmrAppIcon.Enabled := True; + End + Else + Begin + AppIcon_DrawState; + End; End; { =============================================================================== } Procedure TTopBar.ImgAppIconMouseLeave(Sender: TObject); Begin - AppIcon_MouseIn := False; - AppIcon_MouseDown := False; - AppIcon_TranparentValue := 0; - If m_GlowEffect Then Begin - TmrAppIcon.Enabled := True; - End - Else Begin - AppIcon_DrawState; - End; + AppIcon_MouseIn := False; + AppIcon_MouseDown := False; + AppIcon_TranparentValue := 0; + If m_GlowEffect Then + Begin + TmrAppIcon.Enabled := True; + End + Else + Begin + AppIcon_DrawState; + End; End; { =============================================================================== } Procedure TTopBar.ImgButtonHelpDblClick(Sender: TObject); Begin - ButtonHelp_DrawDown; - ImgButtonHelp.Refresh; + ButtonHelp_DrawDown; + ImgButtonHelp.Refresh; End; { =============================================================================== } -Procedure TTopBar.ImgButtonHelpMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +Procedure TTopBar.ImgButtonHelpMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); Begin - ButtonHelp_MouseDown := True; - ButtonHelp_DrawState; + ButtonHelp_MouseDown := True; + ButtonHelp_DrawState; End; { =============================================================================== } Procedure TTopBar.ImgButtonHelpMouseEnter(Sender: TObject); Begin - ButtonHelp_MouseIn := True; - ButtonHelp_TranparentValue := 0; - If m_GlowEffect = True Then Begin - TmrButtonHelp.Enabled := True; - End - Else Begin - ButtonHelp_DrawState; - End; + ButtonHelp_MouseIn := True; + ButtonHelp_TranparentValue := 0; + If m_GlowEffect = True Then + Begin + TmrButtonHelp.Enabled := True; + End + Else + Begin + ButtonHelp_DrawState; + End; End; { =============================================================================== } Procedure TTopBar.ImgButtonHelpMouseLeave(Sender: TObject); Begin - ButtonHelp_MouseIn := False; - ButtonHelp_MouseDown := False; - ButtonHelp_TranparentValue := 0; - If m_GlowEffect Then Begin - TmrButtonHelp.Enabled := True; - End - Else Begin - ButtonHelp_DrawState; - End; + ButtonHelp_MouseIn := False; + ButtonHelp_MouseDown := False; + ButtonHelp_TranparentValue := 0; + If m_GlowEffect Then + Begin + TmrButtonHelp.Enabled := True; + End + Else + Begin + ButtonHelp_DrawState; + End; End; { =============================================================================== } Procedure TTopBar.ImgButtonLayoutDblClick(Sender: TObject); Begin - ButtonLayout_DrawDown; - ImgButtonLayout.Refresh; + ButtonLayout_DrawDown; + ImgButtonLayout.Refresh; End; { =============================================================================== } Procedure TTopBar.ImgButtonLayoutDownDblClick(Sender: TObject); Begin - ButtonLayoutDown_DrawDown; - ImgButtonLayoutDown.Refresh; + ButtonLayoutDown_DrawDown; + ImgButtonLayoutDown.Refresh; End; { =============================================================================== } -Procedure TTopBar.ImgButtonLayoutDownMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +Procedure TTopBar.ImgButtonLayoutDownMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); Begin - ButtonLayoutDown_MouseDown := True; - ButtonLayoutDown_DrawState; + ButtonLayoutDown_MouseDown := True; + ButtonLayoutDown_DrawState; End; { =============================================================================== } Procedure TTopBar.ImgButtonLayoutDownMouseEnter(Sender: TObject); Begin - ButtonLayoutDown_MouseIn := True; - ButtonLayoutDown_TranparentValue := 0; - If m_GlowEffect = True Then Begin - TmrButtonLayoutDown.Enabled := True; - End - Else Begin - ButtonLayoutDown_DrawState; - End; + ButtonLayoutDown_MouseIn := True; + ButtonLayoutDown_TranparentValue := 0; + If m_GlowEffect = True Then + Begin + TmrButtonLayoutDown.Enabled := True; + End + Else + Begin + ButtonLayoutDown_DrawState; + End; End; { =============================================================================== } Procedure TTopBar.ImgButtonLayoutDownMouseLeave(Sender: TObject); Begin - ButtonLayoutDown_MouseIn := False; - ButtonLayoutDown_MouseDown := False; - ButtonLayoutDown_TranparentValue := 0; - If m_GlowEffect Then Begin - TmrButtonLayoutDown.Enabled := True; - End - Else Begin - ButtonLayoutDown_DrawState; - End; + ButtonLayoutDown_MouseIn := False; + ButtonLayoutDown_MouseDown := False; + ButtonLayoutDown_TranparentValue := 0; + If m_GlowEffect Then + Begin + TmrButtonLayoutDown.Enabled := True; + End + Else + Begin + ButtonLayoutDown_DrawState; + End; End; { =============================================================================== } -Procedure TTopBar.ImgButtonLayoutMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +Procedure TTopBar.ImgButtonLayoutMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); Begin - ButtonLayout_MouseDown := True; - ButtonLayout_DrawState; + ButtonLayout_MouseDown := True; + ButtonLayout_DrawState; End; { =============================================================================== } Procedure TTopBar.ImgButtonLayoutMouseEnter(Sender: TObject); Begin - ButtonLayout_MouseIn := True; - ButtonLayout_TranparentValue := 0; - If m_GlowEffect = True Then Begin - TmrButtonLayout.Enabled := True; - End - Else Begin - ButtonLayout_DrawState; - End; + ButtonLayout_MouseIn := True; + ButtonLayout_TranparentValue := 0; + If m_GlowEffect = True Then + Begin + TmrButtonLayout.Enabled := True; + End + Else + Begin + ButtonLayout_DrawState; + End; End; { =============================================================================== } Procedure TTopBar.ImgButtonLayoutMouseLeave(Sender: TObject); Begin - ButtonLayout_MouseIn := False; - ButtonLayout_MouseDown := False; - ButtonLayout_TranparentValue := 0; - If m_GlowEffect Then Begin - TmrButtonLayout.Enabled := True; - End - Else Begin - ButtonLayout_DrawState; - End; + ButtonLayout_MouseIn := False; + ButtonLayout_MouseDown := False; + ButtonLayout_TranparentValue := 0; + If m_GlowEffect Then + Begin + TmrButtonLayout.Enabled := True; + End + Else + Begin + ButtonLayout_DrawState; + End; End; { =============================================================================== } Procedure TTopBar.ImgButtonMinimizeDblClick(Sender: TObject); Begin - ButtonMinimize_DrawDown; - ImgButtonMinimize.Refresh; + ButtonMinimize_DrawDown; + ImgButtonMinimize.Refresh; End; { =============================================================================== } -Procedure TTopBar.ImgButtonMinimizeMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +Procedure TTopBar.ImgButtonMinimizeMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); Begin - ButtonMinimize_MouseDown := True; - ButtonMinimize_DrawState; + ButtonMinimize_MouseDown := True; + ButtonMinimize_DrawState; End; { =============================================================================== } Procedure TTopBar.ImgButtonMinimizeMouseEnter(Sender: TObject); Begin - ButtonMinimize_MouseIn := True; - ButtonMinimize_TranparentValue := 0; - If m_GlowEffect = True Then Begin - TmrButtonMinimize.Enabled := True; - End - Else Begin - ButtonMinimize_DrawState; - End; + ButtonMinimize_MouseIn := True; + ButtonMinimize_TranparentValue := 0; + If m_GlowEffect = True Then + Begin + TmrButtonMinimize.Enabled := True; + End + Else + Begin + ButtonMinimize_DrawState; + End; End; { =============================================================================== } Procedure TTopBar.ImgButtonMinimizeMouseLeave(Sender: TObject); Begin - ButtonMinimize_MouseIn := False; - ButtonMinimize_MouseDown := False; - ButtonMinimize_TranparentValue := 0; - If m_GlowEffect Then Begin - TmrButtonMinimize.Enabled := True; - End - Else Begin - ButtonMinimize_DrawState; - End; + ButtonMinimize_MouseIn := False; + ButtonMinimize_MouseDown := False; + ButtonMinimize_TranparentValue := 0; + If m_GlowEffect Then + Begin + TmrButtonMinimize.Enabled := True; + End + Else + Begin + ButtonMinimize_DrawState; + End; End; { =============================================================================== } Procedure TTopBar.ImgButtonModeDblClick(Sender: TObject); Begin - ButtonMode_DrawDown; - ImgButtonMode.Refresh; + ButtonMode_DrawDown; + ImgButtonMode.Refresh; End; { =============================================================================== } -Procedure TTopBar.ImgButtonModeMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +Procedure TTopBar.ImgButtonModeMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); Begin - ButtonMode_MouseDown := True; - ButtonMode_DrawState; + ButtonMode_MouseDown := True; + ButtonMode_DrawState; End; { =============================================================================== } Procedure TTopBar.ImgButtonModeMouseEnter(Sender: TObject); Begin - ButtonMode_MouseIn := True; - ButtonMode_TranparentValue := 0; - If m_GlowEffect = True Then Begin - TmrButtonMode.Enabled := True; - End - Else Begin - ButtonMode_DrawState; - End; + ButtonMode_MouseIn := True; + ButtonMode_TranparentValue := 0; + If m_GlowEffect = True Then + Begin + TmrButtonMode.Enabled := True; + End + Else + Begin + ButtonMode_DrawState; + End; End; { =============================================================================== } Procedure TTopBar.ImgButtonModeMouseLeave(Sender: TObject); Begin - ButtonMode_MouseIn := False; - ButtonMode_MouseDown := False; - ButtonMode_TranparentValue := 0; - If m_GlowEffect Then Begin - TmrButtonMode.Enabled := True; - End - Else Begin - ButtonMode_DrawState; - End; + ButtonMode_MouseIn := False; + ButtonMode_MouseDown := False; + ButtonMode_TranparentValue := 0; + If m_GlowEffect Then + Begin + TmrButtonMode.Enabled := True; + End + Else + Begin + ButtonMode_DrawState; + End; End; { =============================================================================== } Procedure TTopBar.ImgButtonMouseDblClick(Sender: TObject); Begin - ButtonMouse_DrawDown; - ImgButtonMouse.Refresh; + ButtonMouse_DrawDown; + ImgButtonMouse.Refresh; End; { =============================================================================== } -Procedure TTopBar.ImgButtonMouseMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +Procedure TTopBar.ImgButtonMouseMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); Begin - ButtonMouse_MouseDown := True; - ButtonMouse_DrawState; + ButtonMouse_MouseDown := True; + ButtonMouse_DrawState; End; { =============================================================================== } Procedure TTopBar.ImgButtonMouseMouseEnter(Sender: TObject); Begin - ButtonMouse_MouseIn := True; - ButtonMouse_TranparentValue := 0; - If m_GlowEffect = True Then Begin - TmrButtonMouse.Enabled := True; - End - Else Begin - ButtonMouse_DrawState; - End; + ButtonMouse_MouseIn := True; + ButtonMouse_TranparentValue := 0; + If m_GlowEffect = True Then + Begin + TmrButtonMouse.Enabled := True; + End + Else + Begin + ButtonMouse_DrawState; + End; End; { =============================================================================== } Procedure TTopBar.ImgButtonMouseMouseLeave(Sender: TObject); Begin - ButtonMouse_MouseIn := False; - ButtonMouse_MouseDown := False; - ButtonMouse_TranparentValue := 0; - If m_GlowEffect Then Begin - TmrButtonMouse.Enabled := True; - End - Else Begin - ButtonMouse_DrawState; - End; + ButtonMouse_MouseIn := False; + ButtonMouse_MouseDown := False; + ButtonMouse_TranparentValue := 0; + If m_GlowEffect Then + Begin + TmrButtonMouse.Enabled := True; + End + Else + Begin + ButtonMouse_DrawState; + End; End; { =============================================================================== } Procedure TTopBar.ImgButtonToolsDblClick(Sender: TObject); Begin - ButtonTools_DrawDown; - ImgButtonTools.Refresh; + ButtonTools_DrawDown; + ImgButtonTools.Refresh; End; { =============================================================================== } -Procedure TTopBar.ImgButtonToolsMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +Procedure TTopBar.ImgButtonToolsMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); Begin - ButtonTools_MouseDown := True; - ButtonTools_DrawState; + ButtonTools_MouseDown := True; + ButtonTools_DrawState; End; { =============================================================================== } Procedure TTopBar.ImgButtonToolsMouseEnter(Sender: TObject); Begin - ButtonTools_MouseIn := True; - ButtonTools_TranparentValue := 0; - If m_GlowEffect = True Then Begin - TmrButtonTools.Enabled := True; - End - Else Begin - ButtonTools_DrawState; - End; + ButtonTools_MouseIn := True; + ButtonTools_TranparentValue := 0; + If m_GlowEffect = True Then + Begin + TmrButtonTools.Enabled := True; + End + Else + Begin + ButtonTools_DrawState; + End; End; { =============================================================================== } Procedure TTopBar.ImgButtonToolsMouseLeave(Sender: TObject); Begin - ButtonTools_MouseIn := False; - ButtonTools_MouseDown := False; - ButtonTools_TranparentValue := 0; - If m_GlowEffect Then Begin - TmrButtonTools.Enabled := True; - End - Else Begin - ButtonTools_DrawState; - End; + ButtonTools_MouseIn := False; + ButtonTools_MouseDown := False; + ButtonTools_TranparentValue := 0; + If m_GlowEffect Then + Begin + TmrButtonTools.Enabled := True; + End + Else + Begin + ButtonTools_DrawState; + End; End; { =============================================================================== } Procedure TTopBar.ImgButtonWWWDblClick(Sender: TObject); Begin - ButtonWWW_DrawDown; - ImgButtonWWW.Refresh; + ButtonWWW_DrawDown; + ImgButtonWWW.Refresh; End; { =============================================================================== } -Procedure TTopBar.ImgButtonWWWMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +Procedure TTopBar.ImgButtonWWWMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); Begin - ButtonWWW_MouseDown := True; - ButtonWWW_DrawState; + ButtonWWW_MouseDown := True; + ButtonWWW_DrawState; End; { =============================================================================== } Procedure TTopBar.ImgButtonWWWMouseEnter(Sender: TObject); Begin - ButtonWWW_MouseIn := True; - ButtonWWW_TranparentValue := 0; - If m_GlowEffect = True Then Begin - TmrButtonWWW.Enabled := True; - End - Else Begin - ButtonWWW_DrawState; - End; + ButtonWWW_MouseIn := True; + ButtonWWW_TranparentValue := 0; + If m_GlowEffect = True Then + Begin + TmrButtonWWW.Enabled := True; + End + Else + Begin + ButtonWWW_DrawState; + End; End; { =============================================================================== } Procedure TTopBar.ImgButtonWWWMouseLeave(Sender: TObject); Begin - ButtonWWW_MouseIn := False; - ButtonWWW_MouseDown := False; - ButtonWWW_TranparentValue := 0; - If m_GlowEffect Then Begin - TmrButtonWWW.Enabled := True; - End - Else Begin - ButtonWWW_DrawState; - End; + ButtonWWW_MouseIn := False; + ButtonWWW_MouseDown := False; + ButtonWWW_TranparentValue := 0; + If m_GlowEffect Then + Begin + TmrButtonWWW.Enabled := True; + End + Else + Begin + ButtonWWW_DrawState; + End; End; { =============================================================================== } Procedure TTopBar.TmrAppIconTimer(Sender: TObject); Var - bf: TBLENDFUNCTION; -Begin - - If AppIcon_MouseIn = True Then Begin - // blend to over state - AppIcon_TranparentValue := AppIcon_TranparentValue + m_BlendingStep; - If AppIcon_TranparentValue >= 255 Then Begin - TmrAppIcon.Enabled := False; - AppIcon_TranparentValue := 0; - AppIcon_DrawState; - exit; - End; - - bf.BlendOp := 0; - bf.BlendFlags := 0; - bf.SourceConstantAlpha := AppIcon_TranparentValue; - bf.AlphaFormat := 0; - - Windows.AlphaBlend(ImgAppIcon.Canvas.Handle, 0, 0, ImgAppIcon.Width, ImgAppIcon.Height, BMP_AppIcon_Over.Canvas.Handle, 0, 0, ImgAppIcon.Width, ImgAppIcon.Height, bf); - End - Else Begin - // blend to up state - AppIcon_TranparentValue := AppIcon_TranparentValue + m_BlendingStep; - If AppIcon_TranparentValue >= 255 Then Begin - TmrAppIcon.Enabled := False; - AppIcon_TranparentValue := 0; - AppIcon_DrawState; - exit; - End; - - bf.BlendOp := 0; - bf.BlendFlags := 0; - bf.SourceConstantAlpha := AppIcon_TranparentValue; - bf.AlphaFormat := 0; - - Windows.AlphaBlend(ImgAppIcon.Canvas.Handle, 0, 0, ImgAppIcon.Width, ImgAppIcon.Height, BMP_AppIcon.Canvas.Handle, 0, 0, ImgAppIcon.Width, ImgAppIcon.Height, bf); - End; - - ImgAppIcon.Refresh; + bf: TBLENDFUNCTION; +Begin + + If AppIcon_MouseIn = True Then + Begin + // blend to over state + AppIcon_TranparentValue := AppIcon_TranparentValue + m_BlendingStep; + If AppIcon_TranparentValue >= 255 Then + Begin + TmrAppIcon.Enabled := False; + AppIcon_TranparentValue := 0; + AppIcon_DrawState; + exit; + End; + + bf.BlendOp := 0; + bf.BlendFlags := 0; + bf.SourceConstantAlpha := AppIcon_TranparentValue; + bf.AlphaFormat := 0; + + Windows.AlphaBlend(ImgAppIcon.Canvas.Handle, 0, 0, ImgAppIcon.Width, + ImgAppIcon.Height, BMP_AppIcon_Over.Canvas.Handle, 0, 0, ImgAppIcon.Width, + ImgAppIcon.Height, bf); + End + Else + Begin + // blend to up state + AppIcon_TranparentValue := AppIcon_TranparentValue + m_BlendingStep; + If AppIcon_TranparentValue >= 255 Then + Begin + TmrAppIcon.Enabled := False; + AppIcon_TranparentValue := 0; + AppIcon_DrawState; + exit; + End; + + bf.BlendOp := 0; + bf.BlendFlags := 0; + bf.SourceConstantAlpha := AppIcon_TranparentValue; + bf.AlphaFormat := 0; + + Windows.AlphaBlend(ImgAppIcon.Canvas.Handle, 0, 0, ImgAppIcon.Width, + ImgAppIcon.Height, BMP_AppIcon.Canvas.Handle, 0, 0, ImgAppIcon.Width, + ImgAppIcon.Height, bf); + End; + + ImgAppIcon.Refresh; End; { =============================================================================== } Procedure TTopBar.TmrButtonHelpTimer(Sender: TObject); Var - bf: TBLENDFUNCTION; -Begin - - If ButtonHelp_MouseIn = True Then Begin - // blend to over state - ButtonHelp_TranparentValue := ButtonHelp_TranparentValue + m_BlendingStep; - If ButtonHelp_TranparentValue >= 255 Then Begin - TmrButtonHelp.Enabled := False; - ButtonHelp_TranparentValue := 0; - ButtonHelp_DrawState; - exit; - End; - - bf.BlendOp := 0; - bf.BlendFlags := 0; - bf.SourceConstantAlpha := ButtonHelp_TranparentValue; - bf.AlphaFormat := 0; - - Windows.AlphaBlend(ImgButtonHelp.Canvas.Handle, 0, 0, ImgButtonHelp.Width, ImgButtonHelp.Height, BMP_ButtonHelp_Over.Canvas.Handle, 0, 0, ImgButtonHelp.Width, ImgButtonHelp.Height, bf); - End - Else Begin - // blend to up state - ButtonHelp_TranparentValue := ButtonHelp_TranparentValue + m_BlendingStep; - If ButtonHelp_TranparentValue >= 255 Then Begin - TmrButtonHelp.Enabled := False; - ButtonHelp_TranparentValue := 0; - ButtonHelp_DrawState; - exit; - End; - - bf.BlendOp := 0; - bf.BlendFlags := 0; - bf.SourceConstantAlpha := ButtonHelp_TranparentValue; - bf.AlphaFormat := 0; - - Windows.AlphaBlend(ImgButtonHelp.Canvas.Handle, 0, 0, ImgButtonHelp.Width, ImgButtonHelp.Height, BMP_ButtonHelp.Canvas.Handle, 0, 0, ImgButtonHelp.Width, ImgButtonHelp.Height, bf); - End; - - ImgButtonHelp.Refresh; + bf: TBLENDFUNCTION; +Begin + + If ButtonHelp_MouseIn = True Then + Begin + // blend to over state + ButtonHelp_TranparentValue := ButtonHelp_TranparentValue + m_BlendingStep; + If ButtonHelp_TranparentValue >= 255 Then + Begin + TmrButtonHelp.Enabled := False; + ButtonHelp_TranparentValue := 0; + ButtonHelp_DrawState; + exit; + End; + + bf.BlendOp := 0; + bf.BlendFlags := 0; + bf.SourceConstantAlpha := ButtonHelp_TranparentValue; + bf.AlphaFormat := 0; + + Windows.AlphaBlend(ImgButtonHelp.Canvas.Handle, 0, 0, ImgButtonHelp.Width, + ImgButtonHelp.Height, BMP_ButtonHelp_Over.Canvas.Handle, 0, 0, + ImgButtonHelp.Width, ImgButtonHelp.Height, bf); + End + Else + Begin + // blend to up state + ButtonHelp_TranparentValue := ButtonHelp_TranparentValue + m_BlendingStep; + If ButtonHelp_TranparentValue >= 255 Then + Begin + TmrButtonHelp.Enabled := False; + ButtonHelp_TranparentValue := 0; + ButtonHelp_DrawState; + exit; + End; + + bf.BlendOp := 0; + bf.BlendFlags := 0; + bf.SourceConstantAlpha := ButtonHelp_TranparentValue; + bf.AlphaFormat := 0; + + Windows.AlphaBlend(ImgButtonHelp.Canvas.Handle, 0, 0, ImgButtonHelp.Width, + ImgButtonHelp.Height, BMP_ButtonHelp.Canvas.Handle, 0, 0, + ImgButtonHelp.Width, ImgButtonHelp.Height, bf); + End; + + ImgButtonHelp.Refresh; End; { =============================================================================== } Procedure TTopBar.TmrButtonLayoutDownTimer(Sender: TObject); Var - bf: TBLENDFUNCTION; -Begin - - If ButtonLayoutDown_MouseIn = True Then Begin - // blend to over state - ButtonLayoutDown_TranparentValue := ButtonLayoutDown_TranparentValue + m_BlendingStep; - If ButtonLayoutDown_TranparentValue >= 255 Then Begin - TmrButtonLayoutDown.Enabled := False; - ButtonLayoutDown_TranparentValue := 0; - ButtonLayoutDown_DrawState; - exit; - End; - - bf.BlendOp := 0; - bf.BlendFlags := 0; - bf.SourceConstantAlpha := ButtonLayoutDown_TranparentValue; - bf.AlphaFormat := 0; - - Windows.AlphaBlend(ImgButtonLayoutDown.Canvas.Handle, 0, 0, ImgButtonLayoutDown.Width, ImgButtonLayoutDown.Height, BMP_ButtonLayoutDown_Over.Canvas.Handle, 0, 0, ImgButtonLayoutDown.Width, - ImgButtonLayoutDown.Height, bf); - End - Else Begin - // blend to up state - ButtonLayoutDown_TranparentValue := ButtonLayoutDown_TranparentValue + m_BlendingStep; - If ButtonLayoutDown_TranparentValue >= 255 Then Begin - TmrButtonLayoutDown.Enabled := False; - ButtonLayoutDown_TranparentValue := 0; - ButtonLayoutDown_DrawState; - exit; - End; - - bf.BlendOp := 0; - bf.BlendFlags := 0; - bf.SourceConstantAlpha := ButtonLayoutDown_TranparentValue; - bf.AlphaFormat := 0; - - Windows.AlphaBlend(ImgButtonLayoutDown.Canvas.Handle, 0, 0, ImgButtonLayoutDown.Width, ImgButtonLayoutDown.Height, BMP_ButtonLayoutDown.Canvas.Handle, 0, 0, ImgButtonLayoutDown.Width, - ImgButtonLayoutDown.Height, bf); - End; - - ImgButtonLayoutDown.Refresh; + bf: TBLENDFUNCTION; +Begin + + If ButtonLayoutDown_MouseIn = True Then + Begin + // blend to over state + ButtonLayoutDown_TranparentValue := ButtonLayoutDown_TranparentValue + + m_BlendingStep; + If ButtonLayoutDown_TranparentValue >= 255 Then + Begin + TmrButtonLayoutDown.Enabled := False; + ButtonLayoutDown_TranparentValue := 0; + ButtonLayoutDown_DrawState; + exit; + End; + + bf.BlendOp := 0; + bf.BlendFlags := 0; + bf.SourceConstantAlpha := ButtonLayoutDown_TranparentValue; + bf.AlphaFormat := 0; + + Windows.AlphaBlend(ImgButtonLayoutDown.Canvas.Handle, 0, 0, + ImgButtonLayoutDown.Width, ImgButtonLayoutDown.Height, + BMP_ButtonLayoutDown_Over.Canvas.Handle, 0, 0, ImgButtonLayoutDown.Width, + ImgButtonLayoutDown.Height, bf); + End + Else + Begin + // blend to up state + ButtonLayoutDown_TranparentValue := ButtonLayoutDown_TranparentValue + + m_BlendingStep; + If ButtonLayoutDown_TranparentValue >= 255 Then + Begin + TmrButtonLayoutDown.Enabled := False; + ButtonLayoutDown_TranparentValue := 0; + ButtonLayoutDown_DrawState; + exit; + End; + + bf.BlendOp := 0; + bf.BlendFlags := 0; + bf.SourceConstantAlpha := ButtonLayoutDown_TranparentValue; + bf.AlphaFormat := 0; + + Windows.AlphaBlend(ImgButtonLayoutDown.Canvas.Handle, 0, 0, + ImgButtonLayoutDown.Width, ImgButtonLayoutDown.Height, + BMP_ButtonLayoutDown.Canvas.Handle, 0, 0, ImgButtonLayoutDown.Width, + ImgButtonLayoutDown.Height, bf); + End; + + ImgButtonLayoutDown.Refresh; End; { =============================================================================== } Procedure TTopBar.TmrButtonLayoutTimer(Sender: TObject); Var - bf: TBLENDFUNCTION; -Begin - - If ButtonLayout_MouseIn = True Then Begin - // blend to over state - ButtonLayout_TranparentValue := ButtonLayout_TranparentValue + m_BlendingStep; - If ButtonLayout_TranparentValue >= 255 Then Begin - TmrButtonLayout.Enabled := False; - ButtonLayout_TranparentValue := 0; - ButtonLayout_DrawState; - exit; - End; - - bf.BlendOp := 0; - bf.BlendFlags := 0; - bf.SourceConstantAlpha := ButtonLayout_TranparentValue; - bf.AlphaFormat := 0; - - Windows.AlphaBlend(ImgButtonLayout.Canvas.Handle, 0, 0, ImgButtonLayout.Width, ImgButtonLayout.Height, BMP_ButtonLayout_Over.Canvas.Handle, 0, 0, ImgButtonLayout.Width, - ImgButtonLayout.Height, bf); - End - Else Begin - // blend to up state - ButtonLayout_TranparentValue := ButtonLayout_TranparentValue + m_BlendingStep; - If ButtonLayout_TranparentValue >= 255 Then Begin - TmrButtonLayout.Enabled := False; - ButtonLayout_TranparentValue := 0; - ButtonLayout_DrawState; - exit; - End; - - bf.BlendOp := 0; - bf.BlendFlags := 0; - bf.SourceConstantAlpha := ButtonLayout_TranparentValue; - bf.AlphaFormat := 0; - - Windows.AlphaBlend(ImgButtonLayout.Canvas.Handle, 0, 0, ImgButtonLayout.Width, ImgButtonLayout.Height, BMP_ButtonLayout.Canvas.Handle, 0, 0, ImgButtonLayout.Width, ImgButtonLayout.Height, - bf); - End; - - ImgButtonLayout.Refresh; + bf: TBLENDFUNCTION; +Begin + + If ButtonLayout_MouseIn = True Then + Begin + // blend to over state + ButtonLayout_TranparentValue := ButtonLayout_TranparentValue + + m_BlendingStep; + If ButtonLayout_TranparentValue >= 255 Then + Begin + TmrButtonLayout.Enabled := False; + ButtonLayout_TranparentValue := 0; + ButtonLayout_DrawState; + exit; + End; + + bf.BlendOp := 0; + bf.BlendFlags := 0; + bf.SourceConstantAlpha := ButtonLayout_TranparentValue; + bf.AlphaFormat := 0; + + Windows.AlphaBlend(ImgButtonLayout.Canvas.Handle, 0, 0, + ImgButtonLayout.Width, ImgButtonLayout.Height, + BMP_ButtonLayout_Over.Canvas.Handle, 0, 0, ImgButtonLayout.Width, + ImgButtonLayout.Height, bf); + End + Else + Begin + // blend to up state + ButtonLayout_TranparentValue := ButtonLayout_TranparentValue + + m_BlendingStep; + If ButtonLayout_TranparentValue >= 255 Then + Begin + TmrButtonLayout.Enabled := False; + ButtonLayout_TranparentValue := 0; + ButtonLayout_DrawState; + exit; + End; + + bf.BlendOp := 0; + bf.BlendFlags := 0; + bf.SourceConstantAlpha := ButtonLayout_TranparentValue; + bf.AlphaFormat := 0; + + Windows.AlphaBlend(ImgButtonLayout.Canvas.Handle, 0, 0, + ImgButtonLayout.Width, ImgButtonLayout.Height, + BMP_ButtonLayout.Canvas.Handle, 0, 0, ImgButtonLayout.Width, + ImgButtonLayout.Height, bf); + End; + + ImgButtonLayout.Refresh; End; { =============================================================================== } Procedure TTopBar.TmrButtonMinimizeTimer(Sender: TObject); Var - bf: TBLENDFUNCTION; -Begin - - If ButtonMinimize_MouseIn = True Then Begin - // blend to over state - ButtonMinimize_TranparentValue := ButtonMinimize_TranparentValue + m_BlendingStep; - If ButtonMinimize_TranparentValue >= 255 Then Begin - TmrButtonMinimize.Enabled := False; - ButtonMinimize_TranparentValue := 0; - ButtonMinimize_DrawState; - exit; - End; - - bf.BlendOp := 0; - bf.BlendFlags := 0; - bf.SourceConstantAlpha := ButtonMinimize_TranparentValue; - bf.AlphaFormat := 0; - - Windows.AlphaBlend(ImgButtonMinimize.Canvas.Handle, 0, 0, ImgButtonMinimize.Width, ImgButtonMinimize.Height, BMP_ButtonMinimize_Over.Canvas.Handle, 0, 0, ImgButtonMinimize.Width, - ImgButtonMinimize.Height, bf); - End - Else Begin - // blend to up state - ButtonMinimize_TranparentValue := ButtonMinimize_TranparentValue + m_BlendingStep; - If ButtonMinimize_TranparentValue >= 255 Then Begin - TmrButtonMinimize.Enabled := False; - ButtonMinimize_TranparentValue := 0; - ButtonMinimize_DrawState; - exit; - End; - - bf.BlendOp := 0; - bf.BlendFlags := 0; - bf.SourceConstantAlpha := ButtonMinimize_TranparentValue; - bf.AlphaFormat := 0; - - Windows.AlphaBlend(ImgButtonMinimize.Canvas.Handle, 0, 0, ImgButtonMinimize.Width, ImgButtonMinimize.Height, BMP_ButtonMinimize.Canvas.Handle, 0, 0, ImgButtonMinimize.Width, - ImgButtonMinimize.Height, bf); - End; - - ImgButtonMinimize.Refresh; + bf: TBLENDFUNCTION; +Begin + + If ButtonMinimize_MouseIn = True Then + Begin + // blend to over state + ButtonMinimize_TranparentValue := ButtonMinimize_TranparentValue + + m_BlendingStep; + If ButtonMinimize_TranparentValue >= 255 Then + Begin + TmrButtonMinimize.Enabled := False; + ButtonMinimize_TranparentValue := 0; + ButtonMinimize_DrawState; + exit; + End; + + bf.BlendOp := 0; + bf.BlendFlags := 0; + bf.SourceConstantAlpha := ButtonMinimize_TranparentValue; + bf.AlphaFormat := 0; + + Windows.AlphaBlend(ImgButtonMinimize.Canvas.Handle, 0, 0, + ImgButtonMinimize.Width, ImgButtonMinimize.Height, + BMP_ButtonMinimize_Over.Canvas.Handle, 0, 0, ImgButtonMinimize.Width, + ImgButtonMinimize.Height, bf); + End + Else + Begin + // blend to up state + ButtonMinimize_TranparentValue := ButtonMinimize_TranparentValue + + m_BlendingStep; + If ButtonMinimize_TranparentValue >= 255 Then + Begin + TmrButtonMinimize.Enabled := False; + ButtonMinimize_TranparentValue := 0; + ButtonMinimize_DrawState; + exit; + End; + + bf.BlendOp := 0; + bf.BlendFlags := 0; + bf.SourceConstantAlpha := ButtonMinimize_TranparentValue; + bf.AlphaFormat := 0; + + Windows.AlphaBlend(ImgButtonMinimize.Canvas.Handle, 0, 0, + ImgButtonMinimize.Width, ImgButtonMinimize.Height, + BMP_ButtonMinimize.Canvas.Handle, 0, 0, ImgButtonMinimize.Width, + ImgButtonMinimize.Height, bf); + End; + + ImgButtonMinimize.Refresh; End; { =============================================================================== } Procedure TTopBar.TmrButtonModeTimer(Sender: TObject); Var - bf: TBLENDFUNCTION; -Begin - If ButtonMode_State = State1 Then Begin - If ButtonMode_MouseIn Then Begin - // blend to over state - ButtonMode_TranparentValue := ButtonMode_TranparentValue + m_BlendingStep; - If ButtonMode_TranparentValue >= 255 Then Begin - TmrButtonMode.Enabled := False; - ButtonMode_TranparentValue := 0; - ButtonMode_DrawState; - exit; - End; - - bf.BlendOp := 0; - bf.BlendFlags := 0; - bf.SourceConstantAlpha := ButtonMode_TranparentValue; - bf.AlphaFormat := 0; - - Windows.AlphaBlend(ImgButtonMode.Canvas.Handle, 0, 0, ImgButtonMode.Width, ImgButtonMode.Height, BMP_ButtonModeE_Over.Canvas.Handle, 0, 0, ImgButtonMode.Width, ImgButtonMode.Height, - bf); - End - Else Begin - // blend to up state - ButtonMode_TranparentValue := ButtonMode_TranparentValue + m_BlendingStep; - If ButtonMode_TranparentValue >= 255 Then Begin - TmrButtonMode.Enabled := False; - ButtonMode_TranparentValue := 0; - ButtonMode_DrawState; - exit; - End; - - bf.BlendOp := 0; - bf.BlendFlags := 0; - bf.SourceConstantAlpha := ButtonMode_TranparentValue; - bf.AlphaFormat := 0; - - Windows.AlphaBlend(ImgButtonMode.Canvas.Handle, 0, 0, ImgButtonMode.Width, ImgButtonMode.Height, BMP_ButtonModeE.Canvas.Handle, 0, 0, ImgButtonMode.Width, ImgButtonMode.Height, bf); - End; - End - Else Begin - If ButtonMode_MouseIn Then Begin - // blend to over state - ButtonMode_TranparentValue := ButtonMode_TranparentValue + m_BlendingStep; - - If ButtonMode_TranparentValue >= 255 Then Begin - TmrButtonMode.Enabled := False; - ButtonMode_TranparentValue := 0; - ButtonMode_DrawState; - exit; - End; - - bf.BlendOp := 0; - bf.BlendFlags := 0; - bf.SourceConstantAlpha := ButtonMode_TranparentValue; - bf.AlphaFormat := 0; - - Windows.AlphaBlend(ImgButtonMode.Canvas.Handle, 0, 0, ImgButtonMode.Width, ImgButtonMode.Height, BMP_ButtonModeB_Over.Canvas.Handle, 0, 0, ImgButtonMode.Width, ImgButtonMode.Height, - bf); - End - Else Begin - // blend to up state - ButtonMode_TranparentValue := ButtonMode_TranparentValue + m_BlendingStep; - - If ButtonMode_TranparentValue >= 255 Then Begin - TmrButtonMode.Enabled := False; - ButtonMode_TranparentValue := 0; - ButtonMode_DrawState; - exit; - End; - - bf.BlendOp := 0; - bf.BlendFlags := 0; - bf.SourceConstantAlpha := ButtonMode_TranparentValue; - bf.AlphaFormat := 0; - - Windows.AlphaBlend(ImgButtonMode.Canvas.Handle, 0, 0, ImgButtonMode.Width, ImgButtonMode.Height, BMP_ButtonModeB.Canvas.Handle, 0, 0, ImgButtonMode.Width, ImgButtonMode.Height, bf); - End; - End; - - ImgButtonMode.Refresh; + bf: TBLENDFUNCTION; +Begin + If ButtonMode_State = State1 Then + Begin + If ButtonMode_MouseIn Then + Begin + // blend to over state + ButtonMode_TranparentValue := ButtonMode_TranparentValue + m_BlendingStep; + If ButtonMode_TranparentValue >= 255 Then + Begin + TmrButtonMode.Enabled := False; + ButtonMode_TranparentValue := 0; + ButtonMode_DrawState; + exit; + End; + + bf.BlendOp := 0; + bf.BlendFlags := 0; + bf.SourceConstantAlpha := ButtonMode_TranparentValue; + bf.AlphaFormat := 0; + + Windows.AlphaBlend(ImgButtonMode.Canvas.Handle, 0, 0, ImgButtonMode.Width, + ImgButtonMode.Height, BMP_ButtonModeE_Over.Canvas.Handle, 0, 0, + ImgButtonMode.Width, ImgButtonMode.Height, bf); + End + Else + Begin + // blend to up state + ButtonMode_TranparentValue := ButtonMode_TranparentValue + m_BlendingStep; + If ButtonMode_TranparentValue >= 255 Then + Begin + TmrButtonMode.Enabled := False; + ButtonMode_TranparentValue := 0; + ButtonMode_DrawState; + exit; + End; + + bf.BlendOp := 0; + bf.BlendFlags := 0; + bf.SourceConstantAlpha := ButtonMode_TranparentValue; + bf.AlphaFormat := 0; + + Windows.AlphaBlend(ImgButtonMode.Canvas.Handle, 0, 0, ImgButtonMode.Width, + ImgButtonMode.Height, BMP_ButtonModeE.Canvas.Handle, 0, 0, + ImgButtonMode.Width, ImgButtonMode.Height, bf); + End; + End + Else + Begin + If ButtonMode_MouseIn Then + Begin + // blend to over state + ButtonMode_TranparentValue := ButtonMode_TranparentValue + m_BlendingStep; + + If ButtonMode_TranparentValue >= 255 Then + Begin + TmrButtonMode.Enabled := False; + ButtonMode_TranparentValue := 0; + ButtonMode_DrawState; + exit; + End; + + bf.BlendOp := 0; + bf.BlendFlags := 0; + bf.SourceConstantAlpha := ButtonMode_TranparentValue; + bf.AlphaFormat := 0; + + Windows.AlphaBlend(ImgButtonMode.Canvas.Handle, 0, 0, ImgButtonMode.Width, + ImgButtonMode.Height, BMP_ButtonModeB_Over.Canvas.Handle, 0, 0, + ImgButtonMode.Width, ImgButtonMode.Height, bf); + End + Else + Begin + // blend to up state + ButtonMode_TranparentValue := ButtonMode_TranparentValue + m_BlendingStep; + + If ButtonMode_TranparentValue >= 255 Then + Begin + TmrButtonMode.Enabled := False; + ButtonMode_TranparentValue := 0; + ButtonMode_DrawState; + exit; + End; + + bf.BlendOp := 0; + bf.BlendFlags := 0; + bf.SourceConstantAlpha := ButtonMode_TranparentValue; + bf.AlphaFormat := 0; + + Windows.AlphaBlend(ImgButtonMode.Canvas.Handle, 0, 0, ImgButtonMode.Width, + ImgButtonMode.Height, BMP_ButtonModeB.Canvas.Handle, 0, 0, + ImgButtonMode.Width, ImgButtonMode.Height, bf); + End; + End; + + ImgButtonMode.Refresh; End; @@ -1857,137 +2071,159 @@ Procedure TTopBar.TmrButtonMouseTimer(Sender: TObject); Var - bf: TBLENDFUNCTION; -Begin - - If ButtonMouse_MouseIn = True Then Begin - // blend to over state - ButtonMouse_TranparentValue := ButtonMouse_TranparentValue + m_BlendingStep; - If ButtonMouse_TranparentValue >= 255 Then Begin - TmrButtonMouse.Enabled := False; - ButtonMouse_TranparentValue := 0; - ButtonMouse_DrawState; - exit; - End; - - bf.BlendOp := 0; - bf.BlendFlags := 0; - bf.SourceConstantAlpha := ButtonMouse_TranparentValue; - bf.AlphaFormat := 0; - - Windows.AlphaBlend(ImgButtonMouse.Canvas.Handle, 0, 0, ImgButtonMouse.Width, ImgButtonMouse.Height, BMP_ButtonMouse_Over.Canvas.Handle, 0, 0, ImgButtonMouse.Width, ImgButtonMouse.Height, - bf); - End - Else Begin - // blend to up state - ButtonMouse_TranparentValue := ButtonMouse_TranparentValue + m_BlendingStep; - If ButtonMouse_TranparentValue >= 255 Then Begin - TmrButtonMouse.Enabled := False; - ButtonMouse_TranparentValue := 0; - ButtonMouse_DrawState; - exit; - End; - - bf.BlendOp := 0; - bf.BlendFlags := 0; - bf.SourceConstantAlpha := ButtonMouse_TranparentValue; - bf.AlphaFormat := 0; - - Windows.AlphaBlend(ImgButtonMouse.Canvas.Handle, 0, 0, ImgButtonMouse.Width, ImgButtonMouse.Height, BMP_ButtonMouse.Canvas.Handle, 0, 0, ImgButtonMouse.Width, ImgButtonMouse.Height, bf); - End; - - ImgButtonMouse.Refresh; + bf: TBLENDFUNCTION; +Begin + + If ButtonMouse_MouseIn = True Then + Begin + // blend to over state + ButtonMouse_TranparentValue := ButtonMouse_TranparentValue + m_BlendingStep; + If ButtonMouse_TranparentValue >= 255 Then + Begin + TmrButtonMouse.Enabled := False; + ButtonMouse_TranparentValue := 0; + ButtonMouse_DrawState; + exit; + End; + + bf.BlendOp := 0; + bf.BlendFlags := 0; + bf.SourceConstantAlpha := ButtonMouse_TranparentValue; + bf.AlphaFormat := 0; + + Windows.AlphaBlend(ImgButtonMouse.Canvas.Handle, 0, 0, ImgButtonMouse.Width, + ImgButtonMouse.Height, BMP_ButtonMouse_Over.Canvas.Handle, 0, 0, + ImgButtonMouse.Width, ImgButtonMouse.Height, bf); + End + Else + Begin + // blend to up state + ButtonMouse_TranparentValue := ButtonMouse_TranparentValue + m_BlendingStep; + If ButtonMouse_TranparentValue >= 255 Then + Begin + TmrButtonMouse.Enabled := False; + ButtonMouse_TranparentValue := 0; + ButtonMouse_DrawState; + exit; + End; + + bf.BlendOp := 0; + bf.BlendFlags := 0; + bf.SourceConstantAlpha := ButtonMouse_TranparentValue; + bf.AlphaFormat := 0; + + Windows.AlphaBlend(ImgButtonMouse.Canvas.Handle, 0, 0, ImgButtonMouse.Width, + ImgButtonMouse.Height, BMP_ButtonMouse.Canvas.Handle, 0, 0, + ImgButtonMouse.Width, ImgButtonMouse.Height, bf); + End; + + ImgButtonMouse.Refresh; End; { =============================================================================== } Procedure TTopBar.TmrButtonToolsTimer(Sender: TObject); Var - bf: TBLENDFUNCTION; -Begin - - If ButtonTools_MouseIn = True Then Begin - // blend to over state - ButtonTools_TranparentValue := ButtonTools_TranparentValue + m_BlendingStep; - If ButtonTools_TranparentValue >= 255 Then Begin - TmrButtonTools.Enabled := False; - ButtonTools_TranparentValue := 0; - ButtonTools_DrawState; - exit; - End; - - bf.BlendOp := 0; - bf.BlendFlags := 0; - bf.SourceConstantAlpha := ButtonTools_TranparentValue; - bf.AlphaFormat := 0; - - Windows.AlphaBlend(ImgButtonTools.Canvas.Handle, 0, 0, ImgButtonTools.Width, ImgButtonTools.Height, BMP_ButtonTools_Over.Canvas.Handle, 0, 0, ImgButtonTools.Width, ImgButtonTools.Height, - bf); - End - Else Begin - // blend to up state - ButtonTools_TranparentValue := ButtonTools_TranparentValue + m_BlendingStep; - If ButtonTools_TranparentValue >= 255 Then Begin - TmrButtonTools.Enabled := False; - ButtonTools_TranparentValue := 0; - ButtonTools_DrawState; - exit; - End; - - bf.BlendOp := 0; - bf.BlendFlags := 0; - bf.SourceConstantAlpha := ButtonTools_TranparentValue; - bf.AlphaFormat := 0; - - Windows.AlphaBlend(ImgButtonTools.Canvas.Handle, 0, 0, ImgButtonTools.Width, ImgButtonTools.Height, BMP_ButtonTools.Canvas.Handle, 0, 0, ImgButtonTools.Width, ImgButtonTools.Height, bf); - End; - - ImgButtonTools.Refresh; + bf: TBLENDFUNCTION; +Begin + + If ButtonTools_MouseIn = True Then + Begin + // blend to over state + ButtonTools_TranparentValue := ButtonTools_TranparentValue + m_BlendingStep; + If ButtonTools_TranparentValue >= 255 Then + Begin + TmrButtonTools.Enabled := False; + ButtonTools_TranparentValue := 0; + ButtonTools_DrawState; + exit; + End; + + bf.BlendOp := 0; + bf.BlendFlags := 0; + bf.SourceConstantAlpha := ButtonTools_TranparentValue; + bf.AlphaFormat := 0; + + Windows.AlphaBlend(ImgButtonTools.Canvas.Handle, 0, 0, ImgButtonTools.Width, + ImgButtonTools.Height, BMP_ButtonTools_Over.Canvas.Handle, 0, 0, + ImgButtonTools.Width, ImgButtonTools.Height, bf); + End + Else + Begin + // blend to up state + ButtonTools_TranparentValue := ButtonTools_TranparentValue + m_BlendingStep; + If ButtonTools_TranparentValue >= 255 Then + Begin + TmrButtonTools.Enabled := False; + ButtonTools_TranparentValue := 0; + ButtonTools_DrawState; + exit; + End; + + bf.BlendOp := 0; + bf.BlendFlags := 0; + bf.SourceConstantAlpha := ButtonTools_TranparentValue; + bf.AlphaFormat := 0; + + Windows.AlphaBlend(ImgButtonTools.Canvas.Handle, 0, 0, ImgButtonTools.Width, + ImgButtonTools.Height, BMP_ButtonTools.Canvas.Handle, 0, 0, + ImgButtonTools.Width, ImgButtonTools.Height, bf); + End; + + ImgButtonTools.Refresh; End; { =============================================================================== } Procedure TTopBar.TmrButtonWWWTimer(Sender: TObject); Var - bf: TBLENDFUNCTION; -Begin - - If ButtonWWW_MouseIn = True Then Begin - // blend to over state - ButtonWWW_TranparentValue := ButtonWWW_TranparentValue + m_BlendingStep; - If ButtonWWW_TranparentValue >= 255 Then Begin - TmrButtonWWW.Enabled := False; - ButtonWWW_TranparentValue := 0; - ButtonWWW_DrawState; - exit; - End; - - bf.BlendOp := 0; - bf.BlendFlags := 0; - bf.SourceConstantAlpha := ButtonWWW_TranparentValue; - bf.AlphaFormat := 0; - - Windows.AlphaBlend(ImgButtonWWW.Canvas.Handle, 0, 0, ImgButtonWWW.Width, ImgButtonWWW.Height, BMP_ButtonWWW_Over.Canvas.Handle, 0, 0, ImgButtonWWW.Width, ImgButtonWWW.Height, bf); - End - Else Begin - // blend to up state - ButtonWWW_TranparentValue := ButtonWWW_TranparentValue + m_BlendingStep; - If ButtonWWW_TranparentValue >= 255 Then Begin - TmrButtonWWW.Enabled := False; - ButtonWWW_TranparentValue := 0; - ButtonWWW_DrawState; - exit; - End; - - bf.BlendOp := 0; - bf.BlendFlags := 0; - bf.SourceConstantAlpha := ButtonWWW_TranparentValue; - bf.AlphaFormat := 0; - - Windows.AlphaBlend(ImgButtonWWW.Canvas.Handle, 0, 0, ImgButtonWWW.Width, ImgButtonWWW.Height, BMP_ButtonWWW.Canvas.Handle, 0, 0, ImgButtonWWW.Width, ImgButtonWWW.Height, bf); - End; - - ImgButtonWWW.Refresh; + bf: TBLENDFUNCTION; +Begin + + If ButtonWWW_MouseIn = True Then + Begin + // blend to over state + ButtonWWW_TranparentValue := ButtonWWW_TranparentValue + m_BlendingStep; + If ButtonWWW_TranparentValue >= 255 Then + Begin + TmrButtonWWW.Enabled := False; + ButtonWWW_TranparentValue := 0; + ButtonWWW_DrawState; + exit; + End; + + bf.BlendOp := 0; + bf.BlendFlags := 0; + bf.SourceConstantAlpha := ButtonWWW_TranparentValue; + bf.AlphaFormat := 0; + + Windows.AlphaBlend(ImgButtonWWW.Canvas.Handle, 0, 0, ImgButtonWWW.Width, + ImgButtonWWW.Height, BMP_ButtonWWW_Over.Canvas.Handle, 0, 0, + ImgButtonWWW.Width, ImgButtonWWW.Height, bf); + End + Else + Begin + // blend to up state + ButtonWWW_TranparentValue := ButtonWWW_TranparentValue + m_BlendingStep; + If ButtonWWW_TranparentValue >= 255 Then + Begin + TmrButtonWWW.Enabled := False; + ButtonWWW_TranparentValue := 0; + ButtonWWW_DrawState; + exit; + End; + + bf.BlendOp := 0; + bf.BlendFlags := 0; + bf.SourceConstantAlpha := ButtonWWW_TranparentValue; + bf.AlphaFormat := 0; + + Windows.AlphaBlend(ImgButtonWWW.Canvas.Handle, 0, 0, ImgButtonWWW.Width, + ImgButtonWWW.Height, BMP_ButtonWWW.Canvas.Handle, 0, 0, + ImgButtonWWW.Width, ImgButtonWWW.Height, bf); + End; + + ImgButtonWWW.Refresh; End; { =============================================================================== } diff --git a/Keyboard and Spell checker/Forms/ufrmAbout.dfm b/Keyboard and Spell checker/Forms/ufrmAbout.dfm index 5a28dd4..c85af91 100644 --- a/Keyboard and Spell checker/Forms/ufrmAbout.dfm +++ b/Keyboard and Spell checker/Forms/ufrmAbout.dfm @@ -4926,7 +4926,7 @@ object frmAbout: TfrmAbout object Label2: TLabel Left = 178 Top = 31 - Width = 48 + Width = 47 Height = 13 Caption = 'Version:' Font.Charset = ANSI_CHARSET diff --git a/Keyboard and Spell checker/Forms/ufrmAbout.pas b/Keyboard and Spell checker/Forms/ufrmAbout.pas index 62a4af0..cf5b3f2 100644 --- a/Keyboard and Spell checker/Forms/ufrmAbout.pas +++ b/Keyboard and Spell checker/Forms/ufrmAbout.pas @@ -1,303 +1,297 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - Unit ufrmAbout; Interface Uses - Windows, - Messages, - SysUtils, - Variants, - Classes, - Graphics, - Controls, - Forms, - Dialogs, - StdCtrls, - jpeg, - ExtCtrls; + Windows, + Messages, + SysUtils, + Variants, + Classes, + Graphics, + Controls, + Forms, + Dialogs, + StdCtrls, + jpeg, + ExtCtrls; Type - TfrmAbout = Class(TForm) - Shape1: TShape; - Image1: TImage; - Label1: TLabel; - Label2: TLabel; - LabelVersion: TLabel; - Label4: TLabel; - Label5: TLabel; - Label_License: TLabel; - Label8: TLabel; - Label_OmicronLab: TLabel; - pbScrollBox: TImage; - ButtonClose: TButton; - tmrScroll: TTimer; - lblText: TLabel; - Credit: TMemo; - Label_Update: TLabel; - MemoLicense: TMemo; - LabelViewCredit: TLabel; - Image2: TImage; - Label3: TLabel; - EditDataDirectory: TEdit; - Procedure FormClose(Sender: TObject; Var Action: TCloseAction); - Procedure FormCreate(Sender: TObject); - Procedure tmrScrollTimer(Sender: TObject); - Procedure pbScrollBoxMouseEnter(Sender: TObject); - Procedure pbScrollBoxMouseLeave(Sender: TObject); - Procedure ButtonCloseClick(Sender: TObject); - Procedure FormShow(Sender: TObject); - Procedure Label_OmicronLabClick(Sender: TObject); - Procedure Label_LicenseClick(Sender: TObject); - Procedure Label_UpdateClick(Sender: TObject); - Procedure LabelViewCreditClick(Sender: TObject); - Procedure FormActivate(Sender: TObject); - Procedure FormPaint(Sender: TObject); - Procedure EditDataDirectoryClick(Sender: TObject); - - - Private - { Private declarations } - TheY: integer; - Procedure DrawLine; - Public - { Public declarations } - End; + TfrmAbout = Class(TForm) + Shape1: TShape; + Image1: TImage; + Label1: TLabel; + Label2: TLabel; + LabelVersion: TLabel; + Label4: TLabel; + Label5: TLabel; + Label_License: TLabel; + Label8: TLabel; + Label_OmicronLab: TLabel; + pbScrollBox: TImage; + ButtonClose: TButton; + tmrScroll: TTimer; + lblText: TLabel; + Credit: TMemo; + Label_Update: TLabel; + MemoLicense: TMemo; + LabelViewCredit: TLabel; + Image2: TImage; + Label3: TLabel; + EditDataDirectory: TEdit; + Procedure FormClose(Sender: TObject; Var Action: TCloseAction); + Procedure FormCreate(Sender: TObject); + Procedure tmrScrollTimer(Sender: TObject); + Procedure pbScrollBoxMouseEnter(Sender: TObject); + Procedure pbScrollBoxMouseLeave(Sender: TObject); + Procedure ButtonCloseClick(Sender: TObject); + Procedure FormShow(Sender: TObject); + Procedure Label_OmicronLabClick(Sender: TObject); + Procedure Label_LicenseClick(Sender: TObject); + Procedure Label_UpdateClick(Sender: TObject); + Procedure LabelViewCreditClick(Sender: TObject); + Procedure FormActivate(Sender: TObject); + Procedure FormPaint(Sender: TObject); + Procedure EditDataDirectoryClick(Sender: TObject); + + Private + { Private declarations } + TheY: integer; + Procedure DrawLine; + Public + { Public declarations } + End; Var - frmAbout : TfrmAbout; + frmAbout: TfrmAbout; Implementation {$R *.dfm} + Uses - uWindowHandlers, - uFileFolderHandling, - clsFileVersion, - uRegistrySettings, - uForm1; + uWindowHandlers, + uFileFolderHandling, + clsFileVersion, + uRegistrySettings, + uForm1; -{===============================================================================} +{ =============================================================================== } Procedure TfrmAbout.ButtonCloseClick(Sender: TObject); Begin - Self.Close; + Self.Close; End; -{===============================================================================} - +{ =============================================================================== } Procedure TfrmAbout.DrawLine; Begin - With Self.Canvas Do Begin - Pen.Color := clBlack; - Pen.Style := psDashDotDot; - Pen.Mode := pmBlack; - Pen.Width := 1; + With Self.Canvas Do + Begin + Pen.Color := clBlack; + Pen.Style := psDashDotDot; + Pen.Mode := pmBlack; + Pen.Width := 1; - MoveTo(0, 0); - LineTo(self.Width, 0); + MoveTo(0, 0); + LineTo(Self.Width, 0); - MoveTo(0, 0); - LineTo(0, Self.Height); + MoveTo(0, 0); + LineTo(0, Self.Height); - MoveTo(0, Self.Height - 1); - LineTo(self.Width, Self.Height - 1); + MoveTo(0, Self.Height - 1); + LineTo(Self.Width, Self.Height - 1); - MoveTo(self.Width - 1, 0); - LineTo(self.Width - 1, Self.Height); + MoveTo(Self.Width - 1, 0); + LineTo(Self.Width - 1, Self.Height); - Refresh; - End; + Refresh; + End; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmAbout.EditDataDirectoryClick(Sender: TObject); Begin - EditDataDirectory.SelectAll; + EditDataDirectory.SelectAll; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmAbout.FormActivate(Sender: TObject); Begin End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmAbout.FormClose(Sender: TObject; Var Action: TCloseAction); Begin - Action := caFree; + Action := caFree; - frmAbout := Nil; + frmAbout := Nil; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmAbout.FormCreate(Sender: TObject); Var - Version : TFileVersion; + Version: TFileVersion; Begin - self.Width := shape1.Width; - self.Height := shape1.Height; - pbScrollBox.Canvas.Font.Name := 'Courier New'; - pbScrollBox.Canvas.Font.Color := clMaroon; - lblText.Caption := Credit.text; - TheY := pbScrollBox.ClientHeight; - pbScrollBox.Canvas.Brush.Style := bsSolid; - - tmrScroll.Enabled := True; - - Version := TFileVersion.Create(); - LabelVersion.Caption := Version.AsString{$IFDEF BetaVersion} + ' BETA'{$ENDIF}{$IFDEF PortableOn} + ' (Portable)'{$ENDIF}; - Version.Free; - Label_Update.Left := LabelVersion.Left + LabelVersion.Width + 10; - EditDataDirectory.Text := GetAvroDataDir; + Self.Width := Shape1.Width; + Self.Height := Shape1.Height; + pbScrollBox.Canvas.Font.Name := 'Courier New'; + pbScrollBox.Canvas.Font.Color := clMaroon; + lblText.Caption := Credit.text; + TheY := pbScrollBox.ClientHeight; + pbScrollBox.Canvas.Brush.Style := bsSolid; + + tmrScroll.Enabled := True; + + Version := TFileVersion.Create(); + LabelVersion.Caption := Version.AsString{$IFDEF BetaVersion} + + ' BETA'{$ENDIF}{$IFDEF PortableOn} + ' (Portable)'{$ENDIF}; + Version.Free; + Label_Update.Left := LabelVersion.Left + LabelVersion.Width + 10; + EditDataDirectory.text := GetAvroDataDir; End; Procedure TfrmAbout.FormPaint(Sender: TObject); Begin - DrawLine; + DrawLine; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmAbout.FormShow(Sender: TObject); Begin - TOPMOST(Self.Handle); - DrawLine; + TOPMOST(Self.Handle); + DrawLine; End; - -{===============================================================================} - +{ =============================================================================== } Procedure TfrmAbout.LabelViewCreditClick(Sender: TObject); Begin - MemoLicense.Visible := False; - pbScrollBox.Visible := True; - tmrScroll.Enabled := True; - Label5.Visible := True; - Label_License.Visible := True; - LabelViewCredit.Visible := False; + MemoLicense.Visible := False; + pbScrollBox.Visible := True; + tmrScroll.Enabled := True; + Label5.Visible := True; + Label_License.Visible := True; + LabelViewCredit.Visible := False; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmAbout.Label_LicenseClick(Sender: TObject); Begin - MemoLicense.Visible := True; - pbScrollBox.Visible := False; - tmrScroll.Enabled := False; - Label5.Visible := False; - Label_License.Visible := False; - LabelViewCredit.Visible := True; + MemoLicense.Visible := True; + pbScrollBox.Visible := False; + tmrScroll.Enabled := False; + Label5.Visible := False; + Label_License.Visible := False; + LabelViewCredit.Visible := True; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmAbout.Label_OmicronLabClick(Sender: TObject); Begin - Execute_Something('http://www.omicronlab.com'); + Execute_Something('http://www.omicronlab.com'); End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmAbout.Label_UpdateClick(Sender: TObject); Begin - AvroMainForm1.CheckupdateforAvroKeyboard1Click(Nil); + AvroMainForm1.CheckupdateforAvroKeyboard1Click(Nil); End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmAbout.pbScrollBoxMouseEnter(Sender: TObject); Begin - tmrScroll.Enabled := False; + tmrScroll.Enabled := False; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmAbout.pbScrollBoxMouseLeave(Sender: TObject); Begin - tmrScroll.Enabled := True; + tmrScroll.Enabled := True; End; -{===============================================================================} +{ =============================================================================== } {$HINTS Off} Procedure TfrmAbout.tmrScrollTimer(Sender: TObject); Var - textSize : TSize; - i, blockHeight : Integer; + textSize: TSize; + i, blockHeight: integer; Begin - pbScrollBox.Canvas.Brush.Color := clwhite; - - pbScrollBox.Canvas.FillRect(pbScrollBox.ClientRect); - - - - - If TheY <= -lblText.Height Then - TheY := pbScrollBox.ClientHeight - Else - TheY := TheY - 1; - - // see how high our block of text is going to be, based on the font the canvas - // currently has set - textSize := pbScrollBox.canvas.TextExtent('Credit'); - blockHeight := textSize.cy * credit.Lines.Count; - blockHeight := blockHeight; - - - // go through each line and output it - For i := 0 To credit.Lines.Count - 1 Do Begin - // we need the width of each line, so we can center it on the canvas - textSize := pbScrollBox.canvas.TextExtent(credit.Lines[i]); - // render the text - - If (((textSize.cy * i) + TheY) < pbScrollBox.ClientHeight) And - (((textSize.cy * i) + TheY) > -textSize.cy) Then Begin - pbScrollBox.canvas.TextOut((pbScrollBox.width Div 2) - (textSize.cx Div 2), - (textSize.cy * i) + TheY, - credit.Lines[i]); - End; - End; - pbScrollBox.Canvas.Refresh; + pbScrollBox.Canvas.Brush.Color := clwhite; + + pbScrollBox.Canvas.FillRect(pbScrollBox.ClientRect); + + If TheY <= -lblText.Height Then + TheY := pbScrollBox.ClientHeight + Else + TheY := TheY - 1; + + // see how high our block of text is going to be, based on the font the canvas + // currently has set + textSize := pbScrollBox.Canvas.TextExtent('Credit'); + blockHeight := textSize.cy * Credit.Lines.Count; + blockHeight := blockHeight; + + // go through each line and output it + For i := 0 To Credit.Lines.Count - 1 Do + Begin + // we need the width of each line, so we can center it on the canvas + textSize := pbScrollBox.Canvas.TextExtent(Credit.Lines[i]); + // render the text + + If (((textSize.cy * i) + TheY) < pbScrollBox.ClientHeight) And + (((textSize.cy * i) + TheY) > -textSize.cy) Then + Begin + pbScrollBox.Canvas.TextOut((pbScrollBox.Width Div 2) - + (textSize.cx Div 2), (textSize.cy * i) + TheY, Credit.Lines[i]); + End; + End; + pbScrollBox.Canvas.Refresh; End; {$HINTS On} -{===============================================================================} +{ =============================================================================== } End. - diff --git a/Keyboard and Spell checker/Forms/ufrmAboutSkinLayout.pas b/Keyboard and Spell checker/Forms/ufrmAboutSkinLayout.pas index e891aee..41ddca9 100644 --- a/Keyboard and Spell checker/Forms/ufrmAboutSkinLayout.pas +++ b/Keyboard and Spell checker/Forms/ufrmAboutSkinLayout.pas @@ -1,105 +1,105 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - Unit ufrmAboutSkinLayout; Interface Uses - Windows, - Messages, - SysUtils, - Variants, - Classes, - Graphics, - Controls, - Forms, - Dialogs, - StdCtrls; + Windows, + Messages, + SysUtils, + Variants, + Classes, + Graphics, + Controls, + Forms, + Dialogs, + StdCtrls; Type - TfrmAboutSkinLayout = Class(TForm) - Label1: TLabel; - Label2: TLabel; - Label3: TLabel; - Label4: TLabel; - txtName: TEdit; - txtVersion: TEdit; - txtDeveloper: TEdit; - Button1: TButton; + TfrmAboutSkinLayout = Class(TForm) + Label1: TLabel; + Label2: TLabel; + Label3: TLabel; + Label4: TLabel; + txtName: TEdit; + txtVersion: TEdit; + txtDeveloper: TEdit; + Button1: TButton; txtComment: TMemo; - Procedure FormClose(Sender: TObject; Var Action: TCloseAction); - Procedure Button1Click(Sender: TObject); - Private - { Private declarations } - Public - { Public declarations } - Procedure ShowDescription; - End; + Procedure FormClose(Sender: TObject; Var Action: TCloseAction); + Procedure Button1Click(Sender: TObject); + Private + { Private declarations } + Public + { Public declarations } + Procedure ShowDescription; + End; Var - frmAboutSkinLayout : TfrmAboutSkinLayout; + frmAboutSkinLayout: TfrmAboutSkinLayout; Implementation {$R *.dfm} + Uses - uWindowHandlers, - uTopBar; + uWindowHandlers, + uTopBar; -{===============================================================================} +{ =============================================================================== } Procedure TfrmAboutSkinLayout.Button1Click(Sender: TObject); Begin - Self.Close; + Self.Close; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmAboutSkinLayout.FormClose(Sender: TObject; - Var Action: TCloseAction); + Var Action: TCloseAction); Begin - Action := caFree; + Action := caFree; - frmAboutSkinLayout := Nil; + frmAboutSkinLayout := Nil; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmAboutSkinLayout.ShowDescription; Begin - self.Show; - TopMost(self.Handle); - If IsFormVisible('TopBar') = True Then TOPMOST(TopBar.Handle); + Self.Show; + TopMost(Self.Handle); + If IsFormVisible('TopBar') = True Then + TopMost(TopBar.Handle); End; -{===============================================================================} +{ =============================================================================== } End. - diff --git a/Keyboard and Spell checker/Forms/ufrmAutoCorrect.pas b/Keyboard and Spell checker/Forms/ufrmAutoCorrect.pas index 4026b2b..184b69f 100644 --- a/Keyboard and Spell checker/Forms/ufrmAutoCorrect.pas +++ b/Keyboard and Spell checker/Forms/ufrmAutoCorrect.pas @@ -1,32 +1,31 @@ { - ============================================================================= - ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + ============================================================================= + ***************************************************************************** + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. - ***************************************************************************** - ============================================================================= + ***************************************************************************** + ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - { COMPLETE TRANSFERING! } Unit ufrmAutoCorrect; @@ -34,99 +33,98 @@ Interface Uses - Windows, - Messages, - SysUtils, - Variants, - Classes, - Graphics, - Controls, - Forms, - Dialogs, - uAutoCorrect, - StdCtrls, - ComCtrls, - clsEnglishToBangla, - uWindowHandlers, - uFileFolderHandling, - StrUtils, - Generics.Collections; + Windows, + Messages, + SysUtils, + Variants, + Classes, + Graphics, + Controls, + Forms, + Dialogs, + uAutoCorrect, + StdCtrls, + ComCtrls, + clsEnglishToBangla, + uWindowHandlers, + uFileFolderHandling, + StrUtils, + Generics.Collections; Type - TfrmAutoCorrect = Class(TForm) - List: TListView; - cmdSave: TButton; - cmdCancel: TButton; - CheckOnTop: TCheckBox; - lblTotalEntries: TLabel; - GroupBox1: TGroupBox; - ReplaceT: TEdit; - WithT: TEdit; - Label2: TLabel; - Label3: TLabel; - R1: TEdit; - R2: TEdit; - cmdClear: TButton; - cmdDel: TButton; - cmdAdd: TButton; - cmdImport: TButton; - OpenDialog1: TOpenDialog; - Procedure FormCreate(Sender: TObject); - Procedure ListSelectItem(Sender: TObject; Item: TListItem; Selected: Boolean); - Procedure ReplaceTChange(Sender: TObject); - Procedure WithTChange(Sender: TObject); - Procedure WithTKeyPress(Sender: TObject; Var Key: Char); - Procedure ReplaceTKeyPress(Sender: TObject; Var Key: Char); - Procedure FormClose(Sender: TObject; Var Action: TCloseAction); - Procedure cmdCancelClick(Sender: TObject); - Procedure cmdClearClick(Sender: TObject); - Procedure cmdDelClick(Sender: TObject); - Procedure cmdAddClick(Sender: TObject); - Procedure cmdSaveClick(Sender: TObject); - Procedure CheckOnTopClick(Sender: TObject); - Procedure FormKeyDown(Sender: TObject; Var Key: Word; Shift: TShiftState); - Procedure cmdImportClick(Sender: TObject); - Private - { Private declarations } - Phonetic: TEnglishToBangla; - Function FindListItem(Const SearchStr: String): TListItem; - Procedure ButtonState; - Function Save: Boolean; - - Public - { Public declarations } - Protected - Procedure CreateParams(Var Params: TCreateParams); Override; - End; + TfrmAutoCorrect = Class(TForm) + List: TListView; + cmdSave: TButton; + cmdCancel: TButton; + CheckOnTop: TCheckBox; + lblTotalEntries: TLabel; + GroupBox1: TGroupBox; + ReplaceT: TEdit; + WithT: TEdit; + Label2: TLabel; + Label3: TLabel; + R1: TEdit; + R2: TEdit; + cmdClear: TButton; + cmdDel: TButton; + cmdAdd: TButton; + cmdImport: TButton; + OpenDialog1: TOpenDialog; + Procedure FormCreate(Sender: TObject); + Procedure ListSelectItem(Sender: TObject; Item: TListItem; + Selected: Boolean); + Procedure ReplaceTChange(Sender: TObject); + Procedure WithTChange(Sender: TObject); + Procedure WithTKeyPress(Sender: TObject; Var Key: Char); + Procedure ReplaceTKeyPress(Sender: TObject; Var Key: Char); + Procedure FormClose(Sender: TObject; Var Action: TCloseAction); + Procedure cmdCancelClick(Sender: TObject); + Procedure cmdClearClick(Sender: TObject); + Procedure cmdDelClick(Sender: TObject); + Procedure cmdAddClick(Sender: TObject); + Procedure cmdSaveClick(Sender: TObject); + Procedure CheckOnTopClick(Sender: TObject); + Procedure FormKeyDown(Sender: TObject; Var Key: Word; Shift: TShiftState); + Procedure cmdImportClick(Sender: TObject); + Private + { Private declarations } + Phonetic: TEnglishToBangla; + Function FindListItem(Const SearchStr: String): TListItem; + Procedure ButtonState; + Function Save: Boolean; + + Public + { Public declarations } + Protected + Procedure CreateParams(Var Params: TCreateParams); Override; + End; Var - frmAutoCorrect: TfrmAutoCorrect; + frmAutoCorrect: TfrmAutoCorrect; Implementation Uses - ufrmConflict; + ufrmConflict; {$R *.dfm} Const - Show_Window_in_Taskbar = True; - + Show_Window_in_Taskbar = True; - { =============================================================================== } + { =============================================================================== } Procedure TfrmAutoCorrect.ButtonState; Begin - If (Trim(ReplaceT.text) <> '') And (Trim(WithT.text) <> '') Then - cmdAdd.Enabled := True - Else - cmdAdd.Enabled := False; - + If (Trim(ReplaceT.text) <> '') And (Trim(WithT.text) <> '') Then + cmdAdd.Enabled := True + Else + cmdAdd.Enabled := False; - If (Trim(ReplaceT.text) <> '') Or (Trim(WithT.text) <> '') Then - cmdClear.Enabled := True - Else - cmdClear.Enabled := False; + If (Trim(ReplaceT.text) <> '') Or (Trim(WithT.text) <> '') Then + cmdClear.Enabled := True + Else + cmdClear.Enabled := False; End; @@ -134,54 +132,55 @@ Procedure TfrmAutoCorrect.CheckOnTopClick(Sender: TObject); Begin - If CheckOnTop.Checked Then - TOPMOST(Self.Handle) - Else - NoTOPMOST(Self.Handle); + If CheckOnTop.Checked Then + TOPMOST(Self.Handle) + Else + NoTOPMOST(Self.Handle); End; { =============================================================================== } Procedure TfrmAutoCorrect.cmdAddClick(Sender: TObject); Var - thisItem: TListItem; + thisItem: TListItem; Begin - ReplaceT.text := Trim(ReplaceT.text); - WithT.text := Trim(WithT.text); - - If ReplaceT.text <> WithT.text Then Begin - ReplaceT.text := Trim(Phonetic.CorrectCase(ReplaceT.text)); - WithT.text := Trim(Phonetic.CorrectCase(WithT.text)); - End; - - thisItem := Nil; - thisItem := FindListItem(ReplaceT.text); - - If (thisItem = Nil) Then Begin - thisItem := List.Items.Add; - thisItem.Caption := ReplaceT.text; - thisItem.SubItems.Add(WithT.text); - List.Selected := Nil; - List.Selected := thisItem; - thisItem.MakeVisible(False); - End - Else Begin - thisItem.Caption := ReplaceT.text; - thisItem.SubItems[0] := WithT.text; - List.Selected := Nil; - List.Selected := thisItem; - thisItem.MakeVisible(False); - End; - - - - WithT.text := ''; - ReplaceT.text := ''; - cmdSave.Enabled := True; - - ReplaceT.SetFocus; - - lblTotalEntries.Caption := 'Total entries : ' + IntToStr(List.Items.Count); + ReplaceT.text := Trim(ReplaceT.text); + WithT.text := Trim(WithT.text); + + If ReplaceT.text <> WithT.text Then + Begin + ReplaceT.text := Trim(Phonetic.CorrectCase(ReplaceT.text)); + WithT.text := Trim(Phonetic.CorrectCase(WithT.text)); + End; + + thisItem := Nil; + thisItem := FindListItem(ReplaceT.text); + + If (thisItem = Nil) Then + Begin + thisItem := List.Items.Add; + thisItem.Caption := ReplaceT.text; + thisItem.SubItems.Add(WithT.text); + List.Selected := Nil; + List.Selected := thisItem; + thisItem.MakeVisible(False); + End + Else + Begin + thisItem.Caption := ReplaceT.text; + thisItem.SubItems[0] := WithT.text; + List.Selected := Nil; + List.Selected := thisItem; + thisItem.MakeVisible(False); + End; + + WithT.text := ''; + ReplaceT.text := ''; + cmdSave.Enabled := True; + + ReplaceT.SetFocus; + + lblTotalEntries.Caption := 'Total entries : ' + IntToStr(List.Items.Count); End; @@ -189,17 +188,20 @@ Procedure TfrmAutoCorrect.cmdCancelClick(Sender: TObject); Var - Msg: Integer; + Msg: Integer; Begin - If cmdSave.Enabled = True Then Begin - Msg := Application.MessageBox('Save changes in the auto-correct dictionary?', 'Confirmation', MB_YESNOCANCEL + MB_ICONQUESTION + MB_DEFBUTTON1 + MB_APPLMODAL); - If Msg = ID_YES Then - Save(); - If Msg = ID_CANCEL Then - Exit; - End; - - Self.Close; + If cmdSave.Enabled = True Then + Begin + Msg := Application.MessageBox + ('Save changes in the auto-correct dictionary?', 'Confirmation', + MB_YESNOCANCEL + MB_ICONQUESTION + MB_DEFBUTTON1 + MB_APPLMODAL); + If Msg = ID_YES Then + Save(); + If Msg = ID_CANCEL Then + Exit; + End; + + Self.Close; End; @@ -207,32 +209,37 @@ Procedure TfrmAutoCorrect.cmdClearClick(Sender: TObject); Begin - ReplaceT.text := ''; - WithT.text := ''; + ReplaceT.text := ''; + WithT.text := ''; - ReplaceT.SetFocus; + ReplaceT.SetFocus; End; { =============================================================================== } Procedure TfrmAutoCorrect.cmdDelClick(Sender: TObject); Var - Msg: Integer; + Msg: Integer; Begin - If Not(List.Selected = Nil) Then Begin - Msg := Application.MessageBox(PChar('Delete ' + List.Selected.Caption + ' = ' + List.Selected.SubItems[0] + '?'), 'Auto correct', MB_YESNO + MB_ICONQUESTION + MB_DEFBUTTON2 + MB_APPLMODAL); - If Msg = ID_NO Then - Exit; - - List.Items.Delete(List.Selected.Index); - ReplaceT.text := ''; - WithT.text := ''; - cmdSave.Enabled := True; - End - Else Begin - Application.MessageBox('No item is selected in the list!', 'Auto correct', MB_OK + MB_ICONEXCLAMATION + MB_DEFBUTTON1 + MB_APPLMODAL); - End; - lblTotalEntries.Caption := 'Total entries : ' + IntToStr(List.Items.Count); + If Not(List.Selected = Nil) Then + Begin + Msg := Application.MessageBox(PChar('Delete ' + List.Selected.Caption + + ' = ' + List.Selected.SubItems[0] + '?'), 'Auto correct', + MB_YESNO + MB_ICONQUESTION + MB_DEFBUTTON2 + MB_APPLMODAL); + If Msg = ID_NO Then + Exit; + + List.Items.Delete(List.Selected.Index); + ReplaceT.text := ''; + WithT.text := ''; + cmdSave.Enabled := True; + End + Else + Begin + Application.MessageBox('No item is selected in the list!', 'Auto correct', + MB_OK + MB_ICONEXCLAMATION + MB_DEFBUTTON1 + MB_APPLMODAL); + End; + lblTotalEntries.Caption := 'Total entries : ' + IntToStr(List.Items.Count); End; { =============================================================================== } @@ -240,163 +247,180 @@ Procedure TfrmAutoCorrect.cmdImportClick(Sender: TObject); {$HINTS Off} - - Function LoadIDict(Path: String; Var idict: TDictionary): Boolean; - Var - List: TStringList; - I, P: Integer; - FirstPart, SecondPart: String; - Begin - result := False; - Try - Try - List := TStringList.Create; - List.LoadFromFile(Path); - - For I := 0 To List.Count - 1 Do Begin - If (LeftStr(Trim(List[I]), 1) <> '/') And (Trim(List[I]) <> '') Then Begin - P := Pos(' ', Trim(List[I])); - FirstPart := LeftStr(Trim(List[I]), P - 1); - SecondPart := MidStr(Trim(List[I]), P + 1, Length(Trim(List[I]))); - idict.AddOrSetValue(FirstPart, SecondPart); - End; - End; - result := True; - Except - On E: Exception Do Begin - Application.MessageBox(PChar('Cannot import auto-correct dictionary!'), 'Avro Keyboard', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - result := False; - End; - End; - Finally - FreeAndNil(List); - End; - - End; + Function LoadIDict(Path: String; + Var idict: TDictionary): Boolean; + Var + List: TStringList; + I, P: Integer; + FirstPart, SecondPart: String; + Begin + result := False; + Try + Try + List := TStringList.Create; + List.LoadFromFile(Path); + + For I := 0 To List.Count - 1 Do + Begin + If (LeftStr(Trim(List[I]), 1) <> '/') And (Trim(List[I]) <> '') Then + Begin + P := Pos(' ', Trim(List[I])); + FirstPart := LeftStr(Trim(List[I]), P - 1); + SecondPart := MidStr(Trim(List[I]), P + 1, Length(Trim(List[I]))); + idict.AddOrSetValue(FirstPart, SecondPart); + End; + End; + result := True; + Except + On E: Exception Do + Begin + Application.MessageBox + (PChar('Cannot import auto-correct dictionary!'), 'Avro Keyboard', + MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); + result := False; + End; + End; + Finally + FreeAndNil(List); + End; + + End; {$HINTS On} { =============================================================================== } Var - idict: TDictionary; - S: String; - Rs, Ws: String; - thisItem: TListItem; - ResultModal: Integer; - DictItem: String; + idict: TDictionary; + S: String; + Rs, Ws: String; + thisItem: TListItem; + ResultModal: Integer; + DictItem: String; Begin - If OpenDialog1.Execute(Self.Handle) Then Begin - idict := TDictionary.Create; - - If LoadIDict(OpenDialog1.FileName, idict) = False Then - Exit; - - For S in idict.Keys Do Begin - - Rs := S; - Ws := idict.Items[S]; - - If dict.TryGetValue(Rs, DictItem) Then Begin - // There may be a conflict - If DictItem <> Ws Then Begin - // Conflict!! items are not same - // CheckCreateForm(TfrmConflict, frmConflict, 'frmConflict'); - Application.CreateForm(TfrmConflict, frmConflict); - frmConflict.EditR.text := Rs; - frmConflict.EditR_P.text := Phonetic.Convert(Rs); - frmConflict.EditWC.text := DictItem; - frmConflict.EditWC_P.text := Phonetic.Convert(DictItem); - frmConflict.EditWI.text := Ws; - If Rs <> Ws Then - frmConflict.EditWI_P.text := Phonetic.Convert(Ws) - Else - frmConflict.EditWI_P.text := Ws; - - ResultModal := frmConflict.ShowModal; - - If ResultModal = mrCancel Then Begin - // Keep current, do nothing - End - Else If ResultModal = mrOk Then Begin - // Update current with imported - thisItem := Nil; - thisItem := FindListItem(Rs); - - thisItem.Caption := Rs; - thisItem.SubItems[0] := Ws; - End; - End; - End - Else Begin - // No conflict, new item->import this - thisItem := List.Items.Add; - thisItem.Caption := Rs; - thisItem.SubItems.Add(Ws); - End; - End; - WithT.text := ''; - ReplaceT.text := ''; - cmdSave.Enabled := True; - - ReplaceT.SetFocus; - - lblTotalEntries.Caption := 'Total entries : ' + IntToStr(List.Items.Count); - End; + If OpenDialog1.Execute(Self.Handle) Then + Begin + idict := TDictionary.Create; + + If LoadIDict(OpenDialog1.FileName, idict) = False Then + Exit; + + For S in idict.Keys Do + Begin + + Rs := S; + Ws := idict.Items[S]; + + If dict.TryGetValue(Rs, DictItem) Then + Begin + // There may be a conflict + If DictItem <> Ws Then + Begin + // Conflict!! items are not same + // CheckCreateForm(TfrmConflict, frmConflict, 'frmConflict'); + Application.CreateForm(TfrmConflict, frmConflict); + frmConflict.EditR.text := Rs; + frmConflict.EditR_P.text := Phonetic.Convert(Rs); + frmConflict.EditWC.text := DictItem; + frmConflict.EditWC_P.text := Phonetic.Convert(DictItem); + frmConflict.EditWI.text := Ws; + If Rs <> Ws Then + frmConflict.EditWI_P.text := Phonetic.Convert(Ws) + Else + frmConflict.EditWI_P.text := Ws; + + ResultModal := frmConflict.ShowModal; + + If ResultModal = mrCancel Then + Begin + // Keep current, do nothing + End + Else If ResultModal = mrOk Then + Begin + // Update current with imported + thisItem := Nil; + thisItem := FindListItem(Rs); + + thisItem.Caption := Rs; + thisItem.SubItems[0] := Ws; + End; + End; + End + Else + Begin + // No conflict, new item->import this + thisItem := List.Items.Add; + thisItem.Caption := Rs; + thisItem.SubItems.Add(Ws); + End; + End; + WithT.text := ''; + ReplaceT.text := ''; + cmdSave.Enabled := True; + + ReplaceT.SetFocus; + + lblTotalEntries.Caption := 'Total entries : ' + IntToStr(List.Items.Count); + End; End; { =============================================================================== } Procedure TfrmAutoCorrect.cmdSaveClick(Sender: TObject); Begin - If Save = True Then Begin - cmdSave.Enabled := False; - ReplaceT.SetFocus; - End; + If Save = True Then + Begin + cmdSave.Enabled := False; + ReplaceT.SetFocus; + End; End; { =============================================================================== } Procedure TfrmAutoCorrect.CreateParams(Var Params: TCreateParams); Begin - Inherited CreateParams(Params); - With Params Do Begin - If Show_Window_in_Taskbar Then Begin - ExStyle := ExStyle Or WS_EX_APPWINDOW And Not WS_EX_TOOLWINDOW; - WndParent := GetDesktopwindow; - End - Else If Not Show_Window_in_Taskbar Then Begin - ExStyle := ExStyle And Not WS_EX_APPWINDOW; - End; - End; + Inherited CreateParams(Params); + With Params Do + Begin + If Show_Window_in_Taskbar Then + Begin + ExStyle := ExStyle Or WS_EX_APPWINDOW And Not WS_EX_TOOLWINDOW; + WndParent := GetDesktopwindow; + End + Else If Not Show_Window_in_Taskbar Then + Begin + ExStyle := ExStyle And Not WS_EX_APPWINDOW; + End; + End; End; { =============================================================================== } Function TfrmAutoCorrect.FindListItem(Const SearchStr: String): TListItem; Var - thisItem: TListItem; - Found: Boolean; - InIndex: Integer; + thisItem: TListItem; + Found: Boolean; + InIndex: Integer; Begin - InIndex := 0; + InIndex := 0; - thisItem := Nil; - Found := False; + thisItem := Nil; + Found := False; - Repeat - thisItem := List.FindCaption(InIndex, SearchStr, False, True, False); + Repeat + thisItem := List.FindCaption(InIndex, SearchStr, False, True, False); - If Not(thisItem = Nil) Then Begin - // Make it case sensitive - If thisItem.Caption <> SearchStr Then - // Find again - InIndex := thisItem.Index + 1 - Else - Found := True; - End; - Until ((Found = True) Or (thisItem = Nil)); + If Not(thisItem = Nil) Then + Begin + // Make it case sensitive + If thisItem.Caption <> SearchStr Then + // Find again + InIndex := thisItem.Index + 1 + Else + Found := True; + End; + Until ((Found = True) Or (thisItem = Nil)); - result := thisItem; + result := thisItem; End; @@ -404,80 +428,85 @@ Procedure TfrmAutoCorrect.FormClose(Sender: TObject; Var Action: TCloseAction); Begin - FreeAndNil(Phonetic); + FreeAndNil(Phonetic); - Action := caFree; + Action := caFree; - frmAutoCorrect := Nil; + frmAutoCorrect := Nil; End; { =============================================================================== } Procedure TfrmAutoCorrect.FormCreate(Sender: TObject); Var - S: String; - thisItem: TListItem; + S: String; + thisItem: TListItem; Begin - Phonetic := TEnglishToBangla.Create; - Phonetic.AutoCorrectEnabled := False; - - List.Items.BeginUpdate; - For S in dict.Keys Do Begin - thisItem := List.Items.Add; - thisItem.Caption := S; - thisItem.SubItems.Add(dict.Items[S]); - End; - List.SortType := stText; - List.Items.EndUpdate; - - lblTotalEntries.Caption := 'Total entries : ' + IntToStr(List.Items.Count); - - DisableCloseButton(Self.Handle); + Phonetic := TEnglishToBangla.Create; + Phonetic.AutoCorrectEnabled := False; + + List.Items.BeginUpdate; + For S in dict.Keys Do + Begin + thisItem := List.Items.Add; + thisItem.Caption := S; + thisItem.SubItems.Add(dict.Items[S]); + End; + List.SortType := stText; + List.Items.EndUpdate; + + lblTotalEntries.Caption := 'Total entries : ' + IntToStr(List.Items.Count); + + DisableCloseButton(Self.Handle); End; { =============================================================================== } -Procedure TfrmAutoCorrect.FormKeyDown(Sender: TObject; Var Key: Word; Shift: TShiftState); +Procedure TfrmAutoCorrect.FormKeyDown(Sender: TObject; Var Key: Word; + Shift: TShiftState); Begin - If (Key = VK_F4) And (ssAlt In Shift) Then - Key := 0; + If (Key = VK_F4) And (ssAlt In Shift) Then + Key := 0; End; { =============================================================================== } -Procedure TfrmAutoCorrect.ListSelectItem(Sender: TObject; Item: TListItem; Selected: Boolean); +Procedure TfrmAutoCorrect.ListSelectItem(Sender: TObject; Item: TListItem; + Selected: Boolean); Begin - ReplaceT.text := Item.Caption; - ReplaceT.SelStart := Length(ReplaceT.text); - WithT.text := Item.SubItems[0]; + ReplaceT.text := Item.Caption; + ReplaceT.SelStart := Length(ReplaceT.text); + WithT.text := Item.SubItems[0]; End; { =============================================================================== } Procedure TfrmAutoCorrect.ReplaceTChange(Sender: TObject); Var - thisItem: TListItem; + thisItem: TListItem; Begin - thisItem := Nil; - thisItem := FindListItem(ReplaceT.text); - - If (thisItem = Nil) Then Begin - WithT.text := ''; - End - Else Begin - List.Selected := Nil; - List.Selected := thisItem; - thisItem.MakeVisible(False); - WithT.text := thisItem.SubItems[0]; - End; - - ReplaceT.text := StringReplace(ReplaceT.text, ' ', '', [rfReplaceAll, rfIgnoreCase]); - ButtonState(); - R1.text := Phonetic.Convert(ReplaceT.text); - - If ReplaceT.text = '' Then - R1.text := ''; - + thisItem := Nil; + thisItem := FindListItem(ReplaceT.text); + + If (thisItem = Nil) Then + Begin + WithT.text := ''; + End + Else + Begin + List.Selected := Nil; + List.Selected := thisItem; + thisItem.MakeVisible(False); + WithT.text := thisItem.SubItems[0]; + End; + + ReplaceT.text := StringReplace(ReplaceT.text, ' ', '', + [rfReplaceAll, rfIgnoreCase]); + ButtonState(); + R1.text := Phonetic.Convert(ReplaceT.text); + + If ReplaceT.text = '' Then + R1.text := ''; End; @@ -485,85 +514,88 @@ Procedure TfrmAutoCorrect.ReplaceTKeyPress(Sender: TObject; Var Key: Char); Begin - If Key = #32 Then - Key := #0; - If Key = #13 Then - Key := #0; + If Key = #32 Then + Key := #0; + If Key = #13 Then + Key := #0; End; {$HINTS Off} - { =============================================================================== } Function TfrmAutoCorrect.Save: Boolean; Var - T: TStringList; - I: Integer; - Path: String; + T: TStringList; + I: Integer; + Path: String; Begin - result := False; - T := TStringList.Create; - - T.BeginUpdate; - With T Do Begin - Add('/ **************************************'); - Add('/ Avro Phonetic Autocorrect dictionary'); - Add('/ Copyright (c) OmicronLab. All rights reserved.'); - Add('/ Web: http://www.omicronlab.com/'); - Add('/'); - Add('/ Warning: DO NOT EDIT THIS FILE MANUALLY'); - Add('/ **************************************'); - - For I := 0 To List.Items.Count - 1 Do Begin - Add(List.Items.Item[I].Caption + ' ' + List.Items.Item[I].SubItems[0]); - End; - End; - T.EndUpdate; - - Try - Path := GetAvroDataDir + 'autodict.dct'; - T.SaveToFile(Path); - DestroyDict; - InitDict; - LoadDict; - result := True; - Except - On E: Exception Do Begin - Application.MessageBox - (PChar('Cannot save to dictionary!' + #10 + '' + #10 + '-> Make sure the disk is not write protected, or' + #10 + '-> ' + Path + ' file is not ''Read Only'', or' + #10 + - '-> You have necessary account privilege to modify content.' + #10 + '' + #10 + 'Please ask your System Administrator or contact' + #10 + - 'OmicronLab (http://www.omicronlab.com/forum/) to solve of this problem.'), 'Auto correct', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - result := False; - End; - End; - - T.Free; + result := False; + T := TStringList.Create; + + T.BeginUpdate; + With T Do + Begin + Add('/ **************************************'); + Add('/ Avro Phonetic Autocorrect dictionary'); + Add('/ Copyright (c) OmicronLab. All rights reserved.'); + Add('/ Web: http://www.omicronlab.com/'); + Add('/'); + Add('/ Warning: DO NOT EDIT THIS FILE MANUALLY'); + Add('/ **************************************'); + + For I := 0 To List.Items.Count - 1 Do + Begin + Add(List.Items.Item[I].Caption + ' ' + List.Items.Item[I].SubItems[0]); + End; + End; + T.EndUpdate; + + Try + Path := GetAvroDataDir + 'autodict.dct'; + T.SaveToFile(Path); + DestroyDict; + InitDict; + LoadDict; + result := True; + Except + On E: Exception Do + Begin + Application.MessageBox(PChar('Cannot save to dictionary!' + #10 + '' + #10 + + '-> Make sure the disk is not write protected, or' + #10 + '-> ' + + Path + ' file is not ''Read Only'', or' + #10 + + '-> You have necessary account privilege to modify content.' + #10 + '' + + #10 + 'Please ask your System Administrator or contact' + #10 + + 'OmicronLab (http://www.omicronlab.com/forum/) to solve of this problem.'), + 'Auto correct', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); + result := False; + End; + End; + + T.Free; End; {$HINTS On} - { =============================================================================== } - Procedure TfrmAutoCorrect.WithTChange(Sender: TObject); Begin - ButtonState; - If WithT.text = ReplaceT.text Then - R2.text := WithT.text - Else - R2.text := Phonetic.Convert(WithT.text); - - If WithT.text = '' Then - R2.text := ''; + ButtonState; + If WithT.text = ReplaceT.text Then + R2.text := WithT.text + Else + R2.text := Phonetic.Convert(WithT.text); + + If WithT.text = '' Then + R2.text := ''; End; { =============================================================================== } Procedure TfrmAutoCorrect.WithTKeyPress(Sender: TObject; Var Key: Char); Begin - If Key = #13 Then - Key := #0; + If Key = #13 Then + Key := #0; End; { =============================================================================== } diff --git a/Keyboard and Spell checker/Forms/ufrmAvroMouse.dfm b/Keyboard and Spell checker/Forms/ufrmAvroMouse.dfm index dd0fe54..360452c 100644 --- a/Keyboard and Spell checker/Forms/ufrmAvroMouse.dfm +++ b/Keyboard and Spell checker/Forms/ufrmAvroMouse.dfm @@ -80,7 +80,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 60050000424D6005000000000000360400002800000019000000190000000100 0800010000002A010000232E0000232E00000001000000010000000000000101 @@ -126,7 +125,6 @@ object frmAvroMouse: TfrmAvroMouse 0240018001BF07FF00000AFF016001CF02FF01400200018007FF00000EFF0140 01DF09FF00000EFF01400AFF00000EFF01EF0AFF000019FF000019FF000019FF 00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 0 TabStop = False @@ -142,7 +140,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 48050000424D4805000000000000360400002800000019000000190000000100 08000100000012010000232E0000232E00000001000000010000000000000101 @@ -187,7 +184,6 @@ object frmAvroMouse: TfrmAvroMouse 019F08FF00000BFF0005CF402080DF9F09FF000004FF01DF0780014001200580 01BF05FF000004FF01BF0E00018005FF000019FF000019FF000019FF000019FF 000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 1 TabStop = False @@ -203,7 +199,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 2C050000424D2C05000000000000360400002800000019000000190000000100 080001000000F6000000232E0000232E00000001000000010000000000000101 @@ -247,7 +242,6 @@ object frmAvroMouse: TfrmAvroMouse 000008FF0004BF00309F0DFF000008FF0003BF009F9F0EFF000006FF0004D180 60000780019F07FF000006FF01BF0A00014007FF000019FF000019FF000019FF 000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 2 TabStop = False @@ -263,7 +257,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 58050000424D5805000000000000360400002800000019000000190000000100 08000100000022010000232E0000232E00000001000000010000000000000101 @@ -308,7 +301,6 @@ object frmAvroMouse: TfrmAvroMouse 4000300070CF09FF000007FF000480407020034001800AFF000007FF00038000 8F200FFF000005FF0004DF8040100880019F07FF000005FF01BF0B00014007FF 000019FF000019FF000019FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 3 TabStop = False @@ -324,7 +316,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 54050000424D5405000000000000360400002800000019000000190000000100 0800010000001E010000232E0000232E00000001000000010000000000000101 @@ -369,7 +360,6 @@ object frmAvroMouse: TfrmAvroMouse 013003FF01CF01100300012001CF08FF000005FF01BF01AF04FF01DF0280019F 01EF09FF000004FF01DF0E8001DF05FF000004FF01BF0E0001BF05FF000019FF 000019FF000019FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 4 TabStop = False @@ -385,7 +375,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 5C050000424D5C05000000000000360400002800000019000000190000000100 08000100000026010000232E0000232E00000001000000010000000000000101 @@ -430,7 +419,6 @@ object frmAvroMouse: TfrmAvroMouse 06FF01BF0B0007FF00000EFF01EF010009FF000008FF01BF018004BF01500120 09FF000006FF01CF01200600011001CF09FF000006FF00042080BFAF0380018F 01EF0AFF000006FF016012FF000006FF018F12FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 5 TabStop = False @@ -446,7 +434,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 70050000424D7005000000000000360400002800000019000000190000000100 0800010000003A010000232E0000232E00000001000000010000000000000101 @@ -492,7 +479,6 @@ object frmAvroMouse: TfrmAvroMouse 00039F30EF400CFF000009FF0003EF20CF400DFF000009FF02800EFF000009FF 01200FFF000008FF01CF01300FFF000008FF0003BF00CFFF0EFF000009FF0003 1000CFFF0DFF000009FF01CF01BF0EFF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 6 TabStop = False @@ -508,7 +494,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 66050000424D6605000000000000360400002800000019000000190000000100 08000100000030010000232E0000232E00000001000000010000000000000101 @@ -554,7 +539,6 @@ object frmAvroMouse: TfrmAvroMouse 0009607000BFFF006080DFFF06FF000008FF000580330020AF7002FF030001BF 06FF00000FFF012009FF00000FFF016009FF00000FFF01EF09FF000019FF0000 19FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 7 TabStop = False @@ -570,7 +554,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 52050000424D5205000000000000360400002800000019000000190000000100 0800010000001C010000232E0000232E00000001000000010000000000000101 @@ -615,7 +598,6 @@ object frmAvroMouse: TfrmAvroMouse 014008FF000007FF01600200000940300060FF8020809F4006FF000008FF0005 BF604050BF3002FF01800200014006FF00000FFF018001BF08FF00000FFF01CF 09FF000019FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 8 TabStop = False @@ -631,7 +613,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 5C050000424D5C05000000000000360400002800000019000000190000000100 08000100000026010000232E0000232E00000001000000010000000000000101 @@ -676,7 +657,6 @@ object frmAvroMouse: TfrmAvroMouse 9FFFBFBF0300012001CF06FF000006FF01CF01500200019F02FF01DF02500180 01EF07FF000004FF0003BF801000020001400A8001BF04FF000004FF01800F00 018004FF000019FF000019FF000019FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 9 TabStop = False @@ -692,7 +672,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 6C050000424D6C05000000000000360400002800000019000000190000000100 08000100000036010000232E0000232E00000001000000010000000000000101 @@ -738,7 +717,6 @@ object frmAvroMouse: TfrmAvroMouse EF008FBFDFFF07FF000006FF01CF01300300000360EFFF000300017D07FF0000 08FF02BF01EF03FF011002BF01DF07FF00000EFF01400AFF00000EFF01CF0AFF 000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 10 TabStop = False @@ -754,7 +732,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 40050000424D4005000000000000360400002800000019000000190000000100 0800010000000A010000232E0000232E00000001000000010000000000000101 @@ -799,7 +776,6 @@ object frmAvroMouse: TfrmAvroMouse 010008FF000006FF0005DF80200020BF048001600100028001DF05FF000006FF 01BF0C0001BF05FF000019FF000019FF000019FF000019FF000019FF000019FF 00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 11 TabStop = False @@ -815,7 +791,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 74050000424D7405000000000000360400002800000019000000190000000100 0800010000003E010000232E0000232E00000001000000010000000000000101 @@ -861,7 +836,6 @@ object frmAvroMouse: TfrmAvroMouse 02FF010001BF06FF000005FF01DF07800160010002FF0004006080BF04FF0000 05FF01BF090002FF0300018004FF000011FF012001EF06FF000011FF016007FF 000011FF01EF07FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 12 TabStop = False @@ -877,7 +851,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 76050000424D7605000000000000360400002800000019000000190000000100 08000100000040010000232E0000232E00000001000000010000000000000101 @@ -923,7 +896,6 @@ object frmAvroMouse: TfrmAvroMouse 01100140028000035010CFCF06FF000005FF0008EFDFFFEF301020500CFF0000 04FF01DF0480015002000120078001DF04FF000004FF01BF0F0001BF04FF0000 19FF000019FF000019FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 13 TabStop = False @@ -939,7 +911,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 4C050000424D4C05000000000000360400002800000019000000190000000100 08000100000016010000232E0000232E00000001000000010000000000000101 @@ -984,7 +955,6 @@ object frmAvroMouse: TfrmAvroMouse 09FF000006FF01EF018003FF010001BF0CFF000005FF01DF0580010001600680 019F05FF000005FF01BF0D00014005FF000019FF000019FF000019FF000019FF 000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 14 TabStop = False @@ -1000,7 +970,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 2A050000424D2A05000000000000360400002800000019000000190000000100 080001000000F4000000232E0000232E00000001000000010000000000000101 @@ -1044,7 +1013,6 @@ object frmAvroMouse: TfrmAvroMouse 08FF000009FF01BF01000EFF000009FF01BF01000EFF000007FF0004BF806000 078001BF06FF000007FF01800A00018006FF000019FF000019FF000019FF0000 19FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 15 TabStop = False @@ -1060,7 +1028,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 4E050000424D4E05000000000000360400002800000019000000190000000100 08000100000018010000232E0000232E00000001000000010000000000000101 @@ -1105,7 +1072,6 @@ object frmAvroMouse: TfrmAvroMouse AF20008008FF000008FF01BF010002410007EFFFEF304180BFFF06FF000009FF 0004300010EF02FF01410200018006FF00000AFF01BF01DF0DFF000019FF0000 19FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 16 TabStop = False @@ -1121,7 +1087,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 3C050000424D3C05000000000000360400002800000019000000190000000100 08000100000006010000232E0000232E00000001000000010000000000000101 @@ -1165,7 +1130,6 @@ object frmAvroMouse: TfrmAvroMouse FFEF70000300011001CF07FF000008FF0140018003FF0004BF5040EF08FF0000 08FF014001800FFF000006FF0004BF802040098001BF05FF000006FF01800C00 018005FF000019FF000019FF000019FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 17 TabStop = False @@ -1181,7 +1145,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 34050000424D3405000000000000360400002800000019000000190000000100 080001000000FE000000232E0000232E00000001000000010000000000000101 @@ -1225,7 +1188,6 @@ object frmAvroMouse: TfrmAvroMouse 40A400BF08FF00000BFF01BF0140030001BF08FF00000DFF0004DF8F00BF08FF 000006FF01BF08800004006080BF06FF000006FF01800B00018006FF000019FF 000019FF000019FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 18 TabStop = False @@ -1241,7 +1203,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 4E050000424D4E05000000000000360400002800000019000000190000000100 08000100000018010000232E0000232E00000001000000010000000000000101 @@ -1286,7 +1247,6 @@ object frmAvroMouse: TfrmAvroMouse 80FF8010CFEF08FF000005FF01BF01EF02FF01EF028F01EF01FF02EF09FF0000 04FF01DF0D80019F06FF000004FF01BF0D00014006FF000019FF000019FF0000 19FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 19 TabStop = False @@ -1302,7 +1262,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 62050000424D6205000000000000360400002800000019000000190000000100 0800010000002C010000232E0000232E00000001000000010000000000000101 @@ -1348,7 +1307,6 @@ object frmAvroMouse: TfrmAvroMouse 8F5D109FFF5D80AF08FF000007FF0006CF0020FFEF300200011001DF08FF0000 08FF01DF01CF03FF01CF01BF0AFF000019FF000019FF000019FF000019FF0000 19FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 20 TabStop = False @@ -1364,7 +1322,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { AC050000424DAC05000000000000360400002800000019000000190000000100 08000100000076010000232E0000232E00000001000000010000000000000101 @@ -1412,7 +1369,6 @@ object frmAvroMouse: TfrmAvroMouse EF30007D02FF000400BFCF100200011001CF04FF000008FF000CEF4000206000 DFFFEF8F7DDF05FF00000AFF00049F40209F0BFF000019FF000019FF000019FF 000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 21 TabStop = False @@ -1428,7 +1384,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 4C050000424D4C05000000000000360400002800000019000000190000000100 08000100000016010000232E0000232E00000001000000010000000000000101 @@ -1473,7 +1428,6 @@ object frmAvroMouse: TfrmAvroMouse 000008FF01600400000620EF426080BF06FF000009FF000780200042CFFF4260 0200018006FF00000FFF014201BF08FF00000FFF019F09FF00000FFF01EF09FF 000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 22 TabStop = False @@ -1489,7 +1443,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 30050000424D3005000000000000360400002800000019000000190000000100 080001000000FA000000232E0000232E00000001000000010000000000000101 @@ -1533,7 +1486,6 @@ object frmAvroMouse: TfrmAvroMouse 02FF0140018008FF00000FFF0140018008FF00000FFF0140018008FF000006FF 01DF088000042040809F06FF000006FF01BF0B00014006FF000019FF000019FF 000019FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 23 TabStop = False @@ -1549,7 +1501,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 46050000424D4605000000000000360400002800000019000000190000000100 08000100000010010000232E0000232E00000001000000010000000000000101 @@ -1594,7 +1545,6 @@ object frmAvroMouse: TfrmAvroMouse 0200018004FF010001BF07FF000006FF01BF01500200013005800004006080BF 05FF000006FF01800C00018005FF000019FF000019FF000019FF000019FF0000 19FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 24 TabStop = False @@ -1610,7 +1560,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 94080000424D94080000000000003604000028000000190000007D0000000100 0800010000005E040000232E0000232E00000001000000010000FFFFFF005C5C @@ -1681,7 +1630,6 @@ object frmAvroMouse: TfrmAvroMouse 0000190000001900000019000000190000001900000019000000190000001900 0000190000001900000019000000190000001900000019000000190000001900 000019000000190000001900000019000000190000000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 25 TabStop = False @@ -1697,7 +1645,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 3A050000424D3A05000000000000360400002800000019000000190000000100 08000100000004010000232E0000232E00000001000000010000000000000101 @@ -1741,7 +1688,6 @@ object frmAvroMouse: TfrmAvroMouse 0006DF109FFFBF0008FF000008FF0005DF8030009F0002FF01BF010008FF0000 06FF01BF017003000150038001600100028001DF05FF000006FF01800C0001BF 05FF000019FF000019FF000019FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 26 TabStop = False @@ -1757,7 +1703,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 42050000424D4205000000000000360400002800000019000000190000000100 0800010000000C010000232E0000232E00000001000000010000000000000101 @@ -1802,7 +1747,6 @@ object frmAvroMouse: TfrmAvroMouse 08FF00000DFF0004DF8000BF08FF000006FF01DF08800004006080BF06FF0000 06FF01BF0B00018006FF000019FF000019FF000019FF000019FF000019FF0000 19FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 27 TabStop = False @@ -1818,7 +1762,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 54050000424D5405000000000000360400002800000019000000190000000100 0800010000001E010000232E0000232E00000001000000010000000000000101 @@ -1863,7 +1806,6 @@ object frmAvroMouse: TfrmAvroMouse 01300200000730CF10009F40808007FF000009FF02BF02FF0005EFCFFF408000 07FF000005FF01BF0A8001200140028005FF000005FF01800E0005FF000019FF 000019FF000019FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 28 TabStop = False @@ -1879,7 +1821,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 58050000424D5805000000000000360400002800000019000000190000000100 08000100000022010000232E0000232E00000001000000010000000000000101 @@ -1924,7 +1865,6 @@ object frmAvroMouse: TfrmAvroMouse 05FF01DF0280000330409F500300000630EF206080BF05FF000004FF01EF0130 0200000840EFFFAF3020CFFF0300018005FF000010FF010001DF07FF000010FF 015008FF00000FFF01EF09FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 29 TabStop = False @@ -1940,7 +1880,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 56050000424D5605000000000000360400002800000019000000190000000100 08000100000020010000232E0000232E00000001000000010000000000000101 @@ -1985,7 +1924,6 @@ object frmAvroMouse: TfrmAvroMouse BF20EF7009FF000008FF019F01100300011001CF0AFF000009FF0005EF60308F EF100BFF000005FF01BF048001100143058001DF07FF000005FF01800B0001BF 07FF000019FF000019FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 30 TabStop = False @@ -2001,7 +1939,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 52050000424D5205000000000000360400002800000019000000190000000100 0800010000001C010000232E0000232E00000001000000010000000000000101 @@ -2046,7 +1983,6 @@ object frmAvroMouse: TfrmAvroMouse CFFF804008FF000008FF00059F602010CF4002FF0180014008FF000006FF01BF 015003000150038001400120028001DF05FF000006FF01800C0001BF05FF0000 19FF000019FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 31 TabStop = False @@ -2062,7 +1998,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 1E050000424D1E05000000000000360400002800000019000000190000000100 080001000000E8000000232E0000232E00000001000000010000000000000101 @@ -2106,7 +2041,6 @@ object frmAvroMouse: TfrmAvroMouse 00BF09FF00000AFF000620309F4400DF09FF00000AFF019F0300019F0AFF0000 0BFF0003DFAFCF9F0BFF000019FF000019FF000019FF000019FF000019FF0000 0100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 32 TabStop = False @@ -2122,7 +2056,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 22050000424D2205000000000000360400002800000019000000190000000100 080001000000EC000000232E0000232E00000001000000010000000000000101 @@ -2166,7 +2099,6 @@ object frmAvroMouse: TfrmAvroMouse 07FF00048F205E9F02FF017001400AFF000007FF0008EF30005E805E009F0AFF 000008FF0006EF70100020800BFF000019FF000019FF000019FF000019FF0000 19FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 33 TabStop = False @@ -2182,7 +2114,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 74050000424D7405000000000000360400002800000019000000190000000100 0800010000003E010000232E0000232E00000001000000010000000000000101 @@ -2228,7 +2159,6 @@ object frmAvroMouse: TfrmAvroMouse 01BF016003FF010001BF02FF01CF01DF08FF000006FF01BF019F03FF010001BF 0CFF000005FF01DF0580010001600680019F05FF000005FF01BF0D00014005FF 000019FF000019FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 34 TabStop = False @@ -2244,7 +2174,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 44050000424D4405000000000000360400002800000019000000190000000100 0800010000000E010000232E0000232E00000001000000010000000000000101 @@ -2289,7 +2218,6 @@ object frmAvroMouse: TfrmAvroMouse 02FF01BF010009FF000005FF01DF016003000160038001600100028001DF06FF 000005FF01BF0C0001BF06FF000019FF000019FF000019FF000019FF000019FF 000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 35 TabStop = False @@ -2305,7 +2233,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 44050000424D4405000000000000360400002800000019000000190000000100 0800010000000E010000232E0000232E00000001000000010000000000000101 @@ -2350,7 +2277,6 @@ object frmAvroMouse: TfrmAvroMouse 03FF01BF010008FF000005FF01DF016003000120048001600100028001BF05FF 000005FF01BF0D00018005FF000019FF000019FF000019FF000019FF000019FF 000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 36 TabStop = False @@ -2366,7 +2292,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 3E050000424D3E05000000000000360400002800000019000000190000000100 08000100000008010000232E0000232E00000001000000010000000000000101 @@ -2411,7 +2336,6 @@ object frmAvroMouse: TfrmAvroMouse 02FF02AF0AFF000009FF010001BF0EFF000006FF01DF028001000160078007FF 000006FF01BF0B0007FF000019FF000019FF000019FF000019FF000019FF0000 0100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 37 TabStop = False @@ -2427,7 +2351,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 1C050000424D1C05000000000000360400002800000019000000190000000100 080001000000E6000000232E0000232E00000001000000010000000000000101 @@ -2470,7 +2393,6 @@ object frmAvroMouse: TfrmAvroMouse 0AFF00000AFF000680BFFF8000CF09FF00000AFF014001AF02FF013001BF09FF 00000AFF00065013807000DF09FF00000AFF01CF01130200019F0AFF00000BFF 0003EFBFDF000BFF000019FF000019FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 38 TabStop = False @@ -2485,7 +2407,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 48050000424D4805000000000000360400002800000019000000190000000100 08000100000012010000232E0000232E00000001000000010000000000000101 @@ -2530,7 +2451,6 @@ object frmAvroMouse: TfrmAvroMouse 019F08FF00000BFF0005CF402080DF9F09FF000004FF01DF0780014001200580 01BF05FF000004FF01BF0E00018005FF000019FF000019FF000019FF000019FF 000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 39 TabStop = False @@ -2553,7 +2473,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 92050000424D9205000000000000360400002800000019000000190000000100 0800010000005C010000232E0000232E00000001000000010000000000000101 @@ -2600,7 +2519,6 @@ object frmAvroMouse: TfrmAvroMouse 0180019F03FF016B0300014001EF03FF024006FF000003FF01BF05FF02BF01DF 05FF024006FF000002FF019F0E4002100240019F03FF000002FF019F1240019F 03FF000019FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False ParentShowHint = False ShowHint = False Spacing = 0 @@ -2618,7 +2536,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { FC050000424DFC05000000000000360400002800000019000000190000000100 080001000000C6010000232E0000232E00000001000000010000000000000101 @@ -2668,7 +2585,6 @@ object frmAvroMouse: TfrmAvroMouse 0004BF809FEF04FF024001FF01EF0230018003FF000001FF019F0D4002100005 401070302040024001CF000001FF019F104000048FFF0030024001CF000014FF 012004FF000014FF015A04FF000013FF01EF05FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 1 TabStop = False @@ -2684,7 +2600,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 9C050000424D9C05000000000000360400002800000019000000190000000100 08000100000066010000232E0000232E00000001000000010000000000000101 @@ -2731,7 +2646,6 @@ object frmAvroMouse: TfrmAvroMouse 0340019F04FF00000FFF018F014008FF000007FF01EB018F0380029F00038020 8FFF08FF000006FF01700800013009FF000005FF00039F207030048000034060 9FFF0AFF000005FF018001BF12FF000005FF01AF017012FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 2 TabStop = False @@ -2747,7 +2661,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { AC050000424DAC05000000000000360400002800000019000000190000000100 08000100000076010000232E0000232E00000001000000010000000000000101 @@ -2795,7 +2708,6 @@ object frmAvroMouse: TfrmAvroMouse EF7020001000024000046080406007FF000006FF01EF01300800016001EF07FF 000006FF00058F30BAEFCF6002BA00038FBADF6009FF000006FF028011FF0000 06FF01DF018011FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 3 TabStop = False @@ -2811,7 +2723,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { C2050000424DC205000000000000360400002800000019000000190000000100 0800010000008C010000232E0000232E00000001000000010000000000000101 @@ -2860,7 +2771,6 @@ object frmAvroMouse: TfrmAvroMouse 10DF07FF000006FF01CF011007000110019F08FF000006FF01100140067D018F 01DF09FF000005FF01BF015012FF000005FF0003EF40EFFF11FF000006FF01EF 12FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 4 TabStop = False @@ -2876,7 +2786,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { BA050000424DBA05000000000000360400002800000019000000190000000100 08000100000084010000232E0000232E00000001000000010000000000000101 @@ -2924,7 +2833,6 @@ object frmAvroMouse: TfrmAvroMouse 03FF000010FF01CF013007FF000005FF0003E37040FF040001200340010001AF 07FF000004FF0003AF0030FF0340040000031050CFAF08FF000004FF0140019F 13FF000004FF0140019F13FF000004FF01BF01E313FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 5 TabStop = False @@ -2940,7 +2848,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { C6050000424DC605000000000000360400002800000019000000190000000100 08000100000090010000232E0000232E00000001000000010000000000000101 @@ -2989,7 +2896,6 @@ object frmAvroMouse: TfrmAvroMouse 00300240019F03FF000005FF01EF03FF01DD018F02FF02400004FFBF00BF06FF 00000DFF0006509FFFBF30DD06FF00000DFF01DD02FF01EF08FF000019FF0000 19FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 6 TabStop = False @@ -3005,7 +2911,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 76050000424D7605000000000000360400002800000019000000190000000100 08000100000040010000232E0000232E00000001000000010000000000000101 @@ -3051,7 +2956,6 @@ object frmAvroMouse: TfrmAvroMouse 07FF00000AFF00048F0010EF02FF0180010007FF00000BFF00076000109FFF80 008007FF00000CFF017002000220018007FF00000DFF0004DF70409F08FF0000 19FF000019FF000019FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 7 TabStop = False @@ -3067,7 +2971,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { CA050000424DCA05000000000000360400002800000019000000190000000100 08000100000094010000232E0000232E00000001000000010000000000000101 @@ -3116,7 +3019,6 @@ object frmAvroMouse: TfrmAvroMouse 0160030000032670DFFF07FF000009FF0006DF10002670CF0AFF000009FF0003 7026BF260DFF000009FF016001BF0EFF000009FF0003BF26CFFF0DFF00000AFF 019F01CF0DFF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 8 TabStop = False @@ -3132,7 +3034,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 80050000424D8005000000000000360400002800000019000000190000000100 0800010000004A010000232E0000232E00000001000000010000000000000101 @@ -3179,7 +3080,6 @@ object frmAvroMouse: TfrmAvroMouse 04FF01CF01AF03FF01CF012002000160027B011001CF07FF00000BFF019F0140 0200013001BF08FF000019FF000019FF000019FF000019FF000019FF000019FF 00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 9 TabStop = False @@ -3195,7 +3095,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { DC050000424DDC05000000000000360400002800000019000000190000000100 080001000000A6010000232E0000232E00000001000000010000000000000101 @@ -3244,7 +3143,6 @@ object frmAvroMouse: TfrmAvroMouse 01EF06FF00000AFF01A30120030000032080EFEF07FF000009FF016002000003 1060A3800AFF000008FF0004A30030BF0DFF000008FF00038000EFBF0EFF0000 08FF0003A310EFBF0EFF000009FF018001400EFF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 10 TabStop = False @@ -3260,7 +3158,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { AE050000424DAE05000000000000360400002800000019000000190000000100 08000100000078010000232E0000232E00000001000000010000000000000101 @@ -3308,7 +3205,6 @@ object frmAvroMouse: TfrmAvroMouse 018F011004FF00000BFF0003EF7030FF0200000530402000801004FF00000BFF 0003304080FF0440017001BF05FF00000AFF01BF01300DFF00000AFF01EF0130 0DFF00000BFF01EF0DFF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 11 TabStop = False @@ -3324,7 +3220,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 10050000424D1005000000000000360400002800000019000000190000000100 080001000000DA000000232E0000232E00000001000000010000000000000101 @@ -3367,7 +3262,6 @@ object frmAvroMouse: TfrmAvroMouse 11FF0003DF2080FF05FF00000FFF0007CF8F307060BFDF0003FF00000EFF0008 9F0020CF502050EF03FF000012FF014001EF05FF000012FF018006FF000012FF 01EF06FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 12 TabStop = False @@ -3383,7 +3277,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 44050000424D4405000000000000360400002800000019000000190000000100 0800010000000E010000232E0000232E00000001000000010000000000000101 @@ -3428,7 +3321,6 @@ object frmAvroMouse: TfrmAvroMouse 019F09FF000004FF0004700030DF04FF0003DF609FFF0AFF000005FF01700200 0150028000033040DFFF0BFF000006FF01BF01600240018001DF0DFF000019FF 000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 13 TabStop = False @@ -3444,7 +3336,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 5C050000424D5C05000000000000360400002800000019000000190000000100 08000100000026010000232E0000232E00000001000000010000000000000101 @@ -3489,7 +3380,6 @@ object frmAvroMouse: TfrmAvroMouse 000008FF016004000120018002FF01CF012006FF000008FF015002BF05FF0003 CF10BFCF06FF000008FF0003209FDFFF02FF0005EFAF60009F0007FF000008FF 01CF01500500016001DF08FF00000BFF03BF0BFF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 14 TabStop = False @@ -3505,7 +3395,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { E4040000424DE404000000000000360400002800000019000000190000000100 080001000000AE000000232E0000232E00000001000000010000000000000101 @@ -3547,7 +3436,6 @@ object frmAvroMouse: TfrmAvroMouse 01CF0AFF000019FF000019FF000019FF000019FF000019FF000019FF000019FF 000019FF000019FF000019FF000019FF000019FF000019FF000019FF000019FF 000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 15 TabStop = False @@ -3563,7 +3451,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { E6040000424DE604000000000000360400002800000019000000190000000100 080001000000B0000000232E0000232E00000001000000010000000000000101 @@ -3605,7 +3492,6 @@ object frmAvroMouse: TfrmAvroMouse 09FF00000EFF01EF0AFF000019FF000019FF000019FF000019FF000019FF0000 19FF000019FF000019FF000019FF000019FF000019FF000019FF000019FF0000 19FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 16 TabStop = False @@ -3621,7 +3507,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { DC040000424DDC04000000000000360400002800000019000000190000000100 080001000000A6000000232E0000232E00000001000000010000000000000101 @@ -3662,7 +3547,6 @@ object frmAvroMouse: TfrmAvroMouse 00000CFF019F021001BF09FF00000DFF0003DF20BFBF09FF00000EFF01AF0AFF 000019FF000019FF000019FF000019FF000019FF000019FF000019FF000019FF 000019FF000019FF000019FF000019FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 17 TabStop = False @@ -3678,7 +3562,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 0E050000424D0E05000000000000360400002800000019000000190000000100 080001000000D8000000232E0000232E00000001000000010000000000000101 @@ -3721,7 +3604,6 @@ object frmAvroMouse: TfrmAvroMouse 000004FF0004EF1030EF11FF000005FF00048F0030DF10FF000006FF01600200 015001CF0EFF000007FF0003AF507D500FFF000019FF000019FF000019FF0000 19FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 18 TabStop = False @@ -3737,7 +3619,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 3C050000424D3C05000000000000360400002800000019000000190000000100 08000100000006010000232E0000232E00000001000000010000000000000101 @@ -3781,7 +3662,6 @@ object frmAvroMouse: TfrmAvroMouse 9FEF0EFF000006FF0004CF1000600FFF000007FF0003BF00BF600FFF000004FF 02BF0003FFCF10FF10FF000002FF019F01100400019F10FF00000008FFDF50BF 9F808FDF11FF00000003FFCFAFBF16FF000002FF01BF16FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 19 TabStop = False @@ -3797,7 +3677,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 86050000424D8605000000000000360400002800000019000000190000000100 08000100000050010000232E0000232E00000001000000010000000000000101 @@ -3844,7 +3723,6 @@ object frmAvroMouse: TfrmAvroMouse DF0002FF000002FF0170074001CF04FF0008A20020CF502050EF02FF000013FF 014001EF04FF000013FF018005FF000013FF01EF05FF000019FF000019FF0000 19FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 20 TabStop = False @@ -3868,7 +3746,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { CE040000424DCE0400000000000036040000280000000F0000000F0000000100 08000100000098000000232E0000232E00000001000000010000000000000101 @@ -3909,7 +3786,6 @@ object frmAvroMouse: TfrmAvroMouse 0003DF00EF5003FF01BF010004FF000004FF0110018003FF01BF015004FF0000 04FF0003AF1080FF02EF017001CF04FF000005FF0005DF804080EFEF05FF0000 0FFF00000FFF00000FFF00000FFF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 0 TabStop = False @@ -3925,7 +3801,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { CA040000424DCA0400000000000036040000280000000F0000000F0000000100 08000100000094000000232E0000232E00000001000000010000000000000101 @@ -3966,7 +3841,6 @@ object frmAvroMouse: TfrmAvroMouse 04FF000008FF00036010EFFF04FF000007FF00036000BFFF05FF000006FF0003 60009FFF06FF000005FF0003800080FF07FF000005FF000370009FFF07FF0000 06FF01BF08FF00000FFF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 1 TabStop = False @@ -3982,7 +3856,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { D0040000424DD00400000000000036040000280000000F0000000F0000000100 0800010000009A000000232E0000232E00000001000000010000000000000101 @@ -4023,7 +3896,6 @@ object frmAvroMouse: TfrmAvroMouse 000004FF00062080CFFF9F3005FF000003FF01CF01EF04FF012005FF000008FF 0160012005FF000006FF00049F2000AF05FF000005FF0004300020BF06FF0000 05FF0110013008FF00000FFF00000FFF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 2 TabStop = False @@ -4039,7 +3911,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { EA040000424DEA0400000000000036040000280000000F0000000F0000000100 080001000000B4000000232E0000232E00000001000000010000000000000101 @@ -4081,7 +3952,6 @@ object frmAvroMouse: TfrmAvroMouse 000003FF000330FFCFAA0200000450FF60CF03FF000002FF0004DF70FFAA0200 0003408050CF04FF000005FF01EF01300200013001EF04FF000006FF01EF02BF 06FF00000FFF00000FFF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 3 TabStop = False @@ -4097,7 +3967,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { F2040000424DF20400000000000036040000280000000F0000000F0000000100 080001000000BC000000232E0000232E00000001000000010000000000000101 @@ -4139,7 +4008,6 @@ object frmAvroMouse: TfrmAvroMouse 04FF000005FF00064000809F109F04FF000005FF0100018F02FF01BF011004FF 000005FF014001AF02FF01BF012004FF000005FF01EF01400270012001CF04FF 000007FF01CF01BF06FF00000FFF00000FFF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 4 TabStop = False @@ -4155,7 +4023,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { E0040000424DE00400000000000036040000280000000F0000000F0000000100 080001000000AA000000232E0000232E00000001000000010000000000000101 @@ -4197,7 +4064,6 @@ object frmAvroMouse: TfrmAvroMouse DF601000608005FF000004FF018002000150019F06FF000003FF0004AF008FEF 08FF000003FF00038000BFEF09FF000003FF01EF01BF0AFF00000FFF00000FFF 00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 5 TabStop = False @@ -4213,7 +4079,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { D0040000424DD00400000000000036040000280000000F0000000F0000000100 0800010000009A000000232E0000232E00000001000000010000000000000101 @@ -4254,7 +4119,6 @@ object frmAvroMouse: TfrmAvroMouse 02FF01BF011006FF000004FF000800608030207080EF03FF000004FF000800AF 4070EF60408003FF000004FF010006FF01DF03FF000003FF013001000AFF0000 03FF013001700AFF00000FFF00000FFF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 6 TabStop = False @@ -4270,7 +4134,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { CA040000424DCA0400000000000036040000280000000F0000000F0000000100 08000100000094000000232E0000232E00000001000000010000000000000101 @@ -4311,7 +4174,6 @@ object frmAvroMouse: TfrmAvroMouse 0400018004FF000004FF01CF012003FF028004FF000004FF0003CF00BFFF02FF 0120019F04FF000005FF00064010BF8F30EF04FF000005FF0005EF600050EFEF 05FF00000FFF00000FFF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 7 TabStop = False @@ -4327,7 +4189,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { E8040000424DE80400000000000036040000280000000F0000000F0000000100 080001000000B2000000232E0000232E00000001000000010000000000000101 @@ -4369,7 +4230,6 @@ object frmAvroMouse: TfrmAvroMouse 0030EFFF03FF000003FF000460FFCF0002FF0130017004FF000003FF0004AFFF BF0002FF01CF05FF000004FF0003DF20000008FF000004FF0003EF50800008FF 00000FFF00000FFF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 8 TabStop = False @@ -4385,7 +4245,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { E0040000424DE00400000000000036040000280000000F0000000F0000000100 080001000000AA000000232E0000232E00000001000000010000000000000101 @@ -4427,7 +4286,6 @@ object frmAvroMouse: TfrmAvroMouse 04FF0110015002FF0004AF1030CA03FF000004FF0007AF008FEF2080DF1004FF 000005FF00049F00204006FF000006FF0004DF6050DF05FF00000FFF00000FFF 00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 9 TabStop = False @@ -4451,7 +4309,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 94050000424D9405000000000000360400002800000019000000190000000100 0800010000005E010000232E0000232E00000001000000010000000000000101 @@ -4498,7 +4355,6 @@ object frmAvroMouse: TfrmAvroMouse 04FF01C00200000439A7CCF50EFF000004FF0003B400990412FF000004FF01B4 010013FF000004FF0003EC00F5FF12FF000005FF0004B499D7EC10FF000006FF 0003A700B4EC10FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 0 TabStop = False @@ -4514,7 +4370,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 02040000424D0204000000000000420000002800000014000000180000000100 100003000000C0030000120B0000120B00000000000000000000007C0000E003 @@ -4549,7 +4404,6 @@ object frmAvroMouse: TfrmAvroMouse FF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7F FF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7F FF7FFF7FFF7F} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 1 TabStop = False @@ -4565,7 +4419,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 02040000424D0204000000000000420000002800000014000000180000000100 100003000000C0030000120B0000120B00000000000000000000007C0000E003 @@ -4600,7 +4453,6 @@ object frmAvroMouse: TfrmAvroMouse FF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7F FF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7F FF7FFF7FFF7F} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 2 TabStop = False @@ -4616,7 +4468,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 56050000424D5605000000000000420000002800000019000000190000000100 10000300000014050000120B0000120B00000000000000000000007C0000E003 @@ -4661,7 +4512,6 @@ object frmAvroMouse: TfrmAvroMouse 524ABD771863BD772104FF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7F FF7FFF7F0000FF7FFF7FFF7FFF7FFF7FFF7FDE7B9C73BD77B556FF7F5A6BFF7F FF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7F0000} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 3 TabStop = False @@ -4677,7 +4527,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 56050000424D5605000000000000420000002800000019000000190000000100 10000300000014050000120B0000120B00000000000000000000007C0000E003 @@ -4722,7 +4571,6 @@ object frmAvroMouse: TfrmAvroMouse FF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7F FF7FFF7F0000FF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7F FF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7F0000} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 4 TabStop = False @@ -4738,7 +4586,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 56050000424D5605000000000000420000002800000019000000190000000100 10000300000014050000120B0000120B00000000000000000000007C0000E003 @@ -4783,7 +4630,6 @@ object frmAvroMouse: TfrmAvroMouse FF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7F FF7FFF7F0000FF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7F FF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7F0000} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 5 TabStop = False @@ -4799,7 +4645,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { D0050000424DD005000000000000360400002800000019000000190000000100 0800010000009A010000232E0000232E00000001000000010000000000000101 @@ -4848,7 +4693,6 @@ object frmAvroMouse: TfrmAvroMouse 0AFF000005FF0006FC520D74C9F30EFF000005FF0004F83974FC10FF000005FF 0003FC5291FC11FF000006FF0005C991C9F3FCFF0EFF000007FF0003D639B1F3 0FFF000008FF01E701F30FFF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 6 TabStop = False @@ -4864,7 +4708,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 9A050000424D9A05000000000000360400002800000014000000180000000100 08000100000064010000232E0000232E00000001000000010000000000000101 @@ -4911,7 +4754,6 @@ object frmAvroMouse: TfrmAvroMouse 01A009FF01C201D703FF000004FF01C6013709FF0182019A03FF000006FF0187 01F806FF019901E504FF000006FF000A5DF3C2FFFEFDC6F376DB04FF000007FF 0007F740FE43FD52BCF306FF000008FF0006F4F5A2FFF4FE06FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 7 TabStop = False @@ -4927,7 +4769,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { AE050000424DAE05000000000000360400002800000014000000180000000100 08000100000078010000232E0000232E00000001000000010000000000000101 @@ -4975,7 +4816,6 @@ object frmAvroMouse: TfrmAvroMouse 7D090200018803FF000004FF01AA011602000102020F01030200010D018F04FF 000005FF0004E0652A0802000004092460D705FF000007FF0006FBDBCBCCDCF9 07FF000014FF000014FF000014FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 8 TabStop = False @@ -4991,7 +4831,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { DA050000424DDA05000000000000360400002800000014000000180000000100 080001000000A4010000232E0000232E00000001000000010000000000000101 @@ -5040,7 +4879,6 @@ object frmAvroMouse: TfrmAvroMouse 04FF0003B40016FF07FF00035600120903FF000004FF0003B40016FF07FF0003 F8AACF0903FF000004FF0003A30012FF0DFF000003FF0004DC1A00210DFF0000 03FF01A2020001980DFF000003FF0004D74781FB0DFF000014FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 9 TabStop = False @@ -5056,7 +4894,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 72050000424D7205000000000000360400002800000014000000180000000100 0800010000003C010000232E0000232E00000001000000010000000000000101 @@ -5102,7 +4939,6 @@ object frmAvroMouse: TfrmAvroMouse 000008FF01F40200011801FE07FF000008FF01F40200011801FE07FF000008FF 01F40200011701FE07FF000008FF01F40200011A01FE07FF000008FF0004F400 49B908FF000008FF01FB01BC0AFF000014FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 10 TabStop = False @@ -5118,7 +4954,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { D8050000424DD805000000000000360400002800000014000000180000000100 080001000000A2010000232E0000232E00000001000000010000000000000101 @@ -5167,7 +5002,6 @@ object frmAvroMouse: TfrmAvroMouse FFC2000005FF0004FCC1C7F906FF00059B0197FAFFFD00000FFF0005F72381F7 FFFF000010FF00046071F3FF000010FF0004C170EDFF000010FF0004FE82EDFF 000011FF0003B2F3FFFF000011FF0003EAFCFFFF000014FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 11 TabStop = False @@ -5183,7 +5017,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 82050000424D8205000000000000360400002800000014000000180000000100 0800010000004C010000232E0000232E00000001000000010000000000000101 @@ -5230,7 +5063,6 @@ object frmAvroMouse: TfrmAvroMouse ECFF05FF0004B12FF4FF000004FF0005DDAB98B9DB0008FF0003759AFFFF0000 11FF0003EE84F2B9000012FF01DB01DD000013FF01FA000014FF000014FF0000 14FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 12 TabStop = False @@ -5246,7 +5078,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 44050000424D4405000000000000360400002800000014000000180000000100 0800010000000E010000232E0000232E00000001000000010000000000000101 @@ -5291,7 +5122,6 @@ object frmAvroMouse: TfrmAvroMouse 00000FFF017D010D03FF00000FFF0003F5299EFF02FF000010FF0004DF21FCFF 000011FF0003A3B9FFFF000011FF0003F3B8FFFF000012FF01EC01FF000014FF 000014FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 13 TabStop = False @@ -5307,7 +5137,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 2A050000424D2A05000000000000360400002800000014000000180000000100 080001000000F4000000232E0000232E00000001000000010000000000000101 @@ -5351,7 +5180,6 @@ object frmAvroMouse: TfrmAvroMouse 07FF000004FF01F6011E0500012B01EB07FF000004FF01590500012B01E508FF 000003FF01EB0500012C01E709FF000003FF0007EE78515272A0E7FF0AFF0000 14FF000014FF000014FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 14 TabStop = False @@ -5367,7 +5195,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { F4050000424DF405000000000000360400002800000014000000180000000100 080001000000BE010000232E0000232E00000001000000010000000000000101 @@ -5417,7 +5244,6 @@ object frmAvroMouse: TfrmAvroMouse 08FF0003EA23FBFF05FF000002FF0004FAF5B4FB05FF0003F0B0E6FF06FF0000 04FF00034DE6E3FB02FF0005FDE5D64AF0FF06FF000005FF0008C43AFF54F739 F4FE07FF000005FF0007FAF3F59CFFF1FEFE08FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 15 TabStop = False @@ -5433,7 +5259,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 52050000424D5205000000000000360400002800000014000000180000000100 0800010000001C010000232E0000232E00000001000000010000000000000101 @@ -5478,7 +5303,6 @@ object frmAvroMouse: TfrmAvroMouse 0105020001C804FF013101E902FF000008FF0003A24F94FF05FF019701C002FF 000010FF01CD019A02FF000010FF01F5014B02FF000011FF000383F5FFFF0000 14FF000014FF000014FF000014FF000014FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 16 TabStop = False @@ -5501,7 +5325,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 50050000424D5005000000000000360400002800000019000000190000000100 0800010000001A010000232E0000232E00000001000000010000000000000101 @@ -5546,7 +5369,6 @@ object frmAvroMouse: TfrmAvroMouse 20AF8F00BFCF07FF000007FF019F018002FF00055480FFBF00CF09FF000004FF 01CF01100E00011001CF03FF000004FF01CF0FBF01DF04FF000019FF000019FF 000019FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 0 TabStop = False @@ -5561,7 +5383,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 50050000424D5005000000000000360400002800000019000000190000000100 0800010000001A010000232E0000232E00000001000000010000000000000101 @@ -5606,7 +5427,6 @@ object frmAvroMouse: TfrmAvroMouse AB10002060BF5010020001AB08FF000007FF000ACF10BFFFEF308FFF60AB08FF 000004FF01EF01300B00016007FF000004FF01DF0CBF08FF000019FF000019FF 000019FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 1 TabStop = False @@ -5621,7 +5441,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 40050000424D4005000000000000360400002800000019000000190000000100 0800010000000A010000232E0000232E00000001000000010000000000000101 @@ -5666,7 +5485,6 @@ object frmAvroMouse: TfrmAvroMouse 08FF000007FF0008EF10BFCF7EDF208F0AFF000004FF019F0C00019F07FF0000 04FF0CBF01CF08FF000019FF000019FF000019FF000019FF000019FF000019FF 00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 2 TabStop = False @@ -5681,7 +5499,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 6C050000424D6C05000000000000360400002800000019000000190000000100 08000100000036010000232E0000232E00000001000000010000000000000101 @@ -5727,7 +5544,6 @@ object frmAvroMouse: TfrmAvroMouse FFBF0070805003FF0004CF80A3EF05FF000009FF0170020001800CFF000004FF 01A30F00013001EF03FF000004FF10BF01DF04FF000019FF000019FF000019FF 000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 3 TabStop = False @@ -5742,7 +5558,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 88050000424D8805000000000000360400002800000019000000190000000100 08000100000052010000232E0000232E00000001000000010000000000000101 @@ -5789,7 +5604,6 @@ object frmAvroMouse: TfrmAvroMouse AF9F109F05FF000006FF000AAF30001080FF00BFEF440200013006FF00000CFF 013001EF02FF01DF01BF07FF00000CFF01EF0CFF000019FF000019FF000019FF 000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 4 TabStop = False @@ -5804,7 +5618,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { A6050000424DA605000000000000360400002800000019000000190000000100 08000100000070010000232E0000232E00000001000000010000000000000101 @@ -5852,7 +5665,6 @@ object frmAvroMouse: TfrmAvroMouse DFEF02FF010001BF07FF000006FF000C6000207A507A9F10607A00DF07FF0000 07FF0004BF60407A02FF0004BF20007A08FF000019FF000019FF000019FF0000 19FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 5 TabStop = False @@ -5867,7 +5679,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 88050000424D8805000000000000360400002800000019000000190000000100 08000100000052010000232E0000232E00000001000000010000000000000101 @@ -5914,7 +5725,6 @@ object frmAvroMouse: TfrmAvroMouse FF70403007FF000007FF01CF0110020000039FEF40700200011001BF07FF0000 08FF0003EFBFDF0003FF01CF01BF09FF000019FF000019FF000019FF000019FF 000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 6 TabStop = False @@ -5929,7 +5739,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 54050000424D5405000000000000360400002800000019000000190000000100 0800010000001E010000232E0000232E00000001000000010000000000000101 @@ -5974,7 +5783,6 @@ object frmAvroMouse: TfrmAvroMouse 01AF015008FF000005FF01EF01CF03FF0007600010608510BF5008FF00000BFF 0005BF704050BF0709FF000004FF019F0C00019F07FF000004FF0CBF01CF08FF 000019FF000019FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 7 TabStop = False @@ -5989,7 +5797,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 7E050000424D7E05000000000000360400002800000019000000190000000100 08000100000048010000232E0000232E00000001000000010000000000000101 @@ -6036,7 +5843,6 @@ object frmAvroMouse: TfrmAvroMouse 03FF00074084FFAF200084FF05FF000004FF01CF01100900013001EF08FF0000 04FF01CF0ABF01EF09FF000019FF000019FF000019FF000019FF000019FF0000 0100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 8 TabStop = False @@ -6051,7 +5857,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 9C050000424D9C05000000000000360400002800000019000000190000000100 08000100000066010000232E0000232E00000001000000010000000000000101 @@ -6098,7 +5903,6 @@ object frmAvroMouse: TfrmAvroMouse 0007DD94872C879459FF0394022C049401B501F904FF000003FF01B50F000140 01F904FF000003FF0003F9E1DD4002E10005DDE1DDE1DD9402E101DD01E102DD 01EB05FF000019FF000019FF000019FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 9 TabStop = False @@ -6113,7 +5917,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 4E050000424D4E05000000000000360400002800000019000000190000000100 08000100000018010000232E0000232E00000001000000010000000000000101 @@ -6158,7 +5961,6 @@ object frmAvroMouse: TfrmAvroMouse 000005FF000770FF7020DFEF5010021001EF0AFF000007FF01DF011002000003 9F8570100BFF000008FF0003DF859F0002FF01EF0BFF000019FF000019FF0000 19FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 10 TabStop = False @@ -6174,7 +5976,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 62060000424D620600000000000036040000280000003C000000190000000100 0800010000002C020000232E0000232E00000001000000010000FFFFFF00BFBF @@ -6228,7 +6029,6 @@ object frmAvroMouse: TfrmAvroMouse 140900050B060908000600000700010306040105290001060105020000000700 060101022A000102030000003C0000003C0000003C0000003C0000003C000000 3C0000000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 5 TabStop = False @@ -6243,7 +6043,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 68060000424D680600000000000036040000280000003C000000190000000100 08000100000032020000232E0000232E00000001000000010000FFFFFF00DFDF @@ -6297,7 +6096,6 @@ object frmAvroMouse: TfrmAvroMouse 02000A0503000000150001030704010503000106010514040005020708090009 0000380001020300000038000101030000003C0000003C0000003C0000003C00 00003C0000003C0000000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 6 TabStop = False @@ -6313,7 +6111,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 10050000424D1005000000000000360400002800000019000000190000000100 080001000000DA000000232E0000232E00000001000000010000000000000101 @@ -6356,7 +6153,6 @@ object frmAvroMouse: TfrmAvroMouse 0120014002FF00079F1040EFFF2040FF08FF000005FF00039F00DFFF02FF0140 020000049FFF805008FF000005FF028003FF017002000004AFFFEFDF08FF0000 0BFF01AF01BF0CFF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 7 TabStop = False @@ -6373,13 +6169,11 @@ object frmAvroMouse: TfrmAvroMouse Margins.Right = 0 Margins.Bottom = 0 Caption = 'ZWNJ' - DoubleBuffered = True Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [fsBold] - ParentDoubleBuffered = False ParentFont = False Spacing = 0 TabOrder = 8 @@ -6396,7 +6190,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 44050000424D4405000000000000360400002800000019000000190000000100 0800010000000E010000232E0000232E00000001000000010000000000000101 @@ -6441,7 +6234,6 @@ object frmAvroMouse: TfrmAvroMouse 08FF018001000FFF000008FF018001000FFF000006FF0004AF4010200FFF0000 06FF0150020001800FFF000007FF01AF01BF10FF000019FF000019FF000019FF 000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 9 TabStop = False @@ -6457,7 +6249,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 5A050000424D5A05000000000000360400002800000019000000190000000100 08000100000024010000232E0000232E00000001000000010000000000000101 @@ -6502,7 +6293,6 @@ object frmAvroMouse: TfrmAvroMouse 5063008006FF00000BFF0003DF8020000400018006FF00000EFF0005CF803000 800006FF000005FF0BBF00038F00630002BF01DF03FF000005FF1000018003FF 000005FF10BF01DF03FF000019FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 10 TabStop = False @@ -6518,7 +6308,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 60050000424D6005000000000000360400002800000019000000190000000100 0800010000002A010000232E0000232E00000001000000010000000000000101 @@ -6564,7 +6353,6 @@ object frmAvroMouse: TfrmAvroMouse EF9F300009FF000005FF01EF08BF018F010002BF01DF06FF000005FF01BF0C00 018006FF000005FF01EF0CBF01DF06FF000019FF000019FF000019FF000019FF 00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 11 TabStop = False @@ -6649,13 +6437,11 @@ object frmAvroMouse: TfrmAvroMouse Margins.Right = 0 Margins.Bottom = 0 Caption = 'ZWJ' - DoubleBuffered = True Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [fsBold] - ParentDoubleBuffered = False ParentFont = False Spacing = 0 TabOrder = 16 @@ -6672,7 +6458,6 @@ object frmAvroMouse: TfrmAvroMouse Margins.Top = 0 Margins.Right = 0 Margins.Bottom = 0 - DoubleBuffered = True Glyph.Data = { 0E050000424D0E05000000000000360400002800000019000000190000000100 080001000000D8000000232E0000232E00000001000000010000000000000101 @@ -6715,7 +6500,6 @@ object frmAvroMouse: TfrmAvroMouse 0BFF0003BF0080FF0BFF00000BFF0003BF0080FF0BFF00000BFF0003BF0080FF 0BFF00000BFF0003BF008FFF0BFF00000BFF02DF0CFF000019FF000019FF0000 19FF000019FF000019FF000019FF00000100} - ParentDoubleBuffered = False Spacing = 0 TabOrder = 17 TabStop = False diff --git a/Keyboard and Spell checker/Forms/ufrmAvroMouse.pas b/Keyboard and Spell checker/Forms/ufrmAvroMouse.pas index 01489cc..7740aa3 100644 --- a/Keyboard and Spell checker/Forms/ufrmAvroMouse.pas +++ b/Keyboard and Spell checker/Forms/ufrmAvroMouse.pas @@ -1,32 +1,31 @@ { - ============================================================================= - ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + ============================================================================= + ***************************************************************************** + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. - ***************************************************************************** - ============================================================================= + ***************************************************************************** + ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - { COMPLETE TRANSFERING! } Unit ufrmAvroMouse; @@ -34,332 +33,340 @@ Interface Uses - Windows, - Messages, - SysUtils, - Variants, - Classes, - Graphics, - Controls, - Forms, - Dialogs, - StdCtrls, - Buttons, - ExtCtrls; + Windows, + Messages, + SysUtils, + Variants, + Classes, + Graphics, + Controls, + Forms, + Dialogs, + StdCtrls, + Buttons, + ExtCtrls; Type - TfrmAvroMouse = Class(TForm) - Panel1: TPanel; - BitBtn3: TBitBtn; - BitBtn1: TBitBtn; - BitBtn2: TBitBtn; - BitBtn4: TBitBtn; - BitBtn5: TBitBtn; - BitBtn6: TBitBtn; - BitBtn7: TBitBtn; - BitBtn8: TBitBtn; - BitBtn9: TBitBtn; - BitBtn10: TBitBtn; - BitBtn11: TBitBtn; - BitBtn12: TBitBtn; - BitBtn13: TBitBtn; - BitBtn14: TBitBtn; - BitBtn15: TBitBtn; - BitBtn16: TBitBtn; - BitBtn17: TBitBtn; - BitBtn18: TBitBtn; - BitBtn19: TBitBtn; - BitBtn20: TBitBtn; - BitBtn21: TBitBtn; - BitBtn24: TBitBtn; - BitBtn25: TBitBtn; - BitBtn28: TBitBtn; - BitBtn29: TBitBtn; - BitBtn22: TBitBtn; - BitBtn23: TBitBtn; - BitBtn26: TBitBtn; - BitBtn27: TBitBtn; - BitBtn30: TBitBtn; - BitBtn31: TBitBtn; - BitBtn32: TBitBtn; - BitBtn33: TBitBtn; - BitBtn34: TBitBtn; - BitBtn35: TBitBtn; - BitBtn36: TBitBtn; - BitBtn37: TBitBtn; - BitBtn38: TBitBtn; - BitBtn39: TBitBtn; - BitBtn41: TBitBtn; - Panel2: TPanel; - BitBtn40: TBitBtn; - BitBtn42: TBitBtn; - BitBtn43: TBitBtn; - BitBtn44: TBitBtn; - BitBtn45: TBitBtn; - BitBtn46: TBitBtn; - BitBtn47: TBitBtn; - BitBtn48: TBitBtn; - BitBtn49: TBitBtn; - BitBtn50: TBitBtn; - BitBtn51: TBitBtn; - BitBtn52: TBitBtn; - BitBtn53: TBitBtn; - BitBtn54: TBitBtn; - BitBtn55: TBitBtn; - BitBtn56: TBitBtn; - BitBtn57: TBitBtn; - BitBtn58: TBitBtn; - BitBtn59: TBitBtn; - BitBtn60: TBitBtn; - BitBtn61: TBitBtn; - Panel3: TPanel; - BitBtn62: TBitBtn; - BitBtn63: TBitBtn; - BitBtn64: TBitBtn; - BitBtn65: TBitBtn; - BitBtn66: TBitBtn; - BitBtn67: TBitBtn; - BitBtn68: TBitBtn; - BitBtn69: TBitBtn; - BitBtn70: TBitBtn; - BitBtn71: TBitBtn; - GroupBox1: TGroupBox; - BitBtn72: TBitBtn; - BitBtn73: TBitBtn; - BitBtn74: TBitBtn; - BitBtn75: TBitBtn; - BitBtn76: TBitBtn; - BitBtn77: TBitBtn; - BitBtn78: TBitBtn; - BitBtn79: TBitBtn; - BitBtn80: TBitBtn; - BitBtn81: TBitBtn; - BitBtn82: TBitBtn; - BitBtn83: TBitBtn; - BitBtn84: TBitBtn; - BitBtn85: TBitBtn; - BitBtn86: TBitBtn; - BitBtn87: TBitBtn; - BitBtn88: TBitBtn; - GroupBox2: TGroupBox; - But_KSs: TBitBtn; - But_NGK: TBitBtn; - But_NgG: TBitBtn; - But_JNYA: TBitBtn; - But_NYAC: TBitBtn; - But_NYACh: TBitBtn; - But_NYAJ: TBitBtn; - But_T_T: TBitBtn; - But_SsNYA: TBitBtn; - But_HM: TBitBtn; - But_ND: TBitBtn; - But_ZFola: TBitBtn; - But_RFola: TBitBtn; - BitBtn102: TBitBtn; - BitBtn103: TBitBtn; - BitBtn104: TBitBtn; - BitBtn105: TBitBtn; - BitBtn106: TBitBtn; - btnTab: TButton; - btnBackspace: TButton; - btnSpace: TButton; - btnEnter: TButton; - BitBtn89: TBitBtn; - BitBtn90: TBitBtn; - Procedure FormClose(Sender: TObject; Var Action: TCloseAction); - Procedure BitBtn1Click(Sender: TObject); - Procedure btnTabClick(Sender: TObject); - Procedure But_KSsClick(Sender: TObject); - Procedure But_NGKClick(Sender: TObject); - Procedure But_NgGClick(Sender: TObject); - Procedure But_JNYAClick(Sender: TObject); - Procedure But_NYACClick(Sender: TObject); - Procedure But_NYAChClick(Sender: TObject); - Procedure But_NYAJClick(Sender: TObject); - Procedure But_T_TClick(Sender: TObject); - Procedure But_SsNYAClick(Sender: TObject); - Procedure But_HMClick(Sender: TObject); - Procedure But_NDClick(Sender: TObject); - Procedure But_RFolaClick(Sender: TObject); - Procedure But_ZFolaClick(Sender: TObject); - Procedure FormCreate(Sender: TObject); - Private - { Private declarations } - Procedure TypeIt(Const tStr: String); - Procedure DetectLeftClickOnTitleBar(Var Msg: TWMNCLButtonDown); Message WM_NCLBUTTONDOWN; - Procedure DetectRightClickOnTitleBar(Var Msg: TWMNCLButtonDown); Message WM_NCRBUTTONDOWN; - Public - { Public declarations } - Protected - Procedure CreateParams(Var Params: TCreateParams); Override; - End; + TfrmAvroMouse = Class(TForm) + Panel1: TPanel; + BitBtn3: TBitBtn; + BitBtn1: TBitBtn; + BitBtn2: TBitBtn; + BitBtn4: TBitBtn; + BitBtn5: TBitBtn; + BitBtn6: TBitBtn; + BitBtn7: TBitBtn; + BitBtn8: TBitBtn; + BitBtn9: TBitBtn; + BitBtn10: TBitBtn; + BitBtn11: TBitBtn; + BitBtn12: TBitBtn; + BitBtn13: TBitBtn; + BitBtn14: TBitBtn; + BitBtn15: TBitBtn; + BitBtn16: TBitBtn; + BitBtn17: TBitBtn; + BitBtn18: TBitBtn; + BitBtn19: TBitBtn; + BitBtn20: TBitBtn; + BitBtn21: TBitBtn; + BitBtn24: TBitBtn; + BitBtn25: TBitBtn; + BitBtn28: TBitBtn; + BitBtn29: TBitBtn; + BitBtn22: TBitBtn; + BitBtn23: TBitBtn; + BitBtn26: TBitBtn; + BitBtn27: TBitBtn; + BitBtn30: TBitBtn; + BitBtn31: TBitBtn; + BitBtn32: TBitBtn; + BitBtn33: TBitBtn; + BitBtn34: TBitBtn; + BitBtn35: TBitBtn; + BitBtn36: TBitBtn; + BitBtn37: TBitBtn; + BitBtn38: TBitBtn; + BitBtn39: TBitBtn; + BitBtn41: TBitBtn; + Panel2: TPanel; + BitBtn40: TBitBtn; + BitBtn42: TBitBtn; + BitBtn43: TBitBtn; + BitBtn44: TBitBtn; + BitBtn45: TBitBtn; + BitBtn46: TBitBtn; + BitBtn47: TBitBtn; + BitBtn48: TBitBtn; + BitBtn49: TBitBtn; + BitBtn50: TBitBtn; + BitBtn51: TBitBtn; + BitBtn52: TBitBtn; + BitBtn53: TBitBtn; + BitBtn54: TBitBtn; + BitBtn55: TBitBtn; + BitBtn56: TBitBtn; + BitBtn57: TBitBtn; + BitBtn58: TBitBtn; + BitBtn59: TBitBtn; + BitBtn60: TBitBtn; + BitBtn61: TBitBtn; + Panel3: TPanel; + BitBtn62: TBitBtn; + BitBtn63: TBitBtn; + BitBtn64: TBitBtn; + BitBtn65: TBitBtn; + BitBtn66: TBitBtn; + BitBtn67: TBitBtn; + BitBtn68: TBitBtn; + BitBtn69: TBitBtn; + BitBtn70: TBitBtn; + BitBtn71: TBitBtn; + GroupBox1: TGroupBox; + BitBtn72: TBitBtn; + BitBtn73: TBitBtn; + BitBtn74: TBitBtn; + BitBtn75: TBitBtn; + BitBtn76: TBitBtn; + BitBtn77: TBitBtn; + BitBtn78: TBitBtn; + BitBtn79: TBitBtn; + BitBtn80: TBitBtn; + BitBtn81: TBitBtn; + BitBtn82: TBitBtn; + BitBtn83: TBitBtn; + BitBtn84: TBitBtn; + BitBtn85: TBitBtn; + BitBtn86: TBitBtn; + BitBtn87: TBitBtn; + BitBtn88: TBitBtn; + GroupBox2: TGroupBox; + But_KSs: TBitBtn; + But_NGK: TBitBtn; + But_NgG: TBitBtn; + But_JNYA: TBitBtn; + But_NYAC: TBitBtn; + But_NYACh: TBitBtn; + But_NYAJ: TBitBtn; + But_T_T: TBitBtn; + But_SsNYA: TBitBtn; + But_HM: TBitBtn; + But_ND: TBitBtn; + But_ZFola: TBitBtn; + But_RFola: TBitBtn; + BitBtn102: TBitBtn; + BitBtn103: TBitBtn; + BitBtn104: TBitBtn; + BitBtn105: TBitBtn; + BitBtn106: TBitBtn; + btnTab: TButton; + btnBackspace: TButton; + btnSpace: TButton; + btnEnter: TButton; + BitBtn89: TBitBtn; + BitBtn90: TBitBtn; + Procedure FormClose(Sender: TObject; Var Action: TCloseAction); + Procedure BitBtn1Click(Sender: TObject); + Procedure btnTabClick(Sender: TObject); + Procedure But_KSsClick(Sender: TObject); + Procedure But_NGKClick(Sender: TObject); + Procedure But_NgGClick(Sender: TObject); + Procedure But_JNYAClick(Sender: TObject); + Procedure But_NYACClick(Sender: TObject); + Procedure But_NYAChClick(Sender: TObject); + Procedure But_NYAJClick(Sender: TObject); + Procedure But_T_TClick(Sender: TObject); + Procedure But_SsNYAClick(Sender: TObject); + Procedure But_HMClick(Sender: TObject); + Procedure But_NDClick(Sender: TObject); + Procedure But_RFolaClick(Sender: TObject); + Procedure But_ZFolaClick(Sender: TObject); + Procedure FormCreate(Sender: TObject); + Private + { Private declarations } + Procedure TypeIt(Const tStr: String); + Procedure DetectLeftClickOnTitleBar(Var Msg: TWMNCLButtonDown); + Message WM_NCLBUTTONDOWN; + Procedure DetectRightClickOnTitleBar(Var Msg: TWMNCLButtonDown); + Message WM_NCRBUTTONDOWN; + Public + { Public declarations } + Protected + Procedure CreateParams(Var Params: TCreateParams); Override; + End; Var - frmAvroMouse: TfrmAvroMouse; + frmAvroMouse: TfrmAvroMouse; Implementation {$R *.dfm} Uses - uForm1, - BanglaChars, - KeyboardFunctions, - uWindowHandlers, - uRegistrySettings, - clsLayout; + uForm1, + BanglaChars, + KeyboardFunctions, + uWindowHandlers, + uRegistrySettings, + clsLayout; Const - Show_Window_in_Taskbar = True; - + Show_Window_in_Taskbar = True; Procedure TfrmAvroMouse.BitBtn1Click(Sender: TObject); Var - WC: Char; + WC: Char; Begin - WC := Char((Sender As TBitBtn).Tag); - TypeIt(WC); + WC := Char((Sender As TBitBtn).Tag); + TypeIt(WC); End; Procedure TfrmAvroMouse.btnTabClick(Sender: TObject); Begin - SendKey_SendInput((Sender As TButton).Tag); + SendKey_SendInput((Sender As TButton).Tag); End; Procedure TfrmAvroMouse.But_HMClick(Sender: TObject); Begin - TypeIt(b_H + b_Hasanta + b_M); + TypeIt(b_H + b_Hasanta + b_M); End; Procedure TfrmAvroMouse.But_JNYAClick(Sender: TObject); Begin - TypeIt(b_J + b_Hasanta + b_NYA); + TypeIt(b_J + b_Hasanta + b_NYA); End; Procedure TfrmAvroMouse.But_KSsClick(Sender: TObject); Begin - TypeIt(b_K + b_Hasanta + b_Ss); + TypeIt(b_K + b_Hasanta + b_Ss); End; Procedure TfrmAvroMouse.But_NDClick(Sender: TObject); Begin - TypeIt(b_Nn + b_Hasanta + b_Dd); + TypeIt(b_Nn + b_Hasanta + b_Dd); End; Procedure TfrmAvroMouse.But_NgGClick(Sender: TObject); Begin - TypeIt(b_NGA + b_Hasanta + b_G); + TypeIt(b_NGA + b_Hasanta + b_G); End; Procedure TfrmAvroMouse.But_NGKClick(Sender: TObject); Begin - TypeIt(b_NGA + b_Hasanta + b_K); + TypeIt(b_NGA + b_Hasanta + b_K); End; Procedure TfrmAvroMouse.But_NYACClick(Sender: TObject); Begin - TypeIt(b_NYA + b_Hasanta + b_C); + TypeIt(b_NYA + b_Hasanta + b_C); End; Procedure TfrmAvroMouse.But_NYAChClick(Sender: TObject); Begin - TypeIt(b_NYA + b_Hasanta + b_CH); + TypeIt(b_NYA + b_Hasanta + b_CH); End; Procedure TfrmAvroMouse.But_NYAJClick(Sender: TObject); Begin - TypeIt(b_NYA + b_Hasanta + b_J); + TypeIt(b_NYA + b_Hasanta + b_J); End; Procedure TfrmAvroMouse.But_RFolaClick(Sender: TObject); Begin - TypeIt(b_Hasanta + b_R); + TypeIt(b_Hasanta + b_R); End; Procedure TfrmAvroMouse.But_SsNYAClick(Sender: TObject); Begin - TypeIt(b_Ss + b_Hasanta + b_Nn); + TypeIt(b_Ss + b_Hasanta + b_Nn); End; Procedure TfrmAvroMouse.But_T_TClick(Sender: TObject); Begin - TypeIt(b_T + b_Hasanta + b_T); + TypeIt(b_T + b_Hasanta + b_T); End; Procedure TfrmAvroMouse.But_ZFolaClick(Sender: TObject); Begin - TypeIt(b_Hasanta + b_Z); + TypeIt(b_Hasanta + b_Z); End; Procedure TfrmAvroMouse.CreateParams(Var Params: TCreateParams); Begin - Inherited CreateParams(Params); - With Params Do Begin - If Show_Window_in_Taskbar Then Begin - ExStyle := ExStyle Or WS_EX_APPWINDOW And Not WS_EX_TOOLWINDOW; - ExStyle := ExStyle Or WS_EX_TOPMOST Or WS_EX_NOACTIVATE; - WndParent := GetDesktopwindow; - End - Else If Not Show_Window_in_Taskbar Then Begin - ExStyle := ExStyle And Not WS_EX_APPWINDOW; - End; - End; + Inherited CreateParams(Params); + With Params Do + Begin + If Show_Window_in_Taskbar Then + Begin + ExStyle := ExStyle Or WS_EX_APPWINDOW And Not WS_EX_TOOLWINDOW; + ExStyle := ExStyle Or WS_EX_TOPMOST Or WS_EX_NOACTIVATE; + WndParent := GetDesktopwindow; + End + Else If Not Show_Window_in_Taskbar Then + Begin + ExStyle := ExStyle And Not WS_EX_APPWINDOW; + End; + End; End; Procedure TfrmAvroMouse.DetectLeftClickOnTitleBar(Var Msg: TWMNCLButtonDown); Begin - If (Msg.HitTest = htCaption) Then - SetForegroundWindow(Self.Handle); - Inherited; + If (Msg.HitTest = htCaption) Then + SetForegroundWindow(Self.Handle); + Inherited; End; Procedure TfrmAvroMouse.DetectRightClickOnTitleBar(Var Msg: TWMNCLButtonDown); Begin - If (Msg.HitTest = htCaption) Then - SetForegroundWindow(Self.Handle); - Inherited; + If (Msg.HitTest = htCaption) Then + SetForegroundWindow(Self.Handle); + Inherited; End; Procedure TfrmAvroMouse.FormClose(Sender: TObject; Var Action: TCloseAction); Begin - If Self.Top >= 0 Then - AvroMousePosX := intToStr(Self.Top); - If Self.Left >= 0 Then - AvroMousePosY := intToStr(Self.Left); + If Self.Top >= 0 Then + AvroMousePosX := intToStr(Self.Top); + If Self.Left >= 0 Then + AvroMousePosY := intToStr(Self.Left); - Action := caFree; + Action := caFree; - frmAvroMouse := Nil; + frmAvroMouse := Nil; End; Procedure TfrmAvroMouse.FormCreate(Sender: TObject); Begin - Try - If (StrToInt(AvroMousePosX) > Screen.Width) Or (StrToInt(AvroMousePosX) < 0) Then - AvroMousePosX := '0'; - If (StrToInt(AvroMousePosY) > Screen.Height) Or (StrToInt(AvroMousePosY) < 0) Then - AvroMousePosY := '0'; - - Self.Top := StrToInt(AvroMousePosX); - Self.Left := StrToInt(AvroMousePosY); - Except - On E: Exception Do Begin - AvroMousePosX := '0'; - AvroMousePosY := '0'; - Self.Top := 0; - Self.Left := 0; - End; - End; + Try + If (StrToInt(AvroMousePosX) > Screen.Width) Or + (StrToInt(AvroMousePosX) < 0) Then + AvroMousePosX := '0'; + If (StrToInt(AvroMousePosY) > Screen.Height) Or + (StrToInt(AvroMousePosY) < 0) Then + AvroMousePosY := '0'; + + Self.Top := StrToInt(AvroMousePosX); + Self.Left := StrToInt(AvroMousePosY); + Except + On E: Exception Do + Begin + AvroMousePosX := '0'; + AvroMousePosY := '0'; + Self.Top := 0; + Self.Left := 0; + End; + End; End; Procedure TfrmAvroMouse.TypeIt(Const tStr: String); Begin - If AvroMouseChangeModeLocale = 'YES' Then Begin - If AvroMainForm1.GetMyCurrentKeyboardMode <> bangla Then - AvroMainForm1.ToggleMode; - End; + If AvroMouseChangeModeLocale = 'YES' Then + Begin + If AvroMainForm1.GetMyCurrentKeyboardMode <> bangla Then + AvroMainForm1.ToggleMode; + End; - SendKey_Char(tStr); + SendKey_Char(tStr); End; End. diff --git a/Keyboard and Spell checker/Forms/ufrmConflict.pas b/Keyboard and Spell checker/Forms/ufrmConflict.pas index 0e43a5c..d544a44 100644 --- a/Keyboard and Spell checker/Forms/ufrmConflict.pas +++ b/Keyboard and Spell checker/Forms/ufrmConflict.pas @@ -1,25 +1,25 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= @@ -30,80 +30,77 @@ Interface Uses - Windows, - Messages, - SysUtils, - Variants, - Classes, - Graphics, - Controls, - Forms, - Dialogs, - StdCtrls; + Windows, + Messages, + SysUtils, + Variants, + Classes, + Graphics, + Controls, + Forms, + Dialogs, + StdCtrls; Type - TfrmConflict = Class(TForm) - EditR_P: TEdit; - Label2: TLabel; - EditR: TEdit; - EditWC_P: TEdit; - EditWC: TEdit; - EditWI_P: TEdit; - EditWI: TEdit; - Label3: TLabel; - Label4: TLabel; - Label5: TLabel; - Label6: TLabel; - butImported: TButton; - butCurrent: TButton; - Procedure FormClose(Sender: TObject; Var Action: TCloseAction); - Procedure FormShow(Sender: TObject); - Procedure butCurrentClick(Sender: TObject); - Procedure butImportedClick(Sender: TObject); - Private - { Private declarations } - Public - { Public declarations } - End; + TfrmConflict = Class(TForm) + EditR_P: TEdit; + Label2: TLabel; + EditR: TEdit; + EditWC_P: TEdit; + EditWC: TEdit; + EditWI_P: TEdit; + EditWI: TEdit; + Label3: TLabel; + Label4: TLabel; + Label5: TLabel; + Label6: TLabel; + butImported: TButton; + butCurrent: TButton; + Procedure FormClose(Sender: TObject; Var Action: TCloseAction); + Procedure FormShow(Sender: TObject); + Procedure butCurrentClick(Sender: TObject); + Procedure butImportedClick(Sender: TObject); + Private + { Private declarations } + Public + { Public declarations } + End; Var - frmConflict : TfrmConflict; + frmConflict: TfrmConflict; Implementation {$R *.dfm} - -{===============================================================================} +{ =============================================================================== } Procedure TfrmConflict.butCurrentClick(Sender: TObject); Begin - self.ModalResult := mrCancel; + self.ModalResult := mrCancel; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmConflict.butImportedClick(Sender: TObject); Begin - self.ModalResult := mrOk; + self.ModalResult := mrOk; End; -{===============================================================================} +{ =============================================================================== } -Procedure TfrmConflict.FormClose(Sender: TObject; - Var Action: TCloseAction); +Procedure TfrmConflict.FormClose(Sender: TObject; Var Action: TCloseAction); Begin - Action := caFree; - frmConflict := Nil; + Action := caFree; + frmConflict := Nil; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmConflict.FormShow(Sender: TObject); Begin - self.Visible := True; + self.Visible := True; End; -{===============================================================================} +{ =============================================================================== } End. - diff --git a/Keyboard and Spell checker/Forms/ufrmEncodingWarning.pas b/Keyboard and Spell checker/Forms/ufrmEncodingWarning.pas index 3f66a7c..77c515d 100644 --- a/Keyboard and Spell checker/Forms/ufrmEncodingWarning.pas +++ b/Keyboard and Spell checker/Forms/ufrmEncodingWarning.pas @@ -1,121 +1,121 @@ { - ============================================================================= - ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + ============================================================================= + ***************************************************************************** + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. - ***************************************************************************** - ============================================================================= + ***************************************************************************** + ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - Unit ufrmEncodingWarning; Interface Uses - Windows, - Messages, - SysUtils, - Variants, - Classes, - Graphics, - Controls, - Forms, - Dialogs, - StdCtrls, - ExtCtrls; + Windows, + Messages, + SysUtils, + Variants, + Classes, + Graphics, + Controls, + Forms, + Dialogs, + StdCtrls, + ExtCtrls; Type - TfrmEncodingWarning = Class(TForm) - Panel1: TPanel; - Label1: TLabel; - Label2: TLabel; - Image1: TImage; - Label3: TLabel; - Label5: TLabel; - Label6: TLabel; - Label7: TLabel; - Image2: TImage; - Image4: TImage; - Image5: TImage; - Button1: TButton; - Button2: TButton; - CheckBox_ShowWarning: TCheckBox; - Procedure FormCreate(Sender: TObject); - Procedure Button1Click(Sender: TObject); - Procedure Button2Click(Sender: TObject); - Procedure FormClose(Sender: TObject; Var Action: TCloseAction); - Private - { Private declarations } - Public - { Public declarations } - End; + TfrmEncodingWarning = Class(TForm) + Panel1: TPanel; + Label1: TLabel; + Label2: TLabel; + Image1: TImage; + Label3: TLabel; + Label5: TLabel; + Label6: TLabel; + Label7: TLabel; + Image2: TImage; + Image4: TImage; + Image5: TImage; + Button1: TButton; + Button2: TButton; + CheckBox_ShowWarning: TCheckBox; + Procedure FormCreate(Sender: TObject); + Procedure Button1Click(Sender: TObject); + Procedure Button2Click(Sender: TObject); + Procedure FormClose(Sender: TObject; Var Action: TCloseAction); + Private + { Private declarations } + Public + { Public declarations } + End; Var - frmEncodingWarning: TfrmEncodingWarning; + frmEncodingWarning: TfrmEncodingWarning; Implementation {$R *.dfm} Uses - uWindowHandlers, - uRegistrySettings, - uform1; + uWindowHandlers, + uRegistrySettings, + uform1; Procedure TfrmEncodingWarning.Button1Click(Sender: TObject); Begin - OutputIsBijoy := 'NO'; - If CheckBox_ShowWarning.Checked Then - ShowOutputwarning := 'YES' - Else - ShowOutputwarning := 'NO'; - - AvroMainForm1.RefreshSettings; - Self.Close; + OutputIsBijoy := 'NO'; + If CheckBox_ShowWarning.Checked Then + ShowOutputwarning := 'YES' + Else + ShowOutputwarning := 'NO'; + + AvroMainForm1.RefreshSettings; + Self.Close; End; Procedure TfrmEncodingWarning.Button2Click(Sender: TObject); Begin - OutputIsBijoy := 'YES'; - If CheckBox_ShowWarning.Checked Then - ShowOutputwarning := 'YES' - Else - ShowOutputwarning := 'NO'; - - AvroMainForm1.RefreshSettings; - Self.Close; + OutputIsBijoy := 'YES'; + If CheckBox_ShowWarning.Checked Then + ShowOutputwarning := 'YES' + Else + ShowOutputwarning := 'NO'; + + AvroMainForm1.RefreshSettings; + Self.Close; End; -Procedure TfrmEncodingWarning.FormClose(Sender: TObject; Var Action: TCloseAction); +Procedure TfrmEncodingWarning.FormClose(Sender: TObject; + Var Action: TCloseAction); Begin - Action := caFree; - frmEncodingWarning := Nil; + Action := caFree; + frmEncodingWarning := Nil; End; Procedure TfrmEncodingWarning.FormCreate(Sender: TObject); Begin - DisableCloseButton(Self.Handle); - TOPMOST(Self.Handle); + DisableCloseButton(Self.Handle); + TOPMOST(Self.Handle); End; End. diff --git a/Keyboard and Spell checker/Forms/ufrmOptions.pas b/Keyboard and Spell checker/Forms/ufrmOptions.pas index 0fd4f98..51bf680 100644 --- a/Keyboard and Spell checker/Forms/ufrmOptions.pas +++ b/Keyboard and Spell checker/Forms/ufrmOptions.pas @@ -1,477 +1,489 @@ { - ============================================================================= - ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + ============================================================================= + ***************************************************************************** + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. - ***************************************************************************** - ============================================================================= + ***************************************************************************** + ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - Unit ufrmOptions; Interface Uses - Windows, - Messages, - SysUtils, - Variants, - Classes, - Graphics, - Controls, - Forms, - Dialogs, - ExtCtrls, - CategoryButtons, - StdCtrls, - ComCtrls; + Windows, + Messages, + SysUtils, + Variants, + Classes, + Graphics, + Controls, + Forms, + Dialogs, + ExtCtrls, + CategoryButtons, + StdCtrls, + ComCtrls; Type - TfrmOptions = Class(TForm) - Panel1: TPanel; - Image1: TImage; - TopLabel: TLabel; - ButtonPanel: TPanel; - Button_OK: TButton; - Button_Cancel: TButton; - CategoryTree: TTreeView; - butEditCustomDict: TButton; - CheckAddNewWords: TCheckBox; - ScrollBox2: TScrollBox; - FixedLayout_Panel: TPanel; - GroupBox6: TGroupBox; - Label10: TLabel; - Label11: TLabel; - optTypingStyle_Modern: TRadioButton; - chkOldReph: TCheckBox; - chkVowelFormat: TCheckBox; - CheckChandraPosition: TCheckBox; - optTypingStyle_Old: TRadioButton; - CheckNumPadBangla: TCheckBox; - KeyboardMode_Panel: TPanel; - GroupBox4: TGroupBox; - Label7: TLabel; - comboFunctionKeys: TComboBox; - Locale_Panel: TPanel; - Label8: TLabel; - CheckEnableLocaleChange: TCheckBox; - optLocaleIND: TRadioButton; - optLocaleBD: TRadioButton; - optLocaleAS: TRadioButton; - ButtonInstallLocale: TButton; - General_Panel: TPanel; - Label3: TLabel; - GroupBox1: TGroupBox; - Label2: TLabel; - checkStartUp: TCheckBox; - CheckShowSplash: TCheckBox; - optStartupUIMode_TopBar: TRadioButton; - optStartupUIMode_Tray: TRadioButton; - optStartupUIMode_Last: TRadioButton; - optTopBarXButton_Close: TRadioButton; - optTopBarXButton_Minimize: TRadioButton; - optTopBarXButton_ShowMenu: TRadioButton; - CheckUpdate: TCheckBox; - Interface_Panel: TPanel; - Captionl_Transparency: TLabel; - Label_Transparency: TLabel; - checkTopBarTransparent: TCheckBox; - TrackBar_Transparency: TTrackBar; - GroupBox2: TGroupBox; - Label5: TLabel; - Label6: TLabel; - comboSkin: TComboBox; - ScrollBox1: TScrollBox; - SkinPreviewPic: TImage; - cmdDownloadSkin: TButton; - ccmdAboutSkin: TButton; - AvroMouse_Panel: TPanel; - GroupBox5: TGroupBox; - optAvroMouseKeyboardMode_NoChange: TRadioButton; - optAvroMouseKeyboardMode_Change: TRadioButton; - AvroPhonetic_Panel: TPanel; - GroupBox3: TGroupBox; - Label_PhoneticTypingMode: TLabel; - Label1: TLabel; - Label4: TLabel; - CheckShowPrevWindow: TCheckBox; - optPhoneticMode_Dict: TRadioButton; - optPhoneticMode_Char: TRadioButton; - optPhoneticMode_OnlyChar: TRadioButton; - CheckRememberCandidate: TCheckBox; - CheckTabBrowsing: TCheckBox; - Label9: TLabel; - Label12: TLabel; - GroupBox7: TGroupBox; - CheckAutoCorrect: TCheckBox; - cmdAutoCorrect: TButton; - CheckEnableJoNukta: TCheckBox; - CheckPipeToDot: TCheckBox; - Label13: TLabel; - Label14: TLabel; - Button_Apply: TButton; - Button_Help: TButton; - LabelStatus: TLabel; - GlobalOutput_Panel: TPanel; - optOutputUnicode: TRadioButton; - optOutputANSI: TRadioButton; - CheckWarningAnsi: TCheckBox; - LabelHideTimer: TTimer; - Label15: TLabel; - GroupBox8: TGroupBox; - Label16: TLabel; - comboFunctionKeys_OutputMode: TComboBox; - Label17: TLabel; - GroupBox9: TGroupBox; - Label18: TLabel; - Label19: TLabel; - comboFunctionKeys_SpellerLauncher: TComboBox; - Label20: TLabel; - LabelGlobalHotkeysLink: TLabel; - Procedure FormCreate(Sender: TObject); - Procedure CategoryTreeClick(Sender: TObject); - Procedure FormClose(Sender: TObject; Var Action: TCloseAction); - Procedure CategoryTreeKeyUp(Sender: TObject; Var Key: Word; Shift: TShiftState); - Procedure checkTopBarTransparentClick(Sender: TObject); - Procedure TrackBar_TransparencyChange(Sender: TObject); - Procedure comboSkinChange(Sender: TObject); - Procedure cmdDownloadSkinClick(Sender: TObject); - Procedure CheckShowPrevWindowClick(Sender: TObject); - Procedure butEditCustomDictClick(Sender: TObject); - Procedure cmdAutoCorrectClick(Sender: TObject); - Procedure Button_CancelClick(Sender: TObject); - Procedure Button_OKClick(Sender: TObject); - Procedure Button_HelpClick(Sender: TObject); - Procedure optTypingStyle_ModernClick(Sender: TObject); - Procedure ccmdAboutSkinClick(Sender: TObject); - Procedure ButtonInstallLocaleClick(Sender: TObject); - Procedure CheckAddNewWordsClick(Sender: TObject); - Procedure Button_ApplyClick(Sender: TObject); - Procedure optOutputANSIMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - Procedure LabelHideTimerTimer(Sender: TObject); - Procedure LabelGlobalHotkeysLinkClick(Sender: TObject); - Private - { Private declarations } - // Procedure SetTabOrder; - Procedure LoadSettings; - Procedure SaveSettings; - Function GetListIndex(List: TStrings; SearchS: String): Integer; - Public - { Public declarations } - Protected - Procedure CreateParams(Var Params: TCreateParams); Override; - End; + TfrmOptions = Class(TForm) + Panel1: TPanel; + Image1: TImage; + TopLabel: TLabel; + ButtonPanel: TPanel; + Button_OK: TButton; + Button_Cancel: TButton; + CategoryTree: TTreeView; + butEditCustomDict: TButton; + CheckAddNewWords: TCheckBox; + ScrollBox2: TScrollBox; + FixedLayout_Panel: TPanel; + GroupBox6: TGroupBox; + Label10: TLabel; + Label11: TLabel; + optTypingStyle_Modern: TRadioButton; + chkOldReph: TCheckBox; + chkVowelFormat: TCheckBox; + CheckChandraPosition: TCheckBox; + optTypingStyle_Old: TRadioButton; + CheckNumPadBangla: TCheckBox; + KeyboardMode_Panel: TPanel; + GroupBox4: TGroupBox; + Label7: TLabel; + comboFunctionKeys: TComboBox; + Locale_Panel: TPanel; + Label8: TLabel; + CheckEnableLocaleChange: TCheckBox; + optLocaleIND: TRadioButton; + optLocaleBD: TRadioButton; + optLocaleAS: TRadioButton; + ButtonInstallLocale: TButton; + General_Panel: TPanel; + Label3: TLabel; + GroupBox1: TGroupBox; + Label2: TLabel; + checkStartUp: TCheckBox; + CheckShowSplash: TCheckBox; + optStartupUIMode_TopBar: TRadioButton; + optStartupUIMode_Tray: TRadioButton; + optStartupUIMode_Last: TRadioButton; + optTopBarXButton_Close: TRadioButton; + optTopBarXButton_Minimize: TRadioButton; + optTopBarXButton_ShowMenu: TRadioButton; + CheckUpdate: TCheckBox; + Interface_Panel: TPanel; + Captionl_Transparency: TLabel; + Label_Transparency: TLabel; + checkTopBarTransparent: TCheckBox; + TrackBar_Transparency: TTrackBar; + GroupBox2: TGroupBox; + Label5: TLabel; + Label6: TLabel; + comboSkin: TComboBox; + ScrollBox1: TScrollBox; + SkinPreviewPic: TImage; + cmdDownloadSkin: TButton; + ccmdAboutSkin: TButton; + AvroMouse_Panel: TPanel; + GroupBox5: TGroupBox; + optAvroMouseKeyboardMode_NoChange: TRadioButton; + optAvroMouseKeyboardMode_Change: TRadioButton; + AvroPhonetic_Panel: TPanel; + GroupBox3: TGroupBox; + Label_PhoneticTypingMode: TLabel; + Label1: TLabel; + Label4: TLabel; + CheckShowPrevWindow: TCheckBox; + optPhoneticMode_Dict: TRadioButton; + optPhoneticMode_Char: TRadioButton; + optPhoneticMode_OnlyChar: TRadioButton; + CheckRememberCandidate: TCheckBox; + CheckTabBrowsing: TCheckBox; + Label9: TLabel; + Label12: TLabel; + GroupBox7: TGroupBox; + CheckAutoCorrect: TCheckBox; + cmdAutoCorrect: TButton; + CheckEnableJoNukta: TCheckBox; + CheckPipeToDot: TCheckBox; + Label13: TLabel; + Label14: TLabel; + Button_Apply: TButton; + Button_Help: TButton; + LabelStatus: TLabel; + GlobalOutput_Panel: TPanel; + optOutputUnicode: TRadioButton; + optOutputANSI: TRadioButton; + CheckWarningAnsi: TCheckBox; + LabelHideTimer: TTimer; + Label15: TLabel; + GroupBox8: TGroupBox; + Label16: TLabel; + comboFunctionKeys_OutputMode: TComboBox; + Label17: TLabel; + GroupBox9: TGroupBox; + Label18: TLabel; + Label19: TLabel; + comboFunctionKeys_SpellerLauncher: TComboBox; + Label20: TLabel; + LabelGlobalHotkeysLink: TLabel; + Procedure FormCreate(Sender: TObject); + Procedure CategoryTreeClick(Sender: TObject); + Procedure FormClose(Sender: TObject; Var Action: TCloseAction); + Procedure CategoryTreeKeyUp(Sender: TObject; Var Key: Word; + Shift: TShiftState); + Procedure checkTopBarTransparentClick(Sender: TObject); + Procedure TrackBar_TransparencyChange(Sender: TObject); + Procedure comboSkinChange(Sender: TObject); + Procedure cmdDownloadSkinClick(Sender: TObject); + Procedure CheckShowPrevWindowClick(Sender: TObject); + Procedure butEditCustomDictClick(Sender: TObject); + Procedure cmdAutoCorrectClick(Sender: TObject); + Procedure Button_CancelClick(Sender: TObject); + Procedure Button_OKClick(Sender: TObject); + Procedure Button_HelpClick(Sender: TObject); + Procedure optTypingStyle_ModernClick(Sender: TObject); + Procedure ccmdAboutSkinClick(Sender: TObject); + Procedure ButtonInstallLocaleClick(Sender: TObject); + Procedure CheckAddNewWordsClick(Sender: TObject); + Procedure Button_ApplyClick(Sender: TObject); + Procedure optOutputANSIMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + Procedure LabelHideTimerTimer(Sender: TObject); + Procedure LabelGlobalHotkeysLinkClick(Sender: TObject); + Private + { Private declarations } + // Procedure SetTabOrder; + Procedure LoadSettings; + Procedure SaveSettings; + Function GetListIndex(List: TStrings; SearchS: String): Integer; + Public + { Public declarations } + Protected + Procedure CreateParams(Var Params: TCreateParams); Override; + End; Var - frmOptions: TfrmOptions; + frmOptions: TfrmOptions; Implementation {$R *.dfm} Uses - uRegistrySettings, - uFileFolderHandling, - SkinLoader, - uWindowHandlers, - ufrmAutoCorrect, - WindowsVersion, - uForm1, - uLocale, - u_Admin, - ufrmEncodingWarning; + uRegistrySettings, + uFileFolderHandling, + SkinLoader, + uWindowHandlers, + ufrmAutoCorrect, + WindowsVersion, + uForm1, + uLocale, + u_Admin, + ufrmEncodingWarning; Const - Show_Window_in_Taskbar = True; + Show_Window_in_Taskbar = True; - { TfrmOptions } - { - Procedure TfrmOptions.SetTabOrder; - Begin - CategoryTree.TabOrder := 0; + { TfrmOptions } + { + Procedure TfrmOptions.SetTabOrder; + Begin + CategoryTree.TabOrder := 0; - ButtonPanel.TabOrder := 2; - Button_OK.TabOrder := 0; - Button_Cancel.TabOrder := 1; - Button_Apply.TabOrder := 2; - Button_Help.TabOrder := 3; + ButtonPanel.TabOrder := 2; + Button_OK.TabOrder := 0; + Button_Cancel.TabOrder := 1; + Button_Apply.TabOrder := 2; + Button_Help.TabOrder := 3; - Case CategoryTree.Selected.Index Of - 0: Begin - //General_Panel - General_Panel.TabOrder := 1; + Case CategoryTree.Selected.Index Of + 0: Begin + //General_Panel + General_Panel.TabOrder := 1; - checkStartUp.TabOrder := 0; - CheckShowSplash.TabOrder := 1; - optStartupUIMode_TopBar.TabOrder := 2; - optStartupUIMode_Tray.TabOrder := 3; - optStartupUIMode_Last.TabOrder := 4; - optTopBarXButton_Minimize.TabOrder := 5; - optTopBarXButton_Close.TabOrder := 6; - optTopBarXButton_ShowMenu.TabOrder := 7; - End; - 1: Begin + checkStartUp.TabOrder := 0; + CheckShowSplash.TabOrder := 1; + optStartupUIMode_TopBar.TabOrder := 2; + optStartupUIMode_Tray.TabOrder := 3; + optStartupUIMode_Last.TabOrder := 4; + optTopBarXButton_Minimize.TabOrder := 5; + optTopBarXButton_Close.TabOrder := 6; + optTopBarXButton_ShowMenu.TabOrder := 7; + End; + 1: Begin - End; - 2: Begin + End; + 2: Begin - End; - 3: Begin + End; + 3: Begin - End; - 4: Begin + End; + 4: Begin - End; - 5: Begin + End; + 5: Begin - End; - 6: Begin + End; + 6: Begin - End; - 7: Begin + End; + 7: Begin - End; - 8: Begin + End; + 8: Begin - End; - 9: Begin + End; + 9: Begin - End; - End; - End; - } + End; + End; + End; + } - { =============================================================================== } + { =============================================================================== } Procedure TfrmOptions.butEditCustomDictClick(Sender: TObject); Begin - { TODO : Incomplete } - Application.MessageBox('This feature is not yet implemented.', 'Avro Keyboard', MB_OK + MB_ICONEXCLAMATION + MB_DEFBUTTON1 + MB_APPLMODAL); + { TODO : Incomplete } + Application.MessageBox('This feature is not yet implemented.', + 'Avro Keyboard', MB_OK + MB_ICONEXCLAMATION + MB_DEFBUTTON1 + MB_APPLMODAL); End; { =============================================================================== } Procedure TfrmOptions.ButtonInstallLocaleClick(Sender: TObject); Begin - If (IsWinVistaOrLater And IsUAC) Then - Execute_Something_With_APP_Admin('/LOCALE /V', Application.ExeName) - Else - InstallLocale; + If (IsWinVistaOrLater And IsUAC) Then + Execute_Something_With_APP_Admin('/LOCALE /V', Application.ExeName) + Else + InstallLocale; End; { =============================================================================== } Procedure TfrmOptions.Button_ApplyClick(Sender: TObject); Begin - Self.SaveSettings; - AvroMainForm1.RefreshSettings; + Self.SaveSettings; + AvroMainForm1.RefreshSettings; - LabelStatus.Font.Color := clGreen; - LabelStatus.Visible := True; - LabelHideTimer.Enabled := True; + LabelStatus.Font.Color := clGreen; + LabelStatus.Visible := True; + LabelHideTimer.Enabled := True; End; { =============================================================================== } Procedure TfrmOptions.Button_CancelClick(Sender: TObject); Begin - Self.Close; + Self.Close; End; { =============================================================================== } Procedure TfrmOptions.Button_HelpClick(Sender: TObject); Begin - AvroMainForm1.OpenHelpFile(25); + AvroMainForm1.OpenHelpFile(25); End; { =============================================================================== } Procedure TfrmOptions.Button_OKClick(Sender: TObject); Begin - Self.SaveSettings; - AvroMainForm1.RefreshSettings; - Self.Close; + Self.SaveSettings; + AvroMainForm1.RefreshSettings; + Self.Close; End; { =============================================================================== } Procedure TfrmOptions.CategoryTreeClick(Sender: TObject); Begin - Case CategoryTree.Selected.Index Of - 0: Begin - General_Panel.Visible := True; - - // General_Panel.Visible:=False; - Interface_Panel.Visible := False; - KeyboardMode_Panel.Visible := False; - Locale_Panel.Visible := False; - AvroPhonetic_Panel.Visible := False; - AvroMouse_Panel.Visible := False; - FixedLayout_Panel.Visible := False; - GlobalOutput_Panel.Visible := False; - End; - 1: Begin - Interface_Panel.Visible := True; - - General_Panel.Visible := False; - // Interface_Panel.Visible:=False; - KeyboardMode_Panel.Visible := False; - Locale_Panel.Visible := False; - AvroPhonetic_Panel.Visible := False; - AvroMouse_Panel.Visible := False; - FixedLayout_Panel.Visible := False; - GlobalOutput_Panel.Visible := False; - End; - 2: Begin - KeyboardMode_Panel.Visible := True; - - General_Panel.Visible := False; - Interface_Panel.Visible := False; - // KeyboardMode_Panel.Visible:=False; - Locale_Panel.Visible := False; - AvroPhonetic_Panel.Visible := False; - AvroMouse_Panel.Visible := False; - FixedLayout_Panel.Visible := False; - GlobalOutput_Panel.Visible := False; - End; - 3: Begin - Locale_Panel.Visible := True; - - General_Panel.Visible := False; - Interface_Panel.Visible := False; - KeyboardMode_Panel.Visible := False; - // Locale_Panel.Visible:=False; - AvroPhonetic_Panel.Visible := False; - AvroMouse_Panel.Visible := False; - FixedLayout_Panel.Visible := False; - GlobalOutput_Panel.Visible := False; - End; - 4: Begin - AvroPhonetic_Panel.Visible := True; - - General_Panel.Visible := False; - Interface_Panel.Visible := False; - KeyboardMode_Panel.Visible := False; - Locale_Panel.Visible := False; - // AvroPhonetic_Panel.Visible:=False; - AvroMouse_Panel.Visible := False; - FixedLayout_Panel.Visible := False; - GlobalOutput_Panel.Visible := False; - End; - 5: Begin - AvroMouse_Panel.Visible := True; - - General_Panel.Visible := False; - Interface_Panel.Visible := False; - KeyboardMode_Panel.Visible := False; - Locale_Panel.Visible := False; - AvroPhonetic_Panel.Visible := False; - // AvroMouse_Panel.Visible:=False; - FixedLayout_Panel.Visible := False; - GlobalOutput_Panel.Visible := False; - End; - 6: Begin - FixedLayout_Panel.Visible := True; - - General_Panel.Visible := False; - Interface_Panel.Visible := False; - KeyboardMode_Panel.Visible := False; - Locale_Panel.Visible := False; - AvroPhonetic_Panel.Visible := False; - AvroMouse_Panel.Visible := False; - // FixedLayout_Panel.Visible:=False; - GlobalOutput_Panel.Visible := False; - End; - 7: Begin - GlobalOutput_Panel.Visible := True; - - General_Panel.Visible := False; - Interface_Panel.Visible := False; - KeyboardMode_Panel.Visible := False; - Locale_Panel.Visible := False; - AvroPhonetic_Panel.Visible := False; - AvroMouse_Panel.Visible := False; - FixedLayout_Panel.Visible := False; - // GlobalOutput_Panel.Visible:=False; - End; - End; - - TopLabel.Caption := CategoryTree.Selected.Text + ' Settings...'; - // SetTabOrder; + Case CategoryTree.Selected.Index Of + 0: + Begin + General_Panel.Visible := True; + + // General_Panel.Visible:=False; + Interface_Panel.Visible := False; + KeyboardMode_Panel.Visible := False; + Locale_Panel.Visible := False; + AvroPhonetic_Panel.Visible := False; + AvroMouse_Panel.Visible := False; + FixedLayout_Panel.Visible := False; + GlobalOutput_Panel.Visible := False; + End; + 1: + Begin + Interface_Panel.Visible := True; + + General_Panel.Visible := False; + // Interface_Panel.Visible:=False; + KeyboardMode_Panel.Visible := False; + Locale_Panel.Visible := False; + AvroPhonetic_Panel.Visible := False; + AvroMouse_Panel.Visible := False; + FixedLayout_Panel.Visible := False; + GlobalOutput_Panel.Visible := False; + End; + 2: + Begin + KeyboardMode_Panel.Visible := True; + + General_Panel.Visible := False; + Interface_Panel.Visible := False; + // KeyboardMode_Panel.Visible:=False; + Locale_Panel.Visible := False; + AvroPhonetic_Panel.Visible := False; + AvroMouse_Panel.Visible := False; + FixedLayout_Panel.Visible := False; + GlobalOutput_Panel.Visible := False; + End; + 3: + Begin + Locale_Panel.Visible := True; + + General_Panel.Visible := False; + Interface_Panel.Visible := False; + KeyboardMode_Panel.Visible := False; + // Locale_Panel.Visible:=False; + AvroPhonetic_Panel.Visible := False; + AvroMouse_Panel.Visible := False; + FixedLayout_Panel.Visible := False; + GlobalOutput_Panel.Visible := False; + End; + 4: + Begin + AvroPhonetic_Panel.Visible := True; + + General_Panel.Visible := False; + Interface_Panel.Visible := False; + KeyboardMode_Panel.Visible := False; + Locale_Panel.Visible := False; + // AvroPhonetic_Panel.Visible:=False; + AvroMouse_Panel.Visible := False; + FixedLayout_Panel.Visible := False; + GlobalOutput_Panel.Visible := False; + End; + 5: + Begin + AvroMouse_Panel.Visible := True; + + General_Panel.Visible := False; + Interface_Panel.Visible := False; + KeyboardMode_Panel.Visible := False; + Locale_Panel.Visible := False; + AvroPhonetic_Panel.Visible := False; + // AvroMouse_Panel.Visible:=False; + FixedLayout_Panel.Visible := False; + GlobalOutput_Panel.Visible := False; + End; + 6: + Begin + FixedLayout_Panel.Visible := True; + + General_Panel.Visible := False; + Interface_Panel.Visible := False; + KeyboardMode_Panel.Visible := False; + Locale_Panel.Visible := False; + AvroPhonetic_Panel.Visible := False; + AvroMouse_Panel.Visible := False; + // FixedLayout_Panel.Visible:=False; + GlobalOutput_Panel.Visible := False; + End; + 7: + Begin + GlobalOutput_Panel.Visible := True; + + General_Panel.Visible := False; + Interface_Panel.Visible := False; + KeyboardMode_Panel.Visible := False; + Locale_Panel.Visible := False; + AvroPhonetic_Panel.Visible := False; + AvroMouse_Panel.Visible := False; + FixedLayout_Panel.Visible := False; + // GlobalOutput_Panel.Visible:=False; + End; + End; + + TopLabel.Caption := CategoryTree.Selected.Text + ' Settings...'; + // SetTabOrder; End; { =============================================================================== } -Procedure TfrmOptions.CategoryTreeKeyUp(Sender: TObject; Var Key: Word; Shift: TShiftState); +Procedure TfrmOptions.CategoryTreeKeyUp(Sender: TObject; Var Key: Word; + Shift: TShiftState); Begin - CategoryTreeClick(Nil); + CategoryTreeClick(Nil); End; { =============================================================================== } Procedure TfrmOptions.ccmdAboutSkinClick(Sender: TObject); Begin - If comboSkin.Items[comboSkin.ItemIndex] = 'None' Then - GetSkinDescription('internalskin*') - Else - GetSkinDescription(GetAvroDataDir + 'Skin\' + comboSkin.Items[comboSkin.ItemIndex] + '.avroskin'); + If comboSkin.Items[comboSkin.ItemIndex] = 'None' Then + GetSkinDescription('internalskin*') + Else + GetSkinDescription(GetAvroDataDir + 'Skin\' + comboSkin.Items + [comboSkin.ItemIndex] + '.avroskin'); End; { =============================================================================== } Procedure TfrmOptions.CheckAddNewWordsClick(Sender: TObject); Begin - { TODO : Incomplete } + { TODO : Incomplete } - // Application.MessageBox('This feature is not yet implemented.', 'Avro Keyboard', MB_OK + MB_ICONEXCLAMATION + MB_DEFBUTTON1 + MB_APPLMODAL); + // Application.MessageBox('This feature is not yet implemented.', 'Avro Keyboard', MB_OK + MB_ICONEXCLAMATION + MB_DEFBUTTON1 + MB_APPLMODAL); End; - - { =============================================================================== } Procedure TfrmOptions.CheckShowPrevWindowClick(Sender: TObject); Begin - If CheckShowPrevWindow.Checked = True Then Begin - Label_PhoneticTypingMode.Enabled := True; - optPhoneticMode_Dict.Enabled := True; - optPhoneticMode_Char.Enabled := True; - optPhoneticMode_OnlyChar.Enabled := True; - CheckRememberCandidate.Enabled := True; - CheckAddNewWords.Enabled := True; - CheckTabBrowsing.Enabled := True; - End - Else Begin - Label_PhoneticTypingMode.Enabled := False; - optPhoneticMode_Dict.Enabled := False; - optPhoneticMode_Char.Enabled := False; - optPhoneticMode_OnlyChar.Enabled := False; - CheckRememberCandidate.Enabled := False; - CheckAddNewWords.Enabled := False; - CheckTabBrowsing.Enabled := False; - End; + If CheckShowPrevWindow.Checked = True Then + Begin + Label_PhoneticTypingMode.Enabled := True; + optPhoneticMode_Dict.Enabled := True; + optPhoneticMode_Char.Enabled := True; + optPhoneticMode_OnlyChar.Enabled := True; + CheckRememberCandidate.Enabled := True; + CheckAddNewWords.Enabled := True; + CheckTabBrowsing.Enabled := True; + End + Else + Begin + Label_PhoneticTypingMode.Enabled := False; + optPhoneticMode_Dict.Enabled := False; + optPhoneticMode_Char.Enabled := False; + optPhoneticMode_OnlyChar.Enabled := False; + CheckRememberCandidate.Enabled := False; + CheckAddNewWords.Enabled := False; + CheckTabBrowsing.Enabled := False; + End; End; @@ -479,73 +491,79 @@ Procedure TfrmOptions.checkTopBarTransparentClick(Sender: TObject); Begin - If checkTopBarTransparent.Checked = True Then Begin - Captionl_Transparency.Enabled := True; - TrackBar_Transparency.Enabled := True; - Label_Transparency.Enabled := True; - End - Else Begin - Captionl_Transparency.Enabled := False; - TrackBar_Transparency.Enabled := False; - Label_Transparency.Enabled := False; - End; + If checkTopBarTransparent.Checked = True Then + Begin + Captionl_Transparency.Enabled := True; + TrackBar_Transparency.Enabled := True; + Label_Transparency.Enabled := True; + End + Else + Begin + Captionl_Transparency.Enabled := False; + TrackBar_Transparency.Enabled := False; + Label_Transparency.Enabled := False; + End; End; { =============================================================================== } Procedure TfrmOptions.cmdAutoCorrectClick(Sender: TObject); Begin - CheckCreateForm(TfrmAutoCorrect, frmAutoCorrect, 'frmAutoCorrect'); - frmAutoCorrect.Show; + CheckCreateForm(TfrmAutoCorrect, frmAutoCorrect, 'frmAutoCorrect'); + frmAutoCorrect.Show; End; { =============================================================================== } Procedure TfrmOptions.cmdDownloadSkinClick(Sender: TObject); Begin - Execute_Something('http://www.omicronlab.com/go.php?id=8'); + Execute_Something('http://www.omicronlab.com/go.php?id=8'); End; { =============================================================================== } - Procedure TfrmOptions.comboSkinChange(Sender: TObject); Begin - Try - { Show skin preview for selected skin } - If comboSkin.Items[comboSkin.ItemIndex] = 'None' Then - GetSkinPreviewPicture('internalskin*', SkinPreviewPic.Picture) - Else - GetSkinPreviewPicture(GetAvroDataDir + 'Skin\' + comboSkin.Items[comboSkin.ItemIndex] + '.avroskin', SkinPreviewPic.Picture); - Except - On E: Exception Do Begin - // Nothing - End; - End; + Try + { Show skin preview for selected skin } + If comboSkin.Items[comboSkin.ItemIndex] = 'None' Then + GetSkinPreviewPicture('internalskin*', SkinPreviewPic.Picture) + Else + GetSkinPreviewPicture(GetAvroDataDir + 'Skin\' + comboSkin.Items + [comboSkin.ItemIndex] + '.avroskin', SkinPreviewPic.Picture); + Except + On E: Exception Do + Begin + // Nothing + End; + End; End; { =============================================================================== } Procedure TfrmOptions.CreateParams(Var Params: TCreateParams); Begin - Inherited CreateParams(Params); - With Params Do Begin - If Show_Window_in_Taskbar Then Begin - ExStyle := ExStyle Or WS_EX_APPWINDOW And Not WS_EX_TOOLWINDOW; - WndParent := GetDesktopwindow; - End - Else If Not Show_Window_in_Taskbar Then Begin - ExStyle := ExStyle And Not WS_EX_APPWINDOW; - End; - End; + Inherited CreateParams(Params); + With Params Do + Begin + If Show_Window_in_Taskbar Then + Begin + ExStyle := ExStyle Or WS_EX_APPWINDOW And Not WS_EX_TOOLWINDOW; + WndParent := GetDesktopwindow; + End + Else If Not Show_Window_in_Taskbar Then + Begin + ExStyle := ExStyle And Not WS_EX_APPWINDOW; + End; + End; End; { =============================================================================== } Procedure TfrmOptions.FormClose(Sender: TObject; Var Action: TCloseAction); Begin - Action := caFree; - frmOptions := Nil; + Action := caFree; + frmOptions := Nil; End; { =============================================================================== } @@ -553,585 +571,605 @@ Procedure TfrmOptions.FormCreate(Sender: TObject); Begin - { Arrange Panels } - - // Bring General_Panel to Top - General_Panel.Visible := True; - FixedLayout_Panel.Visible := False; - AvroPhonetic_Panel.Visible := False; - Locale_Panel.Visible := False; - KeyboardMode_Panel.Visible := False; - General_Panel.Visible := False; - AvroMouse_Panel.Visible := False; - Interface_Panel.Visible := False; - GlobalOutput_Panel.Visible := False; - - Interface_Panel.Top := 0; - AvroMouse_Panel.Top := 0; - General_Panel.Top := 0; - KeyboardMode_Panel.Top := 0; - Locale_Panel.Top := 0; - AvroPhonetic_Panel.Top := 0; - FixedLayout_Panel.Top := 0; - GlobalOutput_Panel.Top := 0; - - Interface_Panel.Left := 0; - AvroMouse_Panel.Left := 0; - General_Panel.Left := 0; - KeyboardMode_Panel.Left := 0; - Locale_Panel.Left := 0; - AvroPhonetic_Panel.Left := 0; - FixedLayout_Panel.Left := 0; - GlobalOutput_Panel.Left := 0; - - Interface_Panel.Width := Self.Width - CategoryTree.Width - 20; - AvroMouse_Panel.Width := Self.Width - CategoryTree.Width - 20; - General_Panel.Width := Self.Width - CategoryTree.Width - 20; - KeyboardMode_Panel.Width := Self.Width - CategoryTree.Width - 20; - Locale_Panel.Width := Self.Width - CategoryTree.Width - 20; - AvroPhonetic_Panel.Width := Self.Width - CategoryTree.Width - 20; - FixedLayout_Panel.Width := Self.Width - CategoryTree.Width - 20; - GlobalOutput_Panel.Width := Self.Width - CategoryTree.Width - 20; - - Interface_Panel.BevelKind := bknone { bkTile } ; - AvroMouse_Panel.BevelKind := bknone { bkTile } ; - General_Panel.BevelKind := bknone { bkTile } ; - KeyboardMode_Panel.BevelKind := bknone { bkTile } ; - Locale_Panel.BevelKind := bknone { bkTile } ; - AvroPhonetic_Panel.BevelKind := bknone { bkTile } ; - FixedLayout_Panel.BevelKind := bknone { bkTile } ; - GlobalOutput_Panel.BevelKind := bknone; - - - CategoryTree.Items[0].Selected := True; - - SetElevationRequiredState(ButtonInstallLocale, True); - - // Load Settings - Self.LoadSettings; + { Arrange Panels } + + // Bring General_Panel to Top + General_Panel.Visible := True; + FixedLayout_Panel.Visible := False; + AvroPhonetic_Panel.Visible := False; + Locale_Panel.Visible := False; + KeyboardMode_Panel.Visible := False; + General_Panel.Visible := False; + AvroMouse_Panel.Visible := False; + Interface_Panel.Visible := False; + GlobalOutput_Panel.Visible := False; + + Interface_Panel.Top := 0; + AvroMouse_Panel.Top := 0; + General_Panel.Top := 0; + KeyboardMode_Panel.Top := 0; + Locale_Panel.Top := 0; + AvroPhonetic_Panel.Top := 0; + FixedLayout_Panel.Top := 0; + GlobalOutput_Panel.Top := 0; + + Interface_Panel.Left := 0; + AvroMouse_Panel.Left := 0; + General_Panel.Left := 0; + KeyboardMode_Panel.Left := 0; + Locale_Panel.Left := 0; + AvroPhonetic_Panel.Left := 0; + FixedLayout_Panel.Left := 0; + GlobalOutput_Panel.Left := 0; + + Interface_Panel.Width := Self.Width - CategoryTree.Width - 20; + AvroMouse_Panel.Width := Self.Width - CategoryTree.Width - 20; + General_Panel.Width := Self.Width - CategoryTree.Width - 20; + KeyboardMode_Panel.Width := Self.Width - CategoryTree.Width - 20; + Locale_Panel.Width := Self.Width - CategoryTree.Width - 20; + AvroPhonetic_Panel.Width := Self.Width - CategoryTree.Width - 20; + FixedLayout_Panel.Width := Self.Width - CategoryTree.Width - 20; + GlobalOutput_Panel.Width := Self.Width - CategoryTree.Width - 20; + + Interface_Panel.BevelKind := bknone { bkTile }; + AvroMouse_Panel.BevelKind := bknone { bkTile }; + General_Panel.BevelKind := bknone { bkTile }; + KeyboardMode_Panel.BevelKind := bknone { bkTile }; + Locale_Panel.BevelKind := bknone { bkTile }; + AvroPhonetic_Panel.BevelKind := bknone { bkTile }; + FixedLayout_Panel.BevelKind := bknone { bkTile }; + GlobalOutput_Panel.BevelKind := bknone; + + CategoryTree.Items[0].Selected := True; + + SetElevationRequiredState(ButtonInstallLocale, True); + + // Load Settings + Self.LoadSettings; End; { =============================================================================== } Function TfrmOptions.GetListIndex(List: TStrings; SearchS: String): Integer; Var - I: Integer; + I: Integer; Begin - Result := 0; + Result := 0; - For I := 0 To List.Count - 1 Do Begin - If LowerCase(List[I]) = LowerCase(SearchS) Then Begin - Result := I; - Break; - End; - End; + For I := 0 To List.Count - 1 Do + Begin + If LowerCase(List[I]) = LowerCase(SearchS) Then + Begin + Result := I; + Break; + End; + End; End; - { =============================================================================== } - - Procedure TfrmOptions.LabelGlobalHotkeysLinkClick(Sender: TObject); Begin - CategoryTree.Items[2].Selected := True; - CategoryTreeClick(Nil); + CategoryTree.Items[2].Selected := True; + CategoryTreeClick(Nil); End; Procedure TfrmOptions.LabelHideTimerTimer(Sender: TObject); Begin - LabelStatus.Visible := False; + LabelStatus.Visible := False; End; { =============================================================================== } Procedure TfrmOptions.LoadSettings; Var - Skins: TStringList; - I, Count: Integer; + Skins: TStringList; + I, Count: Integer; Begin - // ========================================================= - // General Settings - If StartWithWindows = 'YES' Then - checkStartUp.Checked := True - Else - checkStartUp.Checked := False; - - If ShowSplash = 'YES' Then - CheckShowSplash.Checked := True - Else - CheckShowSplash.Checked := False; - - If DefaultUIMode = 'TOP BAR' Then - optStartupUIMode_TopBar.Checked := True - Else If DefaultUIMode = 'ICON' Then - optStartupUIMode_Tray.Checked := True - Else - optStartupUIMode_Last.Checked := True; - - If AvroUpdateCheck = 'YES' Then - CheckUpdate.Checked := True - Else - CheckUpdate.Checked := False; - - If TopBarXButton = 'MINIMIZE' Then - optTopBarXButton_Minimize.Checked := True - Else If TopBarXButton = 'EXIT' Then - optTopBarXButton_Close.Checked := True - Else - optTopBarXButton_ShowMenu.Checked := True; - - // =========================================================== - // Interface Settings - If TopBarTransparent = 'YES' Then Begin - checkTopBarTransparent.Checked := True; - Captionl_Transparency.Enabled := True; - TrackBar_Transparency.Enabled := True; - Label_Transparency.Enabled := True; - End - Else Begin - checkTopBarTransparent.Checked := False; - Captionl_Transparency.Enabled := False; - TrackBar_Transparency.Enabled := False; - Label_Transparency.Enabled := False; - End; - - TrackBar_Transparency.Position := StrToInt(TopBarTransparencyLevel); - { Load Skin Names } - Skins := TStringList.Create; - Count := GetFileList(GetAvroDataDir + 'Skin\*.avroskin', Skins); - - { Set skin combo } - comboSkin.Clear; - comboSkin.Items.Add('None'); - - If Count > 0 Then Begin - - For I := 0 To Count - 1 Do Begin - Skins[I] := RemoveExtension(Skins[I]); - End; - - For I := 0 To Skins.Count - 1 Do Begin - comboSkin.Items.Add(Skins[I]); - End; - End; - - If LowerCase(InterfaceSkin) = 'internalskin*' Then - comboSkin.ItemIndex := GetListIndex(comboSkin.Items, 'None') - Else - comboSkin.ItemIndex := GetListIndex(comboSkin.Items, InterfaceSkin); - - Try - { Show skin preview for selected skin } - If comboSkin.Items[comboSkin.ItemIndex] = 'None' Then - GetSkinPreviewPicture('internalskin*', SkinPreviewPic.Picture) - Else - GetSkinPreviewPicture(GetAvroDataDir + 'Skin\' + comboSkin.Items[comboSkin.ItemIndex] + '.avroskin', SkinPreviewPic.Picture); - Except - On E: Exception Do Begin - // Nothing - End; - End; - - Skins.Free; - - // ======================================================= - // Hotkeys Settings - comboFunctionKeys.ItemIndex := GetListIndex(comboFunctionKeys.Items, ModeSwitchKey); - comboFunctionKeys_OutputMode.ItemIndex := GetListIndex(comboFunctionKeys_OutputMode.Items, ToggleOutputModeKey); - comboFunctionKeys_SpellerLauncher.ItemIndex := GetListIndex(comboFunctionKeys_SpellerLauncher.Items, SpellerLauncherKey); - - // ========================================================= - // Locale Changing Option - - If ChangeInputLocale = 'YES' Then Begin - CheckEnableLocaleChange.Checked := True; - End - Else Begin - CheckEnableLocaleChange.Checked := False; - End; - - If PrefferedLocale = 'BANGLADESH' Then - optLocaleBD.Checked := True - Else If PrefferedLocale = 'INDIA' Then - optLocaleIND.Checked := True - Else If PrefferedLocale = 'ASSAMESE' Then - optLocaleAS.Checked := True; - - { For Portable Edition: Required Additional Check } - If IsWinVistaOrLater = True Then Begin - If (IsBangladeshLocaleInstalled = False) Then Begin - optLocaleBD.Enabled := False; - - If (PrefferedLocale = 'BANGLADESH') Then Begin - PrefferedLocale := 'INDIA'; - optLocaleIND.Checked := True; - End; - End; - - If (IsAssameseLocaleInstalled = False) Then Begin - optLocaleAS.Enabled := False; - - If (PrefferedLocale = 'ASSAMESE') Then Begin - PrefferedLocale := 'INDIA'; - optLocaleIND.Checked := True; - End; - - End; - End; - - - // ========================================================= - // Avro Phonetic Options - If PhoneticAutoCorrect = 'YES' Then - CheckAutoCorrect.Checked := True - Else - CheckAutoCorrect.Checked := False; - - If ShowPrevWindow = 'YES' Then - CheckShowPrevWindow.Checked := True - Else - CheckShowPrevWindow.Checked := False; - - If CheckShowPrevWindow.Checked = True Then Begin - Label_PhoneticTypingMode.Enabled := True; - optPhoneticMode_Dict.Enabled := True; - optPhoneticMode_Char.Enabled := True; - optPhoneticMode_OnlyChar.Enabled := True; - CheckRememberCandidate.Enabled := True; - CheckAddNewWords.Enabled := True; - CheckTabBrowsing.Enabled := True; - End - Else Begin - Label_PhoneticTypingMode.Enabled := False; - optPhoneticMode_Dict.Enabled := False; - optPhoneticMode_Char.Enabled := False; - optPhoneticMode_OnlyChar.Enabled := False; - CheckRememberCandidate.Enabled := False; - CheckAddNewWords.Enabled := False; - CheckTabBrowsing.Enabled := False; - End; - - If PhoneticMode = 'DICT' Then - optPhoneticMode_Dict.Checked := True - Else If PhoneticMode = 'CHAR' Then - optPhoneticMode_Char.Checked := True - Else If PhoneticMode = 'ONLYCHAR' Then - optPhoneticMode_OnlyChar.Checked := True - Else - optPhoneticMode_Char.Checked := True; - - If SaveCandidate = 'YES' Then - CheckRememberCandidate.Checked := True - Else - CheckRememberCandidate.Checked := False; - - If AddToPhoneticDict = 'YES' Then - CheckAddNewWords.Checked := True - Else - CheckAddNewWords.Checked := False; - - If TabBrowsing = 'YES' Then - CheckTabBrowsing.Checked := True - Else - CheckTabBrowsing.Checked := False; - - If PipeToDot = 'YES' Then - CheckPipeToDot.Checked := True - Else - CheckPipeToDot.Checked := False; - - If EnableJoNukta = 'YES' Then - CheckEnableJoNukta.Checked := True - Else - CheckEnableJoNukta.Checked := False; - - - // ========================================================= - // Avro Mouse Options - If AvroMouseChangeModeLocale = 'YES' Then - optAvroMouseKeyboardMode_Change.Checked := True - Else - optAvroMouseKeyboardMode_NoChange.Checked := True; - - // ========================================================= - // Fixed Layout Options - If FullOldStyleTyping = 'YES' Then - optTypingStyle_Old.Checked := True - Else - optTypingStyle_Modern.Checked := True; - - If optTypingStyle_Modern.Checked = True Then Begin - chkOldReph.Enabled := True; - chkVowelFormat.Enabled := True; - CheckChandraPosition.Enabled := True; - End - Else Begin - chkOldReph.Enabled := False; - chkVowelFormat.Enabled := False; - CheckChandraPosition.Enabled := False; - End; - - If OldStyleReph = 'YES' Then - chkOldReph.Checked := True - Else - chkOldReph.Checked := False; - - If VowelFormating = 'YES' Then - chkVowelFormat.Checked := True - Else - chkVowelFormat.Checked := False; - - If AutomaticallyFixChandra = 'YES' Then - CheckChandraPosition.Checked := True - Else - CheckChandraPosition.Checked := False; - - If NumPadBangla = 'YES' Then - CheckNumPadBangla.Checked := True - Else - CheckNumPadBangla.Checked := False; - - - // Global output settings - If OutputIsBijoy = 'NO' Then Begin - optOutputUnicode.Checked := True; - optOutputANSI.Checked := False; - End - Else Begin - optOutputANSI.Checked := True; - optOutputUnicode.Checked := False; - End; - - If ShowOutputwarning = 'YES' Then - CheckWarningAnsi.Checked := True - Else - CheckWarningAnsi.Checked := False; + // ========================================================= + // General Settings + If StartWithWindows = 'YES' Then + checkStartUp.Checked := True + Else + checkStartUp.Checked := False; + + If ShowSplash = 'YES' Then + CheckShowSplash.Checked := True + Else + CheckShowSplash.Checked := False; + + If DefaultUIMode = 'TOP BAR' Then + optStartupUIMode_TopBar.Checked := True + Else If DefaultUIMode = 'ICON' Then + optStartupUIMode_Tray.Checked := True + Else + optStartupUIMode_Last.Checked := True; + + If AvroUpdateCheck = 'YES' Then + CheckUpdate.Checked := True + Else + CheckUpdate.Checked := False; + + If TopBarXButton = 'MINIMIZE' Then + optTopBarXButton_Minimize.Checked := True + Else If TopBarXButton = 'EXIT' Then + optTopBarXButton_Close.Checked := True + Else + optTopBarXButton_ShowMenu.Checked := True; + + // =========================================================== + // Interface Settings + If TopBarTransparent = 'YES' Then + Begin + checkTopBarTransparent.Checked := True; + Captionl_Transparency.Enabled := True; + TrackBar_Transparency.Enabled := True; + Label_Transparency.Enabled := True; + End + Else + Begin + checkTopBarTransparent.Checked := False; + Captionl_Transparency.Enabled := False; + TrackBar_Transparency.Enabled := False; + Label_Transparency.Enabled := False; + End; + + TrackBar_Transparency.Position := StrToInt(TopBarTransparencyLevel); + { Load Skin Names } + Skins := TStringList.Create; + Count := GetFileList(GetAvroDataDir + 'Skin\*.avroskin', Skins); + + { Set skin combo } + comboSkin.Clear; + comboSkin.Items.Add('None'); + + If Count > 0 Then + Begin + + For I := 0 To Count - 1 Do + Begin + Skins[I] := RemoveExtension(Skins[I]); + End; + + For I := 0 To Skins.Count - 1 Do + Begin + comboSkin.Items.Add(Skins[I]); + End; + End; + + If LowerCase(InterfaceSkin) = 'internalskin*' Then + comboSkin.ItemIndex := GetListIndex(comboSkin.Items, 'None') + Else + comboSkin.ItemIndex := GetListIndex(comboSkin.Items, InterfaceSkin); + + Try + { Show skin preview for selected skin } + If comboSkin.Items[comboSkin.ItemIndex] = 'None' Then + GetSkinPreviewPicture('internalskin*', SkinPreviewPic.Picture) + Else + GetSkinPreviewPicture(GetAvroDataDir + 'Skin\' + comboSkin.Items + [comboSkin.ItemIndex] + '.avroskin', SkinPreviewPic.Picture); + Except + On E: Exception Do + Begin + // Nothing + End; + End; + + Skins.Free; + + // ======================================================= + // Hotkeys Settings + comboFunctionKeys.ItemIndex := GetListIndex(comboFunctionKeys.Items, + ModeSwitchKey); + comboFunctionKeys_OutputMode.ItemIndex := + GetListIndex(comboFunctionKeys_OutputMode.Items, ToggleOutputModeKey); + comboFunctionKeys_SpellerLauncher.ItemIndex := + GetListIndex(comboFunctionKeys_SpellerLauncher.Items, SpellerLauncherKey); + + // ========================================================= + // Locale Changing Option + + If ChangeInputLocale = 'YES' Then + Begin + CheckEnableLocaleChange.Checked := True; + End + Else + Begin + CheckEnableLocaleChange.Checked := False; + End; + + If PrefferedLocale = 'BANGLADESH' Then + optLocaleBD.Checked := True + Else If PrefferedLocale = 'INDIA' Then + optLocaleIND.Checked := True + Else If PrefferedLocale = 'ASSAMESE' Then + optLocaleAS.Checked := True; + + { For Portable Edition: Required Additional Check } + If IsWinVistaOrLater = True Then + Begin + If (IsBangladeshLocaleInstalled = False) Then + Begin + optLocaleBD.Enabled := False; + + If (PrefferedLocale = 'BANGLADESH') Then + Begin + PrefferedLocale := 'INDIA'; + optLocaleIND.Checked := True; + End; + End; + + If (IsAssameseLocaleInstalled = False) Then + Begin + optLocaleAS.Enabled := False; + + If (PrefferedLocale = 'ASSAMESE') Then + Begin + PrefferedLocale := 'INDIA'; + optLocaleIND.Checked := True; + End; + + End; + End; + + // ========================================================= + // Avro Phonetic Options + If PhoneticAutoCorrect = 'YES' Then + CheckAutoCorrect.Checked := True + Else + CheckAutoCorrect.Checked := False; + + If ShowPrevWindow = 'YES' Then + CheckShowPrevWindow.Checked := True + Else + CheckShowPrevWindow.Checked := False; + + If CheckShowPrevWindow.Checked = True Then + Begin + Label_PhoneticTypingMode.Enabled := True; + optPhoneticMode_Dict.Enabled := True; + optPhoneticMode_Char.Enabled := True; + optPhoneticMode_OnlyChar.Enabled := True; + CheckRememberCandidate.Enabled := True; + CheckAddNewWords.Enabled := True; + CheckTabBrowsing.Enabled := True; + End + Else + Begin + Label_PhoneticTypingMode.Enabled := False; + optPhoneticMode_Dict.Enabled := False; + optPhoneticMode_Char.Enabled := False; + optPhoneticMode_OnlyChar.Enabled := False; + CheckRememberCandidate.Enabled := False; + CheckAddNewWords.Enabled := False; + CheckTabBrowsing.Enabled := False; + End; + + If PhoneticMode = 'DICT' Then + optPhoneticMode_Dict.Checked := True + Else If PhoneticMode = 'CHAR' Then + optPhoneticMode_Char.Checked := True + Else If PhoneticMode = 'ONLYCHAR' Then + optPhoneticMode_OnlyChar.Checked := True + Else + optPhoneticMode_Char.Checked := True; + + If SaveCandidate = 'YES' Then + CheckRememberCandidate.Checked := True + Else + CheckRememberCandidate.Checked := False; + + If AddToPhoneticDict = 'YES' Then + CheckAddNewWords.Checked := True + Else + CheckAddNewWords.Checked := False; + + If TabBrowsing = 'YES' Then + CheckTabBrowsing.Checked := True + Else + CheckTabBrowsing.Checked := False; + + If PipeToDot = 'YES' Then + CheckPipeToDot.Checked := True + Else + CheckPipeToDot.Checked := False; + + If EnableJoNukta = 'YES' Then + CheckEnableJoNukta.Checked := True + Else + CheckEnableJoNukta.Checked := False; + + // ========================================================= + // Avro Mouse Options + If AvroMouseChangeModeLocale = 'YES' Then + optAvroMouseKeyboardMode_Change.Checked := True + Else + optAvroMouseKeyboardMode_NoChange.Checked := True; + + // ========================================================= + // Fixed Layout Options + If FullOldStyleTyping = 'YES' Then + optTypingStyle_Old.Checked := True + Else + optTypingStyle_Modern.Checked := True; + + If optTypingStyle_Modern.Checked = True Then + Begin + chkOldReph.Enabled := True; + chkVowelFormat.Enabled := True; + CheckChandraPosition.Enabled := True; + End + Else + Begin + chkOldReph.Enabled := False; + chkVowelFormat.Enabled := False; + CheckChandraPosition.Enabled := False; + End; + + If OldStyleReph = 'YES' Then + chkOldReph.Checked := True + Else + chkOldReph.Checked := False; + + If VowelFormating = 'YES' Then + chkVowelFormat.Checked := True + Else + chkVowelFormat.Checked := False; + + If AutomaticallyFixChandra = 'YES' Then + CheckChandraPosition.Checked := True + Else + CheckChandraPosition.Checked := False; + + If NumPadBangla = 'YES' Then + CheckNumPadBangla.Checked := True + Else + CheckNumPadBangla.Checked := False; + + // Global output settings + If OutputIsBijoy = 'NO' Then + Begin + optOutputUnicode.Checked := True; + optOutputANSI.Checked := False; + End + Else + Begin + optOutputANSI.Checked := True; + optOutputUnicode.Checked := False; + End; + + If ShowOutputwarning = 'YES' Then + CheckWarningAnsi.Checked := True + Else + CheckWarningAnsi.Checked := False; End; { =============================================================================== } - -Procedure TfrmOptions.optOutputANSIMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +Procedure TfrmOptions.optOutputANSIMouseUp(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); Begin - If ShowOutputwarning <> 'NO' Then Begin - CheckCreateForm(TfrmEncodingWarning, frmEncodingWarning, 'frmEncodingWarning'); - frmEncodingWarning.ShowModal; - - - If OutputIsBijoy = 'NO' Then Begin - optOutputUnicode.Checked := True; - optOutputANSI.Checked := False; - End - Else Begin - optOutputANSI.Checked := True; - optOutputUnicode.Checked := False; - End; - - If ShowOutputwarning = 'YES' Then - CheckWarningAnsi.Checked := True - Else - CheckWarningAnsi.Checked := False; - End; + If ShowOutputwarning <> 'NO' Then + Begin + CheckCreateForm(TfrmEncodingWarning, frmEncodingWarning, + 'frmEncodingWarning'); + frmEncodingWarning.ShowModal; + + If OutputIsBijoy = 'NO' Then + Begin + optOutputUnicode.Checked := True; + optOutputANSI.Checked := False; + End + Else + Begin + optOutputANSI.Checked := True; + optOutputUnicode.Checked := False; + End; + + If ShowOutputwarning = 'YES' Then + CheckWarningAnsi.Checked := True + Else + CheckWarningAnsi.Checked := False; + End; End; { =============================================================================== } Procedure TfrmOptions.optTypingStyle_ModernClick(Sender: TObject); Begin - If optTypingStyle_Modern.Checked = True Then Begin - chkOldReph.Enabled := True; - chkVowelFormat.Enabled := True; - CheckChandraPosition.Enabled := True; - End - Else Begin - chkOldReph.Enabled := False; - chkVowelFormat.Enabled := False; - CheckChandraPosition.Enabled := False; - End; + If optTypingStyle_Modern.Checked = True Then + Begin + chkOldReph.Enabled := True; + chkVowelFormat.Enabled := True; + CheckChandraPosition.Enabled := True; + End + Else + Begin + chkOldReph.Enabled := False; + chkVowelFormat.Enabled := False; + CheckChandraPosition.Enabled := False; + End; End; { =============================================================================== } Procedure TfrmOptions.SaveSettings; Begin - // ========================================================= - // General Settings - If checkStartUp.Checked = True Then - StartWithWindows := 'YES' - Else - StartWithWindows := 'NO'; - - If CheckShowSplash.Checked = True Then - ShowSplash := 'YES' - Else - ShowSplash := 'NO'; - - If optStartupUIMode_TopBar.Checked = True Then - DefaultUIMode := 'TOP BAR' - Else If optStartupUIMode_Tray.Checked = True Then - DefaultUIMode := 'ICON' - Else - DefaultUIMode := 'LASTUI'; - - If CheckUpdate.Checked = True Then - AvroUpdateCheck := 'YES' - Else - AvroUpdateCheck := 'NO'; - - If optTopBarXButton_Minimize.Checked = True Then - TopBarXButton := 'MINIMIZE' - Else If optTopBarXButton_Close.Checked = True Then - TopBarXButton := 'EXIT' - Else - TopBarXButton := 'SHOW MENU'; - - - - // =========================================================== - // Interface Settings - If checkTopBarTransparent.Checked = True Then - TopBarTransparent := 'YES' - Else - TopBarTransparent := 'NO'; - - TopBarTransparencyLevel := IntToStr(TrackBar_Transparency.Position); - - If comboSkin.Items[comboSkin.ItemIndex] = 'None' Then - InterfaceSkin := 'internalskin*' - Else - InterfaceSkin := comboSkin.Items[comboSkin.ItemIndex]; - - - - // ======================================================= - // Hotkeys Settings - - ModeSwitchKey := uppercase(comboFunctionKeys.Items[comboFunctionKeys.ItemIndex]); - ToggleOutputModeKey := uppercase(comboFunctionKeys_OutputMode.Items[comboFunctionKeys_OutputMode.ItemIndex]); - SpellerLauncherKey := uppercase(comboFunctionKeys_SpellerLauncher.Items[comboFunctionKeys_SpellerLauncher.ItemIndex]); - - - // ========================================================= - // Locale Changing Option - - If CheckEnableLocaleChange.Checked = True Then - ChangeInputLocale := 'YES' - Else - ChangeInputLocale := 'NO'; - - If optLocaleBD.Checked = True Then - PrefferedLocale := 'BANGLADESH' - Else If optLocaleIND.Checked = True Then - PrefferedLocale := 'INDIA' - Else If optLocaleAS.Checked = True Then - PrefferedLocale := 'ASSAMESE'; - - // ========================================================= - // Avro Phonetic Options - If CheckAutoCorrect.Checked = True Then - PhoneticAutoCorrect := 'YES' - Else - PhoneticAutoCorrect := 'NO'; - - If CheckShowPrevWindow.Checked = True Then - ShowPrevWindow := 'YES' - Else - ShowPrevWindow := 'NO'; - - - If optPhoneticMode_Dict.Checked = True Then - PhoneticMode := 'DICT' - Else If optPhoneticMode_Char.Checked = True Then - PhoneticMode := 'CHAR' - Else If optPhoneticMode_OnlyChar.Checked = True Then - PhoneticMode := 'ONLYCHAR' - Else - PhoneticMode := 'CHAR'; - - If CheckRememberCandidate.Checked = True Then - SaveCandidate := 'YES' - Else - SaveCandidate := 'NO'; - - If CheckAddNewWords.Checked = True Then - AddToPhoneticDict := 'YES' - Else - AddToPhoneticDict := 'NO'; - - If CheckTabBrowsing.Checked = True Then - TabBrowsing := 'YES' - Else - TabBrowsing := 'NO'; - - If CheckPipeToDot.Checked = True Then - PipeToDot := 'YES' - Else - PipeToDot := 'NO'; - - If CheckEnableJoNukta.Checked = True Then - EnableJoNukta := 'YES' - Else - EnableJoNukta := 'NO'; - - - - // ========================================================= - // Avro Mouse Options - If optAvroMouseKeyboardMode_Change.Checked = True Then - AvroMouseChangeModeLocale := 'YES' - Else - AvroMouseChangeModeLocale := 'NO'; - - // ========================================================= - // Fixed Layout Options - If optTypingStyle_Old.Checked = True Then - FullOldStyleTyping := 'YES' - Else - FullOldStyleTyping := 'NO'; - - If chkOldReph.Checked = True Then - OldStyleReph := 'YES' - Else - OldStyleReph := 'NO'; - - If chkVowelFormat.Checked = True Then - VowelFormating := 'YES' - Else - VowelFormating := 'NO'; - - If CheckChandraPosition.Checked = True Then - AutomaticallyFixChandra := 'YES' - Else - AutomaticallyFixChandra := 'NO'; - - If CheckNumPadBangla.Checked = True Then - NumPadBangla := 'YES' - Else - NumPadBangla := 'NO'; - - - // Global output settings - If optOutputUnicode.Checked = True Then - OutputIsBijoy := 'NO' - Else - OutputIsBijoy := 'YES'; - - If CheckWarningAnsi.Checked = True Then - ShowOutputwarning := 'YES' - Else - ShowOutputwarning := 'NO'; - - uRegistrySettings.SaveSettings; + // ========================================================= + // General Settings + If checkStartUp.Checked = True Then + StartWithWindows := 'YES' + Else + StartWithWindows := 'NO'; + + If CheckShowSplash.Checked = True Then + ShowSplash := 'YES' + Else + ShowSplash := 'NO'; + + If optStartupUIMode_TopBar.Checked = True Then + DefaultUIMode := 'TOP BAR' + Else If optStartupUIMode_Tray.Checked = True Then + DefaultUIMode := 'ICON' + Else + DefaultUIMode := 'LASTUI'; + + If CheckUpdate.Checked = True Then + AvroUpdateCheck := 'YES' + Else + AvroUpdateCheck := 'NO'; + + If optTopBarXButton_Minimize.Checked = True Then + TopBarXButton := 'MINIMIZE' + Else If optTopBarXButton_Close.Checked = True Then + TopBarXButton := 'EXIT' + Else + TopBarXButton := 'SHOW MENU'; + + // =========================================================== + // Interface Settings + If checkTopBarTransparent.Checked = True Then + TopBarTransparent := 'YES' + Else + TopBarTransparent := 'NO'; + + TopBarTransparencyLevel := IntToStr(TrackBar_Transparency.Position); + + If comboSkin.Items[comboSkin.ItemIndex] = 'None' Then + InterfaceSkin := 'internalskin*' + Else + InterfaceSkin := comboSkin.Items[comboSkin.ItemIndex]; + + + + // ======================================================= + // Hotkeys Settings + + ModeSwitchKey := uppercase(comboFunctionKeys.Items + [comboFunctionKeys.ItemIndex]); + ToggleOutputModeKey := uppercase(comboFunctionKeys_OutputMode.Items + [comboFunctionKeys_OutputMode.ItemIndex]); + SpellerLauncherKey := uppercase(comboFunctionKeys_SpellerLauncher.Items + [comboFunctionKeys_SpellerLauncher.ItemIndex]); + + + // ========================================================= + // Locale Changing Option + + If CheckEnableLocaleChange.Checked = True Then + ChangeInputLocale := 'YES' + Else + ChangeInputLocale := 'NO'; + + If optLocaleBD.Checked = True Then + PrefferedLocale := 'BANGLADESH' + Else If optLocaleIND.Checked = True Then + PrefferedLocale := 'INDIA' + Else If optLocaleAS.Checked = True Then + PrefferedLocale := 'ASSAMESE'; + + // ========================================================= + // Avro Phonetic Options + If CheckAutoCorrect.Checked = True Then + PhoneticAutoCorrect := 'YES' + Else + PhoneticAutoCorrect := 'NO'; + + If CheckShowPrevWindow.Checked = True Then + ShowPrevWindow := 'YES' + Else + ShowPrevWindow := 'NO'; + + If optPhoneticMode_Dict.Checked = True Then + PhoneticMode := 'DICT' + Else If optPhoneticMode_Char.Checked = True Then + PhoneticMode := 'CHAR' + Else If optPhoneticMode_OnlyChar.Checked = True Then + PhoneticMode := 'ONLYCHAR' + Else + PhoneticMode := 'CHAR'; + + If CheckRememberCandidate.Checked = True Then + SaveCandidate := 'YES' + Else + SaveCandidate := 'NO'; + + If CheckAddNewWords.Checked = True Then + AddToPhoneticDict := 'YES' + Else + AddToPhoneticDict := 'NO'; + + If CheckTabBrowsing.Checked = True Then + TabBrowsing := 'YES' + Else + TabBrowsing := 'NO'; + + If CheckPipeToDot.Checked = True Then + PipeToDot := 'YES' + Else + PipeToDot := 'NO'; + + If CheckEnableJoNukta.Checked = True Then + EnableJoNukta := 'YES' + Else + EnableJoNukta := 'NO'; + + // ========================================================= + // Avro Mouse Options + If optAvroMouseKeyboardMode_Change.Checked = True Then + AvroMouseChangeModeLocale := 'YES' + Else + AvroMouseChangeModeLocale := 'NO'; + + // ========================================================= + // Fixed Layout Options + If optTypingStyle_Old.Checked = True Then + FullOldStyleTyping := 'YES' + Else + FullOldStyleTyping := 'NO'; + + If chkOldReph.Checked = True Then + OldStyleReph := 'YES' + Else + OldStyleReph := 'NO'; + + If chkVowelFormat.Checked = True Then + VowelFormating := 'YES' + Else + VowelFormating := 'NO'; + + If CheckChandraPosition.Checked = True Then + AutomaticallyFixChandra := 'YES' + Else + AutomaticallyFixChandra := 'NO'; + + If CheckNumPadBangla.Checked = True Then + NumPadBangla := 'YES' + Else + NumPadBangla := 'NO'; + + // Global output settings + If optOutputUnicode.Checked = True Then + OutputIsBijoy := 'NO' + Else + OutputIsBijoy := 'YES'; + + If CheckWarningAnsi.Checked = True Then + ShowOutputwarning := 'YES' + Else + ShowOutputwarning := 'NO'; + + uRegistrySettings.SaveSettings; End; { =============================================================================== } Procedure TfrmOptions.TrackBar_TransparencyChange(Sender: TObject); Begin - Label_Transparency.Caption := IntToStr(TrackBar_Transparency.Position); + Label_Transparency.Caption := IntToStr(TrackBar_Transparency.Position); End; { =============================================================================== } diff --git a/Keyboard and Spell checker/Forms/ufrmPrevW.dfm b/Keyboard and Spell checker/Forms/ufrmPrevW.dfm index 12ca636..6f2137a 100644 --- a/Keyboard and Spell checker/Forms/ufrmPrevW.dfm +++ b/Keyboard and Spell checker/Forms/ufrmPrevW.dfm @@ -266,8 +266,8 @@ object frmPrevW: TfrmPrevW object ImgButtonOver: TImage Left = 8 Top = 132 - Width = 32 - Height = 32 + Width = 16 + Height = 16 Margins.Left = 0 Margins.Top = 0 Margins.Right = 0 @@ -324,8 +324,8 @@ object frmPrevW: TfrmPrevW object imgPinOpen: TImage Left = 32 Top = 160 - Width = 32 - Height = 32 + Width = 16 + Height = 16 Margins.Left = 0 Margins.Top = 0 Margins.Right = 0 @@ -382,8 +382,8 @@ object frmPrevW: TfrmPrevW object imgPinClose: TImage Left = 8 Top = 160 - Width = 32 - Height = 32 + Width = 16 + Height = 16 Margins.Left = 0 Margins.Top = 0 Margins.Right = 0 @@ -559,8 +559,8 @@ object frmPrevW: TfrmPrevW object imgPin: TImage Left = 199 Top = 124 - Width = 32 - Height = 32 + Width = 16 + Height = 16 Margins.Left = 0 Margins.Top = 0 Margins.Right = 0 diff --git a/Keyboard and Spell checker/Forms/ufrmPrevW.pas b/Keyboard and Spell checker/Forms/ufrmPrevW.pas index e1db1b1..b792502 100644 --- a/Keyboard and Spell checker/Forms/ufrmPrevW.pas +++ b/Keyboard and Spell checker/Forms/ufrmPrevW.pas @@ -1,32 +1,31 @@ { - ============================================================================= - ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + ============================================================================= + ***************************************************************************** + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. - ***************************************************************************** - ============================================================================= + ***************************************************************************** + ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - { COMPLETE TRANSFERING EXCEPT MENU } Unit ufrmPrevW; @@ -34,627 +33,670 @@ Interface Uses - Windows, - Messages, - SysUtils, - Variants, - Classes, - Graphics, - Controls, - Forms, - Dialogs, - GIFImg, - ExtCtrls, - StdCtrls, - Buttons, - Generics.Collections, - StrUtils, - Menus; + Windows, + Messages, + SysUtils, + Variants, + Classes, + Graphics, + Controls, + Forms, + Dialogs, + GIFImg, + ExtCtrls, + StdCtrls, + Buttons, + Generics.Collections, + StrUtils, + Menus; type - TFollow = record - Following: Boolean; - PosX: Integer; - PosY: Integer; - end; + TFollow = record + Following: Boolean; + PosX: Integer; + PosY: Integer; + end; Type - TfrmPrevW = Class(TForm) - Shape1: TShape; - ImgTitleBar: TImage; - imgPin: TImage; - lblCaption: TLabel; - Button: TImage; - ImgButtonUp: TImage; - ImgButtonOver: TImage; - imgPinOpen: TImage; - imgPinClose: TImage; - FocusSolver: TTimer; - lblPreview: TLabel; - PopupMenu: TPopupMenu; - ransparency1: TMenuItem; - Notransparency1: TMenuItem; - N101: TMenuItem; - N201: TMenuItem; - N301: TMenuItem; - N401: TMenuItem; - N501: TMenuItem; - N601: TMenuItem; - ShowPreviewWindow1: TMenuItem; - ShowPreviewWindow2: TMenuItem; - List: TListBox; - Procedure FormCreate(Sender: TObject); - Procedure ButtonMouseEnter(Sender: TObject); - Procedure ButtonMouseLeave(Sender: TObject); - Procedure FocusSolverTimer(Sender: TObject); - Procedure FormClose(Sender: TObject; Var Action: TCloseAction); - Procedure imgPinClick(Sender: TObject); - Procedure ImgTitleBarMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); - Procedure lblCaptionMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); - Procedure ImgTitleBarMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - Procedure ImgTitleBarMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - Procedure lblCaptionMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - Procedure lblCaptionMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - Procedure ButtonMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - Procedure ListClick(Sender: TObject); - Private - { Private declarations } - FollowDict: TDictionary; - FollowingCaretinThisWindow: Boolean; - oldx, oldy, mf: Integer; - MouseDown: Boolean; - Function FindCaretPosWindow(Var Position: TPoint; Var HeightCaret: Integer): Integer; - Function DecideFollowCaret(Var pX, pY: Integer; Var DontShow: Boolean): Boolean; - Procedure moveMe; - Procedure MoveWindow(MeLEFT, MeTOP, CaretHeight: Integer); - Procedure UpdateWindowPosData(NoFUpdate: Boolean = True; Nofollow: Boolean = False); - Procedure MoveForm(xx, yy: Integer); - Public - { Public declarations } - PreviewWVisible: Boolean; - Procedure UpdateMe(Const EnglishT: String); - Procedure MakeMeHide; - Procedure ShowHideList; - Procedure SelectFirstItem; - Procedure SelectNItem(Const ItemNumber: Integer); - Procedure SelectItem(Const Item: String); - Procedure SelectNextItem; - Procedure SelectPrevItem; - Protected - Procedure CreateParams(Var Params: TCreateParams); Override; - - End; + TfrmPrevW = Class(TForm) + Shape1: TShape; + ImgTitleBar: TImage; + imgPin: TImage; + lblCaption: TLabel; + Button: TImage; + ImgButtonUp: TImage; + ImgButtonOver: TImage; + imgPinOpen: TImage; + imgPinClose: TImage; + FocusSolver: TTimer; + lblPreview: TLabel; + PopupMenu: TPopupMenu; + ransparency1: TMenuItem; + Notransparency1: TMenuItem; + N101: TMenuItem; + N201: TMenuItem; + N301: TMenuItem; + N401: TMenuItem; + N501: TMenuItem; + N601: TMenuItem; + ShowPreviewWindow1: TMenuItem; + ShowPreviewWindow2: TMenuItem; + List: TListBox; + Procedure FormCreate(Sender: TObject); + Procedure ButtonMouseEnter(Sender: TObject); + Procedure ButtonMouseLeave(Sender: TObject); + Procedure FocusSolverTimer(Sender: TObject); + Procedure FormClose(Sender: TObject; Var Action: TCloseAction); + Procedure imgPinClick(Sender: TObject); + Procedure ImgTitleBarMouseMove(Sender: TObject; Shift: TShiftState; + X, Y: Integer); + Procedure lblCaptionMouseMove(Sender: TObject; Shift: TShiftState; + X, Y: Integer); + Procedure ImgTitleBarMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + Procedure ImgTitleBarMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + Procedure lblCaptionMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + Procedure lblCaptionMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + Procedure ButtonMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + Procedure ListClick(Sender: TObject); + Private + { Private declarations } + FollowDict: TDictionary; + FollowingCaretinThisWindow: Boolean; + oldx, oldy, mf: Integer; + MouseDown: Boolean; + Function FindCaretPosWindow(Var Position: TPoint; + Var HeightCaret: Integer): Integer; + Function DecideFollowCaret(Var pX, pY: Integer; + Var DontShow: Boolean): Boolean; + Procedure moveMe; + Procedure MoveWindow(MeLEFT, MeTOP, CaretHeight: Integer); + Procedure UpdateWindowPosData(NoFUpdate: Boolean = True; + Nofollow: Boolean = False); + Procedure MoveForm(xx, yy: Integer); + Public + { Public declarations } + PreviewWVisible: Boolean; + Procedure UpdateMe(Const EnglishT: String); + Procedure MakeMeHide; + Procedure ShowHideList; + Procedure SelectFirstItem; + Procedure SelectNItem(Const ItemNumber: Integer); + Procedure SelectItem(Const Item: String); + Procedure SelectNextItem; + Procedure SelectPrevItem; + Protected + Procedure CreateParams(Var Params: TCreateParams); Override; + + End; Var - frmPrevW: TfrmPrevW; + frmPrevW: TfrmPrevW; Implementation {$R *.dfm} Uses - uWindowHandlers, - uTopBar, - uForm1, - BanglaChars; + uWindowHandlers, + uTopBar, + uForm1, + BanglaChars; Procedure TfrmPrevW.ButtonMouseEnter(Sender: TObject); Begin - Button.Picture := ImgButtonOver.Picture; + Button.Picture := ImgButtonOver.Picture; End; Procedure TfrmPrevW.ButtonMouseLeave(Sender: TObject); Begin - Button.Picture := ImgButtonUp.Picture; + Button.Picture := ImgButtonUp.Picture; End; -Procedure TfrmPrevW.ButtonMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +Procedure TfrmPrevW.ButtonMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); Begin - PopupMenu.Popup(Self.Left + (Sender As TImage).Left, Self.Top + (Sender As TImage).Top + (Sender As TImage).Height); + PopupMenu.Popup(Self.Left + (Sender As TImage).Left, + Self.Top + (Sender As TImage).Top + (Sender As TImage).Height); End; Procedure TfrmPrevW.CreateParams(Var Params: TCreateParams); Begin - Inherited CreateParams(Params); - Params.ExStyle := Params.ExStyle Or WS_EX_TOPMOST Or WS_EX_NOACTIVATE or WS_EX_TOOLWINDOW; - Params.WndParent := GetDesktopwindow; + Inherited CreateParams(Params); + Params.ExStyle := Params.ExStyle Or WS_EX_TOPMOST Or WS_EX_NOACTIVATE or + WS_EX_TOOLWINDOW; + Params.WndParent := GetDesktopwindow; End; -Function TfrmPrevW.DecideFollowCaret(Var pX, pY: Integer; Var DontShow: Boolean): Boolean; +Function TfrmPrevW.DecideFollowCaret(Var pX, pY: Integer; + Var DontShow: Boolean): Boolean; Var - hforewnd: HWND; - Follow: TFollow; + hforewnd: HWND; + Follow: TFollow; Begin - - hforewnd := GetForegroundWindow; - - If (hforewnd = 0) Or (hforewnd = Self.Handle) Then Begin // Bypass a nasty bug I have faced - DontShow := True; - Result := False; - Exit; - End; - - if not FollowDict.TryGetValue(hforewnd, Follow) then begin - DontShow := False; - Result := True; - Exit; - End - Else Begin - If not Follow.Following Then Begin - pX := Follow.PosX; - pY := Follow.PosY; - Result := False; - End - Else Begin - Result := True; - End; - End; + hforewnd := GetForegroundWindow; + + If (hforewnd = 0) Or (hforewnd = Self.Handle) Then + Begin // Bypass a nasty bug I have faced + DontShow := True; + Result := False; + Exit; + End; + + if not FollowDict.TryGetValue(hforewnd, Follow) then + begin + DontShow := False; + Result := True; + Exit; + End + Else + Begin + If not Follow.Following Then + Begin + pX := Follow.PosX; + pY := Follow.PosY; + Result := False; + End + Else + Begin + Result := True; + End; + End; End; {$HINTS Off} -Function TfrmPrevW.FindCaretPosWindow(Var Position: TPoint; Var HeightCaret: Integer): Integer; +Function TfrmPrevW.FindCaretPosWindow(Var Position: TPoint; + Var HeightCaret: Integer): Integer; Var - hwndFG, hwndFoc: HWND; - TID, mID: DWORD; - Ret: Boolean; - RetInfo: TGUIThreadInfo; + hwndFG, hwndFoc: HWND; + TID, mID: DWORD; + Ret: Boolean; + RetInfo: TGUIThreadInfo; Begin - // Initialize variables - RetInfo.cbSize := Sizeof(RetInfo); - Result := 0; - Ret := False; - - Ret := GetGUIThreadInfo(GetWindowThreadProcessId(GetForegroundWindow(), Nil), RetInfo); - If Ret <> False Then - HeightCaret := RetInfo.rcCaret.Top - RetInfo.rcCaret.Bottom; - hwndFG := GetForegroundWindow; - If (hwndFG <> 0) And (hwndFG <> Self.Handle) Then Begin - TID := GetWindowThreadProcessId(hwndFG, Nil); - mID := GetCurrentThreadid; - If TID <> mID Then Begin - If AttachThreadInput(mID, TID, True) <> False Then Begin - hwndFoc := GetFocus(); - If hwndFoc <> 0 Then Begin - If GetCaretPos(Position) <> False Then Begin - Windows.ClientToScreen(hwndFoc, Position); - Result := hwndFoc - End; - End; - AttachThreadInput(mID, TID, False); - { DONE : Experimental disable. Check carefully } - ForceForegroundWindow(hwndFG); - MakeNeverActiveWindow(Self.Handle); - End; - End - Else Begin - hwndFoc := GetFocus(); - If hwndFoc <> 0 Then Begin - If GetCaretPos(Position) <> False Then Begin - Windows.ClientToScreen(hwndFoc, Position); - Result := hwndFoc - End; - End; - End; - End; + // Initialize variables + RetInfo.cbSize := Sizeof(RetInfo); + Result := 0; + Ret := False; + + Ret := GetGUIThreadInfo(GetWindowThreadProcessId(GetForegroundWindow(), + Nil), RetInfo); + If Ret <> False Then + HeightCaret := RetInfo.rcCaret.Top - RetInfo.rcCaret.Bottom; + hwndFG := GetForegroundWindow; + If (hwndFG <> 0) And (hwndFG <> Self.Handle) Then + Begin + TID := GetWindowThreadProcessId(hwndFG, Nil); + mID := GetCurrentThreadid; + If TID <> mID Then + Begin + If AttachThreadInput(mID, TID, True) <> False Then + Begin + hwndFoc := GetFocus(); + If hwndFoc <> 0 Then + Begin + If GetCaretPos(Position) <> False Then + Begin + Windows.ClientToScreen(hwndFoc, Position); + Result := hwndFoc + End; + End; + AttachThreadInput(mID, TID, False); + { DONE : Experimental disable. Check carefully } + ForceForegroundWindow(hwndFG); + MakeNeverActiveWindow(Self.Handle); + End; + End + Else + Begin + hwndFoc := GetFocus(); + If hwndFoc <> 0 Then + Begin + If GetCaretPos(Position) <> False Then + Begin + Windows.ClientToScreen(hwndFoc, Position); + Result := hwndFoc + End; + End; + End; + End; End; {$HINTS On} Procedure TfrmPrevW.FocusSolverTimer(Sender: TObject); Var - hforewnd: HWND; - TID, mID: DWORD; - WndCaption, WndClass: String; + hforewnd: HWND; + TID, mID: DWORD; + WndCaption, WndClass: String; Begin - hforewnd := GetForegroundWindow; - If (hforewnd = 0) Or (hforewnd = Self.Handle) Then - Exit; - TID := GetWindowThreadProcessId(hforewnd, Nil); - mID := GetCurrentThreadid; - If TID = mID Then - Exit; - - WndCaption := Trim(GetWindowCaption(hforewnd)); - WndClass := Trim(GetWindowClassName(hforewnd)); - - If WndCaption = '' Then - Exit; - If ContainsText(WndCaption, 'Start Menu') Then - Exit; - If ContainsText(WndCaption, 'Program Manager') Then - Exit; - If ContainsText(WndClass, 'Progman') Then - Exit; - If ContainsText(WndClass, 'Shell_TrayWnd') Then - Exit; - If ContainsText(WndClass, 'Dv2ControlHost') Then - Exit; - - Self.Show; - FollowingCaretinThisWindow := True; - moveMe; - Self.AlphaBlendValue := 255; - Self.AlphaBlendValue := 0; - Application.ProcessMessages; - FocusSolver.Enabled := False; + hforewnd := GetForegroundWindow; + If (hforewnd = 0) Or (hforewnd = Self.Handle) Then + Exit; + TID := GetWindowThreadProcessId(hforewnd, Nil); + mID := GetCurrentThreadid; + If TID = mID Then + Exit; + + WndCaption := Trim(GetWindowCaption(hforewnd)); + WndClass := Trim(GetWindowClassName(hforewnd)); + + If WndCaption = '' Then + Exit; + If ContainsText(WndCaption, 'Start Menu') Then + Exit; + If ContainsText(WndCaption, 'Program Manager') Then + Exit; + If ContainsText(WndClass, 'Progman') Then + Exit; + If ContainsText(WndClass, 'Shell_TrayWnd') Then + Exit; + If ContainsText(WndClass, 'Dv2ControlHost') Then + Exit; + + Self.Show; + FollowingCaretinThisWindow := True; + moveMe; + Self.AlphaBlendValue := 255; + Self.AlphaBlendValue := 0; + Application.ProcessMessages; + FocusSolver.Enabled := False; End; Procedure TfrmPrevW.FormClose(Sender: TObject; Var Action: TCloseAction); Begin - Action := caFree; - FreeAndNil(FollowDict); - frmPrevW := Nil; + Action := caFree; + FreeAndNil(FollowDict); + frmPrevW := Nil; End; Procedure TfrmPrevW.FormCreate(Sender: TObject); Begin - Shape1.Top := 0; - Shape1.Left := 0; - - ShowHideList; + Shape1.Top := 0; + Shape1.Left := 0; - Height := Shape1.Height; - Width := Shape1.Width; + ShowHideList; + Height := Shape1.Height; + Width := Shape1.Width; - ImgTitleBar.Top := Shape1.Top + 1; - ImgTitleBar.Left := Shape1.Left + 1; - ImgTitleBar.Width := Shape1.Width - 2; + ImgTitleBar.Top := Shape1.Top + 1; + ImgTitleBar.Left := Shape1.Left + 1; + ImgTitleBar.Width := Shape1.Width - 2; - Button.Top := ImgTitleBar.Top + 4; - Button.Left := ImgTitleBar.Left + 4; + Button.Top := ImgTitleBar.Top + 4; + Button.Left := ImgTitleBar.Left + 4; - lblCaption.Top := Button.Top; - lblCaption.Left := Button.Left + Button.Width + 4; + lblCaption.Top := Button.Top; + lblCaption.Left := Button.Left + Button.Width + 4; - imgPin.Top := Button.Top; - imgPin.Left := Width - 30; + imgPin.Top := Button.Top; + imgPin.Left := Width - 30; - lblPreview.Top := ImgTitleBar.Top + ImgTitleBar.Height + 2; - lblPreview.Left := ImgTitleBar.Left + 4; - lblPreview.Caption := ''; + lblPreview.Top := ImgTitleBar.Top + ImgTitleBar.Height + 2; + lblPreview.Left := ImgTitleBar.Left + 4; + lblPreview.Caption := ''; - FollowDict := TDictionary.Create; + FollowDict := TDictionary.Create; + oldx := 0; + oldy := 0; + mf := 0; + MouseDown := False; - oldx := 0; - oldy := 0; - mf := 0; - MouseDown := False; - - FocusSolver.Enabled := True; - PreviewWVisible := False; + FocusSolver.Enabled := True; + PreviewWVisible := False; End; Procedure TfrmPrevW.imgPinClick(Sender: TObject); Begin - If FollowingCaretinThisWindow = True Then - UpdateWindowPosData(False, True) - Else - UpdateWindowPosData(False, False); + If FollowingCaretinThisWindow = True Then + UpdateWindowPosData(False, True) + Else + UpdateWindowPosData(False, False); End; - -Procedure TfrmPrevW.ImgTitleBarMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +Procedure TfrmPrevW.ImgTitleBarMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); Begin - MouseDown := True; + MouseDown := True; End; -Procedure TfrmPrevW.ImgTitleBarMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); +Procedure TfrmPrevW.ImgTitleBarMouseMove(Sender: TObject; Shift: TShiftState; + X, Y: Integer); Begin - MoveForm(X, Y); + MoveForm(X, Y); End; - - -Procedure TfrmPrevW.ImgTitleBarMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +Procedure TfrmPrevW.ImgTitleBarMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); Begin - MouseDown := False; + MouseDown := False; End; -Procedure TfrmPrevW.lblCaptionMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +Procedure TfrmPrevW.lblCaptionMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); Begin - MouseDown := True; + MouseDown := True; End; -Procedure TfrmPrevW.lblCaptionMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); +Procedure TfrmPrevW.lblCaptionMouseMove(Sender: TObject; Shift: TShiftState; + X, Y: Integer); Begin - MoveForm(X, Y); + MoveForm(X, Y); End; -Procedure TfrmPrevW.lblCaptionMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +Procedure TfrmPrevW.lblCaptionMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); Begin - MouseDown := False; + MouseDown := False; End; Procedure TfrmPrevW.ListClick(Sender: TObject); Begin - AvroMainForm1.KeyLayout.SelectCandidate(List.Items[List.ItemIndex]); + AvroMainForm1.KeyLayout.SelectCandidate(List.Items[List.ItemIndex]); End; Procedure TfrmPrevW.MakeMeHide; Begin - Self.AlphaBlendValue := 0; - PreviewWVisible := False; + Self.AlphaBlendValue := 0; + PreviewWVisible := False; End; Procedure TfrmPrevW.MoveForm(xx, yy: Integer); Var - moveleft, movetop: Integer; + moveleft, movetop: Integer; Begin - moveleft := Self.Left + xx - oldx; - movetop := Self.Top + yy - oldy; - - If MouseDown Then Begin - If mf = 0 Then Begin - If (Self.Left <> moveleft) Or (Self.Top <> movetop) Then Begin - Self.Left := moveleft; - Self.Top := movetop; - UpdateWindowPosData(False, True); - End; - mf := 1; - End - Else - mf := 0; - End; - oldx := xx; - oldy := yy; + moveleft := Self.Left + xx - oldx; + movetop := Self.Top + yy - oldy; + + If MouseDown Then + Begin + If mf = 0 Then + Begin + If (Self.Left <> moveleft) Or (Self.Top <> movetop) Then + Begin + Self.Left := moveleft; + Self.Top := movetop; + UpdateWindowPosData(False, True); + End; + mf := 1; + End + Else + mf := 0; + End; + oldx := xx; + oldy := yy; End; Procedure TfrmPrevW.moveMe; Var - pos: TPoint; - R: Integer; - Height: Integer; - MeTOP, MeLEFT: Integer; - DontShow: Boolean; + pos: TPoint; + R: Integer; + Height: Integer; + MeTOP, MeLEFT: Integer; + DontShow: Boolean; Begin - // Initialization - DontShow := False; - - - If DecideFollowCaret(MeLEFT, MeTOP, DontShow) = False Then Begin - - If DontShow = False Then - MoveWindow(MeLEFT, MeTOP, 0); - End - Else Begin - If DontShow = False Then Begin - R := FindCaretPosWindow(pos, Height); - Height := -1 * Height; - MeLEFT := pos.X; - MeTOP := pos.Y + Height + 10; { DONE : check this value. Adjust distance from caret } - If R <> 0 Then - MoveWindow(MeLEFT, MeTOP, Height); - End; - End; + // Initialization + DontShow := False; + + If DecideFollowCaret(MeLEFT, MeTOP, DontShow) = False Then + Begin + + If DontShow = False Then + MoveWindow(MeLEFT, MeTOP, 0); + End + Else + Begin + If DontShow = False Then + Begin + R := FindCaretPosWindow(pos, Height); + Height := -1 * Height; + MeLEFT := pos.X; + MeTOP := pos.Y + Height + 10; + { DONE : check this value. Adjust distance from caret } + If R <> 0 Then + MoveWindow(MeLEFT, MeTOP, Height); + End; + End; End; Procedure TfrmPrevW.MoveWindow(MeLEFT, MeTOP, CaretHeight: Integer); Var - ScrW, ScrH: Integer; + ScrW, ScrH: Integer; Begin - ScrW := Screen.Width; - ScrH := Screen.Height; - - // Check Y pos - If MeTOP + Self.Height > ScrH Then - MeTOP := MeTOP - 20 - Self.Height - CaretHeight; { DONE : check this value. Adjust distance from below } - - // Check X pos - If MeLEFT < 0 Then - MeLEFT := 0 - Else If MeLEFT + Self.Width > ScrW Then - MeLEFT := ScrW - Self.Width; - - Self.Top := MeTOP; - Self.Left := MeLEFT; - UpdateWindowPosData(True); + ScrW := Screen.Width; + ScrH := Screen.Height; + + // Check Y pos + If MeTOP + Self.Height > ScrH Then + MeTOP := MeTOP - 20 - Self.Height - CaretHeight; + { DONE : check this value. Adjust distance from below } + + // Check X pos + If MeLEFT < 0 Then + MeLEFT := 0 + Else If MeLEFT + Self.Width > ScrW Then + MeLEFT := ScrW - Self.Width; + + Self.Top := MeTOP; + Self.Left := MeLEFT; + UpdateWindowPosData(True); End; Procedure TfrmPrevW.SelectFirstItem; Begin - List.ItemIndex := 0; - ListClick(Nil); + List.ItemIndex := 0; + ListClick(Nil); End; Procedure TfrmPrevW.SelectItem(Const Item: String); - Function EscapeSpecialCharacters(Const inputT: String): String; - Var - T: String; - Begin - T := inputT; - T := ReplaceStr(T, '\', ''); - T := ReplaceStr(T, '|', ''); - T := ReplaceStr(T, '(', ''); - T := ReplaceStr(T, ')', ''); - T := ReplaceStr(T, '[', ''); - T := ReplaceStr(T, ']', ''); - T := ReplaceStr(T, '{', ''); - T := ReplaceStr(T, '}', ''); - T := ReplaceStr(T, '^', ''); - T := ReplaceStr(T, '$', ''); - T := ReplaceStr(T, '*', ''); - T := ReplaceStr(T, '+', ''); - T := ReplaceStr(T, '?', ''); - T := ReplaceStr(T, '.', ''); - - // Additional characters - T := ReplaceStr(T, '~', ''); - T := ReplaceStr(T, '!', ''); - T := ReplaceStr(T, '@', ''); - T := ReplaceStr(T, '#', ''); - T := ReplaceStr(T, '%', ''); - T := ReplaceStr(T, '&', ''); - T := ReplaceStr(T, '-', ''); - T := ReplaceStr(T, '_', ''); - T := ReplaceStr(T, '=', ''); - T := ReplaceStr(T, #39, ''); - T := ReplaceStr(T, '"', ''); - T := ReplaceStr(T, ';', ''); - T := ReplaceStr(T, '<', ''); - T := ReplaceStr(T, '>', ''); - T := ReplaceStr(T, '/', ''); - T := ReplaceStr(T, '\', ''); - T := ReplaceStr(T, ',', ''); - T := ReplaceStr(T, ':', ''); - T := ReplaceStr(T, '`', ''); - T := ReplaceStr(T, b_Taka, ''); - T := ReplaceStr(T, b_Dari, ''); - - Result := T; - - End; + Function EscapeSpecialCharacters(Const inputT: String): String; + Var + T: String; + Begin + T := inputT; + T := ReplaceStr(T, '\', ''); + T := ReplaceStr(T, '|', ''); + T := ReplaceStr(T, '(', ''); + T := ReplaceStr(T, ')', ''); + T := ReplaceStr(T, '[', ''); + T := ReplaceStr(T, ']', ''); + T := ReplaceStr(T, '{', ''); + T := ReplaceStr(T, '}', ''); + T := ReplaceStr(T, '^', ''); + T := ReplaceStr(T, '$', ''); + T := ReplaceStr(T, '*', ''); + T := ReplaceStr(T, '+', ''); + T := ReplaceStr(T, '?', ''); + T := ReplaceStr(T, '.', ''); + + // Additional characters + T := ReplaceStr(T, '~', ''); + T := ReplaceStr(T, '!', ''); + T := ReplaceStr(T, '@', ''); + T := ReplaceStr(T, '#', ''); + T := ReplaceStr(T, '%', ''); + T := ReplaceStr(T, '&', ''); + T := ReplaceStr(T, '-', ''); + T := ReplaceStr(T, '_', ''); + T := ReplaceStr(T, '=', ''); + T := ReplaceStr(T, #39, ''); + T := ReplaceStr(T, '"', ''); + T := ReplaceStr(T, ';', ''); + T := ReplaceStr(T, '<', ''); + T := ReplaceStr(T, '>', ''); + T := ReplaceStr(T, '/', ''); + T := ReplaceStr(T, '\', ''); + T := ReplaceStr(T, ',', ''); + T := ReplaceStr(T, ':', ''); + T := ReplaceStr(T, '`', ''); + T := ReplaceStr(T, b_Taka, ''); + T := ReplaceStr(T, b_Dari, ''); + + Result := T; + + End; Var - I, J: Integer; + I, J: Integer; Begin - J := -1; - For I := 0 To List.Count - 1 Do Begin - If EscapeSpecialCharacters(List.Items[I]) = Item Then Begin - List.ItemIndex := I; - J := I; - break; - End; - End; - - If J < 0 Then - List.ItemIndex := 0; - - ListClick(Nil); + J := -1; + For I := 0 To List.Count - 1 Do + Begin + If EscapeSpecialCharacters(List.Items[I]) = Item Then + Begin + List.ItemIndex := I; + J := I; + break; + End; + End; + + If J < 0 Then + List.ItemIndex := 0; + + ListClick(Nil); End; Procedure TfrmPrevW.SelectNextItem; Var - I: Integer; - Total: Integer; + I: Integer; + Total: Integer; Begin - I := List.ItemIndex; - If I < 0 Then - I := 0; - Total := List.Count - 1; - I := I + 1; - If I <= Total Then - List.ItemIndex := I - Else If I > Total Then - List.ItemIndex := 0; - ListClick(Nil); + I := List.ItemIndex; + If I < 0 Then + I := 0; + Total := List.Count - 1; + I := I + 1; + If I <= Total Then + List.ItemIndex := I + Else If I > Total Then + List.ItemIndex := 0; + ListClick(Nil); End; - - Procedure TfrmPrevW.SelectNItem(Const ItemNumber: Integer); Begin - If ItemNumber <= List.Count - 1 Then - List.ItemIndex := ItemNumber - Else - List.ItemIndex := 0; - ListClick(Nil); + If ItemNumber <= List.Count - 1 Then + List.ItemIndex := ItemNumber + Else + List.ItemIndex := 0; + ListClick(Nil); End; Procedure TfrmPrevW.SelectPrevItem; Var - I: Integer; - Total: Integer; + I: Integer; + Total: Integer; Begin - I := List.ItemIndex; - If I < 0 Then - I := 0; - Total := List.Count - 1; - I := I - 1; - If I < 0 Then - List.ItemIndex := Total - Else - List.ItemIndex := I; - ListClick(Nil); + I := List.ItemIndex; + If I < 0 Then + I := 0; + Total := List.Count - 1; + I := I - 1; + If I < 0 Then + List.ItemIndex := Total + Else + List.ItemIndex := I; + ListClick(Nil); End; Procedure TfrmPrevW.ShowHideList; Begin - If List.Items.Count > 1 Then Begin - If List.Items.Count < 8 Then - List.Height := (List.Items.Count + 1) * List.ItemHeight - Else - List.Height := 8 * List.ItemHeight; - Shape1.Height := List.Top + List.Height + 1; - Height := Shape1.Height; - End - Else Begin - Shape1.Height := List.Top - Shape1.Top; - Height := Shape1.Height; - End; + If List.Items.Count > 1 Then + Begin + If List.Items.Count < 8 Then + List.Height := (List.Items.Count + 1) * List.ItemHeight + Else + List.Height := 8 * List.ItemHeight; + Shape1.Height := List.Top + List.Height + 1; + Height := Shape1.Height; + End + Else + Begin + Shape1.Height := List.Top - Shape1.Top; + Height := Shape1.Height; + End; End; Procedure TfrmPrevW.UpdateMe(Const EnglishT: String); Begin - lblPreview.Caption := EnglishT; + lblPreview.Caption := EnglishT; - TopMost(frmPrevW.Handle); - moveMe; - Self.AlphaBlendValue := 255; - PreviewWVisible := True; - Application.ProcessMessages; + TopMost(frmPrevW.Handle); + moveMe; + Self.AlphaBlendValue := 255; + PreviewWVisible := True; + Application.ProcessMessages; End; Procedure TfrmPrevW.UpdateWindowPosData(NoFUpdate, Nofollow: Boolean); Var - hforewnd: HWND; - PosX, PosY: Integer; - Follow, NewFollow: TFollow; + hforewnd: HWND; + PosX, PosY: Integer; + Follow, NewFollow: TFollow; Begin - hforewnd := GetForegroundWindow; - If (hforewnd = 0) Or (hforewnd = Self.Handle) Then - Exit; - PosX := Self.Left; - PosY := Self.Top; - - { ========================================== - Structure - F:0:0 or N:0:0 - F=Follow Caret - N=Don't Follow Caret - 0:0= POSX:POSY - '========================================== } - - if not FollowDict.TryGetValue(hforewnd, Follow) then begin - NewFollow.Following := True; - NewFollow.PosX := PosX; - NewFollow.PosY := PosY; - FollowDict.AddOrSetValue(hforewnd, NewFollow); - end - Else Begin - If NoFUpdate Then Begin - NewFollow.Following := Follow.Following; - NewFollow.PosX := PosX; - NewFollow.PosY := PosY; - FollowDict.AddOrSetValue(hforewnd, NewFollow); - End - Else Begin - NewFollow.Following := not Nofollow; - NewFollow.PosX := PosX; - NewFollow.PosY := PosY; - FollowDict.AddOrSetValue(hforewnd, NewFollow); - End; - End; - - If FollowDict.Items[hforewnd].Following Then Begin - imgPin.Picture := imgPinClose.Picture; - FollowingCaretinThisWindow := True; - End - Else Begin - imgPin.Picture := imgPinOpen.Picture; - FollowingCaretinThisWindow := False; - End; - + hforewnd := GetForegroundWindow; + If (hforewnd = 0) Or (hforewnd = Self.Handle) Then + Exit; + PosX := Self.Left; + PosY := Self.Top; + + { ========================================== + Structure + F:0:0 or N:0:0 + F=Follow Caret + N=Don't Follow Caret + 0:0= POSX:POSY + '========================================== } + + if not FollowDict.TryGetValue(hforewnd, Follow) then + begin + NewFollow.Following := True; + NewFollow.PosX := PosX; + NewFollow.PosY := PosY; + FollowDict.AddOrSetValue(hforewnd, NewFollow); + end + Else + Begin + If NoFUpdate Then + Begin + NewFollow.Following := Follow.Following; + NewFollow.PosX := PosX; + NewFollow.PosY := PosY; + FollowDict.AddOrSetValue(hforewnd, NewFollow); + End + Else + Begin + NewFollow.Following := not Nofollow; + NewFollow.PosX := PosX; + NewFollow.PosY := PosY; + FollowDict.AddOrSetValue(hforewnd, NewFollow); + End; + End; + + If FollowDict.Items[hforewnd].Following Then + Begin + imgPin.Picture := imgPinClose.Picture; + FollowingCaretinThisWindow := True; + End + Else + Begin + imgPin.Picture := imgPinOpen.Picture; + FollowingCaretinThisWindow := False; + End; End; diff --git a/Keyboard and Spell checker/Forms/ufrmUpdateNotify.pas b/Keyboard and Spell checker/Forms/ufrmUpdateNotify.pas index e3cb7c1..5a921ed 100644 --- a/Keyboard and Spell checker/Forms/ufrmUpdateNotify.pas +++ b/Keyboard and Spell checker/Forms/ufrmUpdateNotify.pas @@ -1,168 +1,168 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - Unit ufrmUpdateNotify; Interface Uses - Windows, - Messages, - SysUtils, - Variants, - Classes, - Graphics, - Controls, - Forms, - Dialogs, - StdCtrls, - Buttons, - ExtCtrls; + Windows, + Messages, + SysUtils, + Variants, + Classes, + Graphics, + Controls, + Forms, + Dialogs, + StdCtrls, + Buttons, + ExtCtrls; Type - TfrmUpdateNotify = Class(TForm) - Image1: TImage; - Label1: TLabel; - Label2: TLabel; - Label3: TLabel; - Label4: TLabel; - Button1: TButton; - lblWhatsNew: TLabel; - Label6: TLabel; - lblOldVer: TLabel; - lblNewVer: TLabel; - lblDate: TLabel; - but_Download: TButton; - Procedure FormClose(Sender: TObject; Var Action: TCloseAction); - Procedure lblWhatsNewClick(Sender: TObject); - Procedure Button1Click(Sender: TObject); - Procedure but_DownloadClick(Sender: TObject); - Private - { Private declarations } - WhatsNewURL: String; - DownloadURL: String; - Public - { Public declarations } - Procedure SetupAndShow(Const mNewVer, mDate, mWhatsNew, mDownload: String); - Protected - Procedure CreateParams(Var Params: TCreateParams); Override; - End; + TfrmUpdateNotify = Class(TForm) + Image1: TImage; + Label1: TLabel; + Label2: TLabel; + Label3: TLabel; + Label4: TLabel; + Button1: TButton; + lblWhatsNew: TLabel; + Label6: TLabel; + lblOldVer: TLabel; + lblNewVer: TLabel; + lblDate: TLabel; + but_Download: TButton; + Procedure FormClose(Sender: TObject; Var Action: TCloseAction); + Procedure lblWhatsNewClick(Sender: TObject); + Procedure Button1Click(Sender: TObject); + Procedure but_DownloadClick(Sender: TObject); + Private + { Private declarations } + WhatsNewURL: String; + DownloadURL: String; + Public + { Public declarations } + Procedure SetupAndShow(Const mNewVer, mDate, mWhatsNew, mDownload: String); + Protected + Procedure CreateParams(Var Params: TCreateParams); Override; + End; Var - frmUpdateNotify : TfrmUpdateNotify; + frmUpdateNotify: TfrmUpdateNotify; Implementation {$R *.dfm} Uses - uFileFolderHandling, - clsFileVersion, - uWindowHandlers; + uFileFolderHandling, + clsFileVersion, + uWindowHandlers; Const - Show_Window_in_Taskbar = True; + Show_Window_in_Taskbar = True; - {===============================================================================} + { =============================================================================== } Procedure TfrmUpdateNotify.Button1Click(Sender: TObject); Begin - self.Close; + self.Close; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmUpdateNotify.but_DownloadClick(Sender: TObject); Begin - Execute_Something(DownloadURL); - self.Close; + Execute_Something(DownloadURL); + self.Close; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmUpdateNotify.CreateParams(Var Params: TCreateParams); Begin - Inherited CreateParams(Params); - With Params Do Begin - If Show_Window_in_Taskbar Then Begin - ExStyle := ExStyle Or WS_EX_APPWINDOW And Not WS_EX_TOOLWINDOW; - ExStyle := ExStyle Or WS_EX_TOPMOST Or WS_EX_NOACTIVATE; - WndParent := GetDesktopwindow; - End - Else If Not Show_Window_in_Taskbar Then Begin - ExStyle := ExStyle And Not WS_EX_APPWINDOW; - End; - End; + Inherited CreateParams(Params); + With Params Do + Begin + If Show_Window_in_Taskbar Then + Begin + ExStyle := ExStyle Or WS_EX_APPWINDOW And Not WS_EX_TOOLWINDOW; + ExStyle := ExStyle Or WS_EX_TOPMOST Or WS_EX_NOACTIVATE; + WndParent := GetDesktopwindow; + End + Else If Not Show_Window_in_Taskbar Then + Begin + ExStyle := ExStyle And Not WS_EX_APPWINDOW; + End; + End; End; -{===============================================================================} +{ =============================================================================== } -Procedure TfrmUpdateNotify.FormClose(Sender: TObject; - Var Action: TCloseAction); +Procedure TfrmUpdateNotify.FormClose(Sender: TObject; Var Action: TCloseAction); Begin - Action := caFree; + Action := caFree; - frmUpdateNotify := Nil; + frmUpdateNotify := Nil; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmUpdateNotify.lblWhatsNewClick(Sender: TObject); Begin - Execute_Something(WhatsNewURL); + Execute_Something(WhatsNewURL); End; -{===============================================================================} +{ =============================================================================== } -Procedure TfrmUpdateNotify.SetupAndShow(Const mNewVer, mDate, - mWhatsNew, mDownload: String); +Procedure TfrmUpdateNotify.SetupAndShow(Const mNewVer, mDate, mWhatsNew, + mDownload: String); Var - Version : TFileVersion; - mOldVer : String; + Version: TFileVersion; + mOldVer: String; Begin - Version := TFileVersion.Create(); - mOldVer := IntToStr(Version.VerMajor) + '.' + IntToStr(Version.VerMinor) + '.' + - IntToStr(version.VerRelease) + '.' + IntToStr(Version.VerBuild); - lblOldVer.Caption := ''; - lblNewVer.Caption := ''; - lblDate.Caption := ''; - - lblOldVer.Caption := mOldVer; - lblNewVer.Caption := mNewVer; - lblDate.Caption := mDate; - - WhatsNewURL := mWhatsNew; - DownloadURL := mDownload; - TOPMOST(self.Handle); - Self.Show; + Version := TFileVersion.Create(); + mOldVer := IntToStr(Version.VerMajor) + '.' + IntToStr(Version.VerMinor) + '.' + + IntToStr(Version.VerRelease) + '.' + IntToStr(Version.VerBuild); + lblOldVer.Caption := ''; + lblNewVer.Caption := ''; + lblDate.Caption := ''; + + lblOldVer.Caption := mOldVer; + lblNewVer.Caption := mNewVer; + lblDate.Caption := mDate; + + WhatsNewURL := mWhatsNew; + DownloadURL := mDownload; + TOPMOST(self.Handle); + self.Show; End; -{===============================================================================} +{ =============================================================================== } End. - diff --git a/Keyboard and Spell checker/SpellChecker/Avro_Spell_Checker.dpr b/Keyboard and Spell checker/SpellChecker/Avro_Spell_Checker.dpr index aa8b1e7..6a17599 100644 --- a/Keyboard and Spell checker/SpellChecker/Avro_Spell_Checker.dpr +++ b/Keyboard and Spell checker/SpellChecker/Avro_Spell_Checker.dpr @@ -38,7 +38,6 @@ uses VirtualKeyCode in '..\Units\VirtualKeyCode.pas', uRegistrySettings in 'uRegistrySettings.pas', uWindowHandlers in '..\Units\uWindowHandlers.pas', - nativexml in '..\Units\nativexml.pas', clsFileVersion in '..\Classes\clsFileVersion.pas', clsRegistry_XMLSetting in 'clsRegistry_XMLSetting.pas', WindowsVersion in '..\Units\WindowsVersion.pas'; diff --git a/Keyboard and Spell checker/SpellChecker/Avro_Spell_Checker.res b/Keyboard and Spell checker/SpellChecker/Avro_Spell_Checker.res index 14e91acfa82e6f649eeb7216ac261f508b853ae3..2835928fc8c97a6adb42164d5e5fb432767e2d95 100644 GIT binary patch delta 1478 zcmbVMO=uHA6n;Bc>_$rqTCKL=G_@Bc*`#f3S~tQKzuHefwsrklZ3oNj`S9)F3uUjI_B94 z^Z_oxKC!w&1`j5n01jBN04cD6K_1HjoE6_!NJI`n5a(bO>o>{qj%_*O%}sK0p_zf0 zX&6AR84vC%wi+0agmd0vGe}_|62mr)5eG8ZX0cx-55m8eQ7(~gNfM7ro;lg4BE&D*&Ias^9tGQLi_p}*^tp1F6nJMuxEEe z(ViAX#g`Jfzn9)H@+KeGxKS7u(`%%!jBc)PXr!ZVA^(0I_$GmgcroEywohLV~}Dnp@A zM49){%1t45+$VnEaDN@NISu=&g6F{9q?xnuQizjlWFjT2ty`uYK3P`# z1A*B^Mw91gn&qu!ipN>KG>lWsrF_Y@Eytxf%b~TC=5$Wyu0{g^gq3CSYmLO>JHi=l zVm!S~)SY2On;5Y>L_NKubwq>VCdx-dDenj+9BP25bF2Y<$USJzu>Q)e)_6 sZ#sN{e=n$5x3+xvsa?b`Y8KAJG+c%$^b%+%VFJCB_rY!dn57E9Z`Jak00000 delta 1812 zcmcIjQE%H+6h6M&U=4~?n4pXy?bf3bnpQVyN4klmkak;%G_|NLn^gODxM+ z96)J!_xO5KEvQ7Nai7)kJk~@NdJ6a@3aL#UvMHb*tsu5Zs13A=l}8RmKm>FVm1{cx z8O;rUnY#QIlByh%iw#__6p@dtB8!m=@hq_BB(Y9FPa@XhZBzSS=jL&ZgpkdeG|NDjtM#z)5=!cI8q$x z=hmmjt0PnC)7;L>qmU6vSv1IUkY-nIQia4&EbPDmba3chC> zmr17+MzQ3VfeCL&e#w)u&6`Q!C|cXcvH0}#PGgluHU0J$t2&QGZhlniA4;k9!Q&D- z^Jt;3A(XfEKQ{1;Req#YHE+3aSJyG2nt8L_tjt%O`AWKQo0&(mwpM5MOeq^~`ulCh G4f+dMbg?%8 diff --git a/Keyboard and Spell checker/SpellChecker/HashTable.pas b/Keyboard and Spell checker/SpellChecker/HashTable.pas index 550e0b0..6d74602 100644 --- a/Keyboard and Spell checker/SpellChecker/HashTable.pas +++ b/Keyboard and Spell checker/SpellChecker/HashTable.pas @@ -1,52 +1,52 @@ { - ============================================================================= - ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + ============================================================================= + ***************************************************************************** + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. - ***************************************************************************** - ============================================================================= + ***************************************************************************** + ============================================================================= } - Unit HashTable; Interface Uses - Hashing, - BanglaChars, - uDbase, - JclAnsiStrings; + Hashing, + BanglaChars, + classes, + uDbase; Function WordPresent(Const Wrd: String): Boolean; Type - TCompareResult = (crLess, // < - crEqual, // = - crGreater, // > - crUndefined); - TCompareResultSet = Set Of TCompareResult; - -Procedure BuildOneHashTable(Var SourceArray: TAnsiStringList; Var HArray: HashArray); + TCompareResult = (crLess, // < + crEqual, // = + crGreater, // > + crUndefined); + TCompareResultSet = Set Of TCompareResult; + +Procedure BuildOneHashTable(Var SourceArray: TStringList; + Var HArray: HashArray); Function DictionaryRehashSize(Const Count: Integer): Integer; Function Append(Var V: LongIntArray; Const R: LongInt): Integer; Function StrPCompare(Const A, B: PAnsiChar; Const Len: Integer): TCompareResult; @@ -55,378 +55,434 @@ Function WordPresent_Basic(Const Wrd: String): Boolean; Const - AverageHashChainSize = 4; + AverageHashChainSize = 4; Implementation Uses - StrUtils, - SysUtils; - + StrUtils, + SysUtils; Function WordPresent(Const Wrd: String): Boolean; Var - iLen, I, Dummy: Integer; - SearchingPart, IsSuffix: String; + iLen, I, Dummy: Integer; + SearchingPart, IsSuffix: String; Begin - Result := False; - iLen := Length(Wrd); - If iLen <= 0 Then - exit; - - If WordPresent_Basic(Wrd) Then Begin - Result := True; - exit; - End; - - If iLen < 2 Then - exit; - - For I := 2 To iLen Do Begin - IsSuffix := MidStr(Wrd, I, iLen); - SearchingPart := LeftStr(Wrd, iLen - Length(IsSuffix)); - - // Valid suffix? - If Suffix_Spell.Find(IsSuffix, Dummy) = True Then Begin - - If WordPresent_Basic(SearchingPart) Then Begin - Result := True; - exit; - End; - - If RightStr(SearchingPart, 1) = b_T Then Begin - SearchingPart := MidStr(SearchingPart, 1, Length(SearchingPart) - 1) + b_Khandatta; - If WordPresent_Basic(SearchingPart) Then Begin - Result := True; - exit; - End; - End; - - If RightStr(SearchingPart, 1) = b_NGA Then Begin - SearchingPart := MidStr(SearchingPart, 1, Length(SearchingPart) - 1) + b_Anushar; - If WordPresent_Basic(SearchingPart) Then Begin - Result := True; - exit; - End; - End; - - End; - End; + Result := False; + iLen := Length(Wrd); + If iLen <= 0 Then + exit; + + If WordPresent_Basic(Wrd) Then + Begin + Result := True; + exit; + End; + + If iLen < 2 Then + exit; + + For I := 2 To iLen Do + Begin + IsSuffix := MidStr(Wrd, I, iLen); + SearchingPart := LeftStr(Wrd, iLen - Length(IsSuffix)); + + // Valid suffix? + If Suffix_Spell.Find(IsSuffix, Dummy) = True Then + Begin + + If WordPresent_Basic(SearchingPart) Then + Begin + Result := True; + exit; + End; + + If RightStr(SearchingPart, 1) = b_T Then + Begin + SearchingPart := MidStr(SearchingPart, 1, Length(SearchingPart) - 1) + + b_Khandatta; + If WordPresent_Basic(SearchingPart) Then + Begin + Result := True; + exit; + End; + End; + + If RightStr(SearchingPart, 1) = b_NGA Then + Begin + SearchingPart := MidStr(SearchingPart, 1, Length(SearchingPart) - 1) + + b_Anushar; + If WordPresent_Basic(SearchingPart) Then + Begin + Result := True; + exit; + End; + End; + + End; + End; End; Function WordPresent_Basic(Const Wrd: String): Boolean; - Function SearchWord(Var SourceArray: TAnsiStringList; Var HArray: HashArray): Boolean; - Var - H, I, J, L: Integer; - Key: AnsiString; - Begin - Result := False; - L := Length(HArray); - If L > 0 Then Begin - Key := utf8encode(Wrd); - H := HashStr(Key, L); - For I := 0 To Length(HArray[H]) - 1 Do Begin - J := HArray[H, I]; - If StrEqual(Key, SourceArray[J]) Then Begin - Result := True; - break; - End; - End; - End; - End; + Function SearchWord(Var SourceArray: TStringList; + Var HArray: HashArray): Boolean; + Var + H, I, J, L: Integer; + Key: AnsiString; + Begin + Result := False; + L := Length(HArray); + If L > 0 Then + Begin + Key := utf8encode(Wrd); + H := HashStr(Key, L); + For I := 0 To Length(HArray[H]) - 1 Do + Begin + J := HArray[H, I]; + If StrEqual(Key, SourceArray[J]) Then + Begin + Result := True; + break; + End; + End; + End; + End; Var - FirstChar: Char; + FirstChar: Char; Begin - Result := False; - - If Length(Wrd) <= 0 Then - exit; - FirstChar := Wrd[1]; - - - If FirstChar = b_A Then Begin - Result := SearchWord(W_A, W_Hash_A); - exit; - End; - If FirstChar = b_AA Then Begin - Result := SearchWord(W_AA, W_Hash_AA); - exit; - End; - If FirstChar = b_I Then Begin - Result := SearchWord(W_I, W_Hash_I); - exit; - End; - If FirstChar = b_II Then Begin - Result := SearchWord(W_II, W_Hash_II); - exit; - End; - If FirstChar = b_U Then Begin - Result := SearchWord(W_U, W_Hash_U); - exit; - End; - If FirstChar = b_UU Then Begin - Result := SearchWord(W_UU, W_Hash_UU); - exit; - End; - If FirstChar = b_RRI Then Begin - Result := SearchWord(W_RRI, W_Hash_RRI); - exit; - End; - If FirstChar = b_E Then Begin - Result := SearchWord(W_E, W_Hash_E); - exit; - End; - If FirstChar = b_OI Then Begin - Result := SearchWord(W_OI, W_Hash_OI); - exit; - End; - If FirstChar = b_O Then Begin - Result := SearchWord(W_O, W_Hash_O); - exit; - End; - If FirstChar = b_OU Then Begin - Result := SearchWord(W_OU, W_Hash_OU); - exit; - End; - - - - - If FirstChar = b_B Then Begin - Result := SearchWord(W_B, W_Hash_B); - exit; - End; - If FirstChar = b_BH Then Begin - Result := SearchWord(W_BH, W_Hash_BH); - exit; - End; - If FirstChar = b_C Then Begin - Result := SearchWord(W_C, W_Hash_C); - exit; - End; - If FirstChar = b_CH Then Begin - Result := SearchWord(W_CH, W_Hash_CH); - exit; - End; - If FirstChar = b_D Then Begin - Result := SearchWord(W_D, W_Hash_D); - exit; - End; - If FirstChar = b_Dh Then Begin - Result := SearchWord(W_Dh, W_Hash_Dh); - exit; - End; - If FirstChar = b_DD Then Begin - Result := SearchWord(W_DD, W_Hash_Dd); - exit; - End; - If FirstChar = b_DDh Then Begin - Result := SearchWord(W_DDh, W_Hash_DDh); - exit; - End; - If FirstChar = b_G Then Begin - Result := SearchWord(W_G, W_Hash_G); - exit; - End; - If FirstChar = b_Gh Then Begin - Result := SearchWord(W_Gh, W_Hash_Gh); - exit; - End; - If FirstChar = b_H Then Begin - Result := SearchWord(W_H, W_Hash_H); - exit; - End; - If FirstChar = b_J Then Begin - Result := SearchWord(W_J, W_Hash_J); - exit; - End; - If FirstChar = b_Jh Then Begin - Result := SearchWord(W_Jh, W_Hash_Jh); - exit; - End; - If FirstChar = b_K Then Begin - Result := SearchWord(W_K, W_Hash_K); - exit; - End; - If FirstChar = b_Kh Then Begin - Result := SearchWord(W_Kh, W_Hash_Kh); - exit; - End; - If FirstChar = b_L Then Begin - Result := SearchWord(W_L, W_Hash_L); - exit; - End; - If FirstChar = b_M Then Begin - Result := SearchWord(W_M, W_Hash_M); - exit; - End; - If FirstChar = b_N Then Begin - Result := SearchWord(W_N, W_Hash_N); - exit; - End; - If FirstChar = b_NGA Then Begin - Result := SearchWord(W_NGA, W_Hash_NGA); - exit; - End; - If FirstChar = b_NYA Then Begin - Result := SearchWord(W_NYA, W_Hash_NYA); - exit; - End; - If FirstChar = b_Nn Then Begin - Result := SearchWord(W_Nn, W_Hash_Nn); - exit; - End; - If FirstChar = b_P Then Begin - Result := SearchWord(W_P, W_Hash_P); - exit; - End; - If FirstChar = b_Ph Then Begin - Result := SearchWord(W_Ph, W_Hash_Ph); - exit; - End; - If FirstChar = b_R Then Begin - Result := SearchWord(W_R, W_Hash_R); - exit; - End; - If FirstChar = b_RR Then Begin - Result := SearchWord(W_RR, W_Hash_RR); - exit; - End; - If FirstChar = b_RRH Then Begin - Result := SearchWord(W_RRH, W_Hash_RRH); - exit; - End; - If FirstChar = b_S Then Begin - Result := SearchWord(W_S, W_Hash_S); - exit; - End; - If FirstChar = b_Sh Then Begin - Result := SearchWord(W_Sh, W_Hash_Sh); - exit; - End; - If FirstChar = b_Ss Then Begin - Result := SearchWord(W_Ss, W_Hash_Ss); - exit; - End; - If FirstChar = b_T Then Begin - Result := SearchWord(W_T, W_Hash_T); - exit; - End; - If FirstChar = b_Tt Then Begin - Result := SearchWord(W_Tt, W_Hash_Tt); - exit; - End; - If FirstChar = b_Tth Then Begin - Result := SearchWord(W_TTh, W_Hash_Tth); - exit; - End; - If FirstChar = b_Th Then Begin - Result := SearchWord(W_Th, W_Hash_Th); - exit; - End; - If FirstChar = b_Y Then Begin - Result := SearchWord(W_Y, W_Hash_Y); - exit; - End; - If FirstChar = b_Z Then Begin - Result := SearchWord(W_Z, W_Hash_Z); - exit; - End; - If FirstChar = b_Khandatta Then Begin - Result := SearchWord(W_Khandatta, W_Hash_Khandatta); - exit; - End; + Result := False; + + If Length(Wrd) <= 0 Then + exit; + FirstChar := Wrd[1]; + + If FirstChar = b_A Then + Begin + Result := SearchWord(W_A, W_Hash_A); + exit; + End; + If FirstChar = b_AA Then + Begin + Result := SearchWord(W_AA, W_Hash_AA); + exit; + End; + If FirstChar = b_I Then + Begin + Result := SearchWord(W_I, W_Hash_I); + exit; + End; + If FirstChar = b_II Then + Begin + Result := SearchWord(W_II, W_Hash_II); + exit; + End; + If FirstChar = b_U Then + Begin + Result := SearchWord(W_U, W_Hash_U); + exit; + End; + If FirstChar = b_UU Then + Begin + Result := SearchWord(W_UU, W_Hash_UU); + exit; + End; + If FirstChar = b_RRI Then + Begin + Result := SearchWord(W_RRI, W_Hash_RRI); + exit; + End; + If FirstChar = b_E Then + Begin + Result := SearchWord(W_E, W_Hash_E); + exit; + End; + If FirstChar = b_OI Then + Begin + Result := SearchWord(W_OI, W_Hash_OI); + exit; + End; + If FirstChar = b_O Then + Begin + Result := SearchWord(W_O, W_Hash_O); + exit; + End; + If FirstChar = b_OU Then + Begin + Result := SearchWord(W_OU, W_Hash_OU); + exit; + End; + + If FirstChar = b_B Then + Begin + Result := SearchWord(W_B, W_Hash_B); + exit; + End; + If FirstChar = b_BH Then + Begin + Result := SearchWord(W_BH, W_Hash_BH); + exit; + End; + If FirstChar = b_C Then + Begin + Result := SearchWord(W_C, W_Hash_C); + exit; + End; + If FirstChar = b_CH Then + Begin + Result := SearchWord(W_CH, W_Hash_CH); + exit; + End; + If FirstChar = b_D Then + Begin + Result := SearchWord(W_D, W_Hash_D); + exit; + End; + If FirstChar = b_Dh Then + Begin + Result := SearchWord(W_Dh, W_Hash_Dh); + exit; + End; + If FirstChar = b_DD Then + Begin + Result := SearchWord(W_DD, W_Hash_Dd); + exit; + End; + If FirstChar = b_DDh Then + Begin + Result := SearchWord(W_DDh, W_Hash_DDh); + exit; + End; + If FirstChar = b_G Then + Begin + Result := SearchWord(W_G, W_Hash_G); + exit; + End; + If FirstChar = b_Gh Then + Begin + Result := SearchWord(W_Gh, W_Hash_Gh); + exit; + End; + If FirstChar = b_H Then + Begin + Result := SearchWord(W_H, W_Hash_H); + exit; + End; + If FirstChar = b_J Then + Begin + Result := SearchWord(W_J, W_Hash_J); + exit; + End; + If FirstChar = b_Jh Then + Begin + Result := SearchWord(W_Jh, W_Hash_Jh); + exit; + End; + If FirstChar = b_K Then + Begin + Result := SearchWord(W_K, W_Hash_K); + exit; + End; + If FirstChar = b_Kh Then + Begin + Result := SearchWord(W_Kh, W_Hash_Kh); + exit; + End; + If FirstChar = b_L Then + Begin + Result := SearchWord(W_L, W_Hash_L); + exit; + End; + If FirstChar = b_M Then + Begin + Result := SearchWord(W_M, W_Hash_M); + exit; + End; + If FirstChar = b_N Then + Begin + Result := SearchWord(W_N, W_Hash_N); + exit; + End; + If FirstChar = b_NGA Then + Begin + Result := SearchWord(W_NGA, W_Hash_NGA); + exit; + End; + If FirstChar = b_NYA Then + Begin + Result := SearchWord(W_NYA, W_Hash_NYA); + exit; + End; + If FirstChar = b_Nn Then + Begin + Result := SearchWord(W_Nn, W_Hash_Nn); + exit; + End; + If FirstChar = b_P Then + Begin + Result := SearchWord(W_P, W_Hash_P); + exit; + End; + If FirstChar = b_Ph Then + Begin + Result := SearchWord(W_Ph, W_Hash_Ph); + exit; + End; + If FirstChar = b_R Then + Begin + Result := SearchWord(W_R, W_Hash_R); + exit; + End; + If FirstChar = b_RR Then + Begin + Result := SearchWord(W_RR, W_Hash_RR); + exit; + End; + If FirstChar = b_RRH Then + Begin + Result := SearchWord(W_RRH, W_Hash_RRH); + exit; + End; + If FirstChar = b_S Then + Begin + Result := SearchWord(W_S, W_Hash_S); + exit; + End; + If FirstChar = b_Sh Then + Begin + Result := SearchWord(W_Sh, W_Hash_Sh); + exit; + End; + If FirstChar = b_Ss Then + Begin + Result := SearchWord(W_Ss, W_Hash_Ss); + exit; + End; + If FirstChar = b_T Then + Begin + Result := SearchWord(W_T, W_Hash_T); + exit; + End; + If FirstChar = b_Tt Then + Begin + Result := SearchWord(W_Tt, W_Hash_Tt); + exit; + End; + If FirstChar = b_Tth Then + Begin + Result := SearchWord(W_TTh, W_Hash_Tth); + exit; + End; + If FirstChar = b_Th Then + Begin + Result := SearchWord(W_Th, W_Hash_Th); + exit; + End; + If FirstChar = b_Y Then + Begin + Result := SearchWord(W_Y, W_Hash_Y); + exit; + End; + If FirstChar = b_Z Then + Begin + Result := SearchWord(W_Z, W_Hash_Z); + exit; + End; + If FirstChar = b_Khandatta Then + Begin + Result := SearchWord(W_Khandatta, W_Hash_Khandatta); + exit; + End; End; - - Function DictionaryRehashSize(Const Count: Integer): Integer; Var - L: Integer; + L: Integer; Begin - L := Count Div AverageHashChainSize; // Number of slots - If L <= 16 Then // Rehash in powers of 16 - Result := 16 - Else If L <= 256 Then - Result := 256 - Else If L <= 4096 Then - Result := 4096 - Else If L <= 65536 Then - Result := 65536 - Else If L <= 1048576 Then - Result := 1048576 - Else If L <= 16777216 Then - Result := 16777216 - Else - Result := 268435456; + L := Count Div AverageHashChainSize; // Number of slots + If L <= 16 Then // Rehash in powers of 16 + Result := 16 + Else If L <= 256 Then + Result := 256 + Else If L <= 4096 Then + Result := 4096 + Else If L <= 65536 Then + Result := 65536 + Else If L <= 1048576 Then + Result := 1048576 + Else If L <= 16777216 Then + Result := 16777216 + Else + Result := 268435456; End; -Procedure BuildOneHashTable(Var SourceArray: TAnsiStringList; Var HArray: HashArray); +Procedure BuildOneHashTable(Var SourceArray: TStringList; + Var HArray: HashArray); Var - I, C, L: Integer; + I, C, L: Integer; Begin - // C := Length(SourceArray); - C := SourceArray.Count; - L := DictionaryRehashSize(C); - HArray := Nil; - SetLength(HArray, L); - For I := 0 To C - 1 Do - Append(HArray[HashStr(SourceArray[I], L)], I); + // C := Length(SourceArray); + C := SourceArray.Count; + L := DictionaryRehashSize(C); + HArray := Nil; + SetLength(HArray, L); + For I := 0 To C - 1 Do + Append(HArray[HashStr(SourceArray[I], L)], I); End; Function Append(Var V: LongIntArray; Const R: LongInt): Integer; Begin - Result := Length(V); - SetLength(V, Result + 1); - V[Result] := R; + Result := Length(V); + SetLength(V, Result + 1); + V[Result] := R; End; - - Function StrEqual(Const A, B: AnsiString): Boolean; Var - L1, L2: Integer; + L1, L2: Integer; Begin - L1 := Length(A); - L2 := Length(B); - Result := L1 = L2; - If Not Result Or (L1 = 0) Then - exit; - If Pointer(A) = Pointer(B) Then - exit; + L1 := Length(A); + L2 := Length(B); + Result := L1 = L2; + If Not Result Or (L1 = 0) Then + exit; + If Pointer(A) = Pointer(B) Then + exit; - Result := StrPCompare(Pointer(A), Pointer(B), L1) = crEqual; + Result := StrPCompare(Pointer(A), Pointer(B), L1) = crEqual; End; Function StrPCompare(Const A, B: PAnsiChar; Const Len: Integer): TCompareResult; Var - P, Q: PAnsiChar; - I: Integer; + P, Q: PAnsiChar; + I: Integer; Begin - P := A; - Q := B; - If Len <= 0 Then Begin - Result := crUndefined; - exit; - End; - For I := 1 To Len Do - If P^ = Q^ Then Begin - Inc(P); - Inc(Q); - End - Else Begin - If Ord(P^) < Ord(Q^) Then - Result := crLess - Else - Result := crGreater; - exit; - End; - Result := crEqual; + P := A; + Q := B; + If Len <= 0 Then + Begin + Result := crUndefined; + exit; + End; + For I := 1 To Len Do + If P^ = Q^ Then + Begin + Inc(P); + Inc(Q); + End + Else + Begin + If Ord(P^) < Ord(Q^) Then + Result := crLess + Else + Result := crGreater; + exit; + End; + Result := crEqual; End; End. diff --git a/Keyboard and Spell checker/SpellChecker/Hashing.pas b/Keyboard and Spell checker/SpellChecker/Hashing.pas index 937225b..b3a1585 100644 --- a/Keyboard and Spell checker/SpellChecker/Hashing.pas +++ b/Keyboard and Spell checker/SpellChecker/Hashing.pas @@ -1,25 +1,25 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= @@ -28,136 +28,141 @@ Unit Hashing; Interface + uses -SysUtils; + SysUtils; Var - CRC32TableInit : Boolean = False; - CRC32Table : Array[Byte] Of LongWord; - CRC32Poly : LongWord = $EDB88320; - + CRC32TableInit: Boolean = False; + CRC32Table: Array [Byte] Of LongWord; + CRC32Poly: LongWord = $EDB88320; -Function HashBuf(Const Buf; Const BufSize: Integer; - Const Slots: LongWord = 0): LongWord; +Function HashBuf(Const Buf; Const BufSize: Integer; Const Slots: LongWord = 0) + : LongWord; Function HashStr(Const StrBuf: Pointer; Const StrLength: Integer; - Const Slots: LongWord = 0): LongWord; overload; -Function HashStr(Const S: AnsiString; Const Slots: LongWord = 0): LongWord; overload; - + Const Slots: LongWord = 0): LongWord; overload; +Function HashStr(Const S: AnsiString; Const Slots: LongWord = 0) + : LongWord; overload; Implementation Procedure InitCRC32Table; Var - I, J : Byte; - R : LongWord; + I, J: Byte; + R: LongWord; Begin - For I := $00 To $FF Do Begin - R := I; - For J := 8 Downto 1 Do - If R And 1 <> 0 Then - R := (R Shr 1) Xor CRC32Poly - Else - R := R Shr 1; - CRC32Table[I] := R; - End; - CRC32TableInit := True; + For I := $00 To $FF Do + Begin + R := I; + For J := 8 Downto 1 Do + If R And 1 <> 0 Then + R := (R Shr 1) Xor CRC32Poly + Else + R := R Shr 1; + CRC32Table[I] := R; + End; + CRC32TableInit := True; End; Function CalcCRC32Byte(Const CRC32: LongWord; Const Octet: Byte): LongWord; Begin - Result := CRC32Table[Byte(CRC32) Xor Octet] Xor (CRC32 Shr 8); + Result := CRC32Table[Byte(CRC32) Xor Octet] Xor (CRC32 Shr 8); End; -Function CRC32Buf(Const CRC32: LongWord; Const Buf; Const BufSize: Integer): LongWord; +Function CRC32Buf(Const CRC32: LongWord; Const Buf; Const BufSize: Integer) + : LongWord; Var - P : PByte; - I : Integer; + P: PByte; + I: Integer; Begin - If Not CRC32TableInit Then - InitCRC32Table; - P := @Buf; - Result := CRC32; - For I := 1 To BufSize Do Begin - Result := CalcCRC32Byte(Result, P^); - Inc(P); - End; + If Not CRC32TableInit Then + InitCRC32Table; + P := @Buf; + Result := CRC32; + For I := 1 To BufSize Do + Begin + Result := CalcCRC32Byte(Result, P^); + Inc(P); + End; End; Procedure CRC32Init(Var CRC32: LongWord); Begin - CRC32 := $FFFFFFFF; + CRC32 := $FFFFFFFF; End; Function CalcCRC32(Const Buf; Const BufSize: Integer): LongWord; Begin - CRC32Init(Result); - Result := Not CRC32Buf(Result, Buf, BufSize); + CRC32Init(Result); + Result := Not CRC32Buf(Result, Buf, BufSize); End; -Function HashBuf(Const Buf; Const BufSize: Integer; Const Slots: LongWord): LongWord; +Function HashBuf(Const Buf; Const BufSize: Integer; Const Slots: LongWord) + : LongWord; Begin - If BufSize <= 0 Then - Result := 0 - Else - Result := CalcCRC32(Buf, BufSize); - // Mod into slots - If (Slots <> 0) And (Slots <> High(LongWord)) Then - Result := Result Mod Slots; + If BufSize <= 0 Then + Result := 0 + Else + Result := CalcCRC32(Buf, BufSize); + // Mod into slots + If (Slots <> 0) And (Slots <> High(LongWord)) Then + Result := Result Mod Slots; End; Function HashStr(Const StrBuf: Pointer; Const StrLength: Integer; - Const Slots: LongWord): LongWord; + Const Slots: LongWord): LongWord; Var - P : PChar; - I, J : Integer; + P: PChar; + I, J: Integer; - Procedure CRC32StrBuf(Const Size: Integer); - Begin + Procedure CRC32StrBuf(Const Size: Integer); + Begin - Result := CRC32Buf(Result, P^, Size); - End; + Result := CRC32Buf(Result, P^, Size); + End; Begin - // Return 0 for an empty string - Result := 0; - If (StrLength <= 0) Or Not Assigned(StrBuf) Then - exit; - - If Not CRC32TableInit Then - InitCRC32Table; - Result := $FFFFFFFF; - P := StrBuf; - - If StrLength <= 48 Then // Hash everything for short strings - CRC32StrBuf(StrLength) - Else Begin - // Hash first 16 bytes - CRC32StrBuf(16); - - // Hash last 16 bytes - Inc(P, StrLength - 16); - CRC32StrBuf(16); - - // Hash 16 bytes sampled from rest of string - I := (StrLength - 48) Div 16; - P := StrBuf; - Inc(P, 16); - For J := 1 To 16 Do Begin - CRC32StrBuf(1); - Inc(P, I + 1); - End; - End; - - // Mod into slots - If (Slots <> 0) And (Slots <> High(LongWord)) Then - Result := Result Mod Slots; + // Return 0 for an empty string + Result := 0; + If (StrLength <= 0) Or Not Assigned(StrBuf) Then + exit; + + If Not CRC32TableInit Then + InitCRC32Table; + Result := $FFFFFFFF; + P := StrBuf; + + If StrLength <= 48 Then // Hash everything for short strings + CRC32StrBuf(StrLength) + Else + Begin + // Hash first 16 bytes + CRC32StrBuf(16); + + // Hash last 16 bytes + Inc(P, StrLength - 16); + CRC32StrBuf(16); + + // Hash 16 bytes sampled from rest of string + I := (StrLength - 48) Div 16; + P := StrBuf; + Inc(P, 16); + For J := 1 To 16 Do + Begin + CRC32StrBuf(1); + Inc(P, I + 1); + End; + End; + + // Mod into slots + If (Slots <> 0) And (Slots <> High(LongWord)) Then + Result := Result Mod Slots; End; Function HashStr(Const S: AnsiString; Const Slots: LongWord): LongWord; Begin - Result := HashStr(Pointer(S), Length(S), Slots); + Result := HashStr(Pointer(S), Length(S), Slots); End; End. - diff --git a/Keyboard and Spell checker/SpellChecker/clsRegistry_XMLSetting.pas b/Keyboard and Spell checker/SpellChecker/clsRegistry_XMLSetting.pas index ed3d23c..ff6322f 100644 --- a/Keyboard and Spell checker/SpellChecker/clsRegistry_XMLSetting.pas +++ b/Keyboard and Spell checker/SpellChecker/clsRegistry_XMLSetting.pas @@ -1,258 +1,271 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= } {$INCLUDE ../../ProjectDefines.inc} - -{COMPLETE TRANSFERING!} - +{ COMPLETE TRANSFERING! } Unit clsRegistry_XMLSetting; Interface Uses - classes, - sysutils, - StrUtils, - NativeXML, - Forms, - Registry, - uFileFolderHandling; - -//Custom Registry class + classes, + sysutils, + StrUtils, + XmlDoc, XmlIntf, + Forms, + Registry, + uFileFolderHandling; + +// Custom Registry class Type - TMyRegistry = Class(TRegistry) - Public - Function ReadStringDef(Const Name: String; DefaultVal: String = ''): String; - Function ReadDateDef(Const Name: String; DefaultVal: TDateTime): TDateTime; - End; + TMyRegistry = Class(TRegistry) + Public + Function ReadStringDef(Const Name: String; DefaultVal: String = ''): String; + Function ReadDateDef(Const Name: String; DefaultVal: TDateTime): TDateTime; + End; - //Skeleton of Class TXMLSetting + // Skeleton of Class TXMLSetting Type - TXMLSetting = Class - Private - XML: TNativeXml; - child: TXmlNode; - - Public - Constructor Create; //Initializer - Destructor Destroy; Override; //Destructor - - Function LoadXMLData(): Boolean; - Function GetValue(Const ValueName: UTF8String; DefaultValue: String = ''): String; Overload; - Function GetValue(Const ValueName: UTF8String; DefaultValue: TDateTime): TDateTime; Overload; - Procedure CreateNewXMLData; - Procedure SetValue(Const ValueName: UTF8String; Const ValueData: String); Overload; - Procedure SetValue(Const ValueName: UTF8String; Const ValueData: TDateTime); Overload; - Procedure SaveXMLData; - - End; - - + TXMLSetting = Class + Private + XML: IXMLDocument; + child: IXmlNode; + + Public + Constructor Create; // Initializer + Destructor Destroy; Override; // Destructor + + Function LoadXMLData(): Boolean; + Function GetValue(Const ValueName: UTF8String; DefaultValue: String = '') + : String; Overload; + Function GetValue(Const ValueName: UTF8String; DefaultValue: TDateTime) + : TDateTime; Overload; + Procedure CreateNewXMLData; + Procedure SetValue(Const ValueName: UTF8String; + Const ValueData: String); Overload; + Procedure SetValue(Const ValueName: UTF8String; + Const ValueData: TDateTime); Overload; + Procedure SaveXMLData; + + End; Implementation -{===============================================================================} +{ =============================================================================== } { TXMLSetting } Constructor TXMLSetting.Create; Begin - Inherited; + Inherited; - XML := TNativeXml.Create; - XML.ExternalEncoding := seUTF8; + XML := TXMLDocument.Create(nil); + XML.Active := true; + XML.Encoding := 'UTF-8'; End; -{===============================================================================} +{ =============================================================================== } Procedure TXMLSetting.CreateNewXMLData; Begin - Xml.Free; - XML := TNativeXml.Create; - XML.EncodingString := 'UTF-8'; - XML.ExternalEncoding := seUTF8; - XML.Root.Name := 'Settings'; + if XML <> nil then + begin + XML.Active := false; + XML := nil; + end; + + XML := TXMLDocument.Create(nil); + XML.Active := true; + XML.Encoding := 'UTF-8'; + + XML.addChild('Settings'); End; -{===============================================================================} +{ =============================================================================== } Destructor TXMLSetting.Destroy; Begin - FreeAndNil(XML); - Inherited; + XML.Active := false; + XML := nil; + Inherited; End; -{===============================================================================} +{ =============================================================================== } Function TXMLSetting.GetValue(Const ValueName: UTF8String; - DefaultValue: TDateTime): TDateTime; + DefaultValue: TDateTime): TDateTime; Begin - Try - Child := Xml.Root.FindNode(ValueName); - Result := Child.Nodes[0].ValueAsDateTimeDef(DefaultValue); - Except - On E: Exception Do - Result := DefaultValue; - End; + Try + child := XML.documentElement.ChildNodes.FindNode(ValueName); + Result := child.ChildNodes.Nodes[0].NodeValue; + Except + On E: Exception Do + Result := DefaultValue; + End; End; -{===============================================================================} +{ =============================================================================== } Function TXMLSetting.GetValue(Const ValueName: UTF8String; - DefaultValue: String): String; + DefaultValue: String): String; Begin - Try - Child := Xml.Root.FindNode(ValueName); - If Length(Trim(Child.Nodes[0].ValueAsUnicodeString)) <= 0 Then - Result := DefaultValue - Else - Result := Trim(Child.Nodes[0].ValueAsUnicodeString); - Except - On E: Exception Do - Result := DefaultValue; - End; + Try + child := XML.documentElement.ChildNodes.FindNode(ValueName); + If Length(Trim(child.ChildNodes.Nodes[0].NodeValue)) <= 0 Then + Result := DefaultValue + Else + Result := Trim(child.ChildNodes.Nodes[0].NodeValue); + Except + On E: Exception Do + Result := DefaultValue; + End; End; -{===============================================================================} +{ =============================================================================== } {$HINTS Off} Function TXMLSetting.LoadXMLData(): Boolean; Var - SettingFileName : String; + SettingFileName: String; Begin - Result := False; - {$IFNDEF SpellCheckerDll} - SettingFileName := 'Spell Settings.xml'; - {$ELSE} - SettingFileName := 'Spell dll Settings.xml'; - {$ENDIF} - Try - If FileExists(GetAvroDataDir + SettingFileName) = True Then Begin - XML.LoadFromFile(GetAvroDataDir + SettingFileName); - Result := True; - End - Else - Result := False; - Except - On E: Exception Do - Result := False; - End; + Result := false; +{$IFNDEF SpellCheckerDll} + SettingFileName := 'Spell Settings.xml'; +{$ELSE} + SettingFileName := 'Spell dll Settings.xml'; +{$ENDIF} + Try + If FileExists(GetAvroDataDir + SettingFileName) = true Then + Begin + XML.LoadFromFile(GetAvroDataDir + SettingFileName); + Result := true; + End + Else + Result := false; + Except + On E: Exception Do + Result := false; + End; End; {$HINTS On} -{===============================================================================} +{ =============================================================================== } Procedure TXMLSetting.SaveXMLData; Var - SettingFileName : String; + SettingFileName: String; Begin - XML.XmlFormat := xfReadable; - {$IFNDEF SpellCheckerDll} - SettingFileName := 'Spell Settings.xml'; - {$ELSE} - SettingFileName := 'Spell dll Settings.xml'; - {$ENDIF} - Try - Xml.SaveToFile(GetAvroDataDir + SettingFileName); - Except - On E: Exception Do Begin - //Nothing - End; - End; + // XML.XmlFormat := xfReadable; +{$IFNDEF SpellCheckerDll} + SettingFileName := 'Spell Settings.xml'; +{$ELSE} + SettingFileName := 'Spell dll Settings.xml'; +{$ENDIF} + Try + XML.SaveToFile(GetAvroDataDir + SettingFileName); + Except + On E: Exception Do + Begin + // Nothing + End; + End; End; -{===============================================================================} +{ =============================================================================== } Procedure TXMLSetting.SetValue(Const ValueName: UTF8String; - Const ValueData: TDateTime); + Const ValueData: TDateTime); Var - CdataChild : TXmlNode; + CdataChild: IXmlNode; Begin - Child := XML.Root.NodeNew(ValueName); - CdataChild := Child.NodeNew(ValueName); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsDateTime := ValueData; + child := XML.documentElement.addChild(ValueName); + CdataChild := XML.CreateNode(DateTimeToStr(ValueData), ntCDATA); + XML.documentElement.ChildNodes.Nodes[ValueName].ChildNodes.Add(CdataChild); End; -{===============================================================================} +{ =============================================================================== } -Procedure TXMLSetting.SetValue(Const ValueName:UTF8String; Const ValueData: String); +Procedure TXMLSetting.SetValue(Const ValueName: UTF8String; + Const ValueData: String); Var - CdataChild : TXmlNode; + CdataChild: IXmlNode; Begin - Child := XML.Root.NodeNew(ValueName); - CdataChild := Child.NodeNew(ValueName); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := ValueData; + + child := XML.documentElement.addChild(ValueName); + CdataChild := XML.CreateNode(ValueData, ntCDATA); + XML.documentElement.ChildNodes.Nodes[ValueName].ChildNodes.Add(CdataChild); End; -{===============================================================================} -{===============================================================================} -{===============================================================================} +{ =============================================================================== } +{ =============================================================================== } +{ =============================================================================== } { TMyRegistry } -{===============================================================================} +{ =============================================================================== } -Function TMyRegistry.ReadDateDef(Const Name: String; - DefaultVal: TDateTime): TDateTime; +Function TMyRegistry.ReadDateDef(Const Name: String; DefaultVal: TDateTime) + : TDateTime; Begin - Try - If ValueExists(Name) = True Then Begin - Result := ReadDateTime(Name); - End - Else Begin - Result := DefaultVal; - End; - Except - On E: Exception Do - Result := DefaultVal; - End; + Try + If ValueExists(Name) = true Then + Begin + Result := ReadDateTime(Name); + End + Else + Begin + Result := DefaultVal; + End; + Except + On E: Exception Do + Result := DefaultVal; + End; End; -{===============================================================================} +{ =============================================================================== } Function TMyRegistry.ReadStringDef(Const Name: String; - DefaultVal: String = ''): String; + DefaultVal: String = ''): String; Begin - Try - If ValueExists(Name) = True Then Begin - Result := ReadString(Name); - End - Else Begin - Result := DefaultVal; - End; - Except - On E: Exception Do - If Trim(Result) = '' Then - Result := DefaultVal; - End; + Try + If ValueExists(Name) = true Then + Begin + Result := ReadString(Name); + End + Else + Begin + Result := DefaultVal; + End; + Except + On E: Exception Do + If Trim(Result) = '' Then + Result := DefaultVal; + End; End; End. - diff --git a/Keyboard and Spell checker/Units/BanglaChars.pas b/Keyboard and Spell checker/Units/BanglaChars.pas index dbf3c16..1130d75 100644 --- a/Keyboard and Spell checker/Units/BanglaChars.pas +++ b/Keyboard and Spell checker/Units/BanglaChars.pas @@ -1,228 +1,211 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= } - {$IFDEF SpellChecker} {$INCLUDE ../../ProjectDefines.inc} {$ELSE} {$INCLUDE ../ProjectDefines.inc} {$ENDIF} - -{COMPLETE TRANSFERING!} +{ COMPLETE TRANSFERING! } Unit BanglaChars; Interface Const - {$REGION 'Unusual Bangla Characters'} - { - '============================================================== - '============================================================== - 'Unusual Bangla Characters - } - - {$REGION 'Vowels'} - {''''''''''''''''''''''''''''''''''''''''''''''''''' - 'Vowels - '''''''''''''''''''''''''''''''''''''''''''''''''''} - b_Vocalic_L : Char = #$98C; - b_Vocalic_LL : Char = #$9E1; - b_Vocalic_RR : Char = #$9E0; - {''''''''''''''''''''''''''''''''''''''''''''''''''' - ' End Vowels - '''''''''''''''''''''''''''''''''''''''''''''''''''} - {$ENDREGION} - - - {$REGION 'Vowels Signs (Kar/Matra)'} - {''''''''''''''''''''''''''''''''''''''''''''''''''' - 'Vowels Signs (Kar/Matra) - '''''''''''''''''''''''''''''''''''''''''''''''''''} - b_Vocalic_RR_Kar : Char = #$9C4; - b_Vocalic_L_Kar : Char = #$9E2; - b_Vocalic_LL_Kar : Char = #$9E3; - {''''''''''''''''''''''''''''''''''''''''''''''''''' - ' End Vowels Signs (Kar/Matra) - '''''''''''''''''''''''''''''''''''''''''''''''''''} - {$ENDREGION} - - - {$REGION 'Signs'} - {''''''''''''''''''''''''''''''''''''''''''''''''''' - 'Signs - '''''''''''''''''''''''''''''''''''''''''''''''''''} - b_Nukta : Char = #$9BC; - b_Avagraha : Char = #$9BD; - b_LengthMark : Char = #$9D7; - {''''''''''''''''''''''''''''''''''''''''''''''''''' - 'End Signs - '''''''''''''''''''''''''''''''''''''''''''''''''''} - {$ENDREGION} - - {$REGION 'Additional'} - {''''''''''''''''''''''''''''''''''''''''''''''''''' - 'Additional - '''''''''''''''''''''''''''''''''''''''''''''''''''} - b_RupeeMark : Char = #$9F2; - b_CurrencyNumerator1 : Char = #$9F4; - b_CurrencyNumerator2 : Char = #$9F5; - b_CurrencyNumerator3 : Char = #$9F6; - b_CurrencyNumerator4 : Char = #$9F7; - b_CurrencyNumerator1LessThanDenominator: Char = #$9F8; - b_CurrencyDenominator16 : Char = #$9F9; - b_CurrencyEsshar : Char = #$9FA; - {''''''''''''''''''''''''''''''''''''''''''''''''''' - 'End Additional - '''''''''''''''''''''''''''''''''''''''''''''''''''} - {$ENDREGION} - - {'End Unusual Bangla Characters - '============================================================== - '==============================================================} - {$ENDREGION} - - - {$REGION 'Bangla Numbers'} - {'============================================================== - 'Bangla Numbers - '==============================================================} - b_0 : Char = #$9E6; - b_1 : Char = #$9E7; - b_2 : Char = #$9E8; - b_3 : Char = #$9E9; - b_4 : Char = #$9EA; - b_5 : Char = #$9EB; - b_6 : Char = #$9EC; - b_7 : Char = #$9ED; - b_8 : Char = #$9EE; - b_9 : Char = #$9EF; - {'============================================================== - 'End Bangla Numbers - '==============================================================} - {$ENDREGION} - - - {$REGION 'Bangla Vowels and Kars'} - {'============================================================== - 'Bangla Vowels and Kars - '==============================================================} - b_A : Char = #$985; - b_AA : Char = #$986; - b_AAkar : Char = #$9BE; - b_I : Char = #$987; - b_II : Char = #$988; - b_IIkar : Char = #$9C0; - b_Ikar : Char = #$9BF; - b_U : Char = #$989; - b_Ukar : Char = #$9C1; - b_UU : Char = #$98A; - b_UUkar : Char = #$9C2; - b_RRI : Char = #$98B; - b_RRIkar : Char = #$9C3; - b_E : Char = #$98F; - b_Ekar : Char = #$9C7; - b_O : Char = #$993; - b_OI : Char = #$990; - b_OIkar : Char = #$9C8; - b_Okar : Char = #$9CB; - b_OU : Char = #$994; - b_OUkar : Char = #$9CC; - {'============================================================== - 'End Bangla Vowels and Kars - '==============================================================} - {$ENDREGION} - - - {$REGION 'Bangla Consonents'} - {'============================================================== - 'Bangla Consonents - '==============================================================} - b_Anushar : Char = #$982; - b_B : Char = #$9AC; - b_Bh : Char = #$9AD; - b_Bisharga : Char = #$983; - b_C : Char = #$99A; - b_CH : Char = #$99B; - b_Chandra : Char = #$981; - b_D : Char = #$9A6; - b_Dd : Char = #$9A1; - b_Ddh : Char = #$9A2; - b_Dh : Char = #$9A7; - b_G : Char = #$997; - b_GH : Char = #$998; - b_H : Char = #$9B9; - b_J : Char = #$99C; - b_JH : Char = #$99D; - b_K : Char = #$995; - b_KH : Char = #$996; - b_L : Char = #$9B2; - b_M : Char = #$9AE; - b_N : Char = #$9A8; - b_NGA : Char = #$999; - b_Nn : Char = #$9A3; - b_NYA : Char = #$99E; - b_P : Char = #$9AA; - b_Ph : Char = #$9AB; - b_R : Char = #$9B0; - b_Rr : Char = #$9DC; - b_Rrh : Char = #$9DD; - b_S : Char = #$9B8; - b_Sh : Char = #$9B6; - b_Ss : Char = #$9B7; - b_T : Char = #$9A4; - b_Th : Char = #$9A5; - b_Tt : Char = #$99F; - b_Tth : Char = #$9A0; - b_Y : Char = #$9DF; - b_Z : Char = #$9AF; - AssamRa : Char = #$9F0; - AssamVa : Char = #$9F1; - b_Khandatta : Char = #$9CE; - {'============================================================== - 'End Bangla Consonents - '==============================================================} - {$ENDREGION} - - - {$REGION 'Bangla Others'} - {'============================================================== - 'Bangla Others - '==============================================================} - b_Dari : Char = #$964; - b_Hasanta : Char = #$9CD; - b_Taka : Char = #$9F3; - ZWJ : Char = #$200D; - ZWNJ : Char = #$200C; - {'============================================================== - 'End Bangla Others - '==============================================================} - {$ENDREGION} - +{$REGION 'Unusual Bangla Characters'} + { + '============================================================== + '============================================================== + 'Unusual Bangla Characters + } + +{$REGION 'Vowels'} + { ''''''''''''''''''''''''''''''''''''''''''''''''''' + 'Vowels + ''''''''''''''''''''''''''''''''''''''''''''''''''' } + b_Vocalic_L: Char = #$98C; + b_Vocalic_LL: Char = #$9E1; + b_Vocalic_RR: Char = #$9E0; + { ''''''''''''''''''''''''''''''''''''''''''''''''''' + ' End Vowels + ''''''''''''''''''''''''''''''''''''''''''''''''''' } +{$ENDREGION} +{$REGION 'Vowels Signs (Kar/Matra)'} + { ''''''''''''''''''''''''''''''''''''''''''''''''''' + 'Vowels Signs (Kar/Matra) + ''''''''''''''''''''''''''''''''''''''''''''''''''' } + b_Vocalic_RR_Kar: Char = #$9C4; + b_Vocalic_L_Kar: Char = #$9E2; + b_Vocalic_LL_Kar: Char = #$9E3; + { ''''''''''''''''''''''''''''''''''''''''''''''''''' + ' End Vowels Signs (Kar/Matra) + ''''''''''''''''''''''''''''''''''''''''''''''''''' } +{$ENDREGION} +{$REGION 'Signs'} + { ''''''''''''''''''''''''''''''''''''''''''''''''''' + 'Signs + ''''''''''''''''''''''''''''''''''''''''''''''''''' } + b_Nukta: Char = #$9BC; + b_Avagraha: Char = #$9BD; + b_LengthMark: Char = #$9D7; + { ''''''''''''''''''''''''''''''''''''''''''''''''''' + 'End Signs + ''''''''''''''''''''''''''''''''''''''''''''''''''' } +{$ENDREGION} +{$REGION 'Additional'} + { ''''''''''''''''''''''''''''''''''''''''''''''''''' + 'Additional + ''''''''''''''''''''''''''''''''''''''''''''''''''' } + b_RupeeMark: Char = #$9F2; + b_CurrencyNumerator1: Char = #$9F4; + b_CurrencyNumerator2: Char = #$9F5; + b_CurrencyNumerator3: Char = #$9F6; + b_CurrencyNumerator4: Char = #$9F7; + b_CurrencyNumerator1LessThanDenominator: Char = #$9F8; + b_CurrencyDenominator16: Char = #$9F9; + b_CurrencyEsshar: Char = #$9FA; + { ''''''''''''''''''''''''''''''''''''''''''''''''''' + 'End Additional + ''''''''''''''''''''''''''''''''''''''''''''''''''' } +{$ENDREGION} + { 'End Unusual Bangla Characters + '============================================================== + '============================================================== } +{$ENDREGION} +{$REGION 'Bangla Numbers'} + { '============================================================== + 'Bangla Numbers + '============================================================== } + b_0: Char = #$9E6; + b_1: Char = #$9E7; + b_2: Char = #$9E8; + b_3: Char = #$9E9; + b_4: Char = #$9EA; + b_5: Char = #$9EB; + b_6: Char = #$9EC; + b_7: Char = #$9ED; + b_8: Char = #$9EE; + b_9: Char = #$9EF; + { '============================================================== + 'End Bangla Numbers + '============================================================== } +{$ENDREGION} +{$REGION 'Bangla Vowels and Kars'} + { '============================================================== + 'Bangla Vowels and Kars + '============================================================== } + b_A: Char = #$985; + b_AA: Char = #$986; + b_AAkar: Char = #$9BE; + b_I: Char = #$987; + b_II: Char = #$988; + b_IIkar: Char = #$9C0; + b_Ikar: Char = #$9BF; + b_U: Char = #$989; + b_Ukar: Char = #$9C1; + b_UU: Char = #$98A; + b_UUkar: Char = #$9C2; + b_RRI: Char = #$98B; + b_RRIkar: Char = #$9C3; + b_E: Char = #$98F; + b_Ekar: Char = #$9C7; + b_O: Char = #$993; + b_OI: Char = #$990; + b_OIkar: Char = #$9C8; + b_Okar: Char = #$9CB; + b_OU: Char = #$994; + b_OUkar: Char = #$9CC; + { '============================================================== + 'End Bangla Vowels and Kars + '============================================================== } +{$ENDREGION} +{$REGION 'Bangla Consonents'} + { '============================================================== + 'Bangla Consonents + '============================================================== } + b_Anushar: Char = #$982; + b_B: Char = #$9AC; + b_Bh: Char = #$9AD; + b_Bisharga: Char = #$983; + b_C: Char = #$99A; + b_CH: Char = #$99B; + b_Chandra: Char = #$981; + b_D: Char = #$9A6; + b_Dd: Char = #$9A1; + b_Ddh: Char = #$9A2; + b_Dh: Char = #$9A7; + b_G: Char = #$997; + b_GH: Char = #$998; + b_H: Char = #$9B9; + b_J: Char = #$99C; + b_JH: Char = #$99D; + b_K: Char = #$995; + b_KH: Char = #$996; + b_L: Char = #$9B2; + b_M: Char = #$9AE; + b_N: Char = #$9A8; + b_NGA: Char = #$999; + b_Nn: Char = #$9A3; + b_NYA: Char = #$99E; + b_P: Char = #$9AA; + b_Ph: Char = #$9AB; + b_R: Char = #$9B0; + b_Rr: Char = #$9DC; + b_Rrh: Char = #$9DD; + b_S: Char = #$9B8; + b_Sh: Char = #$9B6; + b_Ss: Char = #$9B7; + b_T: Char = #$9A4; + b_Th: Char = #$9A5; + b_Tt: Char = #$99F; + b_Tth: Char = #$9A0; + b_Y: Char = #$9DF; + b_Z: Char = #$9AF; + AssamRa: Char = #$9F0; + AssamVa: Char = #$9F1; + b_Khandatta: Char = #$9CE; + { '============================================================== + 'End Bangla Consonents + '============================================================== } +{$ENDREGION} +{$REGION 'Bangla Others'} + { '============================================================== + 'Bangla Others + '============================================================== } + b_Dari: Char = #$964; + b_Hasanta: Char = #$9CD; + b_Taka: Char = #$9F3; + ZWJ: Char = #$200D; + ZWNJ: Char = #$200C; + { '============================================================== + 'End Bangla Others + '============================================================== } +{$ENDREGION} Function IsVowel(Const strX: String): Boolean; Function IsPureConsonent(Const strX: String): Boolean; Function IsKar(Const strX: String): Boolean; @@ -233,133 +216,70 @@ Function IsVowel(Const strX: String): Boolean; Var - WC : Char; + WC: Char; Begin - Result := false; - + Result := false; - WC := strx[1]; + WC := strX[1]; - If (WC = b_A) Or - (WC = b_AA) Or - (WC = b_AAkar) Or - (WC = b_I) Or - (WC = b_II) Or - (WC = b_IIkar) Or - (WC = b_Ikar) Or - (WC = b_U) Or - (WC = b_Ukar) Or - (WC = b_UU) Or - (WC = b_UUkar) Or - (WC = b_RRI) Or - (WC = b_RRIkar) Or - (WC = b_E) Or - (WC = b_Ekar) Or - (WC = b_OI) Or - (WC = b_OIkar) Or - (WC = b_O) Or - (WC = b_Okar) Or - (WC = b_OU) Or - (WC = b_OUkar) Or - (WC = b_Vocalic_L) Or - (WC = b_Vocalic_LL) Or - (WC = b_Vocalic_RR) Or - (WC = b_Vocalic_RR_Kar) Or - (WC = b_Vocalic_L_Kar) Or - (WC = b_Vocalic_LL_Kar) Then - Result := True - Else - Result := false; + If (WC = b_A) Or (WC = b_AA) Or (WC = b_AAkar) Or (WC = b_I) Or (WC = b_II) Or + (WC = b_IIkar) Or (WC = b_Ikar) Or (WC = b_U) Or (WC = b_Ukar) Or + (WC = b_UU) Or (WC = b_UUkar) Or (WC = b_RRI) Or (WC = b_RRIkar) Or + (WC = b_E) Or (WC = b_Ekar) Or (WC = b_OI) Or (WC = b_OIkar) Or (WC = b_O) + Or (WC = b_Okar) Or (WC = b_OU) Or (WC = b_OUkar) Or (WC = b_Vocalic_L) Or + (WC = b_Vocalic_LL) Or (WC = b_Vocalic_RR) Or (WC = b_Vocalic_RR_Kar) Or + (WC = b_Vocalic_L_Kar) Or (WC = b_Vocalic_LL_Kar) Then + Result := True + Else + Result := false; End; {$HINTS On} - {$HINTS Off} Function IsPureConsonent(Const strX: String): Boolean; Var - WC : Char; + WC: Char; Begin - Result := false; - - WC := strX[1]; - - If (WC = b_B) Or - (WC = b_Bh) Or - (WC = b_C) Or - (WC = b_CH) Or - (WC = b_D) Or - (WC = b_Dd) Or - (WC = b_Ddh) Or - (WC = b_Dh) Or - (WC = b_G) Or - (WC = b_GH) Or - (WC = b_H) Or - (WC = b_J) Or - (WC = b_JH) Or - (WC = b_K) Or - (WC = b_KH) Or - (WC = b_L) Or - (WC = b_M) Or - (WC = b_N) Or - (WC = b_NGA) Or - (WC = b_Nn) Or - (WC = b_NYA) Or - (WC = b_P) Or - (WC = b_Ph) Or - (WC = b_R) Or - (WC = b_Rr) Or - (WC = b_Rrh) Or - (WC = b_S) Or - (WC = b_Sh) Or - (WC = b_Ss) Or - (WC = b_T) Or - (WC = b_Th) Or - (WC = b_Tt) Or - (WC = b_Tth) Or - (WC = b_Z) Or - (WC = b_Y) Or - (WC = b_Khandatta) Or - (WC = AssamRa) Or - (WC = AssamVa) Then - Result := True - Else - Result := False; + Result := false; + + WC := strX[1]; + + If (WC = b_B) Or (WC = b_Bh) Or (WC = b_C) Or (WC = b_CH) Or (WC = b_D) Or + (WC = b_Dd) Or (WC = b_Ddh) Or (WC = b_Dh) Or (WC = b_G) Or (WC = b_GH) Or + (WC = b_H) Or (WC = b_J) Or (WC = b_JH) Or (WC = b_K) Or (WC = b_KH) Or + (WC = b_L) Or (WC = b_M) Or (WC = b_N) Or (WC = b_NGA) Or (WC = b_Nn) Or + (WC = b_NYA) Or (WC = b_P) Or (WC = b_Ph) Or (WC = b_R) Or (WC = b_Rr) Or + (WC = b_Rrh) Or (WC = b_S) Or (WC = b_Sh) Or (WC = b_Ss) Or (WC = b_T) Or + (WC = b_Th) Or (WC = b_Tt) Or (WC = b_Tth) Or (WC = b_Z) Or (WC = b_Y) Or + (WC = b_Khandatta) Or (WC = AssamRa) Or (WC = AssamVa) Then + Result := True + Else + Result := false; End; {$HINTS On} - {$HINTS Off} Function IsKar(Const strX: String): Boolean; Var - WC : Char; + WC: Char; Begin - Result := false; - + Result := false; - WC := strX[1]; + WC := strX[1]; - If (WC = b_AAkar) Or - (WC = b_IIkar) Or - (WC = b_Ikar) Or - (WC = b_Ukar) Or - (WC = b_UUkar) Or - (WC = b_RRIkar) Or - (WC = b_Ekar) Or - (WC = b_OIkar) Or - (WC = b_OUkar) Or - (WC = b_Vocalic_RR_Kar) Or - (WC = b_Vocalic_L_Kar) Or - (WC = b_Vocalic_LL_Kar) Then - Result := True - Else - Result := False; + If (WC = b_AAkar) Or (WC = b_IIkar) Or (WC = b_Ikar) Or (WC = b_Ukar) Or + (WC = b_UUkar) Or (WC = b_RRIkar) Or (WC = b_Ekar) Or (WC = b_OIkar) Or + (WC = b_OUkar) Or (WC = b_Vocalic_RR_Kar) Or (WC = b_Vocalic_L_Kar) Or + (WC = b_Vocalic_LL_Kar) Then + Result := True + Else + Result := false; End; {$HINTS On} End. - diff --git a/Keyboard and Spell checker/Units/KeyboardFunctions.pas b/Keyboard and Spell checker/Units/KeyboardFunctions.pas index 4bba7b1..635f796 100644 --- a/Keyboard and Spell checker/Units/KeyboardFunctions.pas +++ b/Keyboard and Spell checker/Units/KeyboardFunctions.pas @@ -1,25 +1,25 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= @@ -30,14 +30,13 @@ {$ELSE} {$INCLUDE ../ProjectDefines.inc} {$ENDIF} - Unit KeyboardFunctions; Interface -Uses - Windows, - SysUtils; +Uses + Windows, + SysUtils; Procedure TurnOffKey(Const vkKey: Integer); Procedure Backspace(KeyRepeat: Integer = 1); @@ -62,405 +61,428 @@ Procedure RevertCtrlStates; Procedure RevertAltStates; - Var - //Alter states - RightAlterKeyDown : Boolean; - LeftAlterKeyDown : Boolean; - GeneralAlterKeyDown : Boolean; - //Control states - RightCtrlKeyDown : Boolean; - LeftCtrlKeyDown : Boolean; - GeneralCtrlKeyDown : Boolean; - - + // Alter states + RightAlterKeyDown: Boolean; + LeftAlterKeyDown: Boolean; + GeneralAlterKeyDown: Boolean; + // Control states + RightCtrlKeyDown: Boolean; + LeftCtrlKeyDown: Boolean; + GeneralCtrlKeyDown: Boolean; Implementation -{===============================================================================} +{ =============================================================================== } Const - KEYEVENTF_UNICODE : Integer = $4; + KEYEVENTF_UNICODE: Integer = $4; - {===========================================================================} + { =========================================================================== } Function IfIgnorableModifierKey(Const KeyCode: Integer): Boolean; Begin - Case KeyCode Of - VK_LWIN, VK_LSHIFT, VK_LCONTROL, VK_LMENU, VK_PACKET, VK_NUMLOCK, - VK_CAPITAL, VK_MENU, VK_CONTROL, VK_SHIFT, VK_RWIN, VK_RSHIFT, - VK_RMENU, VK_RCONTROL: - Result := True; - Else - Result := False; - End; + Case KeyCode Of + VK_LWIN, VK_LSHIFT, VK_LCONTROL, VK_LMENU, VK_PACKET, VK_NUMLOCK, + VK_CAPITAL, VK_MENU, VK_CONTROL, VK_SHIFT, VK_RWIN, VK_RSHIFT, VK_RMENU, + VK_RCONTROL: + Result := True; + Else + Result := False; + End; End; +{ =============================================================================== } -{===============================================================================} +{$HINTS Off} -{$Hints Off} Function IfOnlyCtrlKey: Boolean; Begin -Result:=False; - If (IfControl = True) And (RightAlterKeyDown = False) And (GeneralAlterKeyDown = False) - And (LeftAlterKeyDown = False) Then - Result := True - Else - Result := False; + Result := False; + If (IfControl = True) And (RightAlterKeyDown = False) And + (GeneralAlterKeyDown = False) And (LeftAlterKeyDown = False) Then + Result := True + Else + Result := False; End; -{$Hints On} +{$HINTS On} +{$HINTS Off} -{$Hints Off} Function IfOnlyLeftAltKey: Boolean; -{Var - LAlter : Boolean; - keyState : Integer;} +{ Var + LAlter : Boolean; + keyState : Integer; } Begin -Result:=False; - { - LAlter := False; - keyState := GetKeyState(VK_LMENU); - If keyState And 128 = 128 Then LAlter := True; - - If (IfControl = False) And (LAlter = True) Then - Result := True - Else - Result := False; - } - If (IfControl = False) And (LeftAlterKeyDown = True) Then - Result := True - Else - Result := False; + Result := False; + { + LAlter := False; + keyState := GetKeyState(VK_LMENU); + If keyState And 128 = 128 Then LAlter := True; + + If (IfControl = False) And (LAlter = True) Then + Result := True + Else + Result := False; + } + If (IfControl = False) And (LeftAlterKeyDown = True) Then + Result := True + Else + Result := False; End; -{$Hints On} +{$HINTS On} +{ =============================================================================== } -{===============================================================================} +{$HINTS Off} -{$Hints Off} Function IfWinKey: Boolean; Var - LWin, RWin : Boolean; - keyState : Integer; + LWin, RWin: Boolean; + keyState: Integer; Begin -Result:=False; - LWin := False; - RWin := False; - - keyState := GetKeyState(VK_LWIN); - If keyState And 128 = 128 Then LWin := True; - keyState := GetKeyState(VK_RWIN); - If keyState And 128 = 128 Then RWin := True; - - If (LWin = true) Or (RWin = true) Then - Result := True - Else - Result := False; + Result := False; + LWin := False; + RWin := False; + + keyState := GetKeyState(VK_LWIN); + If keyState And 128 = 128 Then + LWin := True; + keyState := GetKeyState(VK_RWIN); + If keyState And 128 = 128 Then + RWin := True; + + If (LWin = True) Or (RWin = True) Then + Result := True + Else + Result := False; End; - {$Hints On} -{===============================================================================} +{$HINTS On} +{ =============================================================================== } + +{$HINTS Off} -{$Hints Off} Function IfAlter: Boolean; -{Var - LAlter, RAlter : Boolean; - keyState : Integer;} +{ Var + LAlter, RAlter : Boolean; + keyState : Integer; } Begin -Result:=False; - { LAlter := False; - RAlter := False; - - keyState := GetKeyState(VK_LMENU); - If keyState And 128 = 128 Then LAlter := True; - keyState := GetKeyState(VK_RMENU); - If keyState And 128 = 128 Then RAlter := True; - - If (LAlter = true) Or (RAlter = true) Then - Result := True - Else - Result := False; } - - If (RightAlterKeyDown = true) Or (LeftAlterKeyDown = True) Or (GeneralAlterKeyDown = True) Then - Result := True - Else - Result := False; + Result := False; + { LAlter := False; + RAlter := False; + + keyState := GetKeyState(VK_LMENU); + If keyState And 128 = 128 Then LAlter := True; + keyState := GetKeyState(VK_RMENU); + If keyState And 128 = 128 Then RAlter := True; + + If (LAlter = true) Or (RAlter = true) Then + Result := True + Else + Result := False; } + + If (RightAlterKeyDown = True) Or (LeftAlterKeyDown = True) Or + (GeneralAlterKeyDown = True) Then + Result := True + Else + Result := False; End; -{$Hints On} -{===============================================================================} -{$Hints Off} +{$HINTS On} +{ =============================================================================== } +{$HINTS Off} + Function IfControl: Boolean; Var - LControl, RControl : Boolean; - keyState : Integer; + LControl, RControl: Boolean; + keyState: Integer; Begin -Result:=False; - LControl := False; - RControl := False; - - keyState := GetKeyState(VK_LCONTROL); - If keyState And 128 = 128 Then LControl := True; - keyState := GetKeyState(VK_RCONTROL); - If keyState And 128 = 128 Then RControl := True; - - If (LControl = true) Or (RControl = true) Then - Result := True - Else - Result := False; + Result := False; + LControl := False; + RControl := False; + + keyState := GetKeyState(VK_LCONTROL); + If keyState And 128 = 128 Then + LControl := True; + keyState := GetKeyState(VK_RCONTROL); + If keyState And 128 = 128 Then + RControl := True; + + If (LControl = True) Or (RControl = True) Then + Result := True + Else + Result := False; End; -{$Hints On} -{===============================================================================} -{$Hints Off} +{$HINTS On} +{ =============================================================================== } +{$HINTS Off} + Function IfAltGr: Boolean; Begin -Result:=False; - { If (IfControl = True) And (IfAlter = True) Then - Result := True - Else If RightAlterKeyDown = True Then - Result := True - Else - Result := False; - } - If (LeftCtrlKeyDown = True) And (LeftAlterKeyDown = True) Then - Result := True - Else If (RightAlterKeyDown = True) Then - Result := True - Else - Result := False; + Result := False; + { If (IfControl = True) And (IfAlter = True) Then + Result := True + Else If RightAlterKeyDown = True Then + Result := True + Else + Result := False; + } + If (LeftCtrlKeyDown = True) And (LeftAlterKeyDown = True) Then + Result := True + Else If (RightAlterKeyDown = True) Then + Result := True + Else + Result := False; End; -{$Hints On} -{===============================================================================} -{$Hints Off} +{$HINTS On} +{ =============================================================================== } +{$HINTS Off} + Function IfOnlyShift: Boolean; Var - keyState : Integer; + keyState: Integer; Begin -Result:=False; - keyState := GetKeyState(VK_SHIFT); - If keyState And 128 = 128 Then - Result := True - Else - Result := False; + Result := False; + keyState := GetKeyState(VK_SHIFT); + If keyState And 128 = 128 Then + Result := True + Else + Result := False; End; -{$Hints On} -{===============================================================================} -{$Hints Off} +{$HINTS On} +{ =============================================================================== } +{$HINTS Off} + Function IfTrueShift_L: Boolean; Var - keyState : Integer; + keyState: Integer; Begin -Result:=False; - keyState := GetKeyState(VK_LSHIFT); - If keyState And 128 = 128 Then - Result := True - Else - Result := False; + Result := False; + keyState := GetKeyState(VK_LSHIFT); + If keyState And 128 = 128 Then + Result := True + Else + Result := False; End; -{$Hints On} -{===============================================================================} -{$Hints Off} +{$HINTS On} +{ =============================================================================== } +{$HINTS Off} + Function IfTrueShift_R: Boolean; Var - keyState : Integer; + keyState: Integer; Begin -Result:=False; - keyState := GetKeyState(VK_RSHIFT); - If keyState And 128 = 128 Then - Result := True - Else - Result := False; + Result := False; + keyState := GetKeyState(VK_RSHIFT); + If keyState And 128 = 128 Then + Result := True + Else + Result := False; End; -{$Hints On} -{===============================================================================} -{$Hints Off} +{$HINTS On} +{ =============================================================================== } +{$HINTS Off} + Function IfTrueShift: Boolean; Begin -Result:=False; - If (IfTrueShift_R = True) Or (IfTrueShift_L = True) Then - Result := True - Else - Result := False; + Result := False; + If (IfTrueShift_R = True) Or (IfTrueShift_L = True) Then + Result := True + Else + Result := False; End; -{$Hints On} -{===============================================================================} -{$Hints Off} +{$HINTS On} +{ =============================================================================== } +{$HINTS Off} + Function IfShift: Boolean; Var - bShift, bCapslock : Boolean; - keyState : Integer; + bShift, bCapslock: Boolean; + keyState: Integer; Begin - Result := False; - bShift:=False; - bCapsLock:=False; - - If (IfTrueShift_R = True) Or (IfTrueShift_L = True) Then - bShift := True - Else - bShift := False; - - keyState := GetKeyState(VK_CAPITAL); - If keyState And $01 <> 0 Then - bCapslock := True - Else - bCapslock := False; - - If (bShift = True) And (bCapslock = True) Then - Result := False - Else If (bShift = True) And (bCapslock = False) Then - Result := True - Else If (bCapslock = True) And (bShift = False) Then - Result := True - Else If (bShift = False) And (bCapslock = False) Then - Result := False; + Result := False; + bShift := False; + bCapslock := False; + + If (IfTrueShift_R = True) Or (IfTrueShift_L = True) Then + bShift := True + Else + bShift := False; + + keyState := GetKeyState(VK_CAPITAL); + If keyState And $01 <> 0 Then + bCapslock := True + Else + bCapslock := False; + + If (bShift = True) And (bCapslock = True) Then + Result := False + Else If (bShift = True) And (bCapslock = False) Then + Result := True + Else If (bCapslock = True) And (bShift = False) Then + Result := True + Else If (bShift = False) And (bCapslock = False) Then + Result := False; End; -{$Hints On} -{===============================================================================} +{$HINTS On} +{ =============================================================================== } Procedure TurnOffKey(Const vkKey: Integer); Var - KBState : TKeyboardState; + KBState: TKeyboardState; Begin - GetKeyboardState(KBState); - KBState[vkKey] := 0; - SetKeyboardState(KBState); + GetKeyboardState(KBState); + KBState[vkKey] := 0; + SetKeyboardState(KBState); End; -{===============================================================================} +{ =============================================================================== } Procedure Backspace(KeyRepeat: Integer = 1); -{Var - I : integer; +{ Var + I : integer; -Begin - If KeyRepeat <= 0 Then KeyRepeat := 1; + Begin + If KeyRepeat <= 0 Then KeyRepeat := 1; - For I := 1 To KeyRepeat Do Begin - SendKey_SendInput(VK_Back); - End;} + For I := 1 To KeyRepeat Do Begin + SendKey_SendInput(VK_Back); + End; } Var - I : integer; + I: Integer; Begin - If KeyRepeat <= 0 Then KeyRepeat := 1; + If KeyRepeat <= 0 Then + KeyRepeat := 1; - If RightCtrlKeyDown = True Then SendInput_Up(VK_RCONTROL); - If LeftCtrlKeyDown = True Then SendInput_Up(VK_LCONTROL); + If RightCtrlKeyDown = True Then + SendInput_UP(VK_RCONTROL); + If LeftCtrlKeyDown = True Then + SendInput_UP(VK_LCONTROL); - For I := 1 To KeyRepeat Do Begin - SendKey_SendInput(VK_Back); - End; + For I := 1 To KeyRepeat Do + Begin + SendKey_SendInput(VK_Back); + End; - RevertCtrlStates; + RevertCtrlStates; End; -{===============================================================================} +{ =============================================================================== } Procedure SendKey_Char(Const Keytext: String); Var - i : integer; + I: Integer; Begin - For I := 1 To Length(Keytext) Do Begin - SendKey_Basic(Ord(Keytext[i])); - End; + For I := 1 To Length(Keytext) Do + Begin + SendKey_Basic(Ord(Keytext[I])); + End; End; -{===============================================================================} +{ =============================================================================== } Procedure SendKey_SendInput(Const bKey: Integer); Begin - SendInput_Down(bKey); - SendInput_UP(bKey); + SendInput_Down(bKey); + SendInput_UP(bKey); End; -{===============================================================================} +{ =============================================================================== } Procedure SendInput_UP(Const bKey: Integer); Var - KInput : TInput; + KInput: TInput; Begin - KInput.Itype := INPUT_KEYBOARD; - With KInput.ki Do Begin - wVk := bKey; - wScan := MapVirtualKey(wVk, 0); - dwFlags := KEYEVENTF_KEYUP; - time := 0; - dwExtraInfo := 0; - End; - SendInput(1, KInput, SizeOf(KInput)); + KInput.Itype := INPUT_KEYBOARD; + With KInput.ki Do + Begin + wVk := bKey; + wScan := MapVirtualKey(wVk, 0); + dwFlags := KEYEVENTF_KEYUP; + time := 0; + dwExtraInfo := 0; + End; + SendInput(1, KInput, SizeOf(KInput)); End; -{===============================================================================} +{ =============================================================================== } Procedure SendInput_Down(Const bKey: Integer); Var - KInput : TInput; + KInput: TInput; Begin - KInput.Itype := INPUT_KEYBOARD; - With KInput.ki Do Begin - wVk := bKey; - wScan := MapVirtualKey(wVk, 0); - dwFlags := 0; - time := 0; - dwExtraInfo := 0; - End; - SendInput(1, KInput, SizeOf(KInput)); + KInput.Itype := INPUT_KEYBOARD; + With KInput.ki Do + Begin + wVk := bKey; + wScan := MapVirtualKey(wVk, 0); + dwFlags := 0; + time := 0; + dwExtraInfo := 0; + End; + SendInput(1, KInput, SizeOf(KInput)); End; -{===============================================================================} +{ =============================================================================== } Procedure SendKey_Basic(Const Unikey: Integer); Var - KInput : Array Of TInput; + KInput: Array Of TInput; Begin - SetLength(KInput, 2); - KInput[0].Itype := INPUT_KEYBOARD; - With KInput[0].ki Do Begin - wVk := 0; - wScan := Unikey; - dwFlags := KEYEVENTF_UNICODE; - time := 0; - dwExtraInfo := 0; - End; - - KInput[1].Itype := INPUT_KEYBOARD; - With KInput[1].ki Do Begin - wVk := 0; - wScan := Unikey; - dwFlags := KEYEVENTF_UNICODE Or KEYEVENTF_KEYUP; - time := 0; - dwExtraInfo := 0; - End; - - SendInput(2, KInput[0], SizeOf(KInput[0])); + SetLength(KInput, 2); + KInput[0].Itype := INPUT_KEYBOARD; + With KInput[0].ki Do + Begin + wVk := 0; + wScan := Unikey; + dwFlags := KEYEVENTF_UNICODE; + time := 0; + dwExtraInfo := 0; + End; + + KInput[1].Itype := INPUT_KEYBOARD; + With KInput[1].ki Do + Begin + wVk := 0; + wScan := Unikey; + dwFlags := KEYEVENTF_UNICODE Or KEYEVENTF_KEYUP; + time := 0; + dwExtraInfo := 0; + End; + + SendInput(2, KInput[0], SizeOf(KInput[0])); End; Procedure RevertAltStates; Begin - If RightAlterKeyDown = True Then SendInput_Down(VK_RMENU); - If LeftAlterKeyDown = True Then SendInput_Down(VK_LMENU); - // If GeneralAlterKeyDown = True Then SendInput_Down(VK_MENU); + If RightAlterKeyDown = True Then + SendInput_Down(VK_RMENU); + If LeftAlterKeyDown = True Then + SendInput_Down(VK_LMENU); + // If GeneralAlterKeyDown = True Then SendInput_Down(VK_MENU); End; Procedure RevertCtrlStates; Begin - If RightCtrlKeyDown = True Then SendInput_Down(VK_RCONTROL); - If LeftCtrlKeyDown = True Then SendInput_Down(VK_LCONTROL); - // If GeneralCtrlKeyDown = True Then SendInput_Down(VK_CONTROL); + If RightCtrlKeyDown = True Then + SendInput_Down(VK_RCONTROL); + If LeftCtrlKeyDown = True Then + SendInput_Down(VK_LCONTROL); + // If GeneralCtrlKeyDown = True Then SendInput_Down(VK_CONTROL); End; -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ Initialization - //Alter states - RightAlterKeyDown :=False; - LeftAlterKeyDown :=False; - GeneralAlterKeyDown :=False; - //Control states - RightCtrlKeyDown :=False; - LeftCtrlKeyDown :=False; - GeneralCtrlKeyDown :=False; -End. +// Alter states +RightAlterKeyDown := False; +LeftAlterKeyDown := False; +GeneralAlterKeyDown := False; +// Control states +RightCtrlKeyDown := False; +LeftCtrlKeyDown := False; +GeneralCtrlKeyDown := False; +End. diff --git a/Keyboard and Spell checker/Units/KeyboardHook.pas b/Keyboard and Spell checker/Units/KeyboardHook.pas index 41ba084..46a3c24 100644 --- a/Keyboard and Spell checker/Units/KeyboardHook.pas +++ b/Keyboard and Spell checker/Units/KeyboardHook.pas @@ -1,712 +1,927 @@ { - ============================================================================= - ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + ============================================================================= + ***************************************************************************** + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. - ***************************************************************************** - ============================================================================= + ***************************************************************************** + ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - Unit KeyboardHook; Interface Uses - Windows, - SysUtils, - Dialogs; + Windows, + SysUtils, + Dialogs; Function Sethook(): Integer; Procedure Removehook(); -Function LowLevelKeyboardProc(nCode: Integer; wParam: wParam; lParam: lParam): longword; Stdcall; +Function LowLevelKeyboardProc(nCode: Integer; wParam: wParam; lParam: lParam) + : longword; Stdcall; Type - pKBDLLHOOKSTRUCT = ^TKBDLLHOOKSTRUCT; - - TKBDLLHOOKSTRUCT = Record - vkCode: Integer; - scancode: Integer; - flags: Integer; - time: Integer; - dwExtraInfo: Integer; - End; + pKBDLLHOOKSTRUCT = ^TKBDLLHOOKSTRUCT; + TKBDLLHOOKSTRUCT = Record + vkCode: Integer; + scancode: Integer; + flags: Integer; + time: Integer; + dwExtraInfo: Integer; + End; Var - HookRetVal: Integer; + HookRetVal: Integer; Const - LLKHF_INJECTED = $10; + LLKHF_INJECTED = $10; Implementation Uses - uForm1, - KeyboardFunctions, - VirtualKeycode, - clsLayout, - uRegistrySettings, - uWindowHandlers; + uForm1, + KeyboardFunctions, + VirtualKeycode, + clsLayout, + uRegistrySettings, + uWindowHandlers; { =============================================================================== } Var - IsHook: Boolean; + IsHook: Boolean; - { =============================================================================== } + { =============================================================================== } Function Sethook(): Integer; Var - WH_KEYBOARD_LL: Integer; + WH_KEYBOARD_LL: Integer; Begin - Try - If IsHook = True Then - Removehook; - - WH_KEYBOARD_LL := 13; - HookRetVal := SetWindowsHookEx(WH_KEYBOARD_LL, @LowLevelKeyboardProc, hInstance, 0); - If HookRetVal <> 0 Then Begin - Result := HookRetVal; - IsHook := True; - End - Else Begin - Result := 0; - IsHook := False; - End; - Except - On e: exception Do Begin - // A ghost range check error is coming - IsHook := False; - Result := 0; - End; - End; + Try + If IsHook = True Then + Removehook; + + WH_KEYBOARD_LL := 13; + HookRetVal := SetWindowsHookEx(WH_KEYBOARD_LL, @LowLevelKeyboardProc, + hInstance, 0); + If HookRetVal <> 0 Then + Begin + Result := HookRetVal; + IsHook := True; + End + Else + Begin + Result := 0; + IsHook := False; + End; + Except + On e: exception Do + Begin + // A ghost range check error is coming + IsHook := False; + Result := 0; + End; + End; End; { =============================================================================== } Procedure Removehook(); Begin - UnhookWindowsHookEx(HookRetVal); + UnhookWindowsHookEx(HookRetVal); End; { =============================================================================== } -Function LowLevelKeyboardProc(nCode: Integer; wParam: wParam; lParam: lParam): longword; Stdcall; +Function LowLevelKeyboardProc(nCode: Integer; wParam: wParam; lParam: lParam) + : longword; Stdcall; Var - kbdllhs: pKBDLLHOOKSTRUCT; - ShouldBlock: Boolean; - T: String; + kbdllhs: pKBDLLHOOKSTRUCT; + ShouldBlock: Boolean; + T: String; Label - ExitHere; + ExitHere; Begin - ShouldBlock := False; - T := ''; - - kbdllhs := Ptr(lParam); - - If nCode = HC_ACTION Then Begin - - {$REGION 'Error fixes'} - - // ---------------------------------------------- - // Ignore injected keys - // ---------------------------------------------- - If kbdllhs.flags And LLKHF_INJECTED <> 0 Then Begin - LowLevelKeyboardProc := CallNextHookEx(HookRetVal, nCode, wParam, lParam); - Exit; - End; - - // ---------------------------------------------- - // Don't Prcess VK_Packet - // ---------------------------------------------- - If kbdllhs.vkCode = VK_PACKET Then Begin - LowLevelKeyboardProc := CallNextHookEx(HookRetVal, nCode, wParam, lParam); - Exit; - End; - - // ---------------------------------------------- - // Vista Error Fix: Ghost 144 (Dec) key is coming - // ---------------------------------------------- - If kbdllhs.vkCode = 144 Then Begin - LowLevelKeyboardProc := CallNextHookEx(HookRetVal, nCode, wParam, lParam); - Exit; - End; - - {$ENDREGION} - {$REGION 'Control and alter key management for AltGr support'} - - If (AvroMainForm1.GetMyCurrentKeyboardMode = Bangla) And (lowercase(AvroMainForm1.GetMyCurrentLayout) <> 'avrophonetic*') Then Begin - - - { //Alt+BAckspace problem fix - If kbdllhs.vkCode = VK_BACk Then Begin - If RightAlterKeyDown Or LeftAlterKeyDown Or GeneralAlterKeyDown Then Begin - If RightAlterKeyDown Then SendInput_Up(VK_RMENU); - If LeftAlterKeyDown Then SendInput_Up(VK_LMENU); - If GeneralAlterKeyDown Then SendInput_Up(VK_MENU); - - LowLevelKeyboardProc := CallNextHookEx(HookRetVal, - nCode, - wParam, - lParam); - - Exit; - End; - End; } - - - // '---------------------------------------------- - // 'Check if Alter Key State is Changed - // '---------------------------------------------- - - If kbdllhs.vkCode = VK_RMENU Then Begin - If (wParam = 257) Or (wParam = 261) Then Begin // ' Keyup - RightAlterKeyDown := False; - LowLevelKeyboardProc := CallNextHookEx(HookRetVal, nCode, wParam, lParam); - Exit; - End - Else If (wParam = 256) Or (wParam = 260) Then Begin // ' KeyDown - RightAlterKeyDown := True; - LowLevelKeyboardProc := 1; - SendInput_UP(VK_RMENU); - SendInput_UP(vk_menu); - Exit; - End; - End; - - - If kbdllhs.vkCode = vk_menu Then Begin - If (wParam = 257) Or (wParam = 261) Then Begin // ' Keyup - GeneralAlterKeyDown := False; - LowLevelKeyboardProc := CallNextHookEx(HookRetVal, nCode, wParam, lParam); - Exit; - End - Else If (wParam = 256) Or (wParam = 260) Then Begin // ' KeyDown - GeneralAlterKeyDown := True; - LowLevelKeyboardProc := 1; - SendInput_UP(vk_menu); - Exit; - End; - End; - - If kbdllhs.vkCode = VK_LMENU Then Begin - If (wParam = 257) Or (wParam = 261) Then Begin // ' Keyup - LeftAlterKeyDown := False; - LowLevelKeyboardProc := CallNextHookEx(HookRetVal, nCode, wParam, lParam); - Exit; - End - Else If (wParam = 256) Or (wParam = 260) Then Begin // ' KeyDown - LeftAlterKeyDown := True; - LowLevelKeyboardProc := 1; - SendInput_UP(VK_LMENU); - SendInput_UP(vk_menu); - Exit; - End; - End; - - // End; - // '---------------------------------------------- - // 'End Check if Alter Key State is Changed - // '---------------------------------------------- - - - // '---------------------------------------------- - // 'Check if Control Key State is Changed - // '---------------------------------------------- - - If kbdllhs.vkCode = VK_RCONTROL Then Begin - If (wParam = 257) Or (wParam = 261) Then Begin // ' Keyup - RightCtrlKeyDown := False; - LowLevelKeyboardProc := CallNextHookEx(HookRetVal, nCode, wParam, lParam); - Exit; - End - Else If (wParam = 256) Or (wParam = 260) Then Begin // ' KeyDown - - RightCtrlKeyDown := True; - LowLevelKeyboardProc := CallNextHookEx(HookRetVal, nCode, wParam, lParam); - Exit; - End; - End; - - If kbdllhs.vkCode = VK_CONTROL Then Begin - If (wParam = 257) Or (wParam = 261) Then Begin // ' Keyup - GeneralCtrlKeyDown := False; - LowLevelKeyboardProc := CallNextHookEx(HookRetVal, nCode, wParam, lParam); - Exit; - End - Else If (wParam = 256) Or (wParam = 260) Then Begin // ' KeyDown - GeneralCtrlKeyDown := True; - LowLevelKeyboardProc := CallNextHookEx(HookRetVal, nCode, wParam, lParam); - Exit; - End; - End; - - If kbdllhs.vkCode = VK_LCONTROL Then Begin - If (wParam = 257) Or (wParam = 261) Then Begin // ' Keyup - LeftCtrlKeyDown := False; - LowLevelKeyboardProc := CallNextHookEx(HookRetVal, nCode, wParam, lParam); - Exit; - End - Else If (wParam = 256) Or (wParam = 260) Then Begin // ' KeyDown - LeftCtrlKeyDown := True; - LowLevelKeyboardProc := CallNextHookEx(HookRetVal, nCode, wParam, lParam); - Exit; - End; - End; - - // '---------------------------------------------- - // 'End Check if Control Key State is Changed - // '---------------------------------------------- - - End; { Bangla mode and fixed keyboard layout } - - {$ENDREGION} - {$REGION 'Keyboard layout management'} - - If (wParam = 257) Or (wParam = 261) Then Begin // Key Up - AvroMainForm1.TransferKeyUp(kbdllhs.vkCode, ShouldBlock); - If ShouldBlock = True Then - Goto ExitHere; - End - Else If (wParam = 256) Or (wParam = 260) Then Begin // KeyDown - T := AvroMainForm1.TransferKeyDown(kbdllhs.vkCode, ShouldBlock); - If T <> '' Then - SendKey_Char(T); - If ShouldBlock = True Then - Goto ExitHere; - End; - - {$ENDREGION} - {$REGION 'Keyboard mode management'} - - If ((wParam = 256) or (wParam = 260)) Then Begin // Keydown - If kbdllhs.vkCode = VK_F1 Then Begin - If (ModeSwitchKey = 'F1') And (IfTrueShift = False) And (IfControl = False) And (IfAlter = False) Then Begin - AvroMainForm1.ToggleMode; - ShouldBlock := True; - Goto ExitHere; - End; - If (ToggleOutputModeKey = 'F1') And IfTrueShift And (IfControl = False) And (IfAlter = False) Then Begin - AvroMainForm1.ToggleOutputEncoding; - ShouldBlock := True; - Goto ExitHere; - End; - If (SpellerLauncherKey = 'F1') And (IfTrueShift = False) And IfControl And (IfAlter = False) Then Begin - AvroMainForm1.Spellcheck1Click(Nil); - ShouldBlock := True; - Goto ExitHere; - End; - End - Else If kbdllhs.vkCode = VK_F2 Then Begin - If (ModeSwitchKey = 'F2') And (IfTrueShift = False) And (IfControl = False) And (IfAlter = False) Then Begin - AvroMainForm1.ToggleMode; - ShouldBlock := True; - Goto ExitHere; - End; - If (ToggleOutputModeKey = 'F2') And IfTrueShift And (IfControl = False) And (IfAlter = False) Then Begin - AvroMainForm1.ToggleOutputEncoding; - ShouldBlock := True; - Goto ExitHere; - End; - If (SpellerLauncherKey = 'F2') And (IfTrueShift = False) And IfControl And (IfAlter = False) Then Begin - AvroMainForm1.Spellcheck1Click(Nil); - ShouldBlock := True; - Goto ExitHere; - End; - End - Else If kbdllhs.vkCode = VK_F3 Then Begin - If (ModeSwitchKey = 'F3') And (IfTrueShift = False) And (IfControl = False) And (IfAlter = False) Then Begin - AvroMainForm1.ToggleMode; - ShouldBlock := True; - Goto ExitHere; - End; - If (ToggleOutputModeKey = 'F3') And IfTrueShift And (IfControl = False) And (IfAlter = False) Then Begin - AvroMainForm1.ToggleOutputEncoding; - ShouldBlock := True; - Goto ExitHere; - End; - If (SpellerLauncherKey = 'F3') And (IfTrueShift = False) And IfControl And (IfAlter = False) Then Begin - AvroMainForm1.Spellcheck1Click(Nil); - ShouldBlock := True; - Goto ExitHere; - End; - End - Else If kbdllhs.vkCode = VK_F4 Then Begin - If (ModeSwitchKey = 'F4') And (IfTrueShift = False) And (IfControl = False) And (IfAlter = False) Then Begin - AvroMainForm1.ToggleMode; - ShouldBlock := True; - Goto ExitHere; - End; - If (ToggleOutputModeKey = 'F4') And IfTrueShift And (IfControl = False) And (IfAlter = False) Then Begin - AvroMainForm1.ToggleOutputEncoding; - ShouldBlock := True; - Goto ExitHere; - End; - If (SpellerLauncherKey = 'F4') And (IfTrueShift = False) And IfControl And (IfAlter = False) Then Begin - AvroMainForm1.Spellcheck1Click(Nil); - ShouldBlock := True; - Goto ExitHere; - End; - End - Else If kbdllhs.vkCode = VK_F5 Then Begin - If (ModeSwitchKey = 'F5') And (IfTrueShift = False) And (IfControl = False) And (IfAlter = False) Then Begin - AvroMainForm1.ToggleMode; - ShouldBlock := True; - Goto ExitHere; - End; - If (ToggleOutputModeKey = 'F5') And IfTrueShift And (IfControl = False) And (IfAlter = False) Then Begin - AvroMainForm1.ToggleOutputEncoding; - ShouldBlock := True; - Goto ExitHere; - End; - If (SpellerLauncherKey = 'F5') And (IfTrueShift = False) And IfControl And (IfAlter = False) Then Begin - AvroMainForm1.Spellcheck1Click(Nil); - ShouldBlock := True; - Goto ExitHere; - End; - End - Else If kbdllhs.vkCode = VK_F6 Then Begin - If (ModeSwitchKey = 'F6') And (IfTrueShift = False) And (IfControl = False) And (IfAlter = False) Then Begin - AvroMainForm1.ToggleMode; - ShouldBlock := True; - Goto ExitHere; - End; - If (ToggleOutputModeKey = 'F6') And IfTrueShift And (IfControl = False) And (IfAlter = False) Then Begin - AvroMainForm1.ToggleOutputEncoding; - ShouldBlock := True; - Goto ExitHere; - End; - If (SpellerLauncherKey = 'F6') And (IfTrueShift = False) And IfControl And (IfAlter = False) Then Begin - AvroMainForm1.Spellcheck1Click(Nil); - ShouldBlock := True; - Goto ExitHere; - End; - End - Else If kbdllhs.vkCode = VK_F7 Then Begin - If (ModeSwitchKey = 'F7') And (IfTrueShift = False) And (IfControl = False) And (IfAlter = False) Then Begin - AvroMainForm1.ToggleMode; - ShouldBlock := True; - Goto ExitHere; - End; - If (ToggleOutputModeKey = 'F7') And IfTrueShift And (IfControl = False) And (IfAlter = False) Then Begin - AvroMainForm1.ToggleOutputEncoding; - ShouldBlock := True; - Goto ExitHere; - End; - If (SpellerLauncherKey = 'F7') And (IfTrueShift = False) And IfControl And (IfAlter = False) Then Begin - AvroMainForm1.Spellcheck1Click(Nil); - ShouldBlock := True; - Goto ExitHere; - End; - End - Else If kbdllhs.vkCode = VK_F8 Then Begin - If (ModeSwitchKey = 'F8') And (IfTrueShift = False) And (IfControl = False) And (IfAlter = False) Then Begin - AvroMainForm1.ToggleMode; - ShouldBlock := True; - Goto ExitHere; - End; - If (ToggleOutputModeKey = 'F8') And IfTrueShift And (IfControl = False) And (IfAlter = False) Then Begin - AvroMainForm1.ToggleOutputEncoding; - ShouldBlock := True; - Goto ExitHere; - End; - If (SpellerLauncherKey = 'F8') And (IfTrueShift = False) And IfControl And (IfAlter = False) Then Begin - AvroMainForm1.Spellcheck1Click(Nil); - ShouldBlock := True; - Goto ExitHere; - End; - End - Else If kbdllhs.vkCode = VK_F9 Then Begin - If (ModeSwitchKey = 'F9') And (IfTrueShift = False) And (IfControl = False) And (IfAlter = False) Then Begin - AvroMainForm1.ToggleMode; - ShouldBlock := True; - Goto ExitHere; - End; - If (ToggleOutputModeKey = 'F9') And IfTrueShift And (IfControl = False) And (IfAlter = False) Then Begin - AvroMainForm1.ToggleOutputEncoding; - ShouldBlock := True; - Goto ExitHere; - End; - If (SpellerLauncherKey = 'F9') And (IfTrueShift = False) And IfControl And (IfAlter = False) Then Begin - AvroMainForm1.Spellcheck1Click(Nil); - ShouldBlock := True; - Goto ExitHere; - End; - End - Else If kbdllhs.vkCode = VK_F10 Then Begin - If (ModeSwitchKey = 'F10') And (IfTrueShift = False) And (IfControl = False) And (IfAlter = False) Then Begin - AvroMainForm1.ToggleMode; - ShouldBlock := True; - Goto ExitHere; - End; - If (ToggleOutputModeKey = 'F10') And IfTrueShift And (IfControl = False) And (IfAlter = False) Then Begin - AvroMainForm1.ToggleOutputEncoding; - ShouldBlock := True; - Goto ExitHere; - End; - If (SpellerLauncherKey = 'F10') And (IfTrueShift = False) And IfControl And (IfAlter = False) Then Begin - AvroMainForm1.Spellcheck1Click(Nil); - ShouldBlock := True; - Goto ExitHere; - End; - End - Else If kbdllhs.vkCode = VK_F11 Then Begin - If (ModeSwitchKey = 'F11') And (IfTrueShift = False) And (IfControl = False) And (IfAlter = False) Then Begin - AvroMainForm1.ToggleMode; - ShouldBlock := True; - Goto ExitHere; - End; - If (ToggleOutputModeKey = 'F11') And IfTrueShift And (IfControl = False) And (IfAlter = False) Then Begin - AvroMainForm1.ToggleOutputEncoding; - ShouldBlock := True; - Goto ExitHere; - End; - If (SpellerLauncherKey = 'F11') And (IfTrueShift = False) And IfControl And (IfAlter = False) Then Begin - AvroMainForm1.Spellcheck1Click(Nil); - ShouldBlock := True; - Goto ExitHere; - End; - End - Else If kbdllhs.vkCode = VK_F12 Then Begin - If (ModeSwitchKey = 'F12') And (IfTrueShift = False) And (IfControl = False) And (IfAlter = False) Then Begin - AvroMainForm1.ToggleMode; - ShouldBlock := True; - Goto ExitHere; - End; - If (ToggleOutputModeKey = 'F12') And IfTrueShift And (IfControl = False) And (IfAlter = False) Then Begin - AvroMainForm1.ToggleOutputEncoding; - ShouldBlock := True; - Goto ExitHere; - End; - If (SpellerLauncherKey = 'F12') And (IfTrueShift = False) And IfControl And (IfAlter = False) Then Begin - AvroMainForm1.Spellcheck1Click(Nil); - ShouldBlock := True; - Goto ExitHere; - End; - End - Else If kbdllhs.vkCode = VK_SPACE Then Begin - If (ModeSwitchKey = 'CTRL+SPACE') And (IfTrueShift = False) And IfControl And (IfAlter = False) Then Begin - AvroMainForm1.ToggleMode; - ShouldBlock := True; - Goto ExitHere; - End; - End; - End - - Else If ((wParam = 257) Or (wParam = 261)) Then Begin // Keyup - - If kbdllhs.vkCode = VK_F1 Then Begin - If (ModeSwitchKey = 'F1') And (IfTrueShift = False) And (IfControl = False) And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - If (ToggleOutputModeKey = 'F1') And IfTrueShift And (IfControl = False) And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - If (SpellerLauncherKey = 'F1') And (IfTrueShift = False) And IfControl And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - End - Else If kbdllhs.vkCode = VK_F2 Then Begin - If (ModeSwitchKey = 'F2') And (IfTrueShift = False) And (IfControl = False) And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - If (ToggleOutputModeKey = 'F2') And IfTrueShift And (IfControl = False) And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - If (SpellerLauncherKey = 'F2') And (IfTrueShift = False) And IfControl And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - End - Else If kbdllhs.vkCode = VK_F3 Then Begin - If (ModeSwitchKey = 'F3') And (IfTrueShift = False) And (IfControl = False) And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - If (ToggleOutputModeKey = 'F3') And IfTrueShift And (IfControl = False) And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - If (SpellerLauncherKey = 'F3') And (IfTrueShift = False) And IfControl And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - End - Else If kbdllhs.vkCode = VK_F4 Then Begin - If (ModeSwitchKey = 'F4') And (IfTrueShift = False) And (IfControl = False) And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - If (ToggleOutputModeKey = 'F4') And IfTrueShift And (IfControl = False) And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - If (SpellerLauncherKey = 'F4') And (IfTrueShift = False) And IfControl And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - End - Else If kbdllhs.vkCode = VK_F5 Then Begin - If (ModeSwitchKey = 'F5') And (IfTrueShift = False) And (IfControl = False) And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - If (ToggleOutputModeKey = 'F5') And IfTrueShift And (IfControl = False) And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - If (SpellerLauncherKey = 'F5') And (IfTrueShift = False) And IfControl And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - End - Else If kbdllhs.vkCode = VK_F6 Then Begin - If (ModeSwitchKey = 'F6') And (IfTrueShift = False) And (IfControl = False) And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - If (ToggleOutputModeKey = 'F6') And IfTrueShift And (IfControl = False) And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - If (SpellerLauncherKey = 'F6') And (IfTrueShift = False) And IfControl And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - End - Else If kbdllhs.vkCode = VK_F7 Then Begin - If (ModeSwitchKey = 'F7') And (IfTrueShift = False) And (IfControl = False) And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - If (ToggleOutputModeKey = 'F7') And IfTrueShift And (IfControl = False) And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - If (SpellerLauncherKey = 'F7') And (IfTrueShift = False) And IfControl And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - End - Else If kbdllhs.vkCode = VK_F8 Then Begin - If (ModeSwitchKey = 'F8') And (IfTrueShift = False) And (IfControl = False) And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - If (ToggleOutputModeKey = 'F8') And IfTrueShift And (IfControl = False) And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - If (SpellerLauncherKey = 'F8') And (IfTrueShift = False) And IfControl And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - End - Else If kbdllhs.vkCode = VK_F9 Then Begin - If (ModeSwitchKey = 'F9') And (IfTrueShift = False) And (IfControl = False) And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - If (ToggleOutputModeKey = 'F9') And IfTrueShift And (IfControl = False) And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - If (SpellerLauncherKey = 'F9') And (IfTrueShift = False) And IfControl And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - End - Else If kbdllhs.vkCode = VK_F10 Then Begin - If (ModeSwitchKey = 'F10') And (IfTrueShift = False) And (IfControl = False) And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - If (ToggleOutputModeKey = 'F10') And IfTrueShift And (IfControl = False) And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - If (SpellerLauncherKey = 'F10') And (IfTrueShift = False) And IfControl And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - End - Else If kbdllhs.vkCode = VK_F11 Then Begin - If (ModeSwitchKey = 'F11') And (IfTrueShift = False) And (IfControl = False) And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - If (ToggleOutputModeKey = 'F11') And IfTrueShift And (IfControl = False) And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - If (SpellerLauncherKey = 'F11') And (IfTrueShift = False) And IfControl And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - End - Else If kbdllhs.vkCode = VK_F12 Then Begin - If (ModeSwitchKey = 'F12') And (IfTrueShift = False) And (IfControl = False) And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - If (ToggleOutputModeKey = 'F12') And IfTrueShift And (IfControl = False) And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - If (SpellerLauncherKey = 'F12') And (IfTrueShift = False) And IfControl And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - End - else if kbdllhs.vkCode = VK_SPACE then begin - If (ModeSwitchKey = 'CTRL+SPACE') And (IfTrueShift = False) And IfControl And (IfAlter = False) Then Begin - ShouldBlock := True; - Goto ExitHere; - End; - end; - End; - - End; { nCode = HC_ACTION } - -ExitHere : - If ShouldBlock = True Then - LowLevelKeyboardProc := 1 - Else Begin - If (AvroMainForm1.GetMyCurrentKeyboardMode = Bangla) And (lowercase(AvroMainForm1.GetMyCurrentLayout) <> 'avrophonetic*') Then Begin - If ((wParam = 256) Or (wParam = 260)) And ((kbdllhs.vkCode <> VK_Shift) And (kbdllhs.vkCode <> VK_LShift) And (kbdllhs.vkCode <> VK_RShift)) Then Begin - RevertAltStates; - End; - End; - LowLevelKeyboardProc := CallNextHookEx(HookRetVal, nCode, wParam, lParam); - End; + ShouldBlock := False; + T := ''; + + kbdllhs := Ptr(lParam); + + If nCode = HC_ACTION Then + Begin + +{$REGION 'Error fixes'} + // ---------------------------------------------- + // Ignore injected keys + // ---------------------------------------------- + If kbdllhs.flags And LLKHF_INJECTED <> 0 Then + Begin + LowLevelKeyboardProc := CallNextHookEx(HookRetVal, nCode, wParam, lParam); + Exit; + End; + + // ---------------------------------------------- + // Don't Prcess VK_Packet + // ---------------------------------------------- + If kbdllhs.vkCode = VK_PACKET Then + Begin + LowLevelKeyboardProc := CallNextHookEx(HookRetVal, nCode, wParam, lParam); + Exit; + End; + + // ---------------------------------------------- + // Vista Error Fix: Ghost 144 (Dec) key is coming + // ---------------------------------------------- + If kbdllhs.vkCode = 144 Then + Begin + LowLevelKeyboardProc := CallNextHookEx(HookRetVal, nCode, wParam, lParam); + Exit; + End; + +{$ENDREGION} +{$REGION 'Control and alter key management for AltGr support'} + If (AvroMainForm1.GetMyCurrentKeyboardMode = Bangla) And + (lowercase(AvroMainForm1.GetMyCurrentLayout) <> 'avrophonetic*') Then + Begin + + { //Alt+BAckspace problem fix + If kbdllhs.vkCode = VK_BACk Then Begin + If RightAlterKeyDown Or LeftAlterKeyDown Or GeneralAlterKeyDown Then Begin + If RightAlterKeyDown Then SendInput_Up(VK_RMENU); + If LeftAlterKeyDown Then SendInput_Up(VK_LMENU); + If GeneralAlterKeyDown Then SendInput_Up(VK_MENU); + + LowLevelKeyboardProc := CallNextHookEx(HookRetVal, + nCode, + wParam, + lParam); + + Exit; + End; + End; } + + + // '---------------------------------------------- + // 'Check if Alter Key State is Changed + // '---------------------------------------------- + + If kbdllhs.vkCode = VK_RMENU Then + Begin + If (wParam = 257) Or (wParam = 261) Then + Begin // ' Keyup + RightAlterKeyDown := False; + LowLevelKeyboardProc := CallNextHookEx(HookRetVal, nCode, + wParam, lParam); + Exit; + End + Else If (wParam = 256) Or (wParam = 260) Then + Begin // ' KeyDown + RightAlterKeyDown := True; + LowLevelKeyboardProc := 1; + SendInput_UP(VK_RMENU); + SendInput_UP(vk_menu); + Exit; + End; + End; + + If kbdllhs.vkCode = vk_menu Then + Begin + If (wParam = 257) Or (wParam = 261) Then + Begin // ' Keyup + GeneralAlterKeyDown := False; + LowLevelKeyboardProc := CallNextHookEx(HookRetVal, nCode, + wParam, lParam); + Exit; + End + Else If (wParam = 256) Or (wParam = 260) Then + Begin // ' KeyDown + GeneralAlterKeyDown := True; + LowLevelKeyboardProc := 1; + SendInput_UP(vk_menu); + Exit; + End; + End; + + If kbdllhs.vkCode = VK_LMENU Then + Begin + If (wParam = 257) Or (wParam = 261) Then + Begin // ' Keyup + LeftAlterKeyDown := False; + LowLevelKeyboardProc := CallNextHookEx(HookRetVal, nCode, + wParam, lParam); + Exit; + End + Else If (wParam = 256) Or (wParam = 260) Then + Begin // ' KeyDown + LeftAlterKeyDown := True; + LowLevelKeyboardProc := 1; + SendInput_UP(VK_LMENU); + SendInput_UP(vk_menu); + Exit; + End; + End; + + // End; + // '---------------------------------------------- + // 'End Check if Alter Key State is Changed + // '---------------------------------------------- + + + // '---------------------------------------------- + // 'Check if Control Key State is Changed + // '---------------------------------------------- + + If kbdllhs.vkCode = VK_RCONTROL Then + Begin + If (wParam = 257) Or (wParam = 261) Then + Begin // ' Keyup + RightCtrlKeyDown := False; + LowLevelKeyboardProc := CallNextHookEx(HookRetVal, nCode, + wParam, lParam); + Exit; + End + Else If (wParam = 256) Or (wParam = 260) Then + Begin // ' KeyDown + + RightCtrlKeyDown := True; + LowLevelKeyboardProc := CallNextHookEx(HookRetVal, nCode, + wParam, lParam); + Exit; + End; + End; + + If kbdllhs.vkCode = VK_CONTROL Then + Begin + If (wParam = 257) Or (wParam = 261) Then + Begin // ' Keyup + GeneralCtrlKeyDown := False; + LowLevelKeyboardProc := CallNextHookEx(HookRetVal, nCode, + wParam, lParam); + Exit; + End + Else If (wParam = 256) Or (wParam = 260) Then + Begin // ' KeyDown + GeneralCtrlKeyDown := True; + LowLevelKeyboardProc := CallNextHookEx(HookRetVal, nCode, + wParam, lParam); + Exit; + End; + End; + + If kbdllhs.vkCode = VK_LCONTROL Then + Begin + If (wParam = 257) Or (wParam = 261) Then + Begin // ' Keyup + LeftCtrlKeyDown := False; + LowLevelKeyboardProc := CallNextHookEx(HookRetVal, nCode, + wParam, lParam); + Exit; + End + Else If (wParam = 256) Or (wParam = 260) Then + Begin // ' KeyDown + LeftCtrlKeyDown := True; + LowLevelKeyboardProc := CallNextHookEx(HookRetVal, nCode, + wParam, lParam); + Exit; + End; + End; + + // '---------------------------------------------- + // 'End Check if Control Key State is Changed + // '---------------------------------------------- + + End; { Bangla mode and fixed keyboard layout } + +{$ENDREGION} +{$REGION 'Keyboard layout management'} + If (wParam = 257) Or (wParam = 261) Then + Begin // Key Up + AvroMainForm1.TransferKeyUp(kbdllhs.vkCode, ShouldBlock); + If ShouldBlock = True Then + Goto ExitHere; + End + Else If (wParam = 256) Or (wParam = 260) Then + Begin // KeyDown + T := AvroMainForm1.TransferKeyDown(kbdllhs.vkCode, ShouldBlock); + If T <> '' Then + SendKey_Char(T); + If ShouldBlock = True Then + Goto ExitHere; + End; + +{$ENDREGION} +{$REGION 'Keyboard mode management'} + If ((wParam = 256) or (wParam = 260)) Then + Begin // Keydown + If kbdllhs.vkCode = VK_F1 Then + Begin + If (ModeSwitchKey = 'F1') And (IfTrueShift = False) And + (IfControl = False) And (IfAlter = False) Then + Begin + AvroMainForm1.ToggleMode; + ShouldBlock := True; + Goto ExitHere; + End; + If (ToggleOutputModeKey = 'F1') And IfTrueShift And (IfControl = False) + And (IfAlter = False) Then + Begin + AvroMainForm1.ToggleOutputEncoding; + ShouldBlock := True; + Goto ExitHere; + End; + If (SpellerLauncherKey = 'F1') And (IfTrueShift = False) And + IfControl And (IfAlter = False) Then + Begin + AvroMainForm1.Spellcheck1Click(Nil); + ShouldBlock := True; + Goto ExitHere; + End; + End + Else If kbdllhs.vkCode = VK_F2 Then + Begin + If (ModeSwitchKey = 'F2') And (IfTrueShift = False) And + (IfControl = False) And (IfAlter = False) Then + Begin + AvroMainForm1.ToggleMode; + ShouldBlock := True; + Goto ExitHere; + End; + If (ToggleOutputModeKey = 'F2') And IfTrueShift And (IfControl = False) + And (IfAlter = False) Then + Begin + AvroMainForm1.ToggleOutputEncoding; + ShouldBlock := True; + Goto ExitHere; + End; + If (SpellerLauncherKey = 'F2') And (IfTrueShift = False) And + IfControl And (IfAlter = False) Then + Begin + AvroMainForm1.Spellcheck1Click(Nil); + ShouldBlock := True; + Goto ExitHere; + End; + End + Else If kbdllhs.vkCode = VK_F3 Then + Begin + If (ModeSwitchKey = 'F3') And (IfTrueShift = False) And + (IfControl = False) And (IfAlter = False) Then + Begin + AvroMainForm1.ToggleMode; + ShouldBlock := True; + Goto ExitHere; + End; + If (ToggleOutputModeKey = 'F3') And IfTrueShift And (IfControl = False) + And (IfAlter = False) Then + Begin + AvroMainForm1.ToggleOutputEncoding; + ShouldBlock := True; + Goto ExitHere; + End; + If (SpellerLauncherKey = 'F3') And (IfTrueShift = False) And + IfControl And (IfAlter = False) Then + Begin + AvroMainForm1.Spellcheck1Click(Nil); + ShouldBlock := True; + Goto ExitHere; + End; + End + Else If kbdllhs.vkCode = VK_F4 Then + Begin + If (ModeSwitchKey = 'F4') And (IfTrueShift = False) And + (IfControl = False) And (IfAlter = False) Then + Begin + AvroMainForm1.ToggleMode; + ShouldBlock := True; + Goto ExitHere; + End; + If (ToggleOutputModeKey = 'F4') And IfTrueShift And (IfControl = False) + And (IfAlter = False) Then + Begin + AvroMainForm1.ToggleOutputEncoding; + ShouldBlock := True; + Goto ExitHere; + End; + If (SpellerLauncherKey = 'F4') And (IfTrueShift = False) And + IfControl And (IfAlter = False) Then + Begin + AvroMainForm1.Spellcheck1Click(Nil); + ShouldBlock := True; + Goto ExitHere; + End; + End + Else If kbdllhs.vkCode = VK_F5 Then + Begin + If (ModeSwitchKey = 'F5') And (IfTrueShift = False) And + (IfControl = False) And (IfAlter = False) Then + Begin + AvroMainForm1.ToggleMode; + ShouldBlock := True; + Goto ExitHere; + End; + If (ToggleOutputModeKey = 'F5') And IfTrueShift And (IfControl = False) + And (IfAlter = False) Then + Begin + AvroMainForm1.ToggleOutputEncoding; + ShouldBlock := True; + Goto ExitHere; + End; + If (SpellerLauncherKey = 'F5') And (IfTrueShift = False) And + IfControl And (IfAlter = False) Then + Begin + AvroMainForm1.Spellcheck1Click(Nil); + ShouldBlock := True; + Goto ExitHere; + End; + End + Else If kbdllhs.vkCode = VK_F6 Then + Begin + If (ModeSwitchKey = 'F6') And (IfTrueShift = False) And + (IfControl = False) And (IfAlter = False) Then + Begin + AvroMainForm1.ToggleMode; + ShouldBlock := True; + Goto ExitHere; + End; + If (ToggleOutputModeKey = 'F6') And IfTrueShift And (IfControl = False) + And (IfAlter = False) Then + Begin + AvroMainForm1.ToggleOutputEncoding; + ShouldBlock := True; + Goto ExitHere; + End; + If (SpellerLauncherKey = 'F6') And (IfTrueShift = False) And + IfControl And (IfAlter = False) Then + Begin + AvroMainForm1.Spellcheck1Click(Nil); + ShouldBlock := True; + Goto ExitHere; + End; + End + Else If kbdllhs.vkCode = VK_F7 Then + Begin + If (ModeSwitchKey = 'F7') And (IfTrueShift = False) And + (IfControl = False) And (IfAlter = False) Then + Begin + AvroMainForm1.ToggleMode; + ShouldBlock := True; + Goto ExitHere; + End; + If (ToggleOutputModeKey = 'F7') And IfTrueShift And (IfControl = False) + And (IfAlter = False) Then + Begin + AvroMainForm1.ToggleOutputEncoding; + ShouldBlock := True; + Goto ExitHere; + End; + If (SpellerLauncherKey = 'F7') And (IfTrueShift = False) And + IfControl And (IfAlter = False) Then + Begin + AvroMainForm1.Spellcheck1Click(Nil); + ShouldBlock := True; + Goto ExitHere; + End; + End + Else If kbdllhs.vkCode = VK_F8 Then + Begin + If (ModeSwitchKey = 'F8') And (IfTrueShift = False) And + (IfControl = False) And (IfAlter = False) Then + Begin + AvroMainForm1.ToggleMode; + ShouldBlock := True; + Goto ExitHere; + End; + If (ToggleOutputModeKey = 'F8') And IfTrueShift And (IfControl = False) + And (IfAlter = False) Then + Begin + AvroMainForm1.ToggleOutputEncoding; + ShouldBlock := True; + Goto ExitHere; + End; + If (SpellerLauncherKey = 'F8') And (IfTrueShift = False) And + IfControl And (IfAlter = False) Then + Begin + AvroMainForm1.Spellcheck1Click(Nil); + ShouldBlock := True; + Goto ExitHere; + End; + End + Else If kbdllhs.vkCode = VK_F9 Then + Begin + If (ModeSwitchKey = 'F9') And (IfTrueShift = False) And + (IfControl = False) And (IfAlter = False) Then + Begin + AvroMainForm1.ToggleMode; + ShouldBlock := True; + Goto ExitHere; + End; + If (ToggleOutputModeKey = 'F9') And IfTrueShift And (IfControl = False) + And (IfAlter = False) Then + Begin + AvroMainForm1.ToggleOutputEncoding; + ShouldBlock := True; + Goto ExitHere; + End; + If (SpellerLauncherKey = 'F9') And (IfTrueShift = False) And + IfControl And (IfAlter = False) Then + Begin + AvroMainForm1.Spellcheck1Click(Nil); + ShouldBlock := True; + Goto ExitHere; + End; + End + Else If kbdllhs.vkCode = VK_F10 Then + Begin + If (ModeSwitchKey = 'F10') And (IfTrueShift = False) And + (IfControl = False) And (IfAlter = False) Then + Begin + AvroMainForm1.ToggleMode; + ShouldBlock := True; + Goto ExitHere; + End; + If (ToggleOutputModeKey = 'F10') And IfTrueShift And (IfControl = False) + And (IfAlter = False) Then + Begin + AvroMainForm1.ToggleOutputEncoding; + ShouldBlock := True; + Goto ExitHere; + End; + If (SpellerLauncherKey = 'F10') And (IfTrueShift = False) And + IfControl And (IfAlter = False) Then + Begin + AvroMainForm1.Spellcheck1Click(Nil); + ShouldBlock := True; + Goto ExitHere; + End; + End + Else If kbdllhs.vkCode = VK_F11 Then + Begin + If (ModeSwitchKey = 'F11') And (IfTrueShift = False) And + (IfControl = False) And (IfAlter = False) Then + Begin + AvroMainForm1.ToggleMode; + ShouldBlock := True; + Goto ExitHere; + End; + If (ToggleOutputModeKey = 'F11') And IfTrueShift And (IfControl = False) + And (IfAlter = False) Then + Begin + AvroMainForm1.ToggleOutputEncoding; + ShouldBlock := True; + Goto ExitHere; + End; + If (SpellerLauncherKey = 'F11') And (IfTrueShift = False) And + IfControl And (IfAlter = False) Then + Begin + AvroMainForm1.Spellcheck1Click(Nil); + ShouldBlock := True; + Goto ExitHere; + End; + End + Else If kbdllhs.vkCode = VK_F12 Then + Begin + If (ModeSwitchKey = 'F12') And (IfTrueShift = False) And + (IfControl = False) And (IfAlter = False) Then + Begin + AvroMainForm1.ToggleMode; + ShouldBlock := True; + Goto ExitHere; + End; + If (ToggleOutputModeKey = 'F12') And IfTrueShift And (IfControl = False) + And (IfAlter = False) Then + Begin + AvroMainForm1.ToggleOutputEncoding; + ShouldBlock := True; + Goto ExitHere; + End; + If (SpellerLauncherKey = 'F12') And (IfTrueShift = False) And + IfControl And (IfAlter = False) Then + Begin + AvroMainForm1.Spellcheck1Click(Nil); + ShouldBlock := True; + Goto ExitHere; + End; + End + Else If kbdllhs.vkCode = VK_SPACE Then + Begin + If (ModeSwitchKey = 'CTRL+SPACE') And (IfTrueShift = False) And + IfControl And (IfAlter = False) Then + Begin + AvroMainForm1.ToggleMode; + ShouldBlock := True; + Goto ExitHere; + End; + End; + End + + Else If ((wParam = 257) Or (wParam = 261)) Then + Begin // Keyup + + If kbdllhs.vkCode = VK_F1 Then + Begin + If (ModeSwitchKey = 'F1') And (IfTrueShift = False) And + (IfControl = False) And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + If (ToggleOutputModeKey = 'F1') And IfTrueShift And (IfControl = False) + And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + If (SpellerLauncherKey = 'F1') And (IfTrueShift = False) And + IfControl And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + End + Else If kbdllhs.vkCode = VK_F2 Then + Begin + If (ModeSwitchKey = 'F2') And (IfTrueShift = False) And + (IfControl = False) And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + If (ToggleOutputModeKey = 'F2') And IfTrueShift And (IfControl = False) + And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + If (SpellerLauncherKey = 'F2') And (IfTrueShift = False) And + IfControl And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + End + Else If kbdllhs.vkCode = VK_F3 Then + Begin + If (ModeSwitchKey = 'F3') And (IfTrueShift = False) And + (IfControl = False) And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + If (ToggleOutputModeKey = 'F3') And IfTrueShift And (IfControl = False) + And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + If (SpellerLauncherKey = 'F3') And (IfTrueShift = False) And + IfControl And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + End + Else If kbdllhs.vkCode = VK_F4 Then + Begin + If (ModeSwitchKey = 'F4') And (IfTrueShift = False) And + (IfControl = False) And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + If (ToggleOutputModeKey = 'F4') And IfTrueShift And (IfControl = False) + And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + If (SpellerLauncherKey = 'F4') And (IfTrueShift = False) And + IfControl And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + End + Else If kbdllhs.vkCode = VK_F5 Then + Begin + If (ModeSwitchKey = 'F5') And (IfTrueShift = False) And + (IfControl = False) And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + If (ToggleOutputModeKey = 'F5') And IfTrueShift And (IfControl = False) + And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + If (SpellerLauncherKey = 'F5') And (IfTrueShift = False) And + IfControl And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + End + Else If kbdllhs.vkCode = VK_F6 Then + Begin + If (ModeSwitchKey = 'F6') And (IfTrueShift = False) And + (IfControl = False) And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + If (ToggleOutputModeKey = 'F6') And IfTrueShift And (IfControl = False) + And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + If (SpellerLauncherKey = 'F6') And (IfTrueShift = False) And + IfControl And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + End + Else If kbdllhs.vkCode = VK_F7 Then + Begin + If (ModeSwitchKey = 'F7') And (IfTrueShift = False) And + (IfControl = False) And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + If (ToggleOutputModeKey = 'F7') And IfTrueShift And (IfControl = False) + And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + If (SpellerLauncherKey = 'F7') And (IfTrueShift = False) And + IfControl And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + End + Else If kbdllhs.vkCode = VK_F8 Then + Begin + If (ModeSwitchKey = 'F8') And (IfTrueShift = False) And + (IfControl = False) And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + If (ToggleOutputModeKey = 'F8') And IfTrueShift And (IfControl = False) + And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + If (SpellerLauncherKey = 'F8') And (IfTrueShift = False) And + IfControl And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + End + Else If kbdllhs.vkCode = VK_F9 Then + Begin + If (ModeSwitchKey = 'F9') And (IfTrueShift = False) And + (IfControl = False) And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + If (ToggleOutputModeKey = 'F9') And IfTrueShift And (IfControl = False) + And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + If (SpellerLauncherKey = 'F9') And (IfTrueShift = False) And + IfControl And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + End + Else If kbdllhs.vkCode = VK_F10 Then + Begin + If (ModeSwitchKey = 'F10') And (IfTrueShift = False) And + (IfControl = False) And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + If (ToggleOutputModeKey = 'F10') And IfTrueShift And (IfControl = False) + And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + If (SpellerLauncherKey = 'F10') And (IfTrueShift = False) And + IfControl And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + End + Else If kbdllhs.vkCode = VK_F11 Then + Begin + If (ModeSwitchKey = 'F11') And (IfTrueShift = False) And + (IfControl = False) And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + If (ToggleOutputModeKey = 'F11') And IfTrueShift And (IfControl = False) + And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + If (SpellerLauncherKey = 'F11') And (IfTrueShift = False) And + IfControl And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + End + Else If kbdllhs.vkCode = VK_F12 Then + Begin + If (ModeSwitchKey = 'F12') And (IfTrueShift = False) And + (IfControl = False) And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + If (ToggleOutputModeKey = 'F12') And IfTrueShift And (IfControl = False) + And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + If (SpellerLauncherKey = 'F12') And (IfTrueShift = False) And + IfControl And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + End + else if kbdllhs.vkCode = VK_SPACE then + begin + If (ModeSwitchKey = 'CTRL+SPACE') And (IfTrueShift = False) And + IfControl And (IfAlter = False) Then + Begin + ShouldBlock := True; + Goto ExitHere; + End; + end; + End; + + End; { nCode = HC_ACTION } + +ExitHere: + If ShouldBlock = True Then + LowLevelKeyboardProc := 1 + Else + Begin + If (AvroMainForm1.GetMyCurrentKeyboardMode = Bangla) And + (lowercase(AvroMainForm1.GetMyCurrentLayout) <> 'avrophonetic*') Then + Begin + If ((wParam = 256) Or (wParam = 260)) And + ((kbdllhs.vkCode <> VK_Shift) And (kbdllhs.vkCode <> VK_LShift) And + (kbdllhs.vkCode <> VK_RShift)) Then + Begin + RevertAltStates; + End; + End; + LowLevelKeyboardProc := CallNextHookEx(HookRetVal, nCode, wParam, lParam); + End; End; diff --git a/Keyboard and Spell checker/Units/KeyboardLayoutLoader.pas b/Keyboard and Spell checker/Units/KeyboardLayoutLoader.pas index c86bdad..562c7c8 100644 --- a/Keyboard and Spell checker/Units/KeyboardLayoutLoader.pas +++ b/Keyboard and Spell checker/Units/KeyboardLayoutLoader.pas @@ -1,32 +1,31 @@ { - ============================================================================= - ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + ============================================================================= + ***************************************************************************** + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. - ***************************************************************************** - ============================================================================= + ***************************************************************************** + ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - { COMPLETE TRANSFERING Except layout conversion } Unit KeyboardLayoutLoader; @@ -34,265 +33,283 @@ Interface Uses - Classes, - SysUtils, - Forms, - Windows, - NativeXml, - BanglaChars, - VirtualKeyCode, - uRegistrySettings, - uFileFolderHandling, - Graphics, - StrUtils, - Generics.Collections; + Classes, + SysUtils, + Forms, + system.Variants, + Windows, + Soap.EncdDecd, + XMLIntf, XMLDoc, + BanglaChars, + VirtualKeyCode, + uRegistrySettings, + uFileFolderHandling, + Graphics, + StrUtils, + Generics.Collections; Function LoadLayout(Const LayoutPath: String): Boolean; Function Init_KeyboardLayout(Const KeyboardLayoutName: String): Boolean; Procedure Destroy_KeyboardLayoutData; Procedure Init_KeyboardLayoutData; -Function GetCharForKey(Const KeyCode: Integer; Const var_IfShift, var_IfTrueShift, var_IfAltGr: Boolean): String; +Function GetCharForKey(Const KeyCode: Integer; + Const var_IfShift, var_IfTrueShift, var_IfAltGr: Boolean): String; Procedure ShowLayoutDescription(Const LayoutPath: String); Procedure LoadKeyboardLayoutNames; -Procedure LoadKeyboardLayoutImages(Const LayoutPath: String; Var Pic_LayoutNormal: TBitmap; Var Pic_LayoutAltGr: TBitmap); +Procedure LoadKeyboardLayoutImages(Const LayoutPath: String; + Var Pic_LayoutNormal: TBitmap; Var Pic_LayoutAltGr: TBitmap); Function InstallLayout(Const LayoutPath: String): Boolean; Var - KeyData: TDictionary; - KeyboardLayouts: TStringList; + KeyData: TDictionary; + KeyboardLayouts: TStringList; Implementation Uses - uWindowHandlers, - ufrmAboutSkinLayout, - clsSkinLayoutConverter; + uWindowHandlers, + ufrmAboutSkinLayout, + clsSkinLayoutConverter; { =============================================================================== } -Function GetCharForKey(Const KeyCode: Integer; Const var_IfShift, var_IfTrueShift, var_IfAltGr: Boolean): String; +Function GetCharForKey(Const KeyCode: Integer; + Const var_IfShift, var_IfTrueShift, var_IfAltGr: Boolean): String; Var - KC_Key: String; + KC_Key: String; Begin - Case KeyCode Of - VK_ADD: - KC_Key := 'NumAdd'; - VK_DECIMAL: - KC_Key := 'NumDecimal'; - VK_DIVIDE: - KC_Key := 'NumDivide'; - VK_MULTIPLY: - KC_Key := 'NumMultiply'; - VK_SUBTRACT: - KC_Key := 'NumSubtract'; - - - VK_NUMPAD0: - KC_Key := 'Num0'; - VK_NUMPAD1: - KC_Key := 'Num1'; - VK_NUMPAD2: - KC_Key := 'Num2'; - VK_NUMPAD3: - KC_Key := 'Num3'; - VK_NUMPAD4: - KC_Key := 'Num4'; - VK_NUMPAD5: - KC_Key := 'Num5'; - VK_NUMPAD6: - KC_Key := 'Num6'; - VK_NUMPAD7: - KC_Key := 'Num7'; - VK_NUMPAD8: - KC_Key := 'Num8'; - VK_NUMPAD9: - KC_Key := 'Num9'; - - VK_OEM_1: - KC_Key := 'OEM1'; - VK_OEM_2: - KC_Key := 'OEM2'; - VK_OEM_3: - KC_Key := 'OEM3'; - VK_OEM_4: - KC_Key := 'OEM4'; - VK_OEM_5: - KC_Key := 'OEM5'; - VK_OEM_6: - KC_Key := 'OEM6'; - VK_OEM_7: - KC_Key := 'OEM7'; - - - VK_OEM_COMMA: - KC_Key := 'COMMA'; - VK_OEM_MINUS: - KC_Key := 'MINUS'; - VK_OEM_PERIOD: - KC_Key := 'PERIOD'; - VK_OEM_PLUS: - KC_Key := 'PLUS'; - - - VK_0: - KC_Key := '0'; - VK_1: - KC_Key := '1'; - VK_2: - KC_Key := '2'; - VK_3: - KC_Key := '3'; - VK_4: - KC_Key := '4'; - VK_5: - KC_Key := '5'; - VK_6: - KC_Key := '6'; - VK_7: - KC_Key := '7'; - VK_8: - KC_Key := '8'; - VK_9: - KC_Key := '9'; - A_Key: - KC_Key := 'A'; - B_Key: - KC_Key := 'B'; - C_Key: - KC_Key := 'C'; - D_Key: - KC_Key := 'D'; - E_Key: - KC_Key := 'E'; - F_Key: - KC_Key := 'F'; - G_Key: - KC_Key := 'G'; - H_Key: - KC_Key := 'H'; - I_Key: - KC_Key := 'I'; - J_Key: - KC_Key := 'J'; - K_Key: - KC_Key := 'K'; - L_Key: - KC_Key := 'L'; - M_Key: - KC_Key := 'M'; - N_Key: - KC_Key := 'N'; - O_Key: - KC_Key := 'O'; - P_Key: - KC_Key := 'P'; - Q_Key: - KC_Key := 'Q'; - R_Key: - KC_Key := 'R'; - S_Key: - KC_Key := 'S'; - T_Key: - KC_Key := 'T'; - U_Key: - KC_Key := 'U'; - V_Key: - KC_Key := 'V'; - W_Key: - KC_Key := 'W'; - X_Key: - KC_Key := 'X'; - Y_Key: - KC_Key := 'Y'; - Z_Key: - KC_Key := 'Z'; - End; - - If KC_Key = '' Then Begin - GetCharForKey := ''; - Exit; - End; - - { Version 5 } - If LowerCase(LeftStr(KC_Key, 3)) <> 'num' Then - KC_Key := 'Key_' + KC_Key; - - // Process Numpad - If Pos('Num', KC_Key) > 0 Then Begin - If NumPadBangla = 'YES' Then Begin - If (var_IfShift = False) And (var_IfTrueShift = False) And (var_IfAltGr = False) Then Begin - // In Numpad, no modifier is allowed for Bangla Layout - GetCharForKey := KeyData.Items[KC_Key]; - Exit; - End - Else Begin - GetCharForKey := ''; - Exit; - End; - End - Else Begin - GetCharForKey := ''; - Exit; - End; - End; - - - // Process OEM and Number Keys - If (KC_Key = '1') Or (KC_Key = '2') Or (KC_Key = '3') Or (KC_Key = '4') Or (KC_Key = '5') Or (KC_Key = '6') Or (KC_Key = '7') Or (KC_Key = '8') Or (KC_Key = '9') Or (KC_Key = '0') Or - (Pos('OEM', KC_Key) > 0) Then Begin - If (var_IfTrueShift = False) And (var_IfAltGr = False) Then Begin - // In OEM Keys, Capslock has no value - // Normal State - KC_Key := KC_Key + '_Normal'; - GetCharForKey := KeyData.Items[KC_Key]; - Exit; - End - Else If (var_IfTrueShift = True) And (var_IfAltGr = False) Then Begin - // True Shift State - KC_Key := KC_Key + '_Shift'; - GetCharForKey := KeyData.Items[KC_Key]; - Exit; - End - Else If (var_IfTrueShift = False) And (var_IfAltGr = True) Then Begin - // AltGr state - KC_Key := KC_Key + '_AltGr'; - GetCharForKey := KeyData.Items[KC_Key]; - Exit; - End - Else If (var_IfTrueShift = True) And (var_IfAltGr = True) Then Begin - // Shift+AltGr state - KC_Key := KC_Key + '_ShiftAltGr'; - GetCharForKey := KeyData.Items[KC_Key]; - Exit; - End; - End; - - // Process Alpha Keys - If (var_IfShift = False) And (var_IfAltGr = False) Then Begin - // All Normal - KC_Key := KC_Key + '_Normal'; - GetCharForKey := KeyData.Items[KC_Key]; - Exit; - End - Else If (var_IfShift = True) And (var_IfAltGr = False) Then Begin - // Shift State - KC_Key := KC_Key + '_Shift'; - GetCharForKey := KeyData.Items[KC_Key]; - Exit; - End - Else If (var_IfShift = False) And (var_IfAltGr = True) Then Begin - // AltGr State - KC_Key := KC_Key + '_AltGr'; - // Debug.Print 'KeyName is:' & KC_Key & ' AltGr=' & var_IfAltGr - GetCharForKey := KeyData.Items[KC_Key]; - Exit; - End - Else If (var_IfShift = True) And (var_IfAltGr = True) Then Begin - // Shift+AltGr State - KC_Key := KC_Key + '_ShiftAltGr'; - // Debug.Print 'KeyName is:' & KC_Key & ' AltGr=' & var_IfAltGr - GetCharForKey := KeyData.Items[KC_Key]; - Exit; - End; + Case KeyCode Of + VK_ADD: + KC_Key := 'NumAdd'; + VK_DECIMAL: + KC_Key := 'NumDecimal'; + VK_DIVIDE: + KC_Key := 'NumDivide'; + VK_MULTIPLY: + KC_Key := 'NumMultiply'; + VK_SUBTRACT: + KC_Key := 'NumSubtract'; + + VK_NUMPAD0: + KC_Key := 'Num0'; + VK_NUMPAD1: + KC_Key := 'Num1'; + VK_NUMPAD2: + KC_Key := 'Num2'; + VK_NUMPAD3: + KC_Key := 'Num3'; + VK_NUMPAD4: + KC_Key := 'Num4'; + VK_NUMPAD5: + KC_Key := 'Num5'; + VK_NUMPAD6: + KC_Key := 'Num6'; + VK_NUMPAD7: + KC_Key := 'Num7'; + VK_NUMPAD8: + KC_Key := 'Num8'; + VK_NUMPAD9: + KC_Key := 'Num9'; + + VK_OEM_1: + KC_Key := 'OEM1'; + VK_OEM_2: + KC_Key := 'OEM2'; + VK_OEM_3: + KC_Key := 'OEM3'; + VK_OEM_4: + KC_Key := 'OEM4'; + VK_OEM_5: + KC_Key := 'OEM5'; + VK_OEM_6: + KC_Key := 'OEM6'; + VK_OEM_7: + KC_Key := 'OEM7'; + + VK_OEM_COMMA: + KC_Key := 'COMMA'; + VK_OEM_MINUS: + KC_Key := 'MINUS'; + VK_OEM_PERIOD: + KC_Key := 'PERIOD'; + VK_OEM_PLUS: + KC_Key := 'PLUS'; + + VK_0: + KC_Key := '0'; + VK_1: + KC_Key := '1'; + VK_2: + KC_Key := '2'; + VK_3: + KC_Key := '3'; + VK_4: + KC_Key := '4'; + VK_5: + KC_Key := '5'; + VK_6: + KC_Key := '6'; + VK_7: + KC_Key := '7'; + VK_8: + KC_Key := '8'; + VK_9: + KC_Key := '9'; + A_Key: + KC_Key := 'A'; + B_Key: + KC_Key := 'B'; + C_Key: + KC_Key := 'C'; + D_Key: + KC_Key := 'D'; + E_Key: + KC_Key := 'E'; + F_Key: + KC_Key := 'F'; + G_Key: + KC_Key := 'G'; + H_Key: + KC_Key := 'H'; + I_Key: + KC_Key := 'I'; + J_Key: + KC_Key := 'J'; + K_Key: + KC_Key := 'K'; + L_Key: + KC_Key := 'L'; + M_Key: + KC_Key := 'M'; + N_Key: + KC_Key := 'N'; + O_Key: + KC_Key := 'O'; + P_Key: + KC_Key := 'P'; + Q_Key: + KC_Key := 'Q'; + R_Key: + KC_Key := 'R'; + S_Key: + KC_Key := 'S'; + T_Key: + KC_Key := 'T'; + U_Key: + KC_Key := 'U'; + V_Key: + KC_Key := 'V'; + W_Key: + KC_Key := 'W'; + X_Key: + KC_Key := 'X'; + Y_Key: + KC_Key := 'Y'; + Z_Key: + KC_Key := 'Z'; + End; + + If KC_Key = '' Then + Begin + GetCharForKey := ''; + Exit; + End; + + { Version 5 } + If LowerCase(LeftStr(KC_Key, 3)) <> 'num' Then + KC_Key := 'Key_' + KC_Key; + + // Process Numpad + If Pos('Num', KC_Key) > 0 Then + Begin + If NumPadBangla = 'YES' Then + Begin + If (var_IfShift = False) And (var_IfTrueShift = False) And + (var_IfAltGr = False) Then + Begin + // In Numpad, no modifier is allowed for Bangla Layout + GetCharForKey := KeyData.Items[KC_Key]; + Exit; + End + Else + Begin + GetCharForKey := ''; + Exit; + End; + End + Else + Begin + GetCharForKey := ''; + Exit; + End; + End; + + // Process OEM and Number Keys + If (KC_Key = '1') Or (KC_Key = '2') Or (KC_Key = '3') Or (KC_Key = '4') Or + (KC_Key = '5') Or (KC_Key = '6') Or (KC_Key = '7') Or (KC_Key = '8') Or + (KC_Key = '9') Or (KC_Key = '0') Or (Pos('OEM', KC_Key) > 0) Then + Begin + If (var_IfTrueShift = False) And (var_IfAltGr = False) Then + Begin + // In OEM Keys, Capslock has no value + // Normal State + KC_Key := KC_Key + '_Normal'; + GetCharForKey := KeyData.Items[KC_Key]; + Exit; + End + Else If (var_IfTrueShift = True) And (var_IfAltGr = False) Then + Begin + // True Shift State + KC_Key := KC_Key + '_Shift'; + GetCharForKey := KeyData.Items[KC_Key]; + Exit; + End + Else If (var_IfTrueShift = False) And (var_IfAltGr = True) Then + Begin + // AltGr state + KC_Key := KC_Key + '_AltGr'; + GetCharForKey := KeyData.Items[KC_Key]; + Exit; + End + Else If (var_IfTrueShift = True) And (var_IfAltGr = True) Then + Begin + // Shift+AltGr state + KC_Key := KC_Key + '_ShiftAltGr'; + GetCharForKey := KeyData.Items[KC_Key]; + Exit; + End; + End; + + // Process Alpha Keys + If (var_IfShift = False) And (var_IfAltGr = False) Then + Begin + // All Normal + KC_Key := KC_Key + '_Normal'; + GetCharForKey := KeyData.Items[KC_Key]; + Exit; + End + Else If (var_IfShift = True) And (var_IfAltGr = False) Then + Begin + // Shift State + KC_Key := KC_Key + '_Shift'; + GetCharForKey := KeyData.Items[KC_Key]; + Exit; + End + Else If (var_IfShift = False) And (var_IfAltGr = True) Then + Begin + // AltGr State + KC_Key := KC_Key + '_AltGr'; + // Debug.Print 'KeyName is:' & KC_Key & ' AltGr=' & var_IfAltGr + GetCharForKey := KeyData.Items[KC_Key]; + Exit; + End + Else If (var_IfShift = True) And (var_IfAltGr = True) Then + Begin + // Shift+AltGr State + KC_Key := KC_Key + '_ShiftAltGr'; + // Debug.Print 'KeyName is:' & KC_Key & ' AltGr=' & var_IfAltGr + GetCharForKey := KeyData.Items[KC_Key]; + Exit; + End; End; @@ -302,36 +319,36 @@ Function Init_KeyboardLayout(Const KeyboardLayoutName: String): Boolean; Var - LayoutPath: String; + LayoutPath: String; Begin - Result := False; - Destroy_KeyboardLayoutData; - Init_KeyboardLayoutData; + Result := False; + Destroy_KeyboardLayoutData; + Init_KeyboardLayoutData; - LayoutPath := GetAvroDataDir + 'Keyboard Layouts\' + KeyboardLayoutName + '.avrolayout'; + LayoutPath := GetAvroDataDir + 'Keyboard Layouts\' + KeyboardLayoutName + + '.avrolayout'; - If FileExists(LayoutPath) Then - Result := LoadLayout(LayoutPath) - Else - Result := False; + If FileExists(LayoutPath) Then + Result := LoadLayout(LayoutPath) + Else + Result := False; End; {$HINTS On} - { =============================================================================== } Procedure Init_KeyboardLayoutData; Begin - KeyData := TDictionary.create; + KeyData := TDictionary.create; End; { =============================================================================== } Procedure Destroy_KeyboardLayoutData; Begin - KeyData.Free; + KeyData.Free; End; { =============================================================================== } @@ -340,259 +357,314 @@ Function LoadLayout(Const LayoutPath: String): Boolean; Var - XML: TNativeXml; - Node: TXmlNode; - I: Integer; + XML: IXMLDocument; + Node: IXmlNode; + I: Integer; - m_Converter: TSkinLayoutConverter; + m_Converter: TSkinLayoutConverter; Begin - Result := False; - - Try - Try - - XML := TNativeXml.create; - XML.ExternalEncoding := seUTF8; - XML.LoadFromFile(LayoutPath); - Application.ProcessMessages; - - // ---------------------------------------------- - // Check if the skin is a compatible one - If trim(XML.Root.FindNode('AvroKeyboardVersion').ValueAsUnicodeString) <> '5' Then Begin - - FreeAndNil(XML); - - m_Converter := TSkinLayoutConverter.create; - m_Converter.CheckConvertLayout(LayoutPath); - FreeAndNil(m_Converter); - - - XML := TNativeXml.create; - XML.ExternalEncoding := seUTF8; - XML.LoadFromFile(LayoutPath); - Application.ProcessMessages; - - // Check again - If trim(XML.Root.FindNode('AvroKeyboardVersion').ValueAsUnicodeString) <> '5' Then Begin - Application.MessageBox('This Keyboard Layout is not compatible with current version of Avro Keyboard.', 'Error loading keyboard layout...', - MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - Result := False; - Exit; - End; - End; - // ---------------------------------------------- - - Application.ProcessMessages; - - // ---------------------------------------------- - // Load Key Data - Node := XML.Root.FindNode('KeyData'); - Application.ProcessMessages; - For I := 0 To Node.NodeCount - 1 Do Begin - If Node.Nodes[I].NodeCount <= 0 Then - // If item has no cdata - KeyData.AddOrSetValue(String(Node.Nodes[I].Name), '') - Else - // if item has cdata - KeyData.AddOrSetValue(String(Node.Nodes[I].Name), Node.Nodes[I].Nodes[0].ValueAsUnicodeString); - Application.ProcessMessages; - End; - - Result := True; - Except - On E: Exception Do Begin - Result := False; - Application.ProcessMessages; - End; - End; - Finally - XML.Free; - Application.ProcessMessages; - End; + Result := False; + + Try + Try + + XML := TXMLDocument.create(nil); + XML.Active := True; + XML.Encoding := 'UTF-8'; + + XML.LoadFromFile(LayoutPath); + Application.ProcessMessages; + + // ---------------------------------------------- + // Check if the skin is a compatible one + If trim(XML.DocumentElement.childnodes.FindNode('AvroKeyboardVersion') + .nodevalue) <> '5' Then + Begin + + XML.Active := False; + XML := Nil; + + m_Converter := TSkinLayoutConverter.create; + m_Converter.CheckConvertLayout(LayoutPath); + FreeAndNil(m_Converter); + + XML := TXMLDocument.create(nil); + XML.Active := True; + XML.Encoding := 'UTF-8'; + + XML.LoadFromFile(LayoutPath); + Application.ProcessMessages; + + // Check again + If trim(XML.DocumentElement.childnodes.FindNode('AvroKeyboardVersion') + .nodevalue) <> '5' Then + Begin + Application.MessageBox + ('This Keyboard Layout is not compatible with current version of Avro Keyboard.', + 'Error loading keyboard layout...', MB_OK + MB_ICONHAND + + MB_DEFBUTTON1 + MB_APPLMODAL); + Result := False; + Exit; + End; + End; + // ---------------------------------------------- + + Application.ProcessMessages; + + // ---------------------------------------------- + // Load Key Data + Node := XML.DocumentElement.childnodes.FindNode('KeyData'); + Application.ProcessMessages; + For I := 0 To Node.childnodes.Count - 1 Do + Begin + // showmessage( inttostr(Node.childnodes.nodes[I].childnodes.Count ); + If Node.childnodes.nodes[I].childnodes.Count <= 0 Then + // If item has no cdata + KeyData.AddOrSetValue(String(Node.childnodes.nodes[I].nodename), '') + Else + // if item has cdata + KeyData.AddOrSetValue(String(Node.childnodes.nodes[I].nodename), + VartoStr(Node.childnodes.nodes[I].childnodes.nodes[0].nodevalue)); + Application.ProcessMessages; + End; + + Result := True; + Except + On E: Exception Do + Begin + Result := False; + Application.ProcessMessages; + End; + End; + Finally + + XML.Active := false; + XML := Nil; + Application.ProcessMessages; + End; End; {$HINTS On} - { =============================================================================== } -Procedure LoadKeyboardLayoutImages(Const LayoutPath: String; Var Pic_LayoutNormal: TBitmap; Var Pic_LayoutAltGr: TBitmap); +Procedure LoadKeyboardLayoutImages(Const LayoutPath: String; + Var Pic_LayoutNormal: TBitmap; Var Pic_LayoutAltGr: TBitmap); Var - XML: TNativeXml; - Stream: TStringStream; - Resource: TResourceStream; - - m_Converter: TSkinLayoutConverter; -Begin - - FreeAndNil(Pic_LayoutNormal); - FreeAndNil(Pic_LayoutAltGr); - Application.ProcessMessages; - - - Try - Try - If LowerCase(LayoutPath) <> 'avrophonetic*' Then Begin - - - - XML := TNativeXml.create; - XML.ExternalEncoding := seUTF8; - - XML.LoadFromFile(LayoutPath); - Application.ProcessMessages; - - // ---------------------------------------------- - // Check if the layout is a compatible one - If trim(XML.Root.FindNode('AvroKeyboardVersion').ValueAsUnicodeString) <> '5' Then Begin + XML: IXMLDocument; + Stream: TStringStream; + Resource: TResourceStream; - FreeAndNil(XML); + m_Converter: TSkinLayoutConverter; - m_Converter := TSkinLayoutConverter.create; - m_Converter.CheckConvertLayout(LayoutPath); - FreeAndNil(m_Converter); - Application.ProcessMessages; - - - XML := TNativeXml.create; - XML.ExternalEncoding := seUTF8; - XML.LoadFromFile(LayoutPath); - Application.ProcessMessages; - - // Check again - If trim(XML.Root.FindNode('AvroKeyboardVersion').ValueAsUnicodeString) <> '5' Then Begin - Application.MessageBox('This Keyboard Layout is not compatible with current version of Avro Keyboard.', 'Error loading keyboard layout...', - MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - Exit; - End; - End; - // ---------------------------------------------- - Application.ProcessMessages; - - Stream := TStringStream.create(XML.Root.FindNode('ImageNormalShift').BinaryString); - Pic_LayoutNormal := TBitmap.create; - If Stream.Size > 0 Then - Pic_LayoutNormal.LoadFromStream(Stream) - Else - FreeAndNil(Pic_LayoutNormal); - FreeAndNil(Stream); - - Application.ProcessMessages; - - Stream := TStringStream.create(XML.Root.FindNode('ImageAltGrShift').BinaryString); - Pic_LayoutAltGr := TBitmap.create; - If Stream.Size > 0 Then - Pic_LayoutAltGr.LoadFromStream(Stream) - Else - FreeAndNil(Pic_LayoutAltGr); - - Application.ProcessMessages; - - FreeAndNil(Stream); - - FreeAndNil(XML); - - End - Else Begin - Resource := TResourceStream.create(Hinstance, 'PHONETIC0', RT_RCDATA); - Pic_LayoutNormal := TBitmap.create; - Pic_LayoutNormal.LoadFromStream(Resource); - FreeAndNil(Resource); - Application.ProcessMessages; - End; - - Except - On E: Exception Do Begin - // Do nothing - End; - End; - Finally - // - End; +Begin + FreeAndNil(Pic_LayoutNormal); + FreeAndNil(Pic_LayoutAltGr); + Application.ProcessMessages; + + Try + Try + If LowerCase(LayoutPath) <> 'avrophonetic*' Then + Begin + + XML := TXMLDocument.create(nil); + XML.Active := True; + XML.Encoding := 'UTF-8'; + + XML.LoadFromFile(LayoutPath); + Application.ProcessMessages; + + // ---------------------------------------------- + // Check if the layout is a compatible one + If trim(XML.DocumentElement.childnodes.FindNode('AvroKeyboardVersion') + .nodevalue { UnicodeStr } ) <> '5' Then + Begin + + XML.Active := False; + XML := Nil; + + m_Converter := TSkinLayoutConverter.create; + m_Converter.CheckConvertLayout(LayoutPath); + FreeAndNil(m_Converter); + Application.ProcessMessages; + + XML := TXMLDocument.create(nil); + XML.Active := True; + XML.Encoding := 'UTF-8'; + XML.LoadFromFile(LayoutPath); + Application.ProcessMessages; + + // Check again + If trim(XML.DocumentElement.childnodes.FindNode('AvroKeyboardVersion') + .nodevalue { UnicodeStr } ) <> '5' Then + Begin + Application.MessageBox + ('This Keyboard Layout is not compatible with current version of Avro Keyboard.', + 'Error loading keyboard layout...', MB_OK + MB_ICONHAND + + MB_DEFBUTTON1 + MB_APPLMODAL); + Exit; + End; + End; + // ---------------------------------------------- + Application.ProcessMessages; + Application.ProcessMessages; + if (VarIsNull(XML.DocumentElement.childnodes.FindNode + ('ImageNormalShift').nodevalue) = False) then + begin + Stream := TStringStream.create + (DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('ImageNormalShift').nodevalue)); + Pic_LayoutNormal := TBitmap.create; + If Stream.Size > 0 Then + Pic_LayoutNormal.LoadFromStream(Stream) + Else + FreeAndNil(Pic_LayoutNormal); + Application.ProcessMessages; + FreeAndNil(Stream); + end; + + if (VarIsNull(XML.DocumentElement.childnodes.FindNode('ImageAltGrShift') + .nodevalue) = False) then + begin + + Stream := TStringStream.create + (DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('ImageAltGrShift').nodevalue)); + Pic_LayoutAltGr := TBitmap.create; + If Stream.Size > 0 Then + Pic_LayoutAltGr.LoadFromStream(Stream) + Else + FreeAndNil(Pic_LayoutAltGr); + + Application.ProcessMessages; + + FreeAndNil(Stream); + end; + + XML.Active := False; + XML := Nil; + + End + Else + Begin + Resource := TResourceStream.create(Hinstance, 'PHONETIC0', RT_RCDATA); + Pic_LayoutNormal := TBitmap.create; + Pic_LayoutNormal.LoadFromStream(Resource); + FreeAndNil(Resource); + Application.ProcessMessages; + End; + + Except + On E: Exception Do + Begin + // Do nothing + End; + End; + Finally + // + End; End; - { =============================================================================== } Procedure ShowLayoutDescription(Const LayoutPath: String); Var - XML: TNativeXml; - InternalName, Developer, Version, Comment: String; - m_Converter: TSkinLayoutConverter; + XML: IXMLDocument; + InternalName, Developer, Version, Comment: String; + m_Converter: TSkinLayoutConverter; Begin - Try - Try - If LowerCase(LayoutPath) <> 'avrophonetic*' Then Begin - - - XML := TNativeXml.create; - XML.ExternalEncoding := seUTF8; - XML.LoadFromFile(LayoutPath); - Application.ProcessMessages; - - // ---------------------------------------------- - // Check if the layout is a compatible one - If trim(XML.Root.FindNode('AvroKeyboardVersion').ValueAsUnicodeString) <> '5' Then Begin - - - FreeAndNil(XML); - - m_Converter := TSkinLayoutConverter.create; - m_Converter.CheckConvertLayout(LayoutPath); - FreeAndNil(m_Converter); - - Application.ProcessMessages; - - - XML := TNativeXml.create; - XML.ExternalEncoding := seUTF8; - XML.LoadFromFile(LayoutPath); - Application.ProcessMessages; - - // Check again - If trim(XML.Root.FindNode('AvroKeyboardVersion').ValueAsUnicodeString) <> '5' Then Begin - Application.MessageBox('This Keyboard Layout is not compatible with current version of Avro Keyboard.', 'Error loading keyboard layout...', - MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - Exit; - End; - End; - // ---------------------------------------------- - Application.ProcessMessages; - - InternalName := XML.Root.FindNode('LayoutName').Nodes[0].ValueAsUnicodeString; - Application.ProcessMessages; - Developer := XML.Root.FindNode('DeveloperName').Nodes[0].ValueAsUnicodeString; - Application.ProcessMessages; - Version := XML.Root.FindNode('LayoutVersion').Nodes[0].ValueAsUnicodeString; - Application.ProcessMessages; - Comment := XML.Root.FindNode('DeveloperComment').Nodes[0].ValueAsUnicodeString; - Application.ProcessMessages; - End - Else Begin - InternalName := 'Avro Phonetic'; - Developer := 'Mehdi Hasan (OmicronLab)'; - Version := '4'; - Comment := 'In technical definition, Avro Phonetic is not a fixed keyboard layout. ' + 'This is actually a text parser which takes input as english text and produce bangla ' + - 'characters with similarity matching phonetic converter algorithm of OmicronLab.'; - End; - - CheckCreateForm(TfrmAboutSkinLayout, frmAboutSkinLayout, 'frmAboutSkinLayout'); - - frmAboutSkinLayout.txtName.text := InternalName; - frmAboutSkinLayout.txtVersion.text := Version; - frmAboutSkinLayout.txtDeveloper.text := Developer; - frmAboutSkinLayout.txtComment.text := Comment; - - frmAboutSkinLayout.ShowDescription; - Except - On E: Exception Do Begin - // Do nothing - End; - End; - Finally - FreeAndNil(XML); - End; + Try + Try + If LowerCase(LayoutPath) <> 'avrophonetic*' Then + Begin + + XML := TXMLDocument.create(nil); + XML.Active := True; + XML.Encoding := 'UTF-8'; + XML.LoadFromFile(LayoutPath); + Application.ProcessMessages; + + // ---------------------------------------------- + // Check if the layout is a compatible one + If trim(XML.DocumentElement.childnodes.FindNode('AvroKeyboardVersion') + .nodevalue { UnicodeStr } ) <> '5' Then + Begin + + XML.Active := False; + XML := Nil; + + m_Converter := TSkinLayoutConverter.create; + m_Converter.CheckConvertLayout(LayoutPath); + FreeAndNil(m_Converter); + + Application.ProcessMessages; + + XML := TXMLDocument.create(nil); + XML.Active := True; + + XML.Encoding := 'UTF-8'; + XML.LoadFromFile(LayoutPath); + Application.ProcessMessages; + + // Check again + If trim(XML.DocumentElement.childnodes.FindNode('AvroKeyboardVersion') + .nodevalue { UnicodeStr } ) <> '5' Then + Begin + Application.MessageBox + ('This Keyboard Layout is not compatible with current version of Avro Keyboard.', + 'Error loading keyboard layout...', MB_OK + MB_ICONHAND + + MB_DEFBUTTON1 + MB_APPLMODAL); + Exit; + End; + End; + // ---------------------------------------------- + Application.ProcessMessages; + + InternalName := XML.DocumentElement.childnodes.FindNode('LayoutName') + .childnodes.nodes[0].nodevalue; // UnicodeStr + Application.ProcessMessages; + Developer := XML.DocumentElement.childnodes.FindNode('DeveloperName') + .childnodes.nodes[0].nodevalue; // UnicodeStr + Application.ProcessMessages; + Version := XML.DocumentElement.childnodes.FindNode('LayoutVersion') + .childnodes.nodes[0].nodevalue; // UnicodeStr + Application.ProcessMessages; + Comment := XML.DocumentElement.childnodes.FindNode('DeveloperComment') + .childnodes.nodes[0].nodevalue; // UnicodeStr + Application.ProcessMessages; + End + Else + Begin + InternalName := 'Avro Phonetic'; + Developer := 'Mehdi Hasan (OmicronLab)'; + Version := '4'; + Comment := + 'In technical definition, Avro Phonetic is not a fixed keyboard layout. ' + + 'This is actually a text parser which takes input as english text and produce bangla ' + + 'characters with similarity matching phonetic converter algorithm of OmicronLab.'; + End; + + CheckCreateForm(TfrmAboutSkinLayout, frmAboutSkinLayout, + 'frmAboutSkinLayout'); + + frmAboutSkinLayout.txtName.text := InternalName; + frmAboutSkinLayout.txtVersion.text := Version; + frmAboutSkinLayout.txtDeveloper.text := Developer; + frmAboutSkinLayout.txtComment.text := Comment; + + frmAboutSkinLayout.ShowDescription; + Except + On E: Exception Do + Begin + // Do nothing + End; + End; + Finally + XML.Active := False; + XML := Nil; + + End; End; @@ -600,71 +672,97 @@ Function InstallLayout(Const LayoutPath: String): Boolean; Var - XML: TNativeXml; - InternalName, Developer, Version, Comment: String; - m_Converter: TSkinLayoutConverter; - FileName: String; - Overwrite: Boolean; + XML: IXMLDocument; + InternalName, Developer, Version, Comment: String; + m_Converter: TSkinLayoutConverter; + FileName: String; + Overwrite: Boolean; Begin - Result := False; - Try - Try - XML := TNativeXml.create; - XML.ExternalEncoding := seUTF8; - XML.LoadFromFile(LayoutPath); - Application.ProcessMessages; - - InternalName := XML.Root.FindNode('LayoutName').Nodes[0].ValueAsUnicodeString; - Application.ProcessMessages; - Developer := XML.Root.FindNode('DeveloperName').Nodes[0].ValueAsUnicodeString; - Application.ProcessMessages; - Version := XML.Root.FindNode('LayoutVersion').Nodes[0].ValueAsUnicodeString; - Application.ProcessMessages; - Comment := XML.Root.FindNode('DeveloperComment').Nodes[0].ValueAsUnicodeString; - Application.ProcessMessages; - - FreeAndNil(XML); - FileName := ExtractFilename(LayoutPath); - - If FileExists(GetAvroDataDir + 'Keyboard Layouts\' + FileName) Then Begin - If Application.MessageBox(pchar('Keyboard layout "' + FileName + '" is already installed.' + #10 + 'Do you want to overwrite it?'), 'Avro Keyboard', - MB_YESNO + MB_ICONQUESTION + MB_DEFBUTTON2 + MB_SYSTEMMODAL) = ID_YES Then - Overwrite := True - Else - Overwrite := False; - End; - - If MyCopyFile(LayoutPath, GetAvroDataDir + 'Keyboard Layouts\' + FileName, Overwrite) Then Begin - Result := True; - Application.MessageBox - (pchar('Keyboard layout "' + FileName + '" has been installed successfully!' + #10 + '' + #10 + 'Layout name: ' + InternalName + #10 + 'Version: ' + Version + #10 + - 'Developer: ' + Developer + #10 + 'Comment: ' + Comment + #10), 'Avro Keyboard', MB_OK + MB_ICONASTERISK + MB_DEFBUTTON1 + MB_SYSTEMMODAL); - - // Check and convert the skin - m_Converter := TSkinLayoutConverter.create; - m_Converter.CheckConvertLayout(GetAvroDataDir + 'Keyboard Layouts\' + FileName); - FreeAndNil(m_Converter); - Application.ProcessMessages; - - End - Else Begin - Result := False; - Application.MessageBox(pchar('Keyboard layout "' + FileName + '" was not installed!'), 'Avro Keyboard', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_SYSTEMMODAL); - End; - - Except - On E: Exception Do Begin - Result := False; - - Application.MessageBox(pchar('Error installing keyboard layout!' + #10 + '' + #10 + '' + #10 + 'Make sure this is a valid keyboard layout file' + #10 + 'or,' + #10 + - 'You have enough permission to write in keyboard layouts folder' + #10 + 'or,' + #10 + 'Keyboard layouts directory is writable'), 'Avro Keyboard', - MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_SYSTEMMODAL); - - End; - End; - Finally - FreeAndNil(XML); - End; + Result := False; + Try + Try + XML := TXMLDocument.create(nil); + XML.Active := True; + XML.Encoding := 'UTF-8'; + XML.LoadFromFile(LayoutPath); + Application.ProcessMessages; + + InternalName := XML.DocumentElement.childnodes.FindNode('LayoutName') + .childnodes.nodes[0].nodevalue; // UnicodeStr + Application.ProcessMessages; + Developer := XML.DocumentElement.childnodes.FindNode('DeveloperName') + .childnodes.nodes[0].nodevalue; // UnicodeStr + Application.ProcessMessages; + Version := XML.DocumentElement.childnodes.FindNode('LayoutVersion') + .childnodes.nodes[0].nodevalue; // UnicodeStr + Application.ProcessMessages; + Comment := XML.DocumentElement.childnodes.FindNode('DeveloperComment') + .childnodes.nodes[0].nodevalue; // UnicodeStr + Application.ProcessMessages; + + XML.Active := False; + XML := Nil; + + FileName := ExtractFilename(LayoutPath); + + If FileExists(GetAvroDataDir + 'Keyboard Layouts\' + FileName) Then + Begin + If Application.MessageBox(pchar('Keyboard layout "' + FileName + + '" is already installed.' + #10 + 'Do you want to overwrite it?'), + 'Avro Keyboard', MB_YESNO + MB_ICONQUESTION + MB_DEFBUTTON2 + + MB_SYSTEMMODAL) = ID_YES Then + Overwrite := True + Else + Overwrite := False; + End; + + If MyCopyFile(LayoutPath, GetAvroDataDir + 'Keyboard Layouts\' + FileName, + Overwrite) Then + Begin + Result := True; + Application.MessageBox(pchar('Keyboard layout "' + FileName + + '" has been installed successfully!' + #10 + '' + #10 + + 'Layout name: ' + InternalName + #10 + 'Version: ' + Version + #10 + + 'Developer: ' + Developer + #10 + 'Comment: ' + Comment + #10), + 'Avro Keyboard', MB_OK + MB_ICONASTERISK + MB_DEFBUTTON1 + + MB_SYSTEMMODAL); + + // Check and convert the skin + m_Converter := TSkinLayoutConverter.create; + m_Converter.CheckConvertLayout(GetAvroDataDir + 'Keyboard Layouts\' + + FileName); + FreeAndNil(m_Converter); + Application.ProcessMessages; + + End + Else + Begin + Result := False; + Application.MessageBox(pchar('Keyboard layout "' + FileName + + '" was not installed!'), 'Avro Keyboard', MB_OK + MB_ICONHAND + + MB_DEFBUTTON1 + MB_SYSTEMMODAL); + End; + + Except + On E: Exception Do + Begin + Result := False; + + Application.MessageBox(pchar('Error installing keyboard layout!' + #10 + + '' + #10 + '' + #10 + 'Make sure this is a valid keyboard layout file' + + #10 + 'or,' + #10 + + 'You have enough permission to write in keyboard layouts folder' + #10 + + 'or,' + #10 + 'Keyboard layouts directory is writable'), + 'Avro Keyboard', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + + MB_SYSTEMMODAL); + + End; + End; + Finally + XML.Active := False; + XML := Nil; + + End; End; @@ -672,17 +770,19 @@ Procedure LoadKeyboardLayoutNames; Var - I, Count: Integer; + I, Count: Integer; Begin - KeyboardLayouts := TStringList.create; - Count := GetFileList(GetAvroDataDir + 'Keyboard Layouts\*.avrolayout', KeyboardLayouts); + KeyboardLayouts := TStringList.create; + Count := GetFileList(GetAvroDataDir + 'Keyboard Layouts\*.avrolayout', + KeyboardLayouts); - If Count <= 0 Then - Exit; + If Count <= 0 Then + Exit; - For I := 0 To Count - 1 Do Begin - KeyboardLayouts[I] := RemoveExtension(KeyboardLayouts[I]); - End; + For I := 0 To Count - 1 Do + Begin + KeyboardLayouts[I] := RemoveExtension(KeyboardLayouts[I]); + End; End; End. diff --git a/Keyboard and Spell checker/Units/Levenshtein.pas b/Keyboard and Spell checker/Units/Levenshtein.pas index 98d45e5..f35504a 100644 --- a/Keyboard and Spell checker/Units/Levenshtein.pas +++ b/Keyboard and Spell checker/Units/Levenshtein.pas @@ -1,21 +1,20 @@ -//Copied from http://www.merriampark.com/lddelphi.htm - +// Copied from http://www.merriampark.com/lddelphi.htm unit Levenshtein; - interface -uses sysutils, Math; - function minimum(a, b, c: Integer): Integer; +uses sysutils, Math; - function LD(s, t: String): Integer; +function minimum(a, b, c: Integer): Integer; +function LD(s, t: String): Integer; implementation function minimum(a, b, c: Integer): Integer; -var mi: Integer; +var + mi: Integer; begin mi := a; if (b < mi) then @@ -33,29 +32,35 @@ function LD(s, t: String): Integer; begin n := Length(s); m := Length(t); - if (n = 0) then begin - Result := m; - Exit; - end; - if m = 0 then begin - Result := n; - Exit; - end; + if (n = 0) then + begin + Result := m; + Exit; + end; + if m = 0 then + begin + Result := n; + Exit; + end; setlength(d, n + 1, m + 1); for i := 0 to n do d[i, 0] := i; for j := 0 to m do d[0, j] := j; for i := 1 to n do + begin + s_i := s[i]; + for j := 1 to m do begin - s_i := s[i]; - for j := 1 to m do - begin - t_j := t[j]; - if s_i = t_j then costo := 0 else costo := 1; - d[i, j] := Minimum(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i -1][j - 1] + costo); - end; + t_j := t[j]; + if s_i = t_j then + costo := 0 + else + costo := 1; + d[i, j] := minimum(d[i - 1][j] + 1, d[i][j - 1] + 1, + d[i - 1][j - 1] + costo); end; + end; Result := d[n, m]; end; diff --git a/Keyboard and Spell checker/Units/NativeXml LICENSE.txt b/Keyboard and Spell checker/Units/NativeXml LICENSE.txt deleted file mode 100644 index 8887af5..0000000 --- a/Keyboard and Spell checker/Units/NativeXml LICENSE.txt +++ /dev/null @@ -1,10 +0,0 @@ -Copyright (c) 2003 Simdesign BV. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY SIMDESIGN BV "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SIMDESIGN BV OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/Keyboard and Spell checker/Units/NativeXml.inc b/Keyboard and Spell checker/Units/NativeXml.inc deleted file mode 100644 index e360921..0000000 --- a/Keyboard and Spell checker/Units/NativeXml.inc +++ /dev/null @@ -1,105 +0,0 @@ -{ unit NativeXml.inc - - Nativexml a small-footprint implementation to read and write XML documents - natively from Delpi code. NativeXml has very fast parsing speeds. - - Author: Nils Haeck M.Sc. - Copyright (c) 2007 - 2010 Simdesign B.V. - - It is NOT allowed under ANY circumstances to publish, alter or copy this code - without accepting the license conditions in accompanying LICENSE.txt - first! - - This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF - ANY KIND, either express or implied. - - Please visit http://www.simdesign.nl/xml.html for more information. -} -// Delphi and BCB versions - -// Freepascal (MK) -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF FPC} -// Delphi 5 -{$IFDEF VER130} - {$DEFINE D5UP} -{$ENDIF} -//Delphi 6 -{$IFDEF VER140} - {$DEFINE D5UP} - {$DEFINE D6UP} -{$ENDIF} -//Delphi 7 -{$IFDEF VER150} - {$DEFINE D5UP} - {$DEFINE D6UP} - {$DEFINE D7UP} -{$ENDIF} -//Delphi 8 -{$IFDEF VER160} - {$DEFINE D5UP} - {$DEFINE D6UP} - {$DEFINE D7UP} - {$DEFINE D8UP} -{$ENDIF} -// Delphi 2005 -{$IFDEF VER170} - {$DEFINE D5UP} - {$DEFINE D6UP} - {$DEFINE D7UP} - {$DEFINE D8UP} - {$DEFINE D9UP} -{$ENDIF} -// Delphi 2006 -{$IFDEF VER180} - {$DEFINE D5UP} - {$DEFINE D6UP} - {$DEFINE D7UP} - {$DEFINE D8UP} - {$DEFINE D9UP} - {$DEFINE D10UP} -{$ENDIF} -// Delphi 2007 - NET -{$IFDEF VER190} - {$DEFINE D5UP} - {$DEFINE D6UP} - {$DEFINE D7UP} - {$DEFINE D8UP} - {$DEFINE D9UP} - {$DEFINE D10UP} -{$ENDIF} -// Delphi 2009 -{$IFDEF VER200} - {$DEFINE D5UP} - {$DEFINE D6UP} - {$DEFINE D7UP} - {$DEFINE D8UP} - {$DEFINE D9UP} - {$DEFINE D10UP} - {$DEFINE D11UP} - {$DEFINE D12UP} -{$ENDIF} -// Delphi 2010 -{$IFDEF VER210} - {$DEFINE D5UP} - {$DEFINE D6UP} - {$DEFINE D7UP} - {$DEFINE D8UP} - {$DEFINE D9UP} - {$DEFINE D10UP} - {$DEFINE D11UP} - {$DEFINE D12UP} - {$DEFINE D14UP} -{$ENDIF} - -// Uncomment to save memory space for large documents if you don't need tags. -// Tags are an additional integer field that can be used by the application. -{$DEFINE USETAGS} - -// uncomment if you do not want to include the Graphics unit. -{$DEFINE USEGRAPHICS} - -// uncomment if you do not want line number/position info from the source file -{$DEFINE SOURCEPOS} - diff --git a/Keyboard and Spell checker/Units/NativeXml.pas b/Keyboard and Spell checker/Units/NativeXml.pas deleted file mode 100644 index 9d53a74..0000000 --- a/Keyboard and Spell checker/Units/NativeXml.pas +++ /dev/null @@ -1,6377 +0,0 @@ -{ unit NativeXml - - This is a small-footprint implementation to read and write XML documents - natively from Delpi code. - - You can use this code to read XML documents from files, streams or strings. - The load routine generates events that can be used to display load progress - on the fly. - - Note: any external encoding (ANSI, UTF16, etc) is converted to an internal - encoding that is ANSI or UTF8. When the loaded document is ANSI based, - the encoding will be ANSI, in other cases (UTF8, UTF16) the encoding - will be UTF8. - - Original Author: Nils Haeck M.Sc. (n.haeck@simdesign.nl) - Original Date: 01 Apr 2003 - Version: see below - Copyright (c) 2003-2010 Simdesign BV - Contributor(s): Stefan Glienke - - It is NOT allowed under ANY circumstances to publish or copy this code - without accepting the license conditions in accompanying LICENSE.txt - first! - - This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF - ANY KIND, either express or implied. - - Please visit http://www.simdesign.nl/xml.html for more information. -} -unit NativeXml; - -interface - -{$I NativeXml.inc} - -uses - {$IFDEF D7UP} - Windows, - {$ENDIF} - {$IFDEF CLR} - System.Text, - {$ENDIF} - {$IFDEF USEGRAPHICS} - {$IFDEF LINUX} - QGraphics, - {$ELSE} - Graphics, - {$ENDIF} - {$ENDIF} - Classes, - SysUtils; - -const - - // Current version of the NativeXml unit - cNativeXmlVersion = '3.09'; - -// cross-platform pointer type -type - {$IFDEF CLR} - TPointer = TObject; - {$ELSE} - TPointer = Pointer; - {$ENDIF} - -// Delphi 5 stubs -{$IFNDEF D6UP} -type - TSeekOrigin = Word; - UTF8String = AnsiString; -const - soBeginning = soFromBeginning; - soCurrent = soFromCurrent; - soEnd = soFromEnd; -{$ENDIF} - -{$IFNDEF D12UP} -// Delphi 2007 and below -type - UnicodeString = WideString; - UnicodeChar = WideChar; - PUnicodeChar = PWideChar; - RawByteString = AnsiString; -{$ELSE} -type - UnicodeChar = Char; - PUnicodeChar = PChar; -{$ENDIF} - -type - - // Note on TNativeXml.Format: - // - xfReadable (default) to be able to read the xml file with a standard editor. - // - xfCompact to save the xml fully compliant and at smallest size - TXmlFormatType = ( - xfReadable, // Save in readable format with CR-LF and indents - xfCompact // Save without any control chars except LF after declarations - ); - - // TXmlElementType enumerates the different kinds of elements that can be found - // in the XML document. - TXmlElementType = ( - xeNormal, // Normal element [value][sub-elements] - xeComment, // Comment - xeCData, // literal data - xeDeclaration, // XML declaration - xeStylesheet, // Stylesheet - xeDoctype, // DOCTYPE DTD declaration - xeElement, // - xeAttList, // - xeEntity, // - xeNotation, // - xeExclam, // Any - xeQuestion, // Any - xeCharData, // character data in a node - xeUnknown // Any - ); - - // Choose what kind of binary encoding will be used when calling - // TXmlNode BufferRead and BufferWrite. - TBinaryEncodingType = ( - xbeBinHex, { With this encoding, each byte is stored as a hexadecimal - number, e.g. 0 = 00 and 255 = FF. } - xbeBase64 { With this encoding, each group of 3 bytes are stored as 4 - characters, requiring 64 different AnsiCharacters.} - ); - - // Definition of different methods of String encoding. - TStringEncodingType = ( - seAnsi, // General 8 bit encoding, encoding must be determined from encoding declaration - seUCS4BE, // UCS-4 Big Endian - seUCS4LE, // UCS-4 Little Endian - seUCS4_2143, // UCS-4 unusual octet order (2143) - seUCS4_3412, // UCS-4 unusual octet order (3412) - se16BitBE, // General 16 bit Big Endian, encoding must be determined from encoding declaration - se16BitLE, // General 16 bit Little Endian, encoding must be determined from encoding declaration - seUTF8, // UTF-8 - seUTF16BE, // UTF-16 Big Endian - seUTF16LE, // UTF-16 Little Endian - seEBCDIC // EBCDIC flavour - ); - - TXmlCompareOption = ( - xcNodeName, - xcNodeType, - xcNodeValue, - xcAttribCount, - xcAttribNames, - xcAttribValues, - xcChildCount, - xcChildNames, - xcChildValues, - xcRecursive - ); - - TXmlCompareOptions = set of TXmlCompareOption; - -const - - xcAll: TXmlCompareOptions = [xcNodeName, xcNodeType, xcNodeValue, xcAttribCount, - xcAttribNames, xcAttribValues, xcChildCount, xcChildNames, xcChildValues, - xcRecursive]; - -var - - // XML Defaults - - cDefaultEncodingString: UTF8String = 'UTF-8'; - cDefaultExternalEncoding: TStringEncodingType = seUTF8; - cDefaultVersionString: UTF8String = '1.0'; - cDefaultXmlFormat: TXmlFormatType = xfCompact; - cDefaultWriteOnDefault: boolean = True; - cDefaultBinaryEncoding: TBinaryEncodingType = xbeBase64; - cDefaultIndentString: UTF8String = ' '; - cDefaultDropCommentsOnParse: boolean = False; - cDefaultUseFullNodes: boolean = False; - cDefaultFloatAllowScientific: boolean = True; - cDefaultFloatSignificantDigits: integer = 6; - -type - - TXmlNode = class; - TNativeXml = class; - TsdCodecStream = class; - - // An event that is based on the TXmlNode object Node. - TXmlNodeEvent = procedure(Sender: TObject; Node: TXmlNode) of object; - - // An event that is used to indicate load or save progress. - TXmlProgressEvent = procedure(Sender: TObject; Size: integer) of object; - - // This event is used in the TNativeXml.OnNodeCompare event, and should - // return -1 if Node1 < Node2, 0 if Node1 = Node2 and 1 if Node1 > Node2. - TXmlNodeCompareEvent = function(Sender: TObject; Node1, Node2: TXmlNode; Info: TPointer): integer of object; - - // Pass a function of this kind to TXmlNode.SortChildNodes. The function should - // return -1 if Node1 < Node2, 0 if Node1 = Node2 and 1 if Node1 > Node2. - TXMLNodeCompareFunction = function(Node1, Node2: TXmlNode; Info: TPointer): integer; - - // Very simple autonomous stringlist that holds the list of attributes in the node - TsdUTF8StringList = class(TPersistent) - private - FItems: array of UTF8String; - FCount: integer; - function GetItems(Index: integer): UTF8String; - procedure SetItems(Index: integer; const Value: UTF8String); - function GetValues(const Name: UTF8String): UTF8String; - function GetNames(Index: integer): UTF8String; - procedure SetValues(const Name, Value: UTF8String); - function GetText: UTF8String; - public - function Add(const S: UTF8String): integer; - procedure Assign(Source: TPersistent); override; - procedure Clear; - procedure Delete(Index: Integer); - function IndexOfName(const Name: UTF8String): integer; - property Count: integer read FCount; - property Items[Index: integer]: UTF8String read GetItems write SetItems; default; - property Names[Index: integer]: UTF8String read GetNames; - property Values[const Name: UTF8String]: UTF8String read GetValues write SetValues; - property Text: UTF8String read GetText; - end; - - // The TXmlNode represents an element in the XML file. Each TNativeXml holds - // one Root element. Under ths root element, sub-elements can be nested (there - // is no limit on how deep). Property ElementType defines what kind of element - // this node is. - TXmlNode = class(TPersistent) - private - FName: UTF8String; // The element name - FValue: UTF8String; // The *escaped* value - FAttributes: TsdUTF8StringList; // List with attributes - FNodes: TList; // These are the child elements - FParent: TXmlNode; // Pointer to parent element - FDocument: TNativeXml; // Pointer to parent XmlDocument - FElementType: TXmlElementType; // The type of element - FTag: integer; // A value the developer can use - function AbortParsing: boolean; - function GetValueAsString: UTF8String; - procedure SetAttributeName(Index: integer; const Value: UTF8String); - procedure SetAttributeValue(Index: integer; const Value: UTF8String); - procedure SetValueAsString(const AValue: UTF8String); - function GetIndent: UTF8String; - function GetLineFeed: UTF8String; - function GetTreeDepth: integer; - function GetAttributeCount: integer; - function GetAttributePair(Index: integer): UTF8String; - function GetAttributeName(Index: integer): UTF8String; - function GetAttributeValue(Index: integer): UTF8String; - function GetWriteOnDefault: boolean; - function GetBinaryEncoding: TBinaryEncodingType; - function GetCascadedName: UTF8String; - function QualifyAsDirectNode: boolean; - procedure SetName(const Value: UTF8String); - function GetFullPath: UTF8String; - procedure SetBinaryEncoding(const Value: TBinaryEncodingType); - function GetBinaryString: RawByteString; - procedure SetBinaryString(const Value: RawByteString); - function UseFullNodes: boolean; - function GetValueAsUnicodeString: UnicodeString; - procedure SetValueAsUnicodeString(const Value: UnicodeString); - function GetAttributeByName(const AName: UTF8String): UTF8String; - procedure SetAttributeByName(const AName, Value: UTF8String); - function GetValueAsInteger: integer; - procedure SetValueAsInteger(const Value: integer); - function GetValueAsFloat: double; - procedure SetValueAsFloat(const Value: double); - function GetValueAsDateTime: TDateTime; - procedure SetValueAsDateTime(const Value: TDateTime); - function GetValueAsBool: boolean; - procedure SetValueAsBool(const Value: boolean); - function GetValueAsInt64: int64; - procedure SetValueAsInt64(const Value: int64); - procedure CheckCreateAttributesList; - function GetAttributeValueAsUnicodeString(Index: integer): UnicodeString; - procedure SetAttributeValueAsUnicodeString(Index: integer; - const Value: UnicodeString); - function GetAttributeValueAsInteger(Index: integer): integer; - procedure SetAttributeValueAsInteger(Index: integer; - const Value: integer); - function GetAttributeByNameWide(const AName: UTF8String): UnicodeString; - procedure SetAttributeByNameWide(const AName: UTF8String; - const Value: UnicodeString); - function GetTotalNodeCount: integer; - function FloatSignificantDigits: integer; - function FloatAllowScientific: boolean; - function GetAttributeValueDirect(Index: integer): UTF8String; - procedure SetAttributeValueDirect(Index: integer; const Value: UTF8String); - protected - function CompareNodeName(const NodeName: UTF8String): integer; - procedure DeleteEmptyAttributes; - function GetNodes(Index: integer): TXmlNode; virtual; - function GetNodeCount: integer; virtual; - procedure ParseTag(const AValue: UTF8String; TagStart, TagClose: integer); - procedure ReadFromStream(S: TStream); virtual; - procedure ReadFromString(const AValue: UTF8String); virtual; - procedure ResolveEntityReferences; - function UnescapeString(const AValue: UTF8String): UTF8String; virtual; - function WriteInnerTag: UTF8String; virtual; - procedure WriteToStream(S: TStream); virtual; - procedure ChangeDocument(ADocument: TNativeXml); - public - // Create a new TXmlNode object. ADocument must be the TNativeXml that is - // going to hold this new node. - constructor Create(ADocument: TNativeXml); virtual; - // \Create a new TXmlNode with name AName. ADocument must be the TNativeXml - // that is going to hold this new node. - constructor CreateName(ADocument: TNativeXml; const AName: UTF8String); virtual; - // \Create a new TXmlNode with name AName and UTF8String value AValue. ADocument - // must be the TNativeXml that is going to hold this new node. - constructor CreateNameValue(ADocument: TNativeXml; const AName, AValue: UTF8String); virtual; - // \Create a new TXmlNode with XML element type AType. ADocument must be the - // TNativeXml that is going to hold this new node. - constructor CreateType(ADocument: TNativeXml; AType: TXmlElementType); virtual; - // Use Assign to assign another TXmlNode to this node. This means that all - // properties and subnodes from the Source TXmlNode are copied to the current - // node. You can also Assign a TNativeXml document to the node, in that case - // the RootNodeList property of the TNativeXml object will be copied. - procedure Assign(Source: TPersistent); override; - // Call Delete to delete this node completely from the parent node list. This - // call only succeeds if the node has a parent. It has no effect when called for - // the root node. - procedure Delete; virtual; - // \Delete all nodes that are empty (this means, which have no subnodes, no - // attributes, and no value assigned). This procedure works recursively. - procedure DeleteEmptyNodes; - // Destroy a TXmlNode object. This will free the child node list automatically. - // Never call this method directly. All TXmlNodes in the document will be - // recursively freed when TNativeXml.Free is called. - destructor Destroy; override; - // Use this method to add an integer attribute to the node. - procedure AttributeAdd(const AName: UTF8String; AValue: integer); overload; - // Use this method to add a string attribute with value AValue to the node. - procedure AttributeAdd(const AName, AValue: UTF8String); overload; - // Use this method to delete the attribute at Index in the list. Index must be - // equal or greater than 0, and smaller than AttributeCount. Using an index - // outside of that range has no effect. - procedure AttributeDelete(Index: integer); - // Switch position of the attributes at Index1 and Index2. - procedure AttributeExchange(Index1, Index2: integer); - // Use this method to find the index of an attribute with name AName. - function AttributeIndexByname(const AName: UTF8String): integer; - // \Clear all attributes from the current node. - procedure AttributesClear; virtual; - // Use this method to read binary data from the node into Buffer with a length of Count. - procedure BufferRead(var Buffer{$IFDEF CLR}: TBytes{$ENDIF}; Count: Integer); virtual; - // Use this method to write binary data in Buffer with a length of Count to the - // current node. The data will appear as text using either BinHex or Base64 - // method) in the final XML document. - // Notice that NativeXml does only support up to 2Gb bytes of data per file, - // so do not use this option for huge files. The binary encoding method (converting - // binary data into text) can be selected using property BinaryEncoding. - // xbeBase64 is most efficient, but slightly slower. Always use identical methods - // for reading and writing. - procedure BufferWrite(const Buffer{$IFDEF CLR}: TBytes{$ENDIF}; Count: Integer); virtual; - // Returns the length of the data in the buffer, once it would be decoded by - // method xbeBinHex or xbeBase64. If BinaryEncoding is xbeSixBits, this function - // cannot be used. The length of the unencoded data is determined from the - // length of the encoded data. For xbeBinHex this is trivial (just half the - // length), for xbeBase64 this is more difficult (must use the padding characters) - function BufferLength: integer; virtual; - // Clear all child nodes and attributes, and the name and value of the current - // XML node. However, the node is not deleted. Call Delete instead for that. - procedure Clear; virtual; - // Find the first node which has name NodeName. Contrary to the NodeByName - // function, this function will search the whole subnode tree, using the - // DepthFirst method. It is possible to search for a full path too, e.g. - // FoundNode := MyNode.FindNode('/Root/SubNode1/SubNode2/ThisNode'); - function FindNode(const NodeName: UTF8String): TXmlNode; - // Find all nodes which have name NodeName. Contrary to the NodesByName - // function, this function will search the whole subnode tree. If you use - // a TXmlNodeList for the AList parameter, you don't need to cast the list - // items to TXmlNode. - procedure FindNodes(const NodeName: UTF8String; const AList: TList); - // Use FromAnsiString to convert a normal ANSI String to a UTF8String for the node - // (name, value, attributes). In TNativeXml the ANSI Characters are encoded - // into UTF8. - function FromAnsiString(const s: AnsiString): UTF8String; - // Use FromUnicodeString to convert UnicodeString to a UTF8String for the node (name, value, - // attributes). - function FromUnicodeString(const W: UnicodeString): UTF8String; - // Use HasAttribute to determine if the node has an attribute with name AName. - function HasAttribute(const AName: UTF8String): boolean; virtual; - // This function returns the index of this node in the parent's node list. - // If Parent is not assigned, this function returns -1. - function IndexInParent: integer; - // This function returns True if the node has no subnodes and no attributes, - // and if the node Name and value are empty. - function IsClear: boolean; virtual; - // This function returns True if the node has no subnodes and no attributes, - // and if the node value is empty. - function IsEmpty: boolean; virtual; - function IsEqualTo(ANode: TXmlNode; Options: TXmlCompareOptions; MismatchNodes: TList = nil): boolean; - // Add the node ANode as a new subelement in the nodelist. The node will be - // added in position NodeCount (which will be returned). - function NodeAdd(ANode: TXmlNode): integer; virtual; - // This function returns a pointer to the first subnode that has an attribute with - // name AttribName and value AttribValue. If ShouldRecurse = True (default), the - // function works recursively, using the depthfirst method. - function NodeByAttributeValue(const NodeName, AttribName, AttribValue: UTF8String; - ShouldRecurse: boolean = True): TXmlNode; - // Return a pointer to the first subnode with this Elementype, or return nil - // if no subnode with that type is found. - function NodeByElementType(ElementType: TXmlElementType): TXmlNode; - // Return a pointer to the first subnode in the nodelist that has name AName. - // If no subnodes with AName are found, the function returns nil. - function NodeByName(const AName: UTF8String): TXmlNode; virtual; - // \Delete the subnode at Index. The node will also be freed, so do not free the - // node in the application. - procedure NodeDelete(Index: integer); virtual; - // Switch position of the nodes at Index1 and Index2. - procedure NodeExchange(Index1, Index2: integer); - // Extract the node ANode from the subnode list. The node will no longer appear - // in the subnodes list, so the application is responsible for freeing ANode later. - function NodeExtract(ANode: TXmlNode): TXmlNode; virtual; - // This function returns a pointer to the first node with AName. If this node - // is not found, then it creates a new node with AName and returns its pointer. - function NodeFindOrCreate(const AName: UTF8String): TXmlNode; virtual; - // Find the index of the first subnode with name AName. - function NodeIndexByName(const AName: UTF8String): integer; virtual; - // Find the index of the first subnode with name AName that appears after or on - // the index AFrom. This function can be used in a loop to retrieve all nodes - // with a certain name, without using a helper list. See also NodesByName. - function NodeIndexByNameFrom(const AName: UTF8String; AFrom: integer): integer; virtual; - // Call NodeIndexOf to get the index for ANode in the Nodes array. The first - // node in the array has index 0, the second item has index 1, and so on. If - // a node is not in the list, NodeIndexOf returns -1. - function NodeIndexOf(ANode: TXmlNode): integer; - // Insert the node ANode at location Index in the list. - procedure NodeInsert(Index: integer; ANode: TXmlNode); virtual; - // \Create a new node with AName, add it to the subnode list, and return a - // pointer to it. - function NodeNew(const AName: UTF8String): TXmlNode; virtual; - // \Create a new node with AName, and insert it into the subnode list at location - // Index, and return a pointer to it. - function NodeNewAtIndex(Index: integer; const AName: UTF8String): TXmlNode; virtual; - // Call NodeRemove to remove a specific node from the Nodes array when its index - // is unknown. The value returned is the index of the item in the Nodes array - // before it was removed. After an item is removed, all the items that follow - // it are moved up in index position and the NodeCount is reduced by one. - function NodeRemove(ANode: TxmlNode): integer; - // \Clear (and free) the complete list of subnodes. - procedure NodesClear; virtual; - // Use this procedure to retrieve all nodes that have name AName. Pointers to - // these nodes are added to the list in AList. AList must be initialized - // before calling this procedure. If you use a TXmlNodeList you don't need - // to cast the list items to TXmlNode. - procedure NodesByName(const AName: UTF8String; const AList: TList); - // Find the attribute with AName, and convert its value to a boolean. If the - // attribute is not found, or cannot be converted, the default ADefault will - // be returned. - function ReadAttributeBool(const AName: UTF8String; ADefault: boolean = False): boolean; virtual; - function ReadAttributeDateTime(const AName: UTF8String; ADefault: TDateTime = 0): TDateTime; virtual; - // Find the attribute with AName, and convert its value to an integer. If the - // attribute is not found, or cannot be converted, the default ADefault will - // be returned. - function ReadAttributeInteger(const AName: UTF8String; ADefault: integer = 0): integer; virtual; - // Find the attribute with AName, and convert its value to an int64. If the - // attribute is not found, or cannot be converted, the default ADefault will - // be returned. - function ReadAttributeInt64(const AName: UTF8String; ADefault: int64 = 0): int64; virtual; - // Find the attribute with AName, and convert its value to a float. If the - // attribute is not found, or cannot be converted, the default ADefault will - // be returned. - function ReadAttributeFloat(const AName: UTF8String; ADefault: double = 0): double; - function ReadAttributeString(const AName: UTF8String; const ADefault: UTF8String = ''): UTF8String; virtual; - // Read the subnode with AName and convert it to a boolean value. If the - // subnode is not found, or cannot be converted, the boolean ADefault will - // be returned. - function ReadBool(const AName: UTF8String; ADefault: boolean = False): boolean; virtual; - {$IFDEF USEGRAPHICS} - // Read the properties Color and Style for the TBrush object ABrush from the - // subnode with AName. - procedure ReadBrush(const AName: UTF8String; ABrush: TBrush); virtual; - // Read the subnode with AName and convert its value to TColor. If the - // subnode is not found, or cannot be converted, ADefault will be returned. - function ReadColor(const AName: UTF8String; ADefault: TColor = clBlack): TColor; virtual; - // Read the properties \Name, Color, Size and Style for the TFont object AFont - // from the subnode with AName. - procedure ReadFont(const AName: UTF8String; AFont: TFont); virtual; - // Read the properties Color, Mode, Style and Width for the TPen object APen - // from the subnode with AName. - procedure ReadPen(const AName: UTF8String; APen: TPen); virtual; - {$ENDIF} - // Read the subnode with AName and convert its value to TDateTime. If the - // subnode is not found, or cannot be converted, ADefault will be returned. - function ReadDateTime(const AName: UTF8String; ADefault: TDateTime = 0): TDateTime; virtual; - // Read the subnode with AName and convert its value to a double. If the - // subnode is not found, or cannot be converted, ADefault will be returned. - function ReadFloat(const AName: UTF8String; ADefault: double = 0.0): double; virtual; - // Read the subnode with AName and convert its value to an int64. If the - // subnode is not found, or cannot be converted, ADefault will be returned. - function ReadInt64(const AName: UTF8String; ADefault: int64 = 0): int64; virtual; - // Read the subnode with AName and convert its value to an integer. If the - // subnode is not found, or cannot be converted, ADefault will be returned. - function ReadInteger(const AName: UTF8String; ADefault: integer = 0): integer; virtual; - // Read the subnode with AName and return its UTF8String value. If the subnode is - // not found, ADefault will be returned. - function ReadString(const AName: UTF8String; const ADefault: UTF8String = ''): UTF8String; virtual; - // Read the subnode with AName and return its UnicodeString value. If the subnode is - // not found, ADefault will be returned. - function ReadUnicodeString(const AName: UTF8String; const ADefault: UnicodeString = ''): UnicodeString; virtual; - // Sort the child nodes of this node. Provide a custom node compare function in Compare, - // or attach an event handler to the parent documents' OnNodeCompare in order to - // provide custom sorting. If no compare function is given (nil) and OnNodeCompare - // is not implemented, SortChildNodes will simply sort the nodes by name (ascending, - // case insensitive). The Info pointer parameter can be used to pass any custom - // information to the compare function. Default value for Info is nil. - procedure SortChildNodes(Compare: TXMLNodeCompareFunction = nil; Info: TPointer = nil); - // Use ToUnicodeString to convert any UTF8 String from the node (name, value, attributes) - // to a UnicodeString. - function ToUnicodeString(const s: UTF8String): UnicodeString; - // Convert the node's value to boolean and return the result. If this conversion - // fails, or no value is found, then the function returns ADefault. - function ValueAsBoolDef(ADefault: boolean): boolean; virtual; - // Convert the node's value to a TDateTime and return the result. If this conversion - // fails, or no value is found, then the function returns ADefault. - function ValueAsDateTimeDef(ADefault: TDateTime): TDateTime; virtual; - // Convert the node's value to a double and return the result. If this conversion - // fails, or no value is found, then the function returns ADefault. - function ValueAsFloatDef(ADefault: double): double; virtual; - // Convert the node's value to int64 and return the result. If this conversion - // fails, or no value is found, then the function returns ADefault. - function ValueAsInt64Def(ADefault: int64): int64; virtual; - // Convert the node's value to integer and return the result. If this conversion - // fails, or no value is found, then the function returns ADefault. - function ValueAsIntegerDef(ADefault: integer): integer; virtual; - // If the attribute with name AName exists, then set its value to the boolean - // AValue. If it does not exist, then create a new attribute AName with the - // boolean value converted to either "True" or "False". If ADefault = AValue, and - // WriteOnDefault = False, no attribute will be added. - procedure WriteAttributeBool(const AName: UTF8String; AValue: boolean; ADefault: boolean = False); virtual; - procedure WriteAttributeDateTime(const AName: UTF8string; AValue: TDateTime; ADefault: TDateTime = 0); virtual; - // If the attribute with name AName exists, then set its value to the integer - // AValue. If it does not exist, then create a new attribute AName with the - // integer value converted to a quoted string. If ADefault = AValue, and - // WriteOnDefault = False, no attribute will be added. - procedure WriteAttributeInteger(const AName: UTF8String; AValue: integer; ADefault: integer = 0); virtual; - procedure WriteAttributeInt64(const AName: UTF8String; const AValue: int64; ADefault: int64 = 0); virtual; - procedure WriteAttributeFloat(const AName: UTF8String; AValue: double; ADefault: double = 0); virtual; - // If the attribute with name AName exists, then set its value to the UTF8String - // AValue. If it does not exist, then create a new attribute AName with the - // value AValue. If ADefault = AValue, and WriteOnDefault = False, no attribute - // will be added. - procedure WriteAttributeString(const AName: UTF8String; const AValue: UTF8String; const ADefault: UTF8String = ''); virtual; - // Add or replace the subnode with AName and set its value to represent the boolean - // AValue. If AValue = ADefault, and WriteOnDefault = False, no subnode will be added. - procedure WriteBool(const AName: UTF8String; AValue: boolean; ADefault: boolean = False); virtual; - {$IFDEF USEGRAPHICS} - // Write properties Color and Style of the TBrush object ABrush to the subnode - // with AName. If AName does not exist, it will be created. - procedure WriteBrush(const AName: UTF8String; ABrush: TBrush); virtual; - // Add or replace the subnode with AName and set its value to represent the TColor - // AValue. If AValue = ADefault, and WriteOnDefault = False, no subnode will be added. - procedure WriteColor(const AName: UTF8String; AValue: TColor; ADefault: TColor = clBlack); virtual; - // Write properties \Name, Color, Size and Style of the TFont object AFont to - // the subnode with AName. If AName does not exist, it will be created. - procedure WriteFont(const AName: UTF8String; AFont: TFont); virtual; - // Write properties Color, Mode, Style and Width of the TPen object APen to - // the subnode with AName. If AName does not exist, it will be created. - procedure WritePen(const AName: UTF8String; APen: TPen); virtual; - {$ENDIF} - // Add or replace the subnode with AName and set its value to represent the TDateTime - // AValue. If AValue = ADefault, and WriteOnDefault = False, no subnode will be added. - // The XML format used is compliant with W3C's specification of date and time. - procedure WriteDateTime(const AName: UTF8String; AValue: TDateTime; ADefault: TDateTime = 0); virtual; - // Add or replace the subnode with AName and set its value to represent the double - // AValue. If AValue = ADefault, and WriteOnDefault = False, no subnode will be added. - procedure WriteFloat(const AName: UTF8String; AValue: double; ADefault: double = 0.0); virtual; - // Add or replace the subnode with AName and set its value to represent the hexadecimal representation of - // AValue. If AValue = ADefault, and WriteOnDefault = False, no subnode will be added. - procedure WriteHex(const AName: UTF8String; AValue: integer; Digits: integer; ADefault: integer = 0); virtual; - // Add or replace the subnode with AName and set its value to represent the int64 - // AValue. If AValue = ADefault, and WriteOnDefault = False, no subnode will be added. - procedure WriteInt64(const AName: UTF8String; AValue: int64; ADefault: int64 = 0); virtual; - // Add or replace the subnode with AName and set its value to represent the integer - // AValue. If AValue = ADefault, and WriteOnDefault = False, no subnode will be added. - procedure WriteInteger(const AName: UTF8String; AValue: integer; ADefault: integer = 0); virtual; - // Add or replace the subnode with AName and set its value to represent the UTF8String - // AValue. If AValue = ADefault, and WriteOnDefault = False, no subnode will be added. - procedure WriteString(const AName, AValue: UTF8String; const ADefault: UTF8String = ''); virtual; - // Call WriteToString to save the XML node to a UTF8String. This method can be used to store - // individual nodes instead of the complete XML document. - function WriteToString: UTF8String; virtual; - // Add or replace the subnode with AName and set its value to represent the UnicodeString - // AValue. If AValue = ADefault, and WriteOnDefault = False, no subnode will be added. - procedure WriteUnicodeString(const AName: UTF8String; const AValue: UnicodeString; const ADefault: UnicodeString = ''); virtual; - // AttributeByName returns the attribute value for the attribute that has name AName. - // Set AttributeByName to add an attribute to the attribute list, or replace an - // existing one. - property AttributeByName[const AName: UTF8String]: UTF8String read GetAttributeByName write - SetAttributeByName; - // AttributeByNameWide returns the attribute value for the attribute that has name AName - // as UnicodeString. Set AttributeByNameWide to add an attribute to the attribute list, or replace an - // existing one. - property AttributeByNameWide[const AName: UTF8String]: UnicodeString read GetAttributeByNameWide write - SetAttributeByNameWide; - // Returns the number of attributes in the current node. - property AttributeCount: integer read GetAttributeCount; - // Read this property to get the name of the attribute at Index. Note that Index - // is zero-based: Index goes from 0 to AttributeCount - 1 - property AttributeName[Index: integer]: UTF8String read GetAttributeName write SetAttributeName; - // Read this property to get the Attribute \Name and Value pair at index Index. - // This is a UTF8String with \Name and Value separated by a TAB character (#9). - property AttributePair[Index: integer]: UTF8String read GetAttributePair; - // Read this property to get the UTF8String value of the attribute at index Index. - // Write to it to set the UTF8String value. - property AttributeValue[Index: integer]: UTF8String read GetAttributeValue write SetAttributeValue; - // Read this property to get the UnicodeString value of the attribute at index Index. - // Write to it to set the UnicodeString value. - property AttributeValueAsUnicodeString[Index: integer]: UnicodeString read GetAttributeValueAsUnicodeString write SetAttributeValueAsUnicodeString; - // Read this property to get the integer value of the attribute at index Index. - // If the value cannot be converted, 0 will be returned. Write to it to set the integer value. - property AttributeValueAsInteger[Index: integer]: integer read GetAttributeValueAsInteger write SetAttributeValueAsInteger; - // Set or get the raw attribute value, thus circumventing the escape function. Make sure that - // the value you set does not contain the & and quote AnsiCharacters, or the produced - // XML will be invalid. - property AttributeValueDirect[Index: integer]: UTF8String read GetAttributeValueDirect write SetAttributeValueDirect; - // BinaryEncoding reflects the same value as the BinaryEncoding setting of the parent - // Document. - property BinaryEncoding: TBinaryEncodingType read GetBinaryEncoding write SetBinaryEncoding; - // Use BinaryString to add/extract binary data in an easy way to/from the node. Internally the - // data gets stored as Base64-encoded data. Do not use this method for normal textual - // information, it is better to use ValueAsString in that case (adds less overhead). - property BinaryString: RawByteString read GetBinaryString write SetBinaryString; - // This property returns the name and index and all predecessors with underscores - // to separate, in order to get a unique reference that can be used in filenames. - property CascadedName: UTF8String read GetCascadedName; - // Pointer to parent NativeXml document, or Nil if none. - property Document: TNativeXml read FDocument write FDocument; - // ElementType contains the type of element that this node holds. - property ElementType: TXmlElementType read FElementType write FElementType; - // Fullpath will return the complete path of the node from the root, e.g. - // /Root/SubNode1/SubNode2/ThisNode - property FullPath: UTF8String read GetFullPath; - // Read Name to get the name of the element, and write Name to set the name. - // This is the full name and may include a namespace. (Namespace:Name) - property Name: UTF8String read FName write SetName; - // Parent points to the parent node of the current XML node. - property Parent: TXmlNode read FParent write FParent; - // NodeCount is the number of child nodes that this node holds. In order to - // loop through all child nodes, use a construct like this: - // - // with MyNode do - // for i := 0 to NodeCount - 1 do - // with Nodes[i] do - // ..processing here - // - property NodeCount: integer read GetNodeCount; - // Use Nodes to access the child nodes of the current XML node by index. Note - // that the list is zero-based, so Index is valid from 0 to NodeCount - 1. - property Nodes[Index: integer]: TXmlNode read GetNodes; default; - // Tag is an integer value the developer can use in any way. Tag does not get - // saved to the XML. Tag is often used to point to a GUI element (and is then - // cast to a pointer). - property Tag: integer read FTag write FTag; - // TotalNodeCount represents the total number of child nodes, and child nodes - // of child nodes etcetera of this particular node. Use the following to get - // the total number of nodes in the XML document: - // - // Total := MyDoc.RootNodes.TotalNodeCount; - // - property TotalNodeCount: integer read GetTotalNodeCount; - // Read TreeDepth to find out many nested levels there are for the current XML - // node. Root has a TreeDepth of zero. - property TreeDepth: integer read GetTreeDepth; - // ValueAsBool returns the node's value as boolean, or raises an - // exception if the value cannot be converted to boolean. Set ValueAsBool - // to convert a boolean to a UTF8String in the node's value field. See also - // function ValueAsBoolDef. - property ValueAsBool: boolean read GetValueAsBool write SetValueAsBool; - // ValueAsDateTime returns the node's value as TDateTime, or raises an - // exception if the value cannot be converted to TDateTime. Set ValueAsDateTime - // to convert a TDateTime to a UTF8String in the node's value field. See also - // function ValueAsDateTimeDef. - property ValueAsDateTime: TDateTime read GetValueAsDateTime write SetValueAsDateTime; - // ValueAsIn64 returns the node's value as int64, or raises an - // exception if the value cannot be converted to int64. Set ValueAsInt64 - // to convert an int64 to a UTF8String in the node's value field. See also - // function ValueAsInt64Def. - property ValueAsInt64: int64 read GetValueAsInt64 write SetValueAsInt64; - // ValueAsInteger returns the node's value as integer, or raises an - // exception if the value cannot be converted to integer. Set ValueAsInteger - // to convert an integer to a UTF8String in the node's value field. See also - // function ValueAsIntegerDef. - property ValueAsInteger: integer read GetValueAsInteger write SetValueAsInteger; - // ValueAsFloat returns the node's value as float, or raises an - // exception if the value cannot be converted to float. Set ValueAsFloat - // to convert a float to a UTF8String in the node's value field. See also - // function ValueAsFloatDef. - property ValueAsFloat: double read GetValueAsFloat write SetValueAsFloat; - // ValueAsString returns the unescaped version of ValueDirect. All neccesary - // characters in ValueDirect must be escaped (e.g. "&" becomes "&") but - // ValueAsString returns them in original format. Always use ValueAsString to - // set the text value of a node, to make sure all neccesary charaters are - // escaped. - property ValueAsString: UTF8String read GetValueAsString write SetValueAsString; - // ValueAsUnicodeString returns the unescaped version of ValueDirect as a UnicodeString. - // Always use ValueAsUnicodeString to set the text value of a node, to make sure all - // neccesary charaters are escaped. - property ValueAsUnicodeString: UnicodeString read GetValueAsUnicodeString write SetValueAsUnicodeString; - // ValueDirect is the exact text value as was parsed from the stream. If multiple - // text elements are encountered, they are added to ValueDirect with a CR to - // separate them. - property ValueDirect: UTF8String read FValue write FValue; - // WriteOnDefault reflects the same value as the WriteOnDefault setting of the parent - // Document. - property WriteOnDefault: boolean read GetWriteOnDefault; - end; - - // TXmlNodeList is a utility TList descendant that can be used to work with selection - // lists. An example: - // - // procedure FindAllZips(ANode: TXmlNode); - // var - // i: integer; - // AList: TXmlNodeList; - // begin - // AList := TXmlNodeList.Create; - // try - // // Get a list of all nodes named 'ZIP' - // ANode.NodesByName('ZIP', AList); - // for i := 0 to AList.Count - 1 do - // // Write the value of the node to output. Since AList[i] will be - // // of type TXmlNode, we can directly access the Value property. - // WriteLn(AList[i].Value); - // finally - // AList.Free; - // end; - // end; - // - TXmlNodeList = class(TList) - private - function GetItems(Index: Integer): TXmlNode; - procedure SetItems(Index: Integer; const Value: TXmlNode); - public - // Return the first node in the list that has an attribute with AName, AValue - function ByAttribute(const AName, AValue: UTF8String): TXmlNode; - property Items[Index: Integer]: TXmlNode read GetItems write SetItems; default; - end; - - // TNativeXml is the XML document holder. Create a TNativeXml and then use - // methods LoadFromFile, LoadFromStream or ReadFromString to load an XML document - // into memory. Or start from scratch and use Root.NodeNew to add nodes and - // eventually SaveToFile and SaveToStream to save the results as an XML document. - // Use property Xmlformat = xfReadable to ensure that indented (readable) output - // is produced. - TNativeXml = class(TPersistent) - private - FAbortParsing: boolean; // Signal to abort the parsing process - FBinaryEncoding: TBinaryEncodingType; // xbeBinHex or xbeBase64 - FCodecStream: TsdCodecStream; // Temporary stream used to read encoded files - FDropCommentsOnParse: boolean; // If true, comments are dropped (deleted) when parsing - FExternalEncoding: TStringEncodingType; - FFloatAllowScientific: boolean; - FFloatSignificantDigits: integer; - FParserWarnings: boolean; // Show parser warnings for non-critical errors - FRootNodes: TXmlNode; // Root nodes in the document (which contains one normal element that is the root) - FIndentString: UTF8String; // The indent string used to indent content (default is two spaces) - FUseFullNodes: boolean; // If true, nodes are never written in short notation. - FWriteOnDefault: boolean; // Set this option to "False" to only write values <> default value (default = true) - FXmlFormat: TXmlFormatType; // xfReadable, xfCompact - FOnNodeCompare: TXmlNodeCompareEvent; // Compare two nodes - FOnNodeNew: TXmlNodeEvent; // Called after a node is added - FOnNodeLoaded: TXmlNodeEvent; // Called after a node is loaded completely - FOnProgress: TXmlProgressEvent; // Called after a node is loaded/saved, with the current position in the file - FOnUnicodeLoss: TNotifyEvent; // This event is called when there is a warning for unicode conversion loss when reading unicode - procedure DoNodeNew(Node: TXmlNode); - procedure DoNodeLoaded(Node: TXmlNode); - procedure DoUnicodeLoss(Sender: TObject); - function GetCommentString: UTF8String; - procedure SetCommentString(const Value: UTF8String); - function GetEntityByName(AName: UTF8String): UTF8String; - function GetRoot: TXmlNode; - function GetEncodingString: UTF8String; - procedure SetEncodingString(const Value: UTF8String); - function GetVersionString: UTF8String; - procedure SetVersionString(const Value: UTF8String); - function GetStyleSheetNode: TXmlNode; - function GetUtf8Encoded: boolean; - protected - procedure CopyFrom(Source: TNativeXml); virtual; - procedure DoProgress(Size: integer); - function LineFeed: UTF8String; virtual; - procedure ParseDTD(ANode: TXmlNode; S: TStream); virtual; - procedure ReadFromStream(S: TStream); virtual; - procedure WriteToStream(S: TStream); virtual; - procedure SetDefaults; virtual; - public - // Create a new NativeXml document which can then be used to read or write XML files. - // A document that is created with Create must later be freed using Free. - // Example: - // - // var - // ADoc: TNativeXml; - // begin - // ADoc := TNativeXml.Create; - // try - // ADoc.LoadFromFile('c:\\temp\\myxml.xml'); - // {do something with the document here} - // finally - // ADoc.Free; - // end; - // end; - // - constructor Create; virtual; - // Use CreateName to Create a new Xml document that will automatically - // contain a root element with name ARootName. - constructor CreateName(const ARootName: UTF8String); virtual; - // Destroy will free all data in the TNativeXml object. This includes the - // root node and all subnodes under it. Do not call Destroy directly, call - // Free instead. - destructor Destroy; override; - // When calling Assign with a Source object that is a TNativeXml, will cause - // it to copy all data from Source. - procedure Assign(Source: TPersistent); override; - // Call Clear to remove all data from the object, and restore all defaults. - procedure Clear; virtual; - // Function IsEmpty returns true if the root is clear, or in other words, the - // root contains no value, no name, no subnodes and no attributes. - function IsEmpty: boolean; virtual; - // Load an XML document from the TStream object in Stream. The LoadFromStream - // procedure will raise an exception of type EFilerError when it encounters - // non-wellformed XML. This method can be used with any TStream descendant. - // See also LoadFromFile and ReadFromString. - procedure LoadFromStream(Stream: TStream); virtual; - // Call procedure LoadFromFile to load an XML document from the filename - // specified. See Create for an example. The LoadFromFile procedure will raise - // an exception of type EFilerError when it encounters non-wellformed XML. - procedure LoadFromFile(const AFileName: string); virtual; - // Call procedure ReadFromString to load an XML document from the UTF8String AValue. - // The ReadFromString procedure will raise an exception of type EFilerError - // when it encounters non-wellformed XML. - procedure ReadFromString(const AValue: UTF8String); virtual; - // Call ResolveEntityReferences after the document has been loaded to resolve - // any present entity references (&Entity;). When an entity is found in the - // DTD, it will replace the entity reference. Whenever an entity contains - // XML markup, it will be parsed and become part of the document tree. Since - // calling ResolveEntityReferences is adding quite some extra overhead, it - // is not done automatically. If you want to do the entity replacement, a good - // moment to call ResolveEntityReferences is right after LoadFromFile. - procedure ResolveEntityReferences; - // Call SaveToStream to save the XML document to the Stream. Stream - // can be any TStream descendant. Set XmlFormat to xfReadable if you want - // the stream to contain indentations to make the XML more human-readable. This - // is not the default and also not compliant with the XML specification. See - // SaveToFile for information on how to save in special encoding. - procedure SaveToStream(Stream: TStream); virtual; - // Call SaveToFile to save the XML document to a file with FileName. If the - // filename exists, it will be overwritten without warning. If the file cannot - // be created, a standard I/O exception will be generated. Set XmlFormat to - // xfReadable if you want the file to contain indentations to make the XML - // more human-readable. This is not the default and also not compliant with - // the XML specification.

- // Saving to special encoding types can be achieved by setting two properties - // before saving: - // * ExternalEncoding - // * EncodingString - // ExternalEncoding can be se8bit (for plain ascii), seUtf8 (UTF-8), seUtf16LE - // (for unicode) or seUtf16BE (unicode big endian).

Do not forget to also - // set the EncodingString (e.g. "UTF-8" or "UTF-16") which matches with your - // ExternalEncoding. - procedure SaveToFile(const AFileName: string); virtual; - // Call WriteToString to save the XML document to a UTF8String. Set XmlFormat to - // xfReadable if you want the UTF8String to contain indentations to make the XML - // more human-readable. This is not the default and also not compliant with - // the XML specification. - function WriteToString: UTF8String; virtual; - // Set AbortParsing to True if you use the OnNodeNew and OnNodeLoaded events in - // a SAX-like manner, and you want to abort the parsing process halfway. Example: - // - // procedure MyForm.NativeXmlNodeLoaded(Sender: TObject; Node: TXmlNode); - // begin - // if (Node.Name = 'LastNode') and (Sender is TNativeXml) then - // TNativeXml(Sender).AbortParsing := True; - // end; - // - property AbortParsing: boolean read FAbortParsing write FAbortParsing; - // Choose what kind of binary encoding will be used when calling TXmlNode.BufferRead - // and TXmlNode.BufferWrite. Default value is xbeBase64. - property BinaryEncoding: TBinaryEncodingType read FBinaryEncoding write FBinaryEncoding; - // A comment string above the root element \'; Style: xeComment), - (Start: ''; Style: xeExclam), - (Start: ''; Style: xeQuestion), - (Start: '<'; Close: '>'; Style: xeNormal) ); - // direct tags are derived from Normal tags by checking for the /> - - // These constant are used when generating hexchars from buffer data - cHexChar: array[0..15] of AnsiChar = '0123456789ABCDEF'; - cHexCharLoCase: array[0..15] of AnsiChar = '0123456789abcdef'; - - // These AnsiCharacters are used when generating BASE64 AnsiChars from buffer data - cBase64Char: array[0..63] of AnsiChar = - 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - cBase64PadChar: AnsiChar = '='; - - // The amount of bytes to allocate with each increase of the value buffer - cNodeValueBuf = 2048; - - // byte order marks for strings - // Unicode text files should contain $FFFE as first character to identify such a file clearly. Depending on the system - // where the file was created on this appears either in big endian or little endian style. - - const cBomInfoCount = 15; - const cBomInfo: array[0..cBomInfoCount - 1] of TBomInfo = - ( (BOM: ($00,$00,$FE,$FF); Len: 4; Encoding: seUCS4BE; HasBOM: true), - (BOM: ($FF,$FE,$00,$00); Len: 4; Encoding: seUCS4LE; HasBOM: true), - (BOM: ($00,$00,$FF,$FE); Len: 4; Encoding: seUCS4_2143; HasBOM: true), - (BOM: ($FE,$FF,$00,$00); Len: 4; Encoding: seUCS4_3412; HasBOM: true), - (BOM: ($FE,$FF,$00,$00); Len: 2; Encoding: seUTF16BE; HasBOM: true), - (BOM: ($FF,$FE,$00,$00); Len: 2; Encoding: seUTF16LE; HasBOM: true), - (BOM: ($EF,$BB,$BF,$00); Len: 3; Encoding: seUTF8; HasBOM: true), - (BOM: ($00,$00,$00,$3C); Len: 4; Encoding: seUCS4BE; HasBOM: false), - (BOM: ($3C,$00,$00,$00); Len: 4; Encoding: seUCS4LE; HasBOM: false), - (BOM: ($00,$00,$3C,$00); Len: 4; Encoding: seUCS4_2143; HasBOM: false), - (BOM: ($00,$3C,$00,$00); Len: 4; Encoding: seUCS4_3412; HasBOM: false), - (BOM: ($00,$3C,$00,$3F); Len: 4; Encoding: seUTF16BE; HasBOM: false), - (BOM: ($3C,$00,$3F,$00); Len: 4; Encoding: seUTF16LE; HasBOM: false), - (BOM: ($3C,$3F,$78,$6D); Len: 4; Encoding: seAnsi; HasBOM: false), - (BOM: ($4C,$6F,$A7,$94); Len: 4; Encoding: seEBCDIC; HasBOM: false) - ); - -// .NET compatible stub for TBytes (array of byte) type -{$IFNDEF CLR} -type - TBytes = TBigByteArray; -{$ENDIF} - -function StrScan(const Str: PAnsiChar; Chr: AnsiChar): PAnsiChar; -begin - Result := Str; - while Result^ <> Chr do - begin - if Result^ = #0 then - begin - Result := nil; - Exit; - end; - Inc(Result); - end; -end; - -function UTF8QuotedStr(const S: UTF8String; Quote: AnsiChar): UTF8String; -var - P, Src, Dest: PAnsiChar; - AddCount: Integer; -begin - AddCount := 0; - P := StrScan(PAnsiChar(S), Quote); - while P <> nil do - begin - Inc(P); - Inc(AddCount); - P := StrScan(P, Quote); - end; - if AddCount = 0 then - begin - Result := UTF8String(Quote) + S + UTF8String(Quote); - Exit; - end; - SetLength(Result, Length(S) + AddCount + 2); - Dest := Pointer(Result); - Dest^ := Quote; - Inc(Dest); - Src := Pointer(S); - P := StrScan(Src, Quote); - repeat - Inc(P); - Move(Src^, Dest^, P - Src); - Inc(Dest, P - Src); - Dest^ := Quote; - Inc(Dest); - Src := P; - P := StrScan(Src, Quote); - until P = nil; - P := StrEnd(Src); - Move(Src^, Dest^, P - Src); - Inc(Dest, P - Src); - Dest^ := Quote; -end; - -function UTF8ExtractQuotedStr(const S: UTF8String; Quote: AnsiChar): UTF8String; -var - P, Src, Dest: PAnsiChar; - DropCount: Integer; -begin - Result := ''; - Src := PAnsiChar(S); - if (Src = nil) or (Src^ <> Quote) then - Exit; - Inc(Src); - DropCount := 1; - P := Src; - Src := StrScan(Src, Quote); - while Src <> nil do - begin - Inc(Src); - if Src^ <> Quote then - Break; - Inc(Src); - Inc(DropCount); - Src := StrScan(Src, Quote); - end; - if Src = nil then - Src := StrEnd(P); - if ((Src - P) <= 1) then - Exit; - if DropCount = 1 then - SetString(Result, P, Src - P - 1) - else - begin - SetLength(Result, Src - P - DropCount); - Dest := PAnsiChar(Result); - Src := StrScan(P, Quote); - while Src <> nil do - begin - Inc(Src); - if Src^ <> Quote then - Break; - Move(P^, Dest^, Src - P); - Inc(Dest, Src - P); - Inc(Src); - P := Src; - Src := StrScan(Src, Quote); - end; - if Src = nil then - Src := StrEnd(P); - Move(P^, Dest^, Src - P - 1); - end; -end; - -function Utf8Pos(const Substr, S: UTF8String): Integer; -var - i, x: Integer; - Len, LenSubStr: Integer; -begin - i := 1; - LenSubStr := Length(SubStr); - Len := Length(S) - LenSubStr + 1; - while i <= Len do - begin - if S[i] = SubStr[1] then - begin - x := 1; - while (x < LenSubStr) and (S[i + x] = SubStr[x + 1]) do - Inc(x); - if (x = LenSubStr) then - begin - Result := i; - exit; - end; - end; - Inc(i); - end; - Result := 0; -end; - -// .NET-compatible TStream.Write - -function StreamWrite(Stream: TStream; const Buffer{$IFDEF CLR}: TBytes{$ENDIF}; Offset, Count: Longint): Longint; -begin -{$IFDEF CLR} - Result := Stream.Write(Buffer, Offset, Count); -{$ELSE} - Result := Stream.Write(TBytes(Buffer)[Offset], Count); -{$ENDIF} -end; - -{$IFNDEF CLR} -// Delphi's implementation of TStringStream is severely flawed, it does a SetLength -// on each write, which slows down everything to a crawl. This implementation over- -// comes this issue. -type - TsdUTF8StringStream = class(TMemoryStream) - public - constructor Create(const S: UTF8String); - function DataString: UTF8String; - end; - -constructor TsdUTF8StringStream.Create(const S: UTF8String); -begin - inherited Create; - SetSize(length(S)); - if Size > 0 then - begin - Write(S[1], Size); - Position := 0; - end; -end; - -function TsdUTF8StringStream.DataString: UTF8String; -begin - SetLength(Result, Size); - if Size > 0 then - begin - Position := 0; - Read(Result[1], length(Result)); - end; -end; -{$ELSE} -// In .NET we use the standard TStringStream -type - TsdUTF8StringStream = TStringStream; -{$ENDIF} - -// Utility functions - -function Min(A, B: integer): integer; -begin - if A < B then - Result := A - else - Result := B; -end; - -function Max(A, B: integer): integer; -begin - if A > B then - Result := A - else - Result := B; -end; - -function sdUTF8StringReplace(const S, OldPattern, NewPattern: UTF8String): UTF8String; -var - SearchStr, NewStr: UTF8String; - Offset: Integer; -begin - // Case Sensitive, Replace All - SearchStr := S; - NewStr := S; - Result := ''; - while SearchStr <> '' do - begin - Offset := UTF8Pos(OldPattern, SearchStr); - if Offset = 0 then - begin - Result := Result + NewStr; - Break; - end; - Result := Result + Copy(NewStr, 1, Offset - 1) + NewPattern; - NewStr := Copy(NewStr, Offset + Length(OldPattern), MaxInt); - SearchStr := Copy(SearchStr, Offset + Length(OldPattern), MaxInt); - end; -end; - -function sdUTF8EscapeString(const AValue: UTF8String): UTF8String; -var - i: integer; -begin - Result := AValue; - for i := 0 to cEscapeCount - 1 do - Result := sdUTF8StringReplace(Result, cEscapes[i], cReplaces[i]); -end; - -function sdUTF8UnEscapeString(const AValue: UTF8String): UTF8String; -var - SearchStr, Reference, Replace: UTF8String; - i, Offset, Code: Integer; - W: word; -begin - SearchStr := AValue; - Result := ''; - while SearchStr <> '' do - begin - // find '&' - Offset := Utf8Pos('&', SearchStr); - if Offset = 0 then - begin - // Nothing found - Result := Result + SearchStr; - Break; - end; - Result := Result + Copy(SearchStr, 1, Offset - 1); - SearchStr := Copy(SearchStr, Offset, MaxInt); - // find next ';' - Offset := Utf8Pos(';', SearchStr); - if Offset = 0 then - begin - // Error: encountered a '&' but not a ';'.. we will ignore, just return - // the unmodified value - Result := Result + SearchStr; - Break; - end; - // Reference - Reference := copy(SearchStr, 1, Offset); - SearchStr := Copy(SearchStr, Offset + 1, MaxInt); - Replace := Reference; - // See if it is a Character reference - if copy(Reference, 1, 2) = '&#' then - begin - Reference := copy(Reference, 3, length(Reference) - 3); - if length(Reference) > 0 then - begin - if sdUpCase(Reference[1]) = 'X' then - // Hex notation - Reference[1] := '$'; - Code := StrToIntDef(string(Reference), -1); - if (Code >= 0) and (Code < $FFFF) then - begin - W := Code; - {$IFDEF D5UP} - Replace := sdUnicodeToUtf8(UnicodeChar(W)); - {$ELSE} - Replace := AnsiChar(W and $FF); - {$ENDIF} - end; - end; - end else - begin - // Look up default escapes - for i := 0 to cEscapeCount - 1 do - if Reference = cReplaces[i] then - begin - // Replace - Replace := cEscapes[i]; - Break; - end; - end; - // New result - Result := Result + Replace; - end; -end; - -function sdUTF8QuotedString(const AValue: UTF8String): UTF8String; -var - Quote: AnsiChar; -begin - Quote := '"'; - if UTF8Pos('"', AValue) > 0 then - Quote := ''''; -{$IFDEF CLR} - Result := QuotedStr(AValue, AQuoteChar); -{$ELSE} - Result := UTF8QuotedStr(AValue, Quote); -{$ENDIF} -end; - -function sdUTF8UnQuotedString(const AValue: UTF8String): UTF8String; -var - Quote: AnsiChar; -begin - if Length(AValue) < 2 then - begin - Result := AValue; - exit; - end; - Quote := AValue[1]; - if Quote in cQuoteChars then - begin - {$IFDEF CLR} - Result := DequotedStr(AValue, Quote); - {$ELSE} - Result := UTF8ExtractQuotedStr(AValue, Quote); - {$ENDIF} - end else - Result := AValue; -end; - -function sdAddControlChars(const AValue: UTF8String; const Chars: UTF8String; Interval: integer): UTF8String; -// Insert AnsiChars in AValue at each Interval AnsiChars -var - i, j, ALength: integer; - // local - procedure InsertControlChars; - var - k: integer; - begin - for k := 1 to Length(Chars) do - begin - Result[j] := Chars[k]; - inc(j); - end; - end; -// main -begin - if (Length(Chars) = 0) or (Interval <= 0) then - begin - Result := AValue; - exit; - end; - - // Calculate length based on original length and total extra length for control AnsiChars - ALength := Length(AValue) + ((Length(AValue) - 1) div Interval + 3) * Length(Chars); - SetLength(Result, ALength); - - // Copy and insert - j := 1; - for i := 1 to Length(AValue) do - begin - if (i mod Interval) = 1 then - // Insert control AnsiChars - InsertControlChars; - Result[j] := AValue[i]; - inc(j); - end; - InsertControlChars; - - // Adjust length - dec(j); - if ALength > j then - SetLength(Result, j); -end; - -function sdRemoveControlChars(const AValue: UTF8String): UTF8String; -// Remove control characters from UTF8String in AValue -var - i, j: integer; -begin - Setlength(Result, Length(AValue)); - i := 1; - j := 1; - while i <= Length(AValue) do - if AValue[i] in cControlChars then - inc(i) - else - begin - Result[j] := AValue[i]; - inc(i); - inc(j); - end; - // Adjust length - if i <> j then - SetLength(Result, j - 1); -end; - -function sdUTF8FindString(const SubString, S: UTF8String; Start, Close: integer; var APos: integer): boolean; -// Check if the Substring matches the UTF8String S in any position in interval Start to Close - 1 -// and returns found positon in APos. Result = True if anything is found. -// Note: this funtion is case-insensitive -var - CharIndex: integer; -begin - Result := False; - APos := 0; - for CharIndex := Start to Close - Length(SubString) do - if sdUTF8MatchString(SubString, S, CharIndex) then - begin - APos := CharIndex; - Result := True; - exit; - end; -end; - -function UTF8CompareText(const S1, S2: UTF8String): integer; -begin - Result := AnsiCompareText(string(S1), string(S2)); -end; - -function IntToUTF8Str(Value: integer): UTF8String; -begin - Result := UTF8String(IntToStr(Value)); -end; - -function Int64ToUTF8Str(Value: int64): UTF8String; -begin - Result := UTF8String(IntToStr(Value)); -end; - -function sdUTF8MatchString(const SubString: UTF8String; const S: UTF8String; Start: integer): boolean; -// Check if the Substring matches the string S at position Start. -// Note: this funtion is case-insensitive -var - CharIndex: integer; -begin - Result := False; - // Check range just in case - if (Length(S) - Start + 1) < Length(Substring) then - exit; - - CharIndex := 0; - while CharIndex < Length(SubString) do - if sdUpCase(SubString[CharIndex + 1]) = sdUpCase(S[Start + CharIndex]) then - inc(CharIndex) - else - exit; - // All AnsiChars were the same, so we succeeded - Result := True; -end; - -procedure sdUTF8ParseAttributes(const AValue: UTF8String; Start, Close: integer; Attributes: TsdUTF8StringList); -// Convert the attributes string AValue in [Start, Close - 1] to the attributes Stringlist -var - i: integer; - InQuotes: boolean; - Quote: AnsiChar; -begin - InQuotes := False; - Quote := '"'; - if not assigned(Attributes) then - exit; - if not sdUTF8TrimPos(AValue, Start, Close) then - exit; - - // Clear first - Attributes.Clear; - - // Loop through characters - for i := Start to Close - 1 do - begin - - // In quotes? - if InQuotes then - begin - if AValue[i] = Quote then - InQuotes := False; - end else - begin - if AValue[i] in cQuoteChars then - begin - InQuotes := True; - Quote := AValue[i]; - end; - end; - - // Add attribute strings on each controlchar break - if not InQuotes then - if AValue[i] in cControlChars then - begin - if i > Start then - Attributes.Add(copy(AValue, Start, i - Start)); - Start := i + 1; - end; - end; - - // Add last attribute string - if Start < Close then - Attributes.Add(copy(AValue, Start, Close - Start)); - - // First-char "=" signs should append to previous - for i := Attributes.Count - 1 downto 1 do - if Attributes[i][1] = '=' then - begin - Attributes[i - 1] := Attributes[i - 1] + Attributes[i]; - Attributes.Delete(i); - end; - - // First-char quotes should append to previous - for i := Attributes.Count - 1 downto 1 do - if (Attributes[i][1] in cQuoteChars) and (UTF8Pos('=', Attributes[i - 1]) > 0) then - begin - Attributes[i - 1] := Attributes[i - 1] + Attributes[i]; - Attributes.Delete(i); - end; -end; - -function sdUTF8TrimPos(const AValue: UTF8String; var Start, Close: integer): boolean; -// Trim the string in AValue in [Start, Close - 1] by adjusting Start and Close variables -begin - // Checks - Start := Max(1, Start); - Close := Min(Length(AValue) + 1, Close); - if Close <= Start then - begin - Result := False; - exit; - end; - - // Trim left - while - (Start < Close) and - (AValue[Start] in cControlChars) do - inc(Start); - - // Trim right - while - (Start < Close) and - (AValue[Close - 1] in cControlChars) do - dec(Close); - - // Do we have a string left? - Result := Close > Start; -end; - -function sdUTF8Trim(const AValue: UTF8String): UTF8String; -var - Start, Close: integer; - Res: boolean; -begin - Start := 1; - Close := length(AValue) + 1; - Res := sdUTF8TrimPos(AValue, Start, Close); - if Res then - Result := Copy(AValue, Start, Close - Start) - else - Result := ''; -end; - -procedure sdUTF8WriteStringToStream(S: TStream; const AString: UTF8String); -begin - if Length(AString) > 0 then - begin - {$IFDEF CLR} - S.Write(BytesOf(AString), Length(AString)); - {$ELSE} - S.Write(AString[1], Length(AString)); - {$ENDIF} - end; -end; - -function sdUpCase(Ch: AnsiChar): AnsiChar; -begin - Result := Ch; - case Result of - 'a'..'z': Dec(Result, Ord('a') - Ord('A')); - end; -end; - -function ReadOpenTag(AReader: TsdSurplusReader): integer; -// Try to read the type of open tag from S -var - AIndex, i: integer; - Found: boolean; - Ch: AnsiChar; - Candidates: array[0..cTagCount - 1] of boolean; - Surplus: UTF8String; -begin - Surplus := ''; - Result := cTagCount - 1; - for i := 0 to cTagCount - 1 do Candidates[i] := True; - AIndex := 1; - repeat - Found := False; - inc(AIndex); - if AReader.ReadChar(Ch) = 0 then - exit; - Surplus := Surplus + UTF8String(Ch); - for i := cTagCount - 1 downto 0 do - if Candidates[i] and (length(cTags[i].Start) >= AIndex) then - begin - if cTags[i].Start[AIndex] = Ch then - begin - Found := True; - if length(cTags[i].Start) = AIndex then - Result := i; - end else - Candidates[i] := False; - end; - until Found = False; - // The surplus string that we already read (everything after the tag) - AReader.Surplus := copy(Surplus, length(cTags[Result].Start), length(Surplus)); -end; - -function ReadStringFromStreamUntil(AReader: TsdSurplusReader; const ASearch: UTF8String; - var AValue: UTF8String; SkipQuotes: boolean): boolean; -var - AIndex, ValueIndex, SearchIndex: integer; - LastSearchChar, Ch: AnsiChar; - InQuotes: boolean; - QuoteChar: AnsiChar; - SB: TsdStringBuilder; -begin - Result := False; - InQuotes := False; - - // Get last searchstring character - AIndex := length(ASearch); - if AIndex = 0 then exit; - LastSearchChar := ASearch[AIndex]; - - SB := TsdStringBuilder.Create; - try - QuoteChar := #0; - - repeat - // Add characters to the value to be returned - if AReader.ReadChar(Ch) = 0 then - exit; - SB.AddChar(Ch); - - // Do we skip quotes? - if SkipQuotes then - begin - if InQuotes then - begin - if (Ch = QuoteChar) then - InQuotes := false; - end else - begin - if Ch in cQuoteChars then - begin - InQuotes := true; - QuoteChar := Ch; - end; - end; - end; - - // In quotes? If so, we don't check the end condition - if not InQuotes then - begin - // Is the last char the same as the last char of the search string? - if Ch = LastSearchChar then - begin - - // Check to see if the whole search string is present - ValueIndex := SB.Length - 1; - SearchIndex := length(ASearch) - 1; - if ValueIndex < SearchIndex then continue; - - Result := True; - while (SearchIndex > 0)and Result do - begin - Result := SB[ValueIndex] = ASearch[SearchIndex]; - dec(ValueIndex); - dec(SearchIndex); - end; - end; - end; - until Result; - - // Use only the part before the search string - AValue := SB.StringCopy(1, SB.Length - length(ASearch)); - finally - SB.Free; - end; -end; - -function ReadStringFromStreamWithQuotes(S: TStream; const Terminator: UTF8String; - var AValue: UTF8String): boolean; -var - Ch, QuoteChar: AnsiChar; - InQuotes: boolean; - SB: TsdStringBuilder; -begin - SB := TsdStringBuilder.Create; - try - QuoteChar := #0; - Result := False; - InQuotes := False; - repeat - if S.Read(Ch, 1) = 0 then exit; - if not InQuotes then - begin - if (Ch = '"') or (Ch = '''') then - begin - InQuotes := True; - QuoteChar := Ch; - end; - end else - begin - if Ch = QuoteChar then - InQuotes := False; - end; - if not InQuotes and (UTF8String(Ch) = Terminator) then - break; - SB.AddChar(Ch); - until False; - AValue := SB.Value; - Result := True; - finally - SB.Free; - end; -end; - -function GetTimeZoneBias: Integer; -// uses windows unit, func GetTimeZoneInformation -var - TimeZoneInfo: TTimeZoneInformation; -begin - case GetTimeZoneInformation(TimeZoneInfo) of - TIME_ZONE_ID_UNKNOWN: Result := TimeZoneInfo.Bias; - TIME_ZONE_ID_STANDARD: Result := TimeZoneInfo.Bias + TimeZoneInfo.StandardBias; - TIME_ZONE_ID_DAYLIGHT: Result := TimeZoneInfo.Bias + TimeZoneInfo.DaylightBias; - else - Result := 0; - end; -end; - -function sdDateTimeFromString(const ADate: UTF8String): TDateTime; -// Convert the string ADate to a TDateTime according to the W3C date/time specification -// as found here: http://www.w3.org/TR/NOTE-datetime -// contributor: Stefan Glienke -var - AYear, AMonth, ADay, AHour, AMin, ASec, AMSec: word; - ALocalBias, ABias: Integer; -begin - AYear := StrToInt(string(copy(ADate, 1, 4))); - AMonth := StrToInt(string(copy(ADate, 6, 2))); - ADay := StrToInt(string(copy(ADate, 9, 2))); - if Length(ADate) > 16 then - begin - AHour := StrToInt(string(copy(ADate, 12, 2))); - AMin := StrToInt(string(copy(ADate, 15, 2))); - ASec := StrToIntDef(string(copy(ADate, 18, 2)), 0); // They might be omitted, so default to 0 - AMSec := StrToIntDef(string(copy(ADate, 21, 3)), 0); // They might be omitted, so default to 0 - end else - begin - AHour := 0; - AMin := 0; - ASec := 0; - AMSec := 0; - end; - Result := - EncodeDate(AYear, AMonth, ADay) + - EncodeTime(AHour, AMin, ASec, AMSec); - ALocalBias := GetTimeZoneBias; - if Length(ADate) > 24 then - begin - ABias := StrToInt(string(Copy(ADate, 25, 2))) * MinsPerHour + - StrToInt(string(Copy(ADate, 28, 2))); - if ADate[24] = '+' then - ABias := ABias * -1; - Result := Result + ABias / MinsPerDay; - end; - Result := Result - ALocalBias / MinsPerDay; -end; - -function sdDateTimeFromStringDefault(const ADate: UTF8String; ADefault: TDateTime): TDateTime; -// Convert the string ADate to a TDateTime according to the W3C date/time specification -// as found here: http://www.w3.org/TR/NOTE-datetime -// If there is a conversion error, the default value ADefault is returned. -begin - try - Result := sdDateTimeFromString(ADate); - except - Result := ADefault; - end; -end; - -function sdDateTimeToString(ADate: TDateTime): UTF8String; -// Convert the TDateTime ADate to a string according to the W3C date/time specification -// as found here: http://www.w3.org/TR/NOTE-datetime -// contributor: Stefan Glienke -var - AYear, AMonth, ADay, AHour, AMin, ASec, AMSec: word; - ABias: Integer; -const - Neg: array[Boolean] of string = ('+', '-'); -begin - DecodeDate(ADate, AYear, AMonth, ADay); - DecodeTime(ADate, AHour, AMin, ASec, AMSec); - if frac(ADate) = 0 then - Result := UTF8String(Format('%.4d-%.2d-%.2d', [AYear, AMonth, ADay])) - else - begin - ABias := GetTimeZoneBias; - if ABias <> 0 then - Result := UTF8String(Format('%.4d-%.2d-%.2dT%.2d:%.2d:%.2d.%.3d%s%.2d:%.2d', - [AYear, AMonth, ADay, AHour, AMin, ASec, AMSec, - Neg[ABias > 0], Abs(ABias) div MinsPerHour, Abs(ABias) mod MinsPerHour])) - else - Result := UTF8String(Format('%.4d-%.2d-%.2dT%.2d:%.2d:%.2d.%.3dZ', - [AYear, AMonth, ADay, AHour, AMin, ASec, AMSec])); - end; -end; - -function sdWriteNumber(Value: double; SignificantDigits: integer; AllowScientific: boolean): UTF8String; -const - Limits: array[1..9] of integer = - (10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000); -var - Limit, Limitd, PointPos, IntVal, ScPower: integer; - Body: UTF8String; -begin - if (SignificantDigits < 1) or (SignificantDigits > 9) then - raise Exception.Create(sxeSignificantDigitsOutOfRange); - - // Zero - if Value = 0 then - begin - Result := '0'; - exit; - end; - - // Sign - if Value < 0 then - begin - Result := '-'; - Value := -Value; - end else - Result := ''; - - // Determine point position - Limit := Limits[SignificantDigits]; - Limitd := Limit div 10; - PointPos := SignificantDigits; - while Value < Limitd do - begin - Value := Value * 10; - dec(PointPos); - end; - while Value >= Limit do - begin - Value := Value * 0.1; - inc(PointPos); - end; - - // Round - IntVal := round(Value); - - // Exceptional case which happens when the value rounds up to the limit - if Intval = Limit then - begin - IntVal := IntVal div 10; - inc(PointPos); - end; - - // Strip off any zeros, these reduce significance count - while (IntVal mod 10 = 0) and (PointPos < SignificantDigits) do - begin - dec(SignificantDigits); - IntVal := IntVal div 10; - end; - - // Check for scientific notation - ScPower := 0; - if AllowScientific and ((PointPos < -1) or (PointPos > SignificantDigits + 2)) then - begin - ScPower := PointPos - 1; - dec(PointPos, ScPower); - end; - - // Body - Body := IntToUTF8Str(IntVal); - while PointPos > SignificantDigits do - begin - Body := Body + '0'; - inc(SignificantDigits); - end; - while PointPos < 0 do - begin - Body := '0' + Body; - inc(PointPos); - end; - if PointPos = 0 then - Body := '.' + Body - else - if PointPos < SignificantDigits then - Body := copy(Body, 1, PointPos) + '.' + copy(Body, PointPos + 1, SignificantDigits); - - // Final result - if ScPower = 0 then - Result := Result + Body - else - Result := Result + Body + 'E' + IntToUTF8Str(ScPower); -end; - -{$IFDEF CLR} - -function sdUnicodeToUtf8(const W: UnicodeString): UTF8String; -begin - Result := Encoding.UTF8.GetBytes(W); -end; - -function sdUtf8ToUnicode(const S: UTF8String): UnicodeString; -begin - Result := Encoding.UTF8.GetString(BytesOf(S)); -end; - -function EncodeBase64Buf(const Buffer: TBytes; Count: Integer): UTF8String; -begin - Result := Convert.ToBase64String(Buffer, 0, Count); -end; - -function EncodeBase64(const Source: UTF8String): UTF8String; -begin - Result := Convert.ToBase64String(BytesOf(Source)); -end; - -procedure DecodeBase64Buf(const Source: UTF8String; var Buffer: TBytes; Count: Integer); -var - ADecoded: TBytes; -begin - ADecoded := Convert.FromBase64String(Source); - if Count > Length(ADecoded) then - raise EFilerError.Create(sxeMissingDataInBinaryStream); - SetLength(ADecoded, Count); - Buffer := ADecoded; -end; - -function DecodeBase64(const Source: UTF8String): UTF8String; -begin - Result := UTF8String(Convert.FromBase64String(Source)); -end; - -{$ELSE} - -function PtrUnicodeToUtf8(Dest: PAnsiChar; MaxDestBytes: Cardinal; Source: PUnicodeChar; SourceChars: Cardinal): Cardinal; -var - i, count: Cardinal; - c: Cardinal; -begin - Result := 0; - if not assigned(Source) or not assigned(Dest) then - exit; - - count := 0; - i := 0; - - while (i < SourceChars) and (count < MaxDestBytes) do - begin - c := Cardinal(Source[i]); - Inc(i); - if c <= $7F then - begin - Dest[count] := AnsiChar(c); - Inc(count); - end else - if c > $7FF then - begin - if count + 3 > MaxDestBytes then - break; - Dest[count] := AnsiChar($E0 or (c shr 12)); - Dest[count+1] := AnsiChar($80 or ((c shr 6) and $3F)); - Dest[count+2] := AnsiChar($80 or (c and $3F)); - Inc(count,3); - end else - begin // $7F < Source[i] <= $7FF - if count + 2 > MaxDestBytes then - break; - Dest[count] := AnsiChar($C0 or (c shr 6)); - Dest[count+1] := AnsiChar($80 or (c and $3F)); - Inc(count,2); - end; - end; - if count >= MaxDestBytes then - count := MaxDestBytes-1; - Dest[count] := #0; - Result := count + 1; // convert zero based index to byte count -end; - -function PtrUtf8ToUnicode(Dest: PUnicodeChar; MaxDestChars: Cardinal; Source: PAnsiChar; - SourceBytes: Cardinal): Cardinal; -var - i, count: Cardinal; - c: Byte; - wc: Cardinal; -begin - if not assigned(Dest) or not assigned(Source) then - begin - Result := 0; - Exit; - end; - Result := Cardinal(-1); - count := 0; - i := 0; - while (i < SourceBytes) and (count < MaxDestChars) do - begin - wc := Cardinal(Source[i]); - Inc(i); - if (wc and $80) <> 0 then - begin - if i >= SourceBytes then - // incomplete multibyte char - Exit; - wc := wc and $3F; - if (wc and $20) <> 0 then - begin - c := Byte(Source[i]); - Inc(i); - if (c and $C0) <> $80 then - // malformed trail byte or out of range char - Exit; - if i >= SourceBytes then - // incomplete multibyte char - Exit; - wc := (wc shl 6) or (c and $3F); - end; - c := Byte(Source[i]); - Inc(i); - if (c and $C0) <> $80 then - // malformed trail byte - Exit; - Dest[count] := UnicodeChar((wc shl 6) or (c and $3F)); - end else - Dest[count] := UnicodeChar(wc); - Inc(count); - end; - - if count >= MaxDestChars then - count := MaxDestChars-1; - - Dest[count] := #0; - Result := count + 1; -end; - -function sdUnicodeToUtf8(const W: UnicodeString): UTF8String; -var - L: integer; - Temp: UTF8String; -begin - Result := ''; - if W = '' then - Exit; - SetLength(Temp, Length(W) * 3); // SetLength includes space for null terminator - - L := PtrUnicodeToUtf8(PAnsiChar(Temp), Length(Temp) + 1, PUnicodeChar(W), Length(W)); - if L > 0 then - SetLength(Temp, L - 1) - else - Temp := ''; - Result := Temp; -end; - -function sdUtf8ToUnicode(const S: UTF8String): UnicodeString; -var - L: Integer; - Temp: UnicodeString; -begin - Result := ''; - if S = '' then - Exit; - SetLength(Temp, Length(S)); - - L := PtrUtf8ToUnicode(PUnicodeChar(Temp), Length(Temp)+1, PAnsiChar(S), Length(S)); - if L > 0 then - SetLength(Temp, L-1) - else - Temp := ''; - Result := Temp; -end; - -function EncodeBase64Buf(const Buffer; Count: Integer): UTF8String; -var - i, j: integer; - ACore: integer; - ALong: cardinal; - S: PByte; -begin - // Make sure ASize is always a multiple of 3, and this multiple - // gets saved as 4 characters - ACore := (Count + 2) div 3; - - // Set the length of the string that stores encoded characters - SetLength(Result, ACore * 4); - S := @Buffer; - // Do the loop ACore times - for i := 0 to ACore - 1 do - begin - ALong := 0; - for j := 0 to 2 do - begin - ALong := ALong shl 8 + S^; - inc(S); - end; - for j := 0 to 3 do - begin - Result[i * 4 + 4 - j] := cBase64Char[ALong and $3F]; - ALong := ALong shr 6; - end; - end; - // For comformity to Base64, we must pad the data instead of zero out - // if the size is not an exact multiple of 3 - case ACore * 3 - Count of - 0:;// nothing to do - 1: // pad one byte - Result[ACore * 4] := cBase64PadChar; - 2: // pad two bytes - begin - Result[ACore * 4 ] := cBase64PadChar; - Result[ACore * 4 - 1] := cBase64PadChar; - end; - end;//case -end; - -function EncodeBase64(const Source: RawByteString): UTF8String; -// Encode binary data in Source as BASE64. The function returns the BASE64 encoded -// data as string, without any linebreaks. -begin - if length(Source) > 0 then - Result := EncodeBase64Buf(Source[1], length(Source)) - else - Result := ''; -end; - -procedure DecodeBase64Buf(var Source: UTF8String; var Buffer; Count: Integer); -var - i, j: integer; - BufPos, Core: integer; - LongVal: cardinal; - D: PByte; - Map: array[AnsiChar] of byte; -begin - // Core * 4 is the number of chars to read - check length - Core := Length(Source) div 4; - if Count > Core * 3 then - raise EFilerError.Create(sxeMissingDataInBinaryStream); - - // Prepare map - for i := 0 to 63 do - Map[cBase64Char[i]] := i; - D := @Buffer; - - // Check for final padding, and replace with "zeros". There can be - // at max two pad chars ('=') - BufPos := length(Source); - if (BufPos > 0) and (Source[BufPos] = cBase64PadChar) then - begin - Source[BufPos] := cBase64Char[0]; - dec(BufPos); - if (BufPos > 0) and (Source[BufPos] = cBase64PadChar) then - Source[BufPos] := cBase64Char[0]; - end; - - // Do this Core times - for i := 0 to Core - 1 do - begin - LongVal := 0; - // Unroll the characters - for j := 0 to 3 do - LongVal := LongVal shl 6 + Map[Source[i * 4 + j + 1]]; - // and unroll the bytes - for j := 2 downto 0 do - begin - // Check overshoot - if integer(D) - integer(@Buffer) >= Count then - exit; - D^ := LongVal shr (j * 8) and $FF; - inc(D); - end; - end; -end; - -function DecodeBase64(const Source: UTF8String): RawByteString; -// Decode BASE64 data in Source into binary data. The function returns the binary -// data as UTF8String. Use a TStringStream to convert this data to a stream. -var - BufData: UTF8String; - BufSize, BufPos: integer; -begin - BufData := sdRemoveControlChars(Source); - - // Determine length of data - BufSize := length(BufData) div 4; - if BufSize * 4 <> length(BufData) then - raise EFilerError.Create(sxeErrorCalcStreamLength); - BufSize := BufSize * 3; - // Check padding AnsiChars - BufPos := length(BufData); - if (BufPos > 0) and (BufData[BufPos] = cBase64PadChar) then - begin - dec(BufPos); - dec(BufSize); - if (BufPos > 0) and (BufData[BufPos] = cBase64PadChar) then - dec(BufSize); - end; - Setlength(Result, BufSize); - - // Decode - if BufSize > 0 then - DecodeBase64Buf(BufData, Result[1], BufSize); -end; - -{$ENDIF} - -function sdAnsiToUtf8(const S: AnsiString): UTF8String; -begin - // We let the OS figure out Ansi<->Unicode - Result := sdUnicodeToUtf8(UnicodeString(S)); -end; - -function sdUtf8ToAnsi(const S: UTF8String): AnsiString; -begin - // We let the OS figure out Ansi<->Unicode. There might be dataloss! - Result := Ansistring(sdUtf8ToUnicode(S)); -end; - -function EncodeBinHexBuf(const Source; Count: Integer): UTF8String; -// Encode binary data in Source as BINHEX. The function returns the BINHEX encoded -// data as UTF8String, without any linebreaks. -var -{$IFDEF CLR} - Text: TBytes; -{$ELSE} - Text: UTF8String; -{$ENDIF} -begin - SetLength(Text, Count * 2); -{$IFDEF CLR} - BinToHex(TBytes(Source), 0, Text, 0, Count); -{$ELSE} - BinToHex(PAnsiChar(@Source), PAnsiChar(Text), Count); -{$ENDIF} - Result := Text; -end; - -function EncodeBinHex(const Source: RawByteString): UTF8String; -// Encode binary data in Source as BINHEX. The function returns the BINHEX encoded -// data as UTF8String, without any linebreaks. -var -{$IFDEF CLR} - Text: TBytes; -{$ELSE} - Text: UTF8String; -{$ENDIF} -begin - SetLength(Text, Length(Source) * 2); -{$IFDEF CLR} - BinToHex(BytesOf(Source), 0, Text, 0, Length(Source)); -{$ELSE} - BinToHex(PAnsiChar(Source), PAnsiChar(Text), Length(Source)); -{$ENDIF} - Result := Text; -end; - -procedure DecodeBinHexBuf(const Source: UTF8String; var Buffer{$IFDEF CLR}: TBytes{$ENDIF}; Count: Integer); -// Decode BINHEX data in Source into binary data. -begin - if Length(Source) div 2 < Count then - raise EFilerError.Create(sxeMissingDataInBinaryStream); - -{$IFDEF CLR} - HexToBin(BytesOf(Source), 0, Buffer, 0, Count); -{$ELSE} - HexToBin(PAnsiChar(Source), PAnsiChar(@Buffer), Count); -{$ENDIF} -end; - -function DecodeBinHex(const Source: UTF8String): RawByteString; -// Decode BINHEX data in Source into binary data. The function returns the binary -// data as RawByteString. Use a TStringStream to convert this data to a stream. -var - Data: Utf8String; - Size: integer; -{$IFDEF CLR} - Buffer: TBytes; -{$ELSE} - Buffer: RawByteString; -{$ENDIF} -begin - Data := sdRemoveControlChars(Source); - - // Determine length of data - Size := length(Data) div 2; - if Size * 2 <> length(Data) then - raise EFilerError.Create(sxeErrorCalcStreamLength); - - SetLength(Buffer, Size); -{$IFDEF CLR} - HexToBin(BytesOf(Data), 0, Buffer, 0, Size); -{$ELSE} - HexToBin(PAnsiChar(Data), PAnsiChar(Buffer), Size); -{$ENDIF} - Result := Buffer; -end; - -function sdStringToBool(const AValue: UTF8String): boolean; -var - Ch: AnsiChar; -begin - if Length(AValue) > 0 then - begin - Ch := sdUpCase(AValue[1]); - if Ch in ['T', 'Y', '1'] then - begin - Result := True; - exit; - end; - if Ch in ['F', 'N', '0'] then - begin - Result := False; - exit; - end; - end; - raise Exception.Create(sxeCannotConverToBool); -end; - -function sdStringFromBool(ABool: boolean): UTF8String; -const - cBoolValues: array[boolean] of UTF8String = ('false', 'true'); -begin - Result := cBoolValues[ABool]; -end; - -{ TsdUTF8StringList } - -function TsdUTF8StringList.Add(const S: UTF8String): integer; -var - L: integer; -begin - L := Length(FItems); - if L = FCount then - begin - // Increase capacity - SetLength(FItems, FCount + 4); - end; - FItems[FCount] := S; - Result := FCount; - inc(FCount); -end; - -procedure TsdUTF8StringList.Assign(Source: TPersistent); -var - i: integer; - SL: TsdUTF8StringList; -begin - if Source is TsdUTF8StringList then - begin - SL := TsdUTF8StringList(Source); - SetLength(FItems, SL.FCount); - for i := 0 to SL.FCount - 1 do - FItems[i] := SL.FItems[i]; - FCount := SL.FCount; - end else - inherited; -end; - -procedure TsdUTF8StringList.Clear; -begin - FCount := 0; -end; - -procedure TsdUTF8StringList.Delete(Index: Integer); -var - i: integer; -begin - if (Index < 0) or (Index >= Count) then - exit; - for i := Index + 1 to Count - 1 do - FItems[i - 1] := FItems[i]; - dec(FCount); -end; - -function TsdUTF8StringList.GetItems(Index: integer): UTF8String; -begin - if (Index >= 0) and (Index < Count) then - Result := FItems[Index] - else - Result := ''; -end; - -function TsdUTF8StringList.GetNames(Index: integer): UTF8String; -var - P: integer; -begin - Result := Items[Index]; - P := UTF8Pos('=', Result); - if P <> 0 then - SetLength(Result, P - 1) - else - SetLength(Result, 0); -end; - -function TsdUTF8StringList.GetText: UTF8String; -const - cLB: UTF8String = #13#10; -var - i, L, LItem: integer; - P: PAnsiChar; -begin - L := 0; - for i := 0 to Count - 1 do - begin - inc(L, length(FItems[i])); - inc(L, 2); - end; - SetLength(Result, L); - if L = 0 then - exit; - P := @Result[1]; - for i := 0 to Count - 1 do - begin - LItem := length(FItems[i]); - if LItem > 0 then - begin - System.Move(FItems[i][1], P^, LItem); - inc(P, LItem); - end; - System.Move(cLB[1], P^, 2); - inc(P, 2); - end; -end; - -function TsdUTF8StringList.GetValues(const Name: UTF8String): UTF8String; -var - Idx: integer; -begin - Idx := IndexOfName(Name); - if Idx >= 0 then - Result := Copy(FItems[Idx], Length(Name) + 2, MaxInt) - else - Result := ''; -end; - -function TsdUTF8StringList.IndexOfName(const Name: UTF8String): integer; -begin - for Result := 0 to Count - 1 do - begin - if sdUTF8MatchString(Name + '=', FItems[Result], 1) then - exit; - end; - Result := -1; -end; - -procedure TsdUTF8StringList.SetItems(Index: integer; const Value: UTF8String); -begin - if (Index >= 0) and (Index < Count) then - FItems[Index] := Value; -end; - -procedure TsdUTF8StringList.SetValues(const Name, Value: UTF8String); -var - Idx: integer; -begin - Idx := IndexOfName(Name); - if Value <> '' then - begin - if Idx < 0 then - Idx := Add(''); - FItems[Idx] := Name + '=' + Value; - end else - Delete(Idx); -end; - -{ TXmlNode } - -function TXmlNode.AbortParsing: boolean; -begin - Result := assigned(Document) and Document.AbortParsing; -end; - -procedure TXmlNode.Assign(Source: TPersistent); -var - i: integer; - Node: TXmlNode; -begin - if Source is TXmlNode then - begin - // Clear first - Clear; - - // Properties - FElementType := TXmlNode(Source).FElementType; - FName := TXmlNode(Source).FName; - FTag := TXmlNode(Source).FTag; - FValue := TXmlNode(Source).FValue; - - // Attributes - if assigned(TXmlNode(Source).FAttributes) then - begin - CheckCreateAttributesList; - FAttributes.Assign(TXmlNode(Source).FAttributes); - end; - - // Nodes - for i := 0 to TXmlNode(Source).NodeCount - 1 do - begin - Node := NodeNew(''); - Node.Assign(TXmlNode(Source).Nodes[i]); - end; - end else - if Source is TNativeXml then - begin - Assign(TNativeXml(Source).FRootNodes); - end else - inherited; -end; - -procedure TXmlNode.AttributeAdd(const AName, AValue: UTF8String); -var - Attr: UTF8String; -begin - Attr := UTF8String(Format('%s=%s', [AName, sdUTF8QuotedString(sdUTF8EscapeString(AValue))])); - CheckCreateAttributesList; - FAttributes.Add(Attr); -end; - -procedure TXmlNode.AttributeAdd(const AName: UTF8String; AValue: integer); -begin - AttributeAdd(AName, IntToUTF8Str(AValue)); -end; - -procedure TXmlNode.AttributeDelete(Index: integer); -begin - if (Index >= 0) and (Index < AttributeCount) then - FAttributes.Delete(Index); -end; - -procedure TXmlNode.AttributeExchange(Index1, Index2: integer); -var - Temp: UTF8String; -begin - if (Index1 <> Index2) and - (Index1 >= 0) and (Index1 < FAttributes.Count) and - (Index2 >= 0) and (Index2 < FAttributes.Count) then - begin - Temp := FAttributes[Index1]; - FAttributes[Index1] := FAttributes[Index2]; - FAttributes[Index2] := Temp; - end; -end; - -function TXmlNode.AttributeIndexByname(const AName: UTF8String): integer; -// Return the index of the attribute with name AName, or -1 if not found -begin - if assigned(FAttributes) then - Result := FAttributes.IndexOfName(AName) - else - Result := -1; -end; - -procedure TXmlNode.AttributesClear; -begin - FreeAndNil(FAttributes); -end; - -function TXmlNode.BufferLength: integer; -var - BufData: UTF8String; - BufPos: integer; -begin - BufData := sdRemoveControlChars(FValue); - case BinaryEncoding of - xbeBinHex: - begin - Result := length(BufData) div 2; - if Result * 2 <> length(BufData) then - raise EFilerError.Create(sxeErrorCalcStreamLength); - end; - xbeBase64: - begin - Result := length(BufData) div 4; - if Result * 4 <> length(BufData) then - raise EFilerError.Create(sxeErrorCalcStreamLength); - Result := Result * 3; - // Check padding AnsiChars - BufPos := length(BufData); - if (BufPos > 0) and (BufData[BufPos] = cBase64PadChar) then - begin - dec(BufPos); - dec(Result); - if (BufPos > 0) and (BufData[BufPos] = cBase64PadChar) then - dec(Result); - end; - end; - else - Result := 0; // avoid compiler warning - end; -end; - -procedure TXmlNode.BufferRead(var Buffer{$IFDEF CLR}: TBytes{$ENDIF}; Count: Integer); -// Read data from XML binhex to the buffer -var - BufData: UTF8String; -begin - BufData := sdRemoveControlChars(FValue); - case BinaryEncoding of - xbeBinHex: - DecodeBinHexBuf(BufData, Buffer, Count); - xbeBase64: - DecodeBase64Buf(BufData, Buffer, Count); - end; -end; - -procedure TXmlNode.BufferWrite(const Buffer{$IFDEF CLR}: TBytes{$ENDIF}; Count: Integer); -// Write data from the buffer to XML in binhex or base64 format -var - BufData: UTF8String; -begin - if Count > 0 then - case BinaryEncoding of - xbeBinHex: - BufData := EncodeBinHexBuf(Buffer, Count); - xbeBase64: - BufData := EncodeBase64Buf(Buffer, Count); - end; - - // For comformity with Base64, we must add linebreaks each 76 AnsiCharacters - FValue := sdAddControlChars(BufData, GetLineFeed + GetIndent, 76); -end; - -procedure TXmlNode.ChangeDocument(ADocument: TNativeXml); -var - i: integer; -begin - FDocument := ADocument; - for i := 0 to NodeCount - 1 do - Nodes[i].ChangeDocument(ADocument); -end; - -procedure TXmlNode.CheckCreateAttributesList; -begin - if not assigned(FAttributes) then - FAttributes := TsdUTF8StringList.Create; -end; - -procedure TXmlNode.Clear; -begin - // Name + value - FName := ''; - FValue := ''; - // Clear attributes and nodes - AttributesClear; - NodesClear; -end; - -function TXmlNode.CompareNodeName(const NodeName: UTF8String): integer; -begin - // Compare with FullPath or local name based on NodeName's first AnsiCharacter - if length(NodeName) > 0 then - if NodeName[1] = '/' then - begin - // FullPath - Result := UTF8CompareText(FullPath, NodeName); - exit; - end; - // local name - Result := UTF8CompareText(Name, NodeName); -end; - -constructor TXmlNode.Create(ADocument: TNativeXml); -begin - inherited Create; - FDocument := ADocument; -end; - -constructor TXmlNode.CreateName(ADocument: TNativeXml; const AName: UTF8String); -begin - Create(ADocument); - Name := AName; -end; - -constructor TXmlNode.CreateNameValue(ADocument: TNativeXml; const AName, AValue: UTF8String); -begin - Create(ADocument); - Name := AName; - ValueAsString := AValue; -end; - -constructor TXmlNode.CreateType(ADocument: TNativeXml; - AType: TXmlElementType); -begin - Create(ADocument); - FElementType := AType; -end; - -procedure TXmlNode.Delete; -begin - if assigned(Parent) then - Parent.NodeRemove(Self); -end; - -procedure TXmlNode.DeleteEmptyAttributes; -var - i: integer; - V: UTF8String; -begin - for i := AttributeCount - 1 downto 0 do - begin - V := AttributeValue[i]; - if length(V) = 0 then - FAttributes.Delete(i); - end; -end; - -procedure TXmlNode.DeleteEmptyNodes; -var - i: integer; - Node: TXmlNode; -begin - for i := NodeCount - 1 downto 0 do - begin - Node := Nodes[i]; - // Recursive call - Node.DeleteEmptyNodes; - // Check if we should delete child node - if Node.IsEmpty then - NodeDelete(i); - end; -end; - -destructor TXmlNode.Destroy; -begin - NodesClear; - AttributesClear; - inherited; -end; - -function TXmlNode.FindNode(const NodeName: UTF8String): TXmlNode; -// Find the first node which has name NodeName. Contrary to the NodeByName -// function, this function will search the whole subnode tree, using the -// DepthFirst method. -var - i: integer; -begin - Result := nil; - // Loop through all subnodes - for i := 0 to NodeCount - 1 do - begin - Result := Nodes[i]; - // If the subnode has name NodeName then we have a result, exit - if Result.CompareNodeName(NodeName) = 0 then - exit; - // If not, we will search the subtree of this node - Result := Result.FindNode(NodeName); - if assigned(Result) then - exit; - end; -end; - -procedure TXmlNode.FindNodes(const NodeName: UTF8String; const AList: TList); - // local - procedure FindNodesRecursive(ANode: TXmlNode; AList: TList); - var - i: integer; - begin - with ANode do - for i := 0 to NodeCount - 1 do - begin - if Nodes[i].CompareNodeName(NodeName) = 0 then - AList.Add(Nodes[i]); - FindNodesRecursive(Nodes[i], AList); - end; - end; -// main -begin - AList.Clear; - FindNodesRecursive(Self, AList); -end; - -function TXmlNode.FloatAllowScientific: boolean; -begin - if assigned(Document) then - Result := Document.FloatAllowScientific - else - Result := cDefaultFloatAllowScientific; -end; - -function TXmlNode.FloatSignificantDigits: integer; -begin - if assigned(Document) then - Result := Document.FloatSignificantDigits - else - Result := cDefaultFloatSignificantDigits; -end; - -function TXmlNode.FromAnsiString(const s: AnsiString): UTF8String; -begin - Result := sdAnsiToUtf8(s) -end; - -function TXmlNode.FromUnicodeString(const W: UnicodeString): UTF8String; -begin - Result := sdUnicodeToUtf8(W) -end; - -function TXmlNode.GetAttributeByName(const AName: UTF8String): UTF8String; -begin - if assigned(FAttributes) then - Result := sdUTF8UnEscapeString(sdUTF8UnQuotedString(FAttributes.Values[AName])) - else - Result := ''; -end; - -function TXmlNode.GetAttributeByNameWide(const AName: UTF8String): UnicodeString; -begin - Result := ToUnicodeString(GetAttributeByName(AName)); -end; - -function TXmlNode.GetAttributeCount: integer; -begin - if assigned(FAttributes) then - Result := FAttributes.Count - else - Result := 0; -end; - -function TXmlNode.GetAttributeName(Index: integer): UTF8String; -begin - if (Index >= 0) and (Index < AttributeCount) then - Result := FAttributes.Names[Index]; -end; - -function TXmlNode.GetAttributePair(Index: integer): UTF8String; -begin - if (Index >= 0) and (Index < AttributeCount) then - Result := FAttributes[Index]; -end; - -function TXmlNode.GetAttributeValue(Index: integer): UTF8String; -var - P: integer; - S: UTF8String; -begin - Result := ''; - if (Index >= 0) and (Index < AttributeCount) then - begin - S := FAttributes[Index]; - P := Utf8Pos('=', S); - if P > 0 then - Result := sdUTF8UnEscapeString(sdUTF8UnQuotedString(Copy(S, P + 1, MaxInt))); - end; -end; - -function TXmlNode.GetAttributeValueAsInteger(Index: integer): integer; -begin - Result := StrToIntDef(string(GetAttributeValue(Index)), 0); -end; - -function TXmlNode.GetAttributeValueAsUnicodeString(Index: integer): UnicodeString; -begin - Result := ToUnicodeString(GetAttributeValue(Index)); -end; - -function TXmlNode.GetAttributeValueDirect(Index: integer): UTF8String; -var - P: integer; - S: UTF8String; -begin - Result := ''; - if (Index >= 0) and (Index < AttributeCount) then - begin - S := FAttributes[Index]; - P := Utf8Pos('=', S); - if P > 0 then - Result := sdUTF8UnQuotedString(Copy(S, P + 1, MaxInt)); - end; -end; - -function TXmlNode.GetBinaryEncoding: TBinaryEncodingType; -begin - Result := xbeBinHex; - if assigned(Document) then - Result := Document.BinaryEncoding; -end; - -function TXmlNode.GetBinaryString: RawByteString; -// Get the binary contents of this node as Base64 and return it as a RawByteString -var - OldEncoding: TBinaryEncodingType; -{$IFDEF CLR} - Buffer: TBytes; -{$ENDIF} -begin - // Set to base64 - OldEncoding := BinaryEncoding; - try - BinaryEncoding := xbeBase64; - {$IFDEF CLR} - SetLength(Buffer, BufferLength); - if length(Buffer) > 0 then - BufferRead(Buffer, length(Buffer)); - Result := Buffer; - {$ELSE} - SetLength(Result, BufferLength); - if length(Result) > 0 then - BufferRead(Result[1], length(Result)); - {$ENDIF} - finally - BinaryEncoding := OldEncoding; - end; -end; - -function TXmlNode.GetCascadedName: UTF8String; -// Return the name+index and all predecessors with underscores to separate, in -// order to get a unique reference that can be used in filenames -var - LName: UTF8String; -begin - LName := UTF8String(Format('%s%.4d', [Name, StrToIntDef(string(AttributeByName['Index']), 0)])); - if assigned(Parent) then - Result := UTF8String(Format('%s_%s', [Parent.CascadedName, LName])) - else - Result := LName; -end; - -function TXmlNode.GetFullPath: UTF8String; -// GetFullpath will return the complete path of the node from the root, e.g. -// /Root/SubNode1/SubNode2/ThisNode -begin - Result := '/' + Name; - if Treedepth > 0 then - // Recursive call - Result := Parent.GetFullPath + Result; -end; - -function TXmlNode.GetIndent: UTF8String; -var - i: integer; -begin - if assigned(Document) then - begin - case Document.XmlFormat of - xfCompact: Result := ''; - xfReadable: - for i := 0 to TreeDepth - 1 do - Result := Result + Document.IndentString; - end; //case - end else - Result := '' -end; - -function TXmlNode.GetLineFeed: UTF8String; -begin - if assigned(Document) then - begin - case Document.XmlFormat of - xfCompact: Result := ''; - xfReadable: Result := #13#10; - else - Result := #10; - end; //case - end else - Result := ''; -end; - -function TXmlNode.GetNodeCount: integer; -begin - if Assigned(FNodes) then - Result := FNodes.Count - else - Result := 0; -end; - -function TXmlNode.GetNodes(Index: integer): TXmlNode; -begin - if (Index >= 0) and (Index < NodeCount) then - Result := TXmlNode(FNodes[Index]) - else - Result := nil; -end; - -function TXmlNode.GetTotalNodeCount: integer; -var - i: integer; -begin - Result := NodeCount; - for i := 0 to NodeCount - 1 do - inc(Result, Nodes[i].TotalNodeCount); -end; - -function TXmlNode.GetTreeDepth: integer; -begin - Result := -1; - if assigned(Parent) then - Result := Parent.TreeDepth + 1; -end; - -function TXmlNode.GetValueAsBool: boolean; -begin - Result := sdStringToBool(FValue); -end; - -function TXmlNode.GetValueAsDateTime: TDateTime; -begin - Result := sdDateTimeFromString(ValueAsString); -end; - -function TXmlNode.GetValueAsFloat: double; -var - Code: integer; -begin - val(string(sdUTF8StringReplace(FValue, ',', '.')), Result, Code); - if Code > 0 then - raise Exception.Create(sxeCannotConvertToFloat); -end; - -function TXmlNode.GetValueAsInt64: int64; -begin - Result := StrToInt64(string(FValue)); -end; - -function TXmlNode.GetValueAsInteger: integer; -begin - Result := StrToInt(string(FValue)); -end; - -function TXmlNode.GetValueAsString: UTF8String; -begin - if FElementType = xeNormal then - Result := UnEscapeString(sdUTF8Trim(FValue)) - else - Result := UnEscapeString(FValue); -end; - -function TXmlNode.GetValueAsUnicodeString: UnicodeString; -begin - Result := ToUnicodeString(ValueAsString); -end; - -function TXmlNode.GetWriteOnDefault: boolean; -begin - Result := True; - if assigned(Document) then - Result := Document.WriteOnDefault; -end; - -function TXmlNode.HasAttribute(const AName: UTF8String): boolean; -begin - if assigned(FAttributes) then - Result := FAttributes.IndexOfName(AName) >= 0 - else - Result := False; -end; - -function TXmlNode.IndexInParent: integer; -// Retrieve our index in the parent's nodelist -begin - Result := -1; - if assigned(Parent) then - Result := Parent.FNodes.IndexOf(Self); -end; - -function TXmlNode.IsClear: boolean; -begin - Result := (Length(FName) = 0) and IsEmpty; -end; - -function TXmlNode.IsEmpty: boolean; -begin - Result := (Length(FValue) = 0) and (NodeCount = 0) and (AttributeCount = 0); -end; - -function TXmlNode.IsEqualTo(ANode: TXmlNode; Options: TXmlCompareOptions; - MismatchNodes: TList): boolean; -var - i, Index: integer; - NodeResult, ChildResult: boolean; -begin - // Start with a negative result - Result := False; - NodeResult := False; - if not assigned(ANode) then - exit; - - // Assume childs equals other node's childs - ChildResult := True; - - // child node names and values - this comes first to assure the lists are filled - if (xcChildNames in Options) or (xcChildValues in Options) or (xcRecursive in Options) then - for i := 0 to NodeCount - 1 do - begin - // Do child name check - Index := ANode.NodeIndexByName(Nodes[i].Name); - // Do we have the childnode in the other? - if Index < 0 then - begin - // No we dont have it - if xcChildNames in Options then - begin - if assigned(MismatchNodes) then MismatchNodes.Add(Nodes[i]); - ChildResult := False; - end; - end else - begin - // Do child value check - if xcChildValues in Options then - if UTF8CompareText(Nodes[i].ValueAsString, ANode.Nodes[Index].ValueAsString) <> 0 then - begin - if assigned(MismatchNodes) then - MismatchNodes.Add(Nodes[i]); - ChildResult := False; - end; - // Do recursive check - if xcRecursive in Options then - if not Nodes[i].IsEqualTo(ANode.Nodes[Index], Options, MismatchNodes) then - ChildResult := False; - end; - end; - - try - // We assume there are differences - NodeResult := False; - - // Node name, type and value - if xcNodeName in Options then - if UTF8CompareText(Name, ANode.Name) <> 0 then - exit; - - if xcNodeType in Options then - if ElementType <> ANode.ElementType then - exit; - - if xcNodeValue in Options then - if UTF8CompareText(ValueAsString, ANode.ValueAsString) <> 0 then - exit; - - // attribute count - if xcAttribCount in Options then - if AttributeCount <> ANode.AttributeCount then - exit; - - // attribute names and values - if (xcAttribNames in Options) or (xcAttribValues in Options) then - for i := 0 to AttributeCount - 1 do - begin - Index := ANode.AttributeIndexByName(AttributeName[i]); - if Index < 0 then - if xcAttribNames in Options then - exit - else - continue; - if xcAttribValues in Options then - if UTF8CompareText(AttributeValue[i], ANode.AttributeValue[Index]) <> 0 then - exit; - end; - - // child node count - if xcChildCount in Options then - if NodeCount <> ANode.NodeCount then - exit; - - // If we arrive here, it means no differences were found, return True - NodeResult := True; - - finally - - Result := ChildResult and NodeResult; - if (not NodeResult) and assigned(MismatchNodes) then - MismatchNodes.Insert(0, Self); - - end; -end; - -function TXmlNode.NodeAdd(ANode: TXmlNode): integer; -begin - if assigned(ANode) then - begin - ANode.Parent := Self; - ANode.ChangeDocument(Document); - if not assigned(FNodes) then - FNodes := TList.Create; - Result := FNodes.Add(ANode); - end else - Result := -1; -end; - -function TXmlNode.NodeByAttributeValue(const NodeName, AttribName, AttribValue: UTF8String; - ShouldRecurse: boolean): TXmlNode; -// This function returns a pointer to the first subnode that has an attribute with -// name AttribName and value AttribValue. -var - i: integer; - Node: TXmlNode; -begin - Result := nil; - // Find all nodes that are potential results - for i := 0 to NodeCount - 1 do - begin - Node := Nodes[i]; - if (UTF8CompareText(Node.Name, NodeName) = 0) and - Node.HasAttribute(AttribName) and - (UTF8CompareText(Node.AttributeByName[AttribName], AttribValue) = 0) then - begin - Result := Node; - exit; - end; - // Recursive call - if ShouldRecurse then - Result := Node.NodeByAttributeValue(NodeName, AttribName, AttribValue, True); - if assigned(Result) then - exit; - end; -end; - -function TXmlNode.NodeByElementType(ElementType: TXmlElementType): TXmlNode; -var - i: integer; -begin - Result := nil; - for i := 0 to NodeCount - 1 do - if Nodes[i].ElementType = ElementType then - begin - Result := Nodes[i]; - exit; - end; -end; - -function TXmlNode.NodeByName(const AName: UTF8String): TXmlNode; -var - i: integer; -begin - Result := nil; - for i := 0 to NodeCount - 1 do - if UTF8CompareText(Nodes[i].Name, AName) = 0 then - begin - Result := Nodes[i]; - exit; - end; -end; - -procedure TXmlNode.NodeDelete(Index: integer); -begin - if (Index >= 0) and (Index < NodeCount) then - begin - TXmlNode(FNodes[Index]).Free; - FNodes.Delete(Index); - end; -end; - -procedure TXmlNode.NodeExchange(Index1, Index2: integer); -begin - if (Index1 >= 0) and (Index1 < Nodecount) and - (Index2 >= 0) and (Index2 < Nodecount) then - FNodes.Exchange(Index1, Index2); -end; - -function TXmlNode.NodeExtract(ANode: TXmlNode): TXmlNode; -var - Index: integer; -begin - // Compatibility with Delphi4 - Result := nil; - if assigned(FNodes) then - begin - Index := FNodes.IndexOf(ANode); - if Index >= 0 then begin - Result := ANode; - FNodes.Delete(Index); - end; - end; -end; - -function TXmlNode.NodeFindOrCreate(const AName: UTF8String): TXmlNode; -// Find the node with AName, and if not found, add new one -begin - Result := NodeByName(AName); - if not assigned(Result) then - Result := NodeNew(AName); -end; - -function TXmlNode.NodeIndexByName(const AName: UTF8String): integer; -begin - Result := 0; - while Result < NodeCount do - begin - if UTF8CompareText(Nodes[Result].Name, AName) = 0 then - exit; - inc(Result); - end; - if Result = NodeCount then - Result := -1; -end; - -function TXmlNode.NodeIndexByNameFrom(const AName: UTF8String; AFrom: integer): integer; -begin - Result := AFrom; - while Result < NodeCount do - begin - if UTF8CompareText(Nodes[Result].Name, AName) = 0 then - exit; - inc(Result); - end; - if Result = NodeCount then - Result := -1; -end; - -function TXmlNode.NodeIndexOf(ANode: TXmlNode): integer; -begin - if assigned(ANode) and assigned(FNodes) then - Result := FNodes.IndexOf(ANode) - else - Result := -1; -end; - -procedure TXmlNode.NodeInsert(Index: integer; ANode: TXmlNode); -// Insert the node ANode at location Index in the list. -begin - if not assigned(ANode) then - exit; - if (Index >=0) and (Index <= NodeCount) then - begin - if not assigned(FNodes) then - FNodes := TList.Create; - ANode.Parent := Self; - FNodes.Insert(Index, ANode); - end; -end; - -function TXmlNode.NodeNew(const AName: UTF8String): TXmlNode; -// Add a new child node and return its pointer -begin - Result := Nodes[NodeAdd(TXmlNode.CreateName(Document, AName))]; -end; - -function TXmlNode.NodeNewAtIndex(Index: integer; const AName: UTF8String): TXmlNode; -// Create a new node with AName, and insert it into the subnode list at location -// Index, and return a pointer to it. -begin - if (Index >= 0) and (Index <= NodeCount) then - begin - Result := TXmlNode.CreateName(Document, AName); - NodeInsert(Index, Result); - end else - Result := nil; -end; - -function TXmlNode.NodeRemove(ANode: TxmlNode): integer; -begin - Result := NodeIndexOf(ANode); - if Result >= 0 then - NodeDelete(Result); -end; - -procedure TXmlNode.NodesByName(const AName: UTF8String; const AList: TList); -// Fill AList with nodes that have name AName -var - i: integer; -begin - if not assigned(AList) then - exit; - AList.Clear; - for i := 0 to NodeCount - 1 do - if UTF8CompareText(Nodes[i].Name, AName) = 0 then - AList.Add(Nodes[i]); -end; - -procedure TXmlNode.NodesClear; -var - i: integer; -begin - for i := 0 to NodeCount - 1 do - TXmlNode(FNodes[i]).Free; - FreeAndNil(FNodes); -end; - -procedure TXmlNode.ParseTag(const AValue: UTF8String; TagStart, TagClose: integer); -var - LItems: TsdUTF8StringList; -begin - // Create a list to hold string items - LItems := TsdUTF8StringList.Create; - try - sdUTF8ParseAttributes(AValue, TagStart, TagClose, LItems); - - // Determine name, attributes or value for each element type - case ElementType of - xeDeclaration: - FName := 'xml'; - xeStyleSheet: - begin - FName := 'xml-stylesheet'; - // We also set this as the value for use in "StyleSheetString" - ValueDirect := sdUTF8Trim(copy(AValue, TagStart, TagClose - TagStart)); - end; - else - // First item is the name - is it there? - if LItems.Count = 0 then - raise EFilerError.Create(sxeMissingElementName); - - // Set the name - using the element instead of property for speed - FName := LItems[0]; - LItems.Delete(0); - end;//case - - // Any attributes? - if LItems.Count > 0 then - begin - CheckCreateAttributesList; - FAttributes.Assign(LItems); - end; - - finally - LItems.Free; - end; -end; - -function TXmlNode.QualifyAsDirectNode: boolean; -// If this node qualifies as a direct node when writing, we return True. -// A direct node may have attributes, but no value or subnodes. Furhtermore, -// the root node will never be displayed as a direct node. -begin - Result := - (Length(FValue) = 0) and - (NodeCount = 0) and - (ElementType = xeNormal) and - not UseFullNodes and - (TreeDepth > 0); -end; - -function TXmlNode.ReadAttributeBool(const AName: UTF8String; ADefault: boolean): boolean; -var - V: UTF8String; -begin - V := AttributeByName[AName]; - try - Result := sdStringToBool(V); - except - Result := ADefault; - end; -end; - -function TXmlNode.ReadAttributeDateTime(const AName: UTF8String; ADefault: TDateTime): TDateTime; -var - V: UTF8String; -begin - V := AttributeByName[AName]; - try - Result := sdDateTimeFromStringDefault(V, ADefault); - except - Result := ADefault; - end; -end; - -function TXmlNode.ReadAttributeFloat(const AName: UTF8String; ADefault: double): double; -var - V: UTF8String; - Code: integer; -begin - V := AttributeByName[AName]; - val(string(sdUTF8StringReplace(V, ',', '.')), Result, Code); - if Code > 0 then - Result := ADefault; -end; - -function TXmlNode.ReadAttributeInteger(const AName: UTF8String; ADefault: integer): integer; -begin - Result := StrToIntDef(string(AttributeByName[AName]), ADefault); -end; - -function TXmlNode.ReadAttributeInt64(const AName: UTF8String; ADefault: int64): int64; -begin - Result := StrToInt64Def(string(AttributeByName[AName]), ADefault); -end; - -function TXmlNode.ReadAttributeString(const AName: UTF8String; const ADefault: UTF8String): UTF8String; -begin - Result := AttributeByName[AName]; - if length(Result) = 0 then - Result := ADefault; -end; - -function TXmlNode.ReadBool(const AName: UTF8String; ADefault: boolean): boolean; -var - Index: integer; -begin - Result := ADefault; - Index := NodeIndexByName(AName); - if Index >= 0 then - Result := Nodes[Index].ValueAsBoolDef(ADefault); -end; - -{$IFDEF USEGRAPHICS} -procedure TXmlNode.ReadBrush(const AName: UTF8String; ABrush: TBrush); -var - Child: TXmlNode; -begin - Child := NodeByName(AName); - if assigned(Child) then with Child do - begin - // Read values - ABrush.Color := ReadColor('Color', clWhite); - ABrush.Style := TBrushStyle(ReadInteger('Style', integer(bsSolid))); - end else - begin - // Defaults - ABrush.Bitmap := nil; - ABrush.Color := clWhite; - ABrush.Style := bsSolid; - end; -end; - -function TXmlNode.ReadColor(const AName: UTF8String; ADefault: TColor): TColor; -var - Index: integer; -begin - Result := ADefault; - Index := NodeIndexByName(AName); - if Index >= 0 then - Result := StrToInt(string(Nodes[Index].ValueAsString)); -end; -{$ENDIF} - -function TXmlNode.ReadDateTime(const AName: UTF8String; ADefault: TDateTime): TDateTime; -// Date MUST always be written in this format: -// YYYY-MM-DD (if just date) or -// YYYY-MM-DDThh:mm:ss.sssZ (if date and time. The Z stands for universal time -// zone. Since Delphi's TDateTime does not give us a clue about the timezone, -// this is the easiest solution) -// This format SHOULD NOT be changed, to avoid all kinds of -// conversion errors in future. -// This format is compatible with the W3C date/time specification as found here: -// http://www.w3.org/TR/NOTE-datetime -begin - Result := sdDateTimeFromStringDefault(ReadString(AName, ''), ADefault); -end; - -function TXmlNode.ReadFloat(const AName: UTF8String; ADefault: double): double; -var - Index: integer; -begin - Result := ADefault; - Index := NodeIndexByName(AName); - if Index >= 0 then - Result := Nodes[Index].ValueAsFloatDef(ADefault); -end; - -{$IFDEF USEGRAPHICS} -procedure TXmlNode.ReadFont(const AName: UTF8String; AFont: TFont); -var - Child: TXmlNode; -begin - Child := NodeByName(AName); - AFont.Style := []; - if assigned(Child) then with Child do - begin - // Read values - AFont.Name := string(ReadString('Name', 'Arial')); - AFont.Color := ReadColor('Color', clBlack); - AFont.Size := ReadInteger('Size', 14); - if ReadBool('Bold', False) then AFont.Style := AFont.Style + [fsBold]; - if ReadBool('Italic', False) then AFont.Style := AFont.Style + [fsItalic]; - if ReadBool('Underline', False) then AFont.Style := AFont.Style + [fsUnderline]; - if ReadBool('Strikeout', False) then AFont.Style := AFont.Style + [fsStrikeout]; - end else - begin - // Defaults - AFont.Name := 'Arial'; - AFont.Color := clBlack; - AFont.Size := 14; - end; -end; -{$ENDIF} - -procedure TXmlNode.ReadFromStream(S: TStream); -// Read the node from the starting "<" until the closing ">" from the stream in S. -// This procedure also calls OnNodeNew and OnNodeLoaded events -var - Ch: AnsiChar; - i: integer; - TagIndex: integer; - V: UTF8String; - Len: integer; - Node: TXmlNode; - NodeValue: UTF8String; - ValuePos, ValueLen: integer; - ClosePos: integer; - HasCR: boolean; - HasSubtags: boolean; - Words: TsdUTF8StringList; - IsDirect: boolean; - Reader: TsdSurplusReader; - // local - procedure AddCharDataNode(PreserveWhiteSpace: boolean); - var - V: UTF8String; - Node: TXmlNode; - L: integer; - begin - // Add all text up till now as xeCharData - if ValuePos > 0 then - begin - V := copy(NodeValue, 1, ValuePos); - - if PreserveWhiteSpace then - L := length(V) - else - L := length(sdUTF8Trim(V)); - - if L > 0 then - begin - Node := TXmlNode.CreateType(Document, xeCharData); - Node.ValueDirect := V; - NodeAdd(Node); - end; - ValuePos := 0; - end; - end; -// Main -begin - // Check if we aborted parsing - if AbortParsing then - exit; - // Clear this node first - Clear; - // Initial reserve textual value: just 80 AnsiCharacters which is OK for most short values - ValuePos := 0; - ValueLen := 80; - SetLength(NodeValue, ValueLen); - HasCR := False; - HasSubTags := False; - Reader := TsdSurplusReader.Create(S); - try - // Trailing blanks/controls AnsiChars? - if not Reader.ReadCharSkipBlanks(Ch) then - exit; - - // What is it? - if Ch = '<' then - begin - // A tag - which one? - TagIndex := ReadOpenTag(Reader); - if TagIndex >= 0 then - begin - try - ElementType := cTags[TagIndex].Style; - case ElementType of - xeNormal, xeDeclaration, xeStyleSheet: - begin - // These tags we will process - ReadStringFromStreamUntil(Reader, cTags[TagIndex].Close, V, True); - Len := length(V); - - // Is it a direct tag? - IsDirect := False; - if (ElementType = xeNormal) and (Len > 0) then - if V[Len] = '/' then - begin - dec(Len); - IsDirect := True; - end; - ParseTag(V, 1, Len + 1); - - // Here we know our name so good place to call OnNodeNew event - if assigned(Document) then - begin - Document.DoNodeNew(Self); - if AbortParsing then - exit; - end; - - // Now the tag can be a direct close - in that case we're finished - if IsDirect or (ElementType in [xeDeclaration, xeStyleSheet]) then - exit; - - // Process rest of tag - repeat - - // Read AnsiCharacter from stream - if S.Read(Ch, 1) <> 1 then - raise EFilerError.CreateFmt(sxeMissingCloseTag, [Name]); - - // Is there a subtag? - if Ch = '<' then - begin - if not Reader.ReadCharSkipBlanks(Ch) then - raise EFilerError.CreateFmt(sxeMissingDataAfterGreaterThan, [Name]); - if Ch = '/' then - begin - - // This seems our closing tag - if not ReadStringFromStreamUntil(Reader, '>', V, True) then - raise EFilerError.CreateFmt(sxeMissingLessThanInCloseTag, [Name]); - if UTF8CompareText(sdUTF8Trim(V), Name) <> 0 then - raise EFilerError.CreateFmt(sxeIncorrectCloseTag, [Name]); - V := ''; - break; - - end else - begin - - // Add all text up till now as xeCharData - AddCharDataNode(False); - - // Reset the HasCR flag if we add node, we only want to detect - // the CR after last subnode - HasCR := False; - - // This is a subtag... so create it and let it process - HasSubTags := True; - S.Seek(-2, soCurrent); - Node := TXmlNode.Create(Document); - NodeAdd(Node); - Node.ReadFromStream(S); - - // Check for dropping comments - if assigned(Document) and Document.DropCommentsOnParse and - (Node.ElementType = xeComment) then - NodeDelete(NodeIndexOf(Node)); - - end; - end else - begin - - // If we detect a CR we will set the flag. This will signal the fact - // that this XML file was saved with xfReadable - if Ch = #13 then - HasCR := True; - - // Add the AnsiCharacter to the node value buffer. - inc(ValuePos); - if ValuePos > ValueLen then - begin - inc(ValueLen, cNodeValueBuf); - SetLength(NodeValue, ValueLen); - end; - NodeValue[ValuePos] := Ch; - - end; - until False or AbortParsing; - - // Add all text up till now as xeText - AddCharDataNode(not HasSubtags); - - // Check AnsiCharData nodes, remove trailing CRLF + indentation if we - // were in xfReadable mode - if HasSubtags and HasCR then - begin - for i := 0 to NodeCount - 1 do - if Nodes[i].ElementType = xeCharData then - begin - ClosePos := length(Nodes[i].FValue); - while (ClosePos > 0) and (Nodes[i].FValue[ClosePos] in [#10, #13, ' ']) do - dec(ClosePos); - Nodes[i].FValue := copy(Nodes[i].FValue, 1, ClosePos); - end; - end; - - // If the first node is xeCharData we use it as ValueDirect - if NodeCount > 0 then - if Nodes[0].ElementType = xeCharData then - begin - ValueDirect := Nodes[0].ValueDirect; - NodeDelete(0); - end; - - end; - xeDocType: - begin - Name := 'DTD'; - if assigned(Document) then - begin - Document.DoNodeNew(Self); - if AbortParsing then - exit; - end; - // Parse DTD - if assigned(Document) then - Document.ParseDTD(Self, S); - end; - xeElement, xeAttList, xeEntity, xeNotation: - begin - // DTD elements - ReadStringFromStreamWithQuotes(S, cTags[TagIndex].Close, V); - Len := length(V); - Words := TsdUTF8StringList.Create; - try - sdUTF8ParseAttributes(V, 1, Len + 1, Words); - if Words.Count > 0 then - begin - Name := Words[0]; - Words.Delete(0); - end; - ValueDirect := sdUTF8Trim(Words.Text); - finally - Words.Free; - end; - if assigned(Document) then - begin - Document.DoNodeNew(Self); - if AbortParsing then - exit; - end; - end; - else - case ElementType of - xeComment: Name := 'Comment'; - xeCData: Name := 'CData'; - xeExclam: Name := 'Special'; - xeQuestion: Name := 'Special'; - else - Name := 'Unknown'; - end; //case - - // Here we know our name so good place to call OnNodeNew - if assigned(Document) then - begin - Document.DoNodeNew(Self); - if AbortParsing then - exit; - end; - - // In these cases just get all data up till the closing tag - ReadStringFromStreamUntil(Reader, cTags[TagIndex].Close, V, False); - ValueDirect := V; - end;//case - finally - // Call the OnNodeLoaded and OnProgress events - if assigned(Document) and not AbortParsing then - begin - Document.DoProgress(S.Position); - Document.DoNodeLoaded(Self); - end; - end; - end; - end; - finally - Reader.Free; - end; -end; - -procedure TXmlNode.ReadFromString(const AValue: UTF8String); -var - S: TStream; -begin - S := TsdUTF8StringStream.Create(AValue); - try - ReadFromStream(S); - finally - S.Free; - end; -end; - -function TXmlNode.ReadInt64(const AName: UTF8String; ADefault: int64): int64; -var - Index: integer; -begin - Result := ADefault; - Index := NodeIndexByName(AName); - if Index >= 0 then - Result := Nodes[Index].ValueAsInt64Def(ADefault); -end; - -function TXmlNode.ReadInteger(const AName: UTF8String; ADefault: integer): integer; -var - Index: integer; -begin - Result := ADefault; - Index := NodeIndexByName(AName); - if Index >= 0 then - Result := Nodes[Index].ValueAsIntegerDef(ADefault); -end; - -{$IFDEF USEGRAPHICS} -procedure TXmlNode.ReadPen(const AName: UTF8String; APen: TPen); -var - Child: TXmlNode; -begin - Child := NodeByName(AName); - if assigned(Child) then with Child do - begin - // Read values - APen.Color := ReadColor('Color', clBlack); - APen.Mode := TPenMode(ReadInteger('Mode', integer(pmCopy))); - APen.Style := TPenStyle(ReadInteger('Style', integer(psSolid))); - APen.Width := ReadInteger('Width', 1); - end else - begin - // Defaults - APen.Color := clBlack; - APen.Mode := pmCopy; - APen.Style := psSolid; - APen.Width := 1; - end; -end; -{$ENDIF} - -function TXmlNode.ReadString(const AName: UTF8String; const ADefault: UTF8String): UTF8String; -var - Index: integer; -begin - Result := ADefault; - Index := NodeIndexByName(AName); - if Index >= 0 then - Result := Nodes[Index].ValueAsString; -end; - -function TXmlNode.ReadUnicodeString(const AName: UTF8String; const ADefault: UnicodeString): UnicodeString; -begin - Result := ToUnicodeString(ReadString(AName, FromUnicodeString(ADefault))); -end; - -procedure TXmlNode.ResolveEntityReferences; -// Replace any entity references by the entities, and parse the new content if any - // local - function SplitReference(const AValue: UTF8String; var Text1, Text2: UTF8String): UTF8String; - var - P: integer; - begin - Result := ''; - P := UTF8Pos('&', AValue); - Text1 := ''; - Text2 := AValue; - if P = 0 then - exit; - Text1 := copy(AValue, 1, P - 1); - Text2 := copy(AValue, P + 1, length(AValue)); - P := UTF8Pos(';', Text2); - if P = 0 then - exit; - Result := copy(Text2, 1, P - 1); - Text2 := copy(Text2, P + 1, length(Text2)); - end; - // local - function ReplaceEntityReferenceByNodes(ARoot: TXmlNode; const AValue: UTF8String; var InsertPos: integer; var Text1, Text2: UTF8String): boolean; - var - Reference: UTF8String; - Entity: UTF8String; - Node: TXmlNode; - S: TStream; - begin - Result := False; - Reference := SplitReference(AValue, Text1, Text2); - if (length(Reference) = 0) or not assigned(Document) then - exit; - - // Lookup entity references - Entity := Document.EntityByName[Reference]; - - // Does the entity contain markup? - if (length(Entity) > 0) and (UTF8Pos('<', Entity) > 0) then - begin - S := TsdUTF8StringStream.Create(Entity); - try - while S.Position < S.Size do - begin - Node := TXmlNode.Create(Document); - Node.ReadFromStream(S); - if Node.IsEmpty then - Node.Free - else - begin - ARoot.NodeInsert(InsertPos, Node); - inc(InsertPos); - Result := True; - end; - end; - finally - S.Free; - end; - end; - end; -// main -var - i: integer; - InsertPos: integer; - Text1, Text2: UTF8String; - Node: TXmlNode; - V, Reference, Replace, Entity, First, Last: UTF8String; -begin - if length(FValue) > 0 then - begin - // Different behaviour for xeNormal and xeCharData - if ElementType = xeNormal then - begin - InsertPos := 0; - if ReplaceEntityReferenceByNodes(Self, FValue, InsertPos, Text1, Text2) then - begin - FValue := Text1; - if length(sdUTF8Trim(Text2)) > 0 then - begin - Node := TXmlNode.CreateType(Document, xeCharData); - Node.ValueDirect := Text2; - NodeInsert(InsertPos, Node); - end; - end; - end else if (ElementType = xeCharData) and assigned(Parent) then - begin - InsertPos := Parent.NodeIndexOf(Self); - if ReplaceEntityReferenceByNodes(Parent, FValue, InsertPos, Text1, Text2) then - begin - FValue := Text1; - if length(sdUTF8Trim(FValue)) = 0 then - FValue := ''; - if length(sdUTF8Trim(Text2)) > 0 then - begin - Node := TXmlNode.CreateType(Document, xeCharData); - Node.ValueDirect := Text2; - Parent.NodeInsert(InsertPos, Node); - end; - end; - end; - end; - - // Do attributes - for i := 0 to AttributeCount - 1 do - begin - Last := AttributeValue[i]; - V := ''; - repeat - Reference := SplitReference(Last, First, Last); - Replace := ''; - if length(Reference) > 0 then - begin - Entity := Document.EntityByName[Reference]; - if length(Entity) > 0 then - Replace := Entity - else - Replace := '&' + Reference + ';'; - end; - V := V + First + Replace; - until length(Reference) = 0; - V := V + Last; - AttributeValue[i] := V; - end; - - // Do childnodes too - i := 0; - while i < NodeCount do - begin - Nodes[i].ResolveEntityReferences; - inc(i); - end; - - // Check for empty AnsiCharData nodes - for i := NodeCount - 1 downto 0 do - if (Nodes[i].ElementType = xeCharData) and (length(Nodes[i].ValueDirect) = 0) then - NodeDelete(i); -end; - -procedure TXmlNode.SetAttributeByName(const AName, Value: UTF8String); -begin - CheckCreateAttributesList; - FAttributes.Values[AName] := sdUTF8QuotedString(sdUTF8EscapeString(Value)); -end; - -procedure TXmlNode.SetAttributeByNameWide(const AName: UTF8String; const Value: UnicodeString); -begin - SetAttributeByName(AName, FromUnicodeString(Value)); -end; - -procedure TXmlNode.SetAttributeName(Index: integer; const Value: UTF8String); -var - S: UTF8String; - P: integer; -begin - if (Index >= 0) and (Index < AttributeCount) then - begin - S := FAttributes[Index]; - P := Utf8Pos('=', S); - if P > 0 then - FAttributes[Index] := Value + '=' + Copy(S, P + 1, MaxInt); - end; -end; - -procedure TXmlNode.SetAttributeValue(Index: integer; const Value: UTF8String); -begin - if (Index >= 0) and (Index < AttributeCount) then - FAttributes[Index] := AttributeName[Index] + '=' + - sdUTF8QuotedString(sdUTF8EscapeString(Value)); -end; - -procedure TXmlNode.SetAttributeValueAsInteger(Index: integer; const Value: integer); -begin - SetAttributeValue(Index, IntToUTF8Str(Value)); -end; - -procedure TXmlNode.SetAttributeValueAsUnicodeString(Index: integer; - const Value: UnicodeString); -begin - SetAttributeValue(Index, FromUnicodeString(Value)); -end; - -procedure TXmlNode.SetAttributeValueDirect(Index: integer; const Value: UTF8String); -begin - if (Index >= 0) and (Index < AttributeCount) then - FAttributes[Index] := AttributeName[Index] + '=' + - sdUTF8QuotedString(Value); -end; - -procedure TXmlNode.SetBinaryEncoding(const Value: TBinaryEncodingType); -begin - if assigned(Document) then - Document.BinaryEncoding := Value; -end; - -procedure TXmlNode.SetBinaryString(const Value: RawByteString); -var - OldEncoding: TBinaryEncodingType; -begin - // Set to base64 - OldEncoding := BinaryEncoding; - try - BinaryEncoding := xbeBase64; - if length(Value) = 0 then - begin - ValueAsString := ''; - exit; - end; - // fill the buffer - {$IFDEF CLR} - BufferWrite(BytesOf(Value), length(Value)); - {$ELSE} - BufferWrite(Value[1], length(Value)); - {$ENDIF} - finally - BinaryEncoding := OldEncoding; - end; -end; - -procedure TXmlNode.SetName(const Value: UTF8String); -var - i: integer; -begin - if FName <> Value then - begin - // Check if the name abides the rules. We will be very forgiving here and - // just accept any name that at least does not contain control AnsiCharacters - for i := 1 to length(Value) do - if Value[i] in cControlChars then - raise Exception.Create(Format(sxeIllegalCharInNodeName, [Value])); - FName := Value; - end; -end; - -procedure TXmlNode.SetValueAsBool(const Value: boolean); -begin - FValue := sdStringFromBool(Value); -end; - -procedure TXmlNode.SetValueAsDateTime(const Value: TDateTime); -begin - ValueAsString := sdDateTimeToString(Value); -end; - -procedure TXmlNode.SetValueAsFloat(const Value: double); -begin - FValue := sdWriteNumber(Value, FloatSignificantDigits, FloatAllowScientific); -end; - -procedure TXmlNode.SetValueAsInt64(const Value: int64); -begin - FValue := Int64ToUTF8Str(Value); -end; - -procedure TXmlNode.SetValueAsInteger(const Value: integer); -begin - FValue := IntToUTF8Str(Value); -end; - -procedure TXmlNode.SetValueAsString(const AValue: UTF8String); -begin - FValue := sdUTF8EscapeString(AValue); -end; - -procedure TXmlNode.SetValueAsUnicodeString(const Value: UnicodeString); -begin - ValueAsString := FromUnicodeString(Value); -end; - -procedure TXmlNode.SortChildNodes(Compare: TXMLNodeCompareFunction; Info: TPointer); -// Sort the child nodes using the quicksort algorithm - //local - function DoNodeCompare(Node1, Node2: TXmlNode): integer; - begin - if assigned(Compare) then - Result := Compare(Node1, Node2, Info) - else - if assigned(Document) and assigned(Document.OnNodeCompare) then - Result := Document.OnNodeCompare(Document, Node1, Node2, Info) - else - Result := UTF8CompareText(Node1.Name, Node2.Name); - end; - // local - procedure QuickSort(iLo, iHi: Integer); - var - Lo, Hi, Mid: longint; - begin - Lo := iLo; - Hi := iHi; - Mid:= (Lo + Hi) div 2; - repeat - while DoNodeCompare(Nodes[Lo], Nodes[Mid]) < 0 do - Inc(Lo); - while DoNodeCompare(Nodes[Hi], Nodes[Mid]) > 0 do - Dec(Hi); - if Lo <= Hi then - begin - // Swap pointers; - NodeExchange(Lo, Hi); - if Mid = Lo then - Mid := Hi - else - if Mid = Hi then - Mid := Lo; - Inc(Lo); - Dec(Hi); - end; - until Lo > Hi; - if Hi > iLo then - QuickSort(iLo, Hi); - if Lo < iHi then - QuickSort(Lo, iHi); - end; -// main -begin - if NodeCount > 1 then - QuickSort(0, NodeCount - 1); -end; - -function TXmlNode.ToUnicodeString(const s: UTF8String): UnicodeString; -begin - Result := sdUtf8ToUnicode(s) -end; - -function TXmlNode.UnescapeString(const AValue: UTF8String): UTF8String; -begin - Result := sdUTF8UnEscapeString(AValue) -end; - -function TXmlNode.UseFullNodes: boolean; -begin - Result := False; - if assigned(Document) then - Result := Document.UseFullNodes; -end; - -function TXmlNode.ValueAsBoolDef(ADefault: boolean): boolean; -var - Ch: AnsiChar; -begin - Result := ADefault; - if Length(FValue) = 0 then - exit; - Ch := sdUpCase(FValue[1]); - if Ch in ['T', 'Y'] then - begin - Result := True; - exit; - end; - if Ch in ['F', 'N'] then - begin - Result := False; - exit; - end; -end; - -function TXmlNode.ValueAsDateTimeDef(ADefault: TDateTime): TDateTime; -begin - Result := sdDateTimeFromStringDefault(ValueAsString, ADefault); -end; - -function TXmlNode.ValueAsFloatDef(ADefault: double): double; -var - Code: integer; -begin - try - val(string(sdUTF8StringReplace(FValue, ',', '.')), Result, Code); - if Code > 0 then - Result := ADefault; - except - Result := ADefault; - end; -end; - -function TXmlNode.ValueAsInt64Def(ADefault: int64): int64; -begin - Result := StrToInt64Def(string(FValue), ADefault); -end; - -function TXmlNode.ValueAsIntegerDef(ADefault: integer): integer; -begin - Result := StrToIntDef(string(FValue), ADefault); -end; - -procedure TXmlNode.WriteAttributeBool(const AName: UTF8String; AValue: boolean; ADefault: boolean); -var - Index: integer; -begin - if WriteOnDefault or (AValue <> ADefault) then - begin - Index := AttributeIndexByName(AName); - if Index >= 0 then - AttributeValue[Index] := sdStringFromBool(AValue) - else - AttributeAdd(AName, sdStringFromBool(AValue)); - end; -end; - -procedure TXmlNode.WriteAttributeDateTime(const AName: UTF8String; AValue, ADefault: TDateTime); -var - Index: integer; -begin - if WriteOnDefault or (AValue <> ADefault) then - begin - Index := AttributeIndexByName(AName); - if Index >= 0 then - AttributeValue[Index] := sdDateTimeToString(AValue) - else - AttributeAdd(AName, sdDateTimeToString(AValue)); - end; -end; - -procedure TXmlNode.WriteAttributeFloat(const AName: UTF8String; AValue, ADefault: double); -var - Index: integer; - S: UTF8String; -begin - if WriteOnDefault or (AValue <> ADefault) then - begin - Index := AttributeIndexByName(AName); - S := sdWriteNumber(AValue, FloatSignificantDigits, FloatAllowScientific); - if Index >= 0 then - AttributeValue[Index] := S - else - AttributeAdd(AName, S); - end; -end; - -procedure TXmlNode.WriteAttributeInteger(const AName: UTF8String; AValue: integer; ADefault: integer); -var - Index: integer; -begin - if WriteOnDefault or (AValue <> ADefault) then - begin - Index := AttributeIndexByName(AName); - if Index >= 0 then - AttributeValue[Index] := IntToUTF8Str(AValue) - else - AttributeAdd(AName, IntToUTF8Str(AValue)); - end; -end; - -procedure TXmlNode.WriteAttributeInt64(const AName: UTF8String; const AValue: int64; ADefault: int64); -var - Index: integer; -begin - if WriteOnDefault or (AValue <> ADefault) then - begin - Index := AttributeIndexByName(AName); - if Index >= 0 then - AttributeValue[Index] := IntToUTF8Str(AValue) - else - AttributeAdd(AName, IntToUTF8Str(AValue)); - end; -end; - -procedure TXmlNode.WriteAttributeString(const AName, AValue, ADefault: UTF8String); -var - Index: integer; -begin - if WriteOnDefault or (AValue <> ADefault) then - begin - Index := AttributeIndexByName(AName); - if Index >= 0 then - AttributeValue[Index] := AValue - else - AttributeAdd(AName, AValue); - end; -end; - -procedure TXmlNode.WriteBool(const AName: UTF8String; AValue: boolean; ADefault: boolean); -const - cBoolValues: array[boolean] of UTF8String = ('False', 'True'); -begin - if WriteOnDefault or (AValue <> ADefault) then - with NodeFindOrCreate(AName) do - ValueAsString := cBoolValues[AValue]; -end; - -{$IFDEF USEGRAPHICS} -procedure TXmlNode.WriteBrush(const AName: UTF8String; ABrush: TBrush); -begin - with NodeFindOrCreate(AName) do - begin - WriteColor('Color', ABrush.Color, clBlack); - WriteInteger('Style', integer(ABrush.Style), 0); - end; -end; - -procedure TXmlNode.WriteColor(const AName: UTF8String; AValue, ADefault: TColor); -begin - if WriteOnDefault or (AValue <> ADefault) then - WriteHex(AName, ColorToRGB(AValue), 8, 0); -end; -{$ENDIF} - -procedure TXmlNode.WriteDateTime(const AName: UTF8String; AValue, ADefault: TDateTime); -// Date MUST always be written in this format: -// YYYY-MM-DD (if just date) or -// YYYY-MM-DDThh:mm:ss.sssZ (if date and time. The Z stands for universal time -// zone. Since Delphi's TDateTime does not give us a clue about the timezone, -// this is the easiest solution) -// This format SHOULD NOT be changed, to avoid all kinds of -// conversion errors in future. -// This format is compatible with the W3C date/time specification as found here: -// http://www.w3.org/TR/NOTE-datetime -begin - if WriteOnDefault or (AValue <> ADefault) then - WriteString(AName, sdDateTimeToString(AValue), ''); -end; - -procedure TXmlNode.WriteFloat(const AName: UTF8String; AValue: double; ADefault: double); -begin - if WriteOnDefault or (AValue <> ADefault) then - with NodeFindOrCreate(AName) do - ValueAsString := sdWriteNumber(AValue, FloatSignificantDigits, FloatAllowScientific); -end; - -{$IFDEF USEGRAPHICS} -procedure TXmlNode.WriteFont(const AName: UTF8String; AFont: TFont); -begin - with NodeFindOrCreate(AName) do - begin - WriteString('Name', UTF8String(AFont.Name), 'Arial'); - WriteColor('Color', AFont.Color, clBlack); - WriteInteger('Size', AFont.Size, 14); - WriteBool('Bold', fsBold in AFont.Style, False); - WriteBool('Italic', fsItalic in AFont.Style, False); - WriteBool('Underline', fsUnderline in AFont.Style, False); - WriteBool('Strikeout', fsStrikeout in AFont.Style, False); - end; -end; -{$ENDIF} - -procedure TXmlNode.WriteHex(const AName: UTF8String; AValue, Digits: integer; ADefault: integer); -begin - if WriteOnDefault or (AValue <> ADefault) then - with NodeFindOrCreate(AName) do - ValueAsString := '$' + UTF8String(IntToHex(AValue, Digits)); -end; - -function TXmlNode.WriteInnerTag: UTF8String; -// Write the inner part of the tag, the one that contains the attributes -var - i: integer; -begin - Result := ''; - // Attributes - for i := 0 to AttributeCount - 1 do - // Here we used to prevent empty attributes, but in fact, empty attributes - // should be allowed because sometimes they're required - Result := Result + ' ' + AttributePair[i]; - // End of tag - direct nodes get an extra "/" - if QualifyAsDirectNode then - Result := Result + '/'; -end; - -procedure TXmlNode.WriteInt64(const AName: UTF8String; AValue, ADefault: int64); -begin - if WriteOnDefault or (AValue <> ADefault) then - with NodeFindOrCreate(AName) do - ValueAsString := IntToUTF8Str(AValue); -end; - -procedure TXmlNode.WriteInteger(const AName: UTF8String; AValue: integer; ADefault: integer); -begin - if WriteOnDefault or (AValue <> ADefault) then - with NodeFindOrCreate(AName) do - ValueAsString := IntToUTF8Str(AValue); -end; - -{$IFDEF USEGRAPHICS} -procedure TXmlNode.WritePen(const AName: UTF8String; APen: TPen); -begin - with NodeFindOrCreate(AName) do - begin - WriteColor('Color', APen.Color, clBlack); - WriteInteger('Mode', integer(APen.Mode), 0); - WriteInteger('Style', integer(APen.Style), 0); - WriteInteger('Width', APen.Width, 0); - end; -end; -{$ENDIF} - -procedure TXmlNode.WriteString(const AName, AValue: UTF8String; const ADefault: UTF8String); -begin - if WriteOnDefault or (AValue <> ADefault) then - with NodeFindOrCreate(AName) do - ValueAsString := AValue; -end; - -procedure TXmlNode.WriteToStream(S: TStream); -var - i: integer; - Indent: UTF8String; - LFeed: UTF8String; - Line: UTF8String; - ThisNode, NextNode: TXmlNode; - AddLineFeed: boolean; -begin - Indent := GetIndent; - LFeed := GetLineFeed; - - // Write indent - Line := Indent; - - // Write the node - distinguish node type - case ElementType of - xeDeclaration: // XML declaration - begin - // Explicitly delete empty attributes in the declaration, - // this is usually the encoding and we do not want encoding="" - // to show up - DeleteEmptyAttributes; - Line := Indent + ''; - end; - xeStylesheet: // Stylesheet - Line := Indent + ''; - xeDoctype: - begin - if NodeCount = 0 then - Line := Indent + '' - else - begin - Line := Indent + ''; - end; - end; - xeElement: - Line := Indent + ''; - xeAttList: - Line := Indent + ''; - xeEntity: - Line := Indent + ''; - xeNotation: - Line := Indent + ''; - xeComment: // Comment - Line := Indent + ''; - xeCData: // literal data - Line := Indent + ''; - xeExclam: // Any - Line := Indent + ''; - xeQuestion: // Any - Line := Indent + ''; - xeCharData: - Line := FValue; - xeUnknown: // Any - Line := Indent + '<' + ValueDirect + '>'; - xeNormal: // normal nodes (xeNormal) - begin - // Write tag - Line := Line + '<' + FName + WriteInnerTag + '>'; - - // Write value (if any) - Line := Line + FValue; - if (NodeCount > 0) then - // ..and a linefeed - Line := Line + LFeed; - - sdUTF8WriteStringToStream(S, Line); - - // Write child elements - for i := 0 to NodeCount - 1 do - begin - ThisNode := Nodes[i]; - NextNode := Nodes[i + 1]; - ThisNode.WriteToStream(S); - AddLineFeed := True; - if ThisNode.ElementType = xeCharData then - AddLineFeed := False; - if assigned(NextNode) then - if NextNode.ElementType = xeCharData then - AddLineFeed := False; - if AddLineFeed then - sdUTF8WriteStringToStream(S, LFeed); - end; - - // Write end tag - Line := ''; - if not QualifyAsDirectNode then - begin - if NodeCount > 0 then - Line := Indent; - Line := Line + ''; - end; - end; - else - raise EFilerError.Create(sxeIllegalElementType); - end;//case - sdUTF8WriteStringToStream(S, Line); - - // Call the onprogress - if assigned(Document) then - Document.DoProgress(S.Position); -end; - -function TXmlNode.WriteToString: UTF8String; -var - S: TsdUTF8StringStream; -begin - // We will simply call WriteToStream and collect the result as UTF8String using - // a string stream - S := TsdUTF8StringStream.Create(''); - try - WriteToStream(S); - Result := S.DataString; - finally - S.Free; - end; -end; - -procedure TXmlNode.WriteUnicodeString(const AName: UTF8String; - const AValue: UnicodeString; const ADefault: UnicodeString); -begin - WriteString(AName, FromUnicodeString(AValue), FromUnicodeString(ADefault)); -end; - -{ TXmlNodeList } - -function TXmlNodeList.ByAttribute(const AName, AValue: UTF8String): TXmlNode; -var - i: integer; -begin - for i := 0 to Count - 1 do - if UTF8CompareText(Items[i].AttributeByName[AName], AValue) = 0 then - begin - Result := Items[i]; - exit; - end; - Result := nil; -end; - -function TXmlNodeList.GetItems(Index: Integer): TXmlNode; -begin - Result := TXmlNode(Get(Index)); -end; - -procedure TXmlNodeList.SetItems(Index: Integer; const Value: TXmlNode); -begin - Put(Index, TPointer(Value)); -end; - -{ TNativeXml } - -procedure TNativeXml.Assign(Source: TPersistent); - // local - procedure SetDocumentRecursively(ANode: TXmlNode; ADocument: TNativeXml); - var - i: integer; - begin - ANode.Document := ADocument; - for i := 0 to ANode.NodeCount - 1 do - SetDocumentRecursively(ANode.Nodes[i], ADocument); - end; -// main -begin - if Source is TNativeXml then - begin - // Copy private members - FBinaryEncoding := TNativeXml(Source).FBinaryEncoding; - FDropCommentsOnParse := TNativeXml(Source).FDropCommentsOnParse; - FExternalEncoding := TNativeXml(Source).FExternalEncoding; - FParserWarnings := TNativeXml(Source).FParserWarnings; - FIndentString := TNativeXml(Source).FIndentString; - FUseFullNodes := TNativeXml(Source).FUseFullNodes; - FWriteOnDefault := TNativeXml(Source).FWriteOnDefault; - FXmlFormat := TNativeXml(Source).FXmlFormat; - // Assign root - FRootNodes.Assign(TNativeXml(Source).FRootNodes); - // Set Document property recursively - SetDocumentRecursively(FRootNodes, Self); - end else - if Source is TXmlNode then - begin - // Assign this node to the FRootNodes property - FRootNodes.Assign(Source); - // Set Document property recursively - SetDocumentRecursively(FRootNodes, Self); - end else - inherited; -end; - -procedure TNativeXml.Clear; -var - Node: TXmlNode; -begin - // Reset defaults - SetDefaults; - // Clear root - FRootNodes.Clear; - // Build default items in RootNodes - // - first the declaration - Node := TXmlNode.CreateType(Self, xeDeclaration); - Node.Name := 'xml'; - Node.AttributeAdd('version', cDefaultVersionString); - Node.AttributeAdd('encoding', cDefaultEncodingString); - FRootNodes.NodeAdd(Node); - // - then the root node - FRootNodes.NodeNew(''); -end; - -procedure TNativeXml.CopyFrom(Source: TNativeXml); -begin - if not assigned(Source) then - exit; - Assign(Source); -end; - -constructor TNativeXml.Create; -begin - inherited Create; - FRootNodes := TXmlNode.Create(Self); - Clear; -end; - -constructor TNativeXml.CreateName(const ARootName: UTF8String); -begin - Create; - Root.Name := ARootName; -end; - -destructor TNativeXml.Destroy; -begin - FreeAndNil(FRootNodes); - inherited; -end; - -procedure TNativeXml.DoNodeLoaded(Node: TXmlNode); -begin - if assigned(FOnNodeLoaded) then - FOnNodeLoaded(Self, Node); -end; - -procedure TNativeXml.DoNodeNew(Node: TXmlNode); -begin - if assigned(FOnNodeNew) then - FOnNodeNew(Self, Node); -end; - -procedure TNativeXml.DoProgress(Size: integer); -begin - if assigned(FOnProgress) then - FOnProgress(Self, Size); -end; - -procedure TNativeXml.DoUnicodeLoss(Sender: TObject); -begin - if assigned(FOnUnicodeLoss) then - FOnUnicodeLoss(Self); -end; - -function TNativeXml.GetCommentString: UTF8String; -// Get the first comment node, and return its value -var - Node: TXmlNode; -begin - Result := ''; - Node := FRootNodes.NodeByElementType(xeComment); - if assigned(Node) then - Result := Node.ValueAsString; -end; - -function TNativeXml.GetEncodingString: UTF8String; -begin - Result := ''; - if FRootNodes.NodeCount > 0 then - if FRootNodes[0].ElementType = xeDeclaration then - Result := FRootNodes[0].AttributeByName['encoding']; -end; - -function TNativeXml.GetEntityByName(AName: UTF8String): UTF8String; -var - i, j: integer; -begin - Result := ''; - for i := 0 to FRootNodes.NodeCount - 1 do - if FRootNodes[i].ElementType = xeDoctype then with FRootNodes[i] do - begin - for j := 0 to NodeCount - 1 do - if (Nodes[j].ElementType = xeEntity) and (Nodes[j].Name = AName) then - begin - Result := sdUTF8UnQuotedString(sdUTF8Trim(Nodes[j].ValueDirect)); - exit; - end; - end; -end; - -function TNativeXml.GetRoot: TXmlNode; -begin - Result := FRootNodes.NodeByElementType(xeNormal); -end; - -function TNativeXml.GetStyleSheetNode: TXmlNode; -begin - Result := FRootNodes.NodeByElementType(xeStylesheet); - if not assigned(Result) then - begin - // Add a stylesheet node as second one if none present - Result := TXmlNode.CreateType(Self, xeStyleSheet); - FRootNodes.NodeInsert(1, Result); - end; -end; - -function TNativeXml.GetUtf8Encoded: boolean; -begin - Result := True; -end; - -function TNativeXml.GetVersionString: UTF8String; -begin - Result := ''; - if FRootNodes.NodeCount > 0 then - if FRootNodes[0].ElementType = xeDeclaration then - Result := FRootNodes[0].AttributeByName['version']; -end; - -function TNativeXml.IsEmpty: boolean; -var - R: TXmlNode; -begin - Result := True; - R := GetRoot; - if assigned(R) then - Result := R.IsClear; -end; - -function TNativeXml.LineFeed: UTF8String; -begin - case XmlFormat of - xfReadable: - Result := #13#10; - xfCompact: - Result := #10; - else - Result := #10; - end;//case -end; - -procedure TNativeXml.LoadFromFile(const AFileName: string); -var - S: TStream; -begin - S := TFileStream.Create(AFileName, fmOpenRead or fmShareDenyWrite); - try - LoadFromStream(S); - finally - S.Free; - end; -end; - -procedure TNativeXml.LoadFromStream(Stream: TStream); -var - B: TsdBufferedReadStream; -begin - // Create buffer filter. Since we read from the original stream a buffer at a - // time, this speeds up the reading process for disk-based files. - B := TsdBufferedReadStream.Create(Stream, False); - try - // We will create a conversion stream as intermediate - FCodecStream := TsdUtf8Stream.Create(B); - try - // Connect events - FCodecStream.OnUnicodeLoss := DoUnicodeLoss; - // Read from stream - ReadFromStream(FCodecStream); - // Set our external encoding - FExternalEncoding := FCodecStream.Encoding; - finally - FreeAndNil(FCodecStream); - end; - finally - B.Free; - end; -end; - -procedure TNativeXml.ParseDTD(ANode: TXmlNode; S: TStream); -// DTD parsing is quite different from normal node parsing so it is brought -// under in the main NativeXml object - // local - procedure ParseMarkupDeclarations; - var - Ch: AnsiChar; - begin - repeat - ANode.NodeNew('').ReadFromStream(S); - // Read AnsiCharacter, exit if none available - repeat - if S.Read(Ch, 1) = 0 then - exit; - // Read until end markup declaration or end - until not (Ch in cControlChars); - if Ch = ']' then - break; - S.Seek(-1, soCurrent); - until False; - end; -// main -var - Prework: UTF8String; - Ch: AnsiChar; - Words: TsdUTF8StringList; -begin - // Get the name and external ID - Prework := ''; - repeat - // Read AnsiCharacter, exit if none available - if S.Read(Ch, 1) = 0 then - exit; - // Read until markup declaration or end - if Ch in ['[', '>'] then - break; - Prework := Prework + UTF8String(Ch); - until False; - Words := TsdUTF8StringList.Create; - try - sdUTF8ParseAttributes(Prework, 1, length(Prework) + 1, Words); - // First word is name - if Words.Count > 0 then - begin - ANode.Name := Words[0]; - Words.Delete(0); - // Put the rest in the valuedirect - ANode.ValueDirect := sdUTF8Trim(sdUTF8StringReplace(Words.Text, #13#10, ' ')); - end; - finally - Words.Free; - end; - - if Ch = '[' then - begin - - // Parse any !ENTITY nodes and such - ParseMarkupDeclarations; - - // read final tag - repeat - if S.Read(Ch, 1) = 0 then - exit; - if Ch = '>' then - break; - until False; - - end; -end; - -procedure TNativeXml.ReadFromStream(S: TStream); -var - i: integer; - Node: TXmlNode; - Enc: UTF8String; - NormalCount, DeclarationCount, - DoctypeCount, CDataCount: integer; - NormalPos, DoctypePos: integer; -begin - FAbortParsing := False; - with FRootNodes do - begin - // Clear the old root nodes - we do not reset the defaults - Clear; - DoProgress(0); - repeat - Node := NodeNew(''); - Node.ReadFromStream(S); - if AbortParsing then - exit; - - // XML declaration - if Node.ElementType = xeDeclaration then - begin - if Node.HasAttribute('encoding') then - Enc := Node.AttributeByName['encoding']; - // Check encoding - if assigned(FCodecStream) and (AnsiUpperCase(string(Enc)) = 'UTF-8') then - FCodecStream.Encoding := seUTF8; - end; - // Skip clear nodes - if Node.IsClear then - NodeDelete(NodeCount - 1); - until S.Position >= S.Size; - DoProgress(S.Size); - - // Do some checks - NormalCount := 0; - DeclarationCount := 0; - DoctypeCount := 0; - CDataCount := 0; - NormalPos := -1; - DoctypePos := -1; - for i := 0 to NodeCount - 1 do - begin - // Count normal elements - there may be only one - case Nodes[i].ElementType of - xeNormal: - begin - inc(NormalCount); - NormalPos := i; - end; - xeDeclaration: inc(DeclarationCount); - xeDoctype: - begin - inc(DoctypeCount); - DoctypePos := i; - end; - xeCData: inc(CDataCount); - end;//case - end; - - // We *must* have a root node - if NormalCount = 0 then - raise EFilerError.Create(sxeNoRootElement); - - // Do some validation if we allow parser warnings - if FParserWarnings then - begin - - // Check for more than one root node - if NormalCount > 1 then - raise EFilerError.Create(sxeMoreThanOneRootElement); - - // Check for more than one xml declaration - if DeclarationCount > 1 then - raise EFilerError.Create(sxeMoreThanOneDeclaration); - - // Declaration must be first element if present - if DeclarationCount = 1 then - if Nodes[0].ElementType <> xeDeclaration then - raise EFilerError.Create(sxeDeclarationMustBeFirstElem); - - // Check for more than one DTD - if DoctypeCount > 1 then - raise EFilerError.Create(sxeMoreThanOneDoctype); - - // Check if DTD is after root, this is not allowed - if (DoctypeCount = 1) and (DoctypePos > NormalPos) then - raise EFilerError.Create(sxeDoctypeAfterRootElement); - - // No CDATA in root allowed - if CDataCount > 0 then - raise EFilerError.Create(sxeCDataInRoot); - end; - end;//with -end; - -procedure TNativeXml.ReadFromString(const AValue: UTF8String); -var - S: TStream; -begin - S := TsdUTF8StringStream.Create(AValue); - try - ReadFromStream(S); - finally - S.Free; - end; -end; - -procedure TNativeXml.ResolveEntityReferences; -begin - if assigned(Root) then - Root.ResolveEntityReferences; -end; - -procedure TNativeXml.SaveToFile(const AFileName: string); -var - S: TStream; -begin - S := TFileStream.Create(AFileName, fmCreate); - try - SaveToStream(S); - finally - S.Free; - end; -end; - -procedure TNativeXml.SaveToStream(Stream: TStream); -var - B: TsdBufferedWriteStream; -begin - // Create buffer filter. Since we write a buffer at a time to the destination - // stream, this speeds up the writing process for disk-based files. - B := TsdBufferedWriteStream.Create(Stream, False); - try - // Create conversion stream - FCodecStream := TsdUtf8Stream.Create(B); - try - // Set External encoding - FCodecStream.Encoding := FExternalEncoding; - WriteToStream(FCodecStream); - finally - FreeAndNil(FCodecStream); - end; - finally - B.Free; - end; -end; - -procedure TNativeXml.SetCommentString(const Value: UTF8String); -// Find first comment node and set it's value, otherwise add new comment node -// right below the xml declaration -var - Node: TXmlNode; -begin - Node := FRootNodes.NodeByElementType(xeComment); - if not assigned(Node) and (length(Value) > 0) then - begin - Node := TXmlNode.CreateType(Self, xeComment); - FRootNodes.NodeInsert(1, Node); - end; - if assigned(Node) then - Node.ValueAsString := Value; -end; - -procedure TNativeXml.SetDefaults; -begin - // Defaults - FExternalEncoding := cDefaultExternalEncoding; - FXmlFormat := cDefaultXmlFormat; - FWriteOnDefault := cDefaultWriteOnDefault; - FBinaryEncoding := cDefaultBinaryEncoding; - FIndentString := cDefaultIndentString; - FDropCommentsOnParse := cDefaultDropCommentsOnParse; - FUseFullNodes := cDefaultUseFullNodes; - FFloatAllowScientific := cDefaultFloatAllowScientific; - FFloatSignificantDigits := cDefaultFloatSignificantDigits; - FOnNodeNew := nil; - FOnNodeLoaded := nil; -end; - -procedure TNativeXml.SetEncodingString(const Value: UTF8String); -var - Node: TXmlNode; -begin - if Value = GetEncodingString then - exit; - Node := FRootNodes[0]; - if not assigned(Node) or (Node.ElementType <> xeDeclaration) then - begin - Node := TXmlNode.CreateType(Self, xeDeclaration); - FRootNodes.NodeInsert(0, Node); - end; - if assigned(Node) then - Node.AttributeByName['encoding'] := Value; -end; - -procedure TNativeXml.SetVersionString(const Value: UTF8String); -var - Node: TXmlNode; -begin - if Value = GetVersionString then - exit; - Node := FRootNodes[0]; - if not assigned(Node) or (Node.ElementType <> xeDeclaration) then - begin - if length(Value) > 0 then - begin - Node := TXmlNode.CreateType(Self, xeDeclaration); - FRootNodes.NodeInsert(0, Node); - end; - end; - if assigned(Node) then - Node.AttributeByName['version'] := Value; -end; - -procedure TNativeXml.WriteToStream(S: TStream); -var - i: integer; -begin - if not assigned(Root) and FParserWarnings then - raise EFilerError.Create(sxeRootElementNotDefined); - - DoProgress(0); - - // write the root nodes - for i := 0 to FRootNodes.NodeCount - 1 do - begin - FRootNodes[i].WriteToStream(S); - sdUTF8WriteStringToStream(S, LineFeed); - end; - - DoProgress(S.Size); -end; - -function TNativeXml.WriteToString: UTF8String; -var - S: TsdUTF8StringStream; -begin - S := TsdUTF8StringStream.Create(''); - try - WriteToStream(S); - Result := S.DataString; - finally - S.Free; - end; -end; - -{ TsdCodecStream } - -constructor TsdCodecStream.Create(AStream: TStream); -begin - inherited Create; - FStream := AStream; -end; - -function TsdCodecStream.InternalRead(var Buffer{$IFDEF CLR}: array of Byte{$ENDIF}; Offset, Count: Longint): Longint; -// Read from FStream and pass back data -var - i, j: integer; - BOM: array[0..3] of byte; - BytesRead: integer; - Found: boolean; -begin - Result := 0; - if FMode = umUnknown then - begin - FMode := umRead; - // Check FStream - if not assigned(FStream) then - raise EStreamError.Create(sxeCodecStreamNotAssigned); - - // Determine encoding - FEncoding := seAnsi; - BytesRead := FStream.Read(BOM, 4); - for i := 0 to cBomInfoCount - 1 do - begin - Found := True; - for j := 0 to Min(BytesRead, cBomInfo[i].Len) - 1 do - begin - if BOM[j] <> cBomInfo[i].BOM[j] then - begin - Found := False; - break; - end; - end; - if Found then - break; - end; - if Found then - begin - FEncoding := cBomInfo[i].Encoding; - FWriteBom := cBomInfo[i].HasBOM; - end else - begin - // Unknown.. default to this - FEncoding := seAnsi; - FWriteBom := False; - end; - - // Some encodings are not supported (yet) - if FEncoding in [seUCS4BE, seUCS4_2143, seUCS4_3412, seEBCDIC] then - raise EStreamError.Create(sxeUnsupportedEncoding); - - // Correct stream to start position - if FWriteBom then - FStream.Seek(cBomInfo[i].Len - BytesRead, soCurrent) - else - FStream.Seek(-BytesRead, soCurrent); - - // Check if we must swap byte order - if FEncoding in [se16BitBE, seUTF16BE] then - FSwapByteOrder := True; - - end; - - // Check mode - if FMode <> umRead then - raise EStreamError.Create(sxeCannotReadCodecForWriting); - - // Check count - if Count <> 1 then - raise EStreamError.Create(sxeCannotReadMultipeChar); - - // Now finally read - TBytes(Buffer)[Offset] := ReadByte; - if TBytes(Buffer)[Offset] <> 0 then Result := 1; -end; - -{$IFDEF CLR} - -function TsdCodecStream.Read(var Buffer: array of Byte; Offset, Count: Longint): Longint; -begin - Result := InternalRead(Buffer, Offset, Count); -end; - -{$ELSE} - -function TsdCodecStream.Read(var Buffer; Count: Longint): Longint; -begin - Result := InternalRead(Buffer, 0, Count); -end; - -{$ENDIF} - -function TsdCodecStream.ReadByte: byte; -begin - // default does nothing - Result := 0; -end; - -function TsdCodecStream.InternalSeek(Offset: Longint; Origin: TSeekOrigin): Longint; -begin - Result := 0; - if FMode = umUnknown then - raise EStreamError.Create(sxeCannotSeekBeforeReadWrite); - - if Origin = soCurrent then - begin - if Offset = 0 then - begin - // Position - Result := FStream.Position; - exit; - end; - if (FMode = umRead) and ((Offset = -1) or (Offset = -2)) then - begin - FBuffer := ''; - case Offset of - -1: FStream.Seek(FPosMin1, soBeginning); - -2: FStream.Seek(FPosMin2, soBeginning); - end;//case - exit; - end; - end; - if (Origin = soEnd) and (Offset = 0) then - begin - // Size - Result := FStream.Size; - exit; - end; - // Ignore set position from beginning (used in Size command) - if Origin = soBeginning then - exit; - // Arriving here means we cannot do it - raise EStreamError.Create(sxeCannotPerformSeek); -end; - -{$IFDEF CLR} - -function TsdCodecStream.Seek(const Offset: Int64; Origin: TSeekOrigin): Int64; -begin - Result := InternalSeek(Offset, Origin); -end; - -{$ELSE} - -function TsdCodecStream.Seek(Offset: Longint; Origin: Word): Longint; -begin - Result := InternalSeek(Offset, TSeekOrigin(Origin)); -end; - -{$ENDIF} - -procedure TsdCodecStream.StorePrevPositions; -begin - FPosMin2 := FPosMin1; - FPosMin1 := FStream.Position; -end; - -function TsdCodecStream.InternalWrite(const Buffer{$IFDEF CLR}: array of Byte{$ENDIF}; Offset, Count: Longint): Longint; -var - i: integer; -begin - if FMode = umUnknown then - begin - FMode := umWrite; - - // Some encodings are not supported (yet) - if FEncoding in [seUCS4BE, seUCS4_2143, seUCS4_3412, seEBCDIC] then - raise EStreamError.Create(sxeUnsupportedEncoding); - - // Find correct encoding info - for i := 0 to cBomInfoCount - 1 do - if cBomInfo[i].Encoding = FEncoding then - begin - // we do not write BOM if UTF8 since UTF8 is default - FWriteBom := cBomInfo[i].HasBOM and (FEncoding <> seUTF8); - break; - end; - - // Write BOM - if FWriteBom then - FStream.WriteBuffer(cBomInfo[i].BOM, cBomInfo[i].Len); - - // Check if we must swap byte order - if FEncoding in [se16BitBE, seUTF16BE] then - FSwapByteOrder := True; - end; - - if FMode <> umWrite then - raise EStreamError.Create(sxeCannotWriteCodecForReading); - WriteBuf(Buffer, Offset, Count); - Result := Count; -end; - -{$IFDEF CLR} - -function TsdCodecStream.Write(const Buffer: array of Byte; Offset, Count: Longint): Longint; -begin - Result := InternalWrite(Buffer, Offset, Count); -end; - -{$ELSE} - -function TsdCodecStream.Write(const Buffer; Count: Longint): Longint; -begin - Result := InternalWrite(Byte(Buffer), 0, Count); -end; - -{$ENDIF} - -procedure TsdCodecStream.WriteBuf(const Buffer{$IFDEF CLR}: TBytes{$ENDIF}; Offset, Count: longint); -var - i: integer; -begin - // Default just writes out bytes one by one. We override this in descendants - // to provide faster writes for some modes - for i := 0 to Count - 1 do - {$IFDEF CLR} - WriteByte(Buffer[Offset + i]); - {$ELSE} - WriteByte(TBytes(Buffer)[Offset + i]); - {$ENDIF} -end; - -procedure TsdCodecStream.WriteByte(const B: byte); -begin -// default does nothing -end; - -{$IFDEF CLR} - -procedure TsdCodecStream.SetSize(NewSize: Int64); -begin -// default does nothing -end; - -{$ENDIF} - -{ TsdUtf8Stream } - -function TsdUtf8Stream.ReadByte: byte; -var - B, B1, B2, B3: byte; - W: word; - SA: AnsiString; -begin - Result := 0; - - // New AnsiCharacter? - if (Length(FBuffer) = 0) or (FBufferPos > length(FBuffer)) then - begin - StorePrevPositions; - FBufferPos := 1; - // Read another AnsiChar and put in buffer - case FEncoding of - seAnsi: - begin - // read one byte - B := 0; - FStream.Read(B, 1); - SA := AnsiChar(B); - // Convert to UTF8 - FBuffer := sdAnsiToUtf8(SA); - end; - seUTF8: - begin - // Read one, two or three bytes in the buffer - B1 := 0; - FStream.Read(B1, 1); - FBuffer := AnsiChar(B1); - if (B1 and $80) > 0 then - begin - if (B1 and $20) <> 0 then - begin - B2 := 0; - FStream.Read(B2, 1); - FBuffer := FBuffer + UTF8String(AnsiChar(B2)); - end; - B3 := 0; - FStream.Read(B3, 1); - FBuffer := FBuffer + UTF8String(AnsiChar(B3)); - end; - end; - se16BitBE, se16BitLE, seUTF16BE, seUTF16LE: - begin - // Read two bytes - W := 0; - FStream.Read(W, 2); - // Swap byte order - if FSwapByteOrder then - W := swap(W); - // Convert to UTF8 in buffer - {$IFDEF D5UP} - FBuffer := sdUnicodeToUtf8(UnicodeChar(W)); - {$ELSE} - FBuffer := sdUnicodeToUtf8(char(W and $FF)); - {$ENDIF} - end; - else - raise EStreamError.Create(sxeUnsupportedEncoding); - end;//case - end; - - // Now we have the buffer, so read - if (FBufferPos > 0) and (FBufferPos <= length(FBuffer)) then - Result := byte(FBuffer[FBufferPos]); - inc(FBufferPos); -end; - -procedure TsdUtf8Stream.WriteBuf(const Buffer{$IFDEF CLR}: TBytes{$ENDIF}; Offset, Count: longint); -begin - case FEncoding of - seUtf8: - begin - // one on one - if StreamWrite(FStream, Buffer, Offset, Count) <> Count then - raise EStreamError.Create(sxeCannotWriteToOutputStream); - end - else - inherited; - end;//case -end; - -procedure TsdUtf8Stream.WriteByte(const B: byte); -var - SA: AnsiString; - SW: UnicodeString; - MustWrite: boolean; -begin - case FEncoding of - seAnsi, se16BitBE, se16BitLE, seUTF16BE, seUTF16LE: - begin - MustWrite := True; - case Length(FBuffer) of - 0: - begin - FBuffer := AnsiChar(B); - if (B and $80) <> 0 then - MustWrite := False; - end; - 1: - begin - FBuffer := FBuffer + UTF8String(AnsiChar(B)); - if (byte(FBuffer[1]) and $20) <> 0 then - MustWrite := False; - end; - 2: FBuffer := FBuffer + UTF8String(AnsiChar(B)); - end; - if MustWrite then - begin - if FEncoding = seAnsi then - begin - // Convert to ansi - SA := sdUtf8ToAnsi(FBuffer); - // write out - if length(SA) = 1 then - if FStream.Write(SA[1], 1) <> 1 then - raise EStreamError.Create(sxeCannotWriteToOutputStream); - end else - begin - // Convert to unicode - SW := sdUtf8ToUnicode(FBuffer); - // write out - if length(SW) = 1 then - if FStream.Write(SW[1], 2) <> 2 then - raise EStreamError.Create(sxeCannotWriteToOutputStream); - end; - FBuffer := ''; - end; - end; - seUTF8: - begin - // Just a flat write of one byte - if FStream.Write(B, 1) <> 1 then - raise EStreamError.Create(sxeCannotWriteToOutputStream); - end; - else - raise EStreamError.Create(sxeUnsupportedEncoding); - end;//case -end; - -{$IFDEF CLR} -{ TsdBufferedStream } - -constructor TsdBufferedStream.Create(AStream: TStream; Owned: Boolean = False); -begin - inherited Create; - FStream := AStream; - FOwned := Owned; -end; - -destructor TsdBufferedStream.Destroy; -begin - if FOwned then FreeAndNil(FStream); - inherited Destroy; -end; - -function TsdBufferedStream.Read(var Buffer: array of Byte; Offset, Count: Longint): Longint; -begin - Result := FStream.Read(Buffer, Offset, Count); -end; - -function TsdBufferedStream.Write(const Buffer: array of Byte; Offset, Count: Longint): Longint; -begin - Result := FStream.Write(Buffer, Offset, Count); -end; - -function TsdBufferedStream.Seek(const Offset: Int64; Origin: TSeekOrigin): Int64; -begin - Result := FStream.Seek(Offset, Origin); -end; - -procedure TsdBufferedStream.SetSize(NewSize: Int64); -begin - FStream.Size := NewSize; -end; - -{$ELSE} - -{ TsdBufferedReadStream } - -const - cMaxBufferSize = $10000; // 65536 bytes in the buffer - -procedure TsdBufferedReadStream.CheckPosition; -var - NewPage: integer; - FStartPos: longint; -begin - // Page and buffer position - NewPage := FPosition div cMaxBufferSize; - FBufPos := FPosition mod cMaxBufferSize; - - // Read new page if required - if (NewPage <> FPage) then - begin - // New page and buffer - FPage := NewPage; - - // Start position in stream - FStartPos := FPage * cMaxBufferSize; - FBufSize := Min(cMaxBufferSize, FStream.Size - FStartPos); - - FStream.Seek(FStartPos, soBeginning); - if FBufSize > 0 then - FStream.Read(FBuffer^, FBufSize); - end; - FMustCheck := False; -end; - -constructor TsdBufferedReadStream.Create(AStream: TStream; Owned: boolean); -begin - inherited Create; - FStream := AStream; - FOwned := Owned; - FMustCheck := True; - FPage := -1; // Set to invalid number to force an update on first read - ReallocMem(FBuffer, cMaxBufferSize); -end; - -destructor TsdBufferedReadStream.Destroy; -begin - if FOwned then FreeAndNil(FStream); - ReallocMem(FBuffer, 0); - inherited; -end; - -function TsdBufferedReadStream.Read(var Buffer; Count: longint): Longint; -var - Packet: PByte; - PacketCount: integer; -begin - // Set the right page - if FMustCheck then - CheckPosition; - - // Special case - read one byte, most often - if (Count = 1) and (FBufPos < FBufSize - 1) then - begin - byte(Buffer) := FBuffer^[FBufPos]; - inc(FBufPos); - inc(FPosition); - Result := 1; - exit; - end; - - // general case - Packet := @Buffer; - Result := 0; - while Count > 0 do - begin - PacketCount := min(FBufSize - FBufPos, Count); - if PacketCount <= 0 then - exit; - Move(FBuffer^[FBufPos], Packet^, PacketCount); - dec(Count, PacketCount); - inc(Packet, PacketCount); - inc(Result, PacketCount); - inc(FPosition, PacketCount); - inc(FBufPos, PacketCount); - if FBufPos >= FBufSize then - CheckPosition; - end; -end; - -function TsdBufferedReadStream.Seek(Offset: longint; Origin: Word): Longint; -begin - case Origin of - soFromBeginning: - FPosition := Offset; - soFromCurrent: - begin - // no need to check in this case - it is the GetPosition command - if Offset = 0 then - begin - Result := FPosition; - exit; - end; - FPosition := FPosition + Offset; - end; - soFromEnd: - FPosition := FStream.Size + Offset; - end;//case - Result := FPosition; - FMustCheck := True; -end; - -function TsdBufferedReadStream.Write(const Buffer; Count: longint): Longint; -begin - raise EStreamError.Create(sxeCannotWriteCodecForReading); -end; - -{ TsdBufferedWriteStream } - -constructor TsdBufferedWriteStream.Create(AStream: TStream; Owned: boolean); -begin - inherited Create; - FStream := AStream; - FOwned := Owned; - ReallocMem(FBuffer, cMaxBufferSize); -end; - -destructor TsdBufferedWriteStream.Destroy; -begin - Flush; - if FOwned then - FreeAndNil(FStream); - ReallocMem(FBuffer, 0); - inherited; -end; - -procedure TsdBufferedWriteStream.Flush; -begin - // Write the buffer to the stream - if FBufPos > 0 then - begin - FStream.Write(FBuffer^, FBufPos); - FBufPos := 0; - end; -end; - -function TsdBufferedWriteStream.Read(var Buffer; Count: longint): Longint; -begin - raise EStreamError.Create(sxeCannotReadCodecForWriting); -end; - -function TsdBufferedWriteStream.Seek(Offset: longint; Origin: Word): Longint; -begin - case Origin of - soFromBeginning: - if Offset = FPosition then - begin - Result := FPosition; - exit; - end; - soFromCurrent: - begin - // GetPosition command - if Offset = 0 then - begin - Result := FPosition; - exit; - end; - end; - soFromEnd: - if Offset = 0 then - begin - Result := FPosition; - exit; - end; - end;//case - raise EStreamError.Create(sxeCannotPerformSeek); -end; - -function TsdBufferedWriteStream.Write(const Buffer; Count: longint): Longint; -var - Packet: PByte; - PacketCount: integer; -begin - // Special case - read less bytes than would fill buffersize - if (FBufPos + Count < cMaxBufferSize) then - begin - Move(Buffer, FBuffer^[FBufPos], Count); - inc(FBufPos, Count); - inc(FPosition, Count); - Result := Count; - exit; - end; - - // general case that wraps buffer - Packet := @Buffer; - Result := 0; - while Count > 0 do - begin - PacketCount := min(cMaxBufferSize - FBufPos, Count); - if PacketCount <= 0 then - exit; - Move(Packet^, FBuffer^[FBufPos], PacketCount); - dec(Count, PacketCount); - inc(Result, PacketCount); - inc(FPosition, PacketCount); - inc(Packet, PacketCount); - inc(FBufPos, PacketCount); - if FBufPos = cMaxBufferSize then - Flush; - end; -end; -{$ENDIF} - -{ TsdSurplusReader } - -constructor TsdSurplusReader.Create(AStream: TStream); -begin - inherited Create; - FStream := AStream; -end; - -function TsdSurplusReader.ReadChar(var Ch: AnsiChar): integer; -begin - if length(FSurplus) > 0 then - begin - Ch := FSurplus[1]; - FSurplus := copy(FSurplus, 2, length(FSurplus) - 1); - Result := 1; - end else - Result := FStream.Read(Ch, 1); -end; - -function TsdSurplusReader.ReadCharSkipBlanks(var Ch: AnsiChar): boolean; -begin - Result := False; - repeat - // Read AnsiCharacter, exit if none available - if ReadChar(Ch) = 0 then - exit; - // Skip if in controlchars - if not (Ch in cControlchars) then - break; - until False; - Result := True; -end; - -{ TsdStringBuilder } - -procedure TsdStringBuilder.AddChar(Ch: AnsiChar); -begin - inc(FCurrentIdx); - Reallocate(FCurrentIdx); - FData[FCurrentIdx] := Ch; -end; - -procedure TsdStringBuilder.AddString(var S: UTF8String); -var - {$IFDEF CLR} - i: integer; - {$ENDIF} - Count: integer; -begin - {$IFDEF CLR} - Count := S.Length; - {$ELSE} - Count := System.length(S); - {$ENDIF} - if Count = 0 then - exit; - Reallocate(FCurrentIdx + Count); - {$IFDEF CLR} - for i := 1 to S.Length do - FData[FCurrentIdx + i] := S[i]; - {$ELSE} - Move(S[1], FData[FCurrentIdx + 1], Count); - {$ENDIF} - inc(FCurrentIdx, Count); -end; - -procedure TsdStringBuilder.Clear; -begin - FCurrentIdx := 0; -end; - -function TsdStringBuilder.StringCopy(AFirst, ALength: integer): UTF8String; -begin - if ALength > FCurrentIdx - AFirst + 1 then - ALength := FCurrentIdx - AFirst + 1; - Result := Copy(FData, AFirst, ALength); -end; - -constructor TsdStringBuilder.Create; -begin - inherited Create; - SetLength(FData, 64); -end; - -function TsdStringBuilder.GetData(Index: integer): AnsiChar; -begin - Result := FData[Index]; -end; - -procedure TsdStringBuilder.Reallocate(RequiredLength: integer); -begin - {$IFDEF CLR} - while FData.Length < RequiredLength do - SetLength(FData, FData.Length * 2); - {$ELSE} - while System.Length(FData) < RequiredLength do - SetLength(FData, System.Length(FData) * 2); - {$ENDIF} -end; - -function TsdStringBuilder.Value: UTF8String; -begin - Result := Copy(FData, 1, FCurrentIdx); -end; - -initialization - - {$IFDEF TRIALXML} - ShowMessage( - 'This is the unregistered version of NativeXml.pas'#13#13 + - 'Please visit http://www.simdesign.nl/xml.html to buy the'#13 + - 'registered version for Eur 29.95 (source included).'); - {$ENDIF} - -end. diff --git a/Keyboard and Spell checker/Units/PCRE.pas b/Keyboard and Spell checker/Units/PCRE.pas deleted file mode 100644 index 32878c1..0000000 --- a/Keyboard and Spell checker/Units/PCRE.pas +++ /dev/null @@ -1,2230 +0,0 @@ -// $Id: PCRE.pas,v 1.23 2005/08/27 13:24:39 Renato Exp $ - -{**************************************************************} -{ } -{ Borland Delphi Wrapper for Philip Hazel's PCRE library } -{ } -{ Author: Renato Mancuso } -{ } -{ Copyright (C) 2003-2004 Renato Mancuso } -{ } -{==============================================================} -{ } -{ Regular expression support is provided by the PCRE library } -{ package, which is open source software, written by Philip } -{ Hazel, and copyright by the University of Cambridge, } -{ England. } -{ } -{ The latest release of PCRE is always available from: } -{ } -{ ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ } -{ } -{==============================================================} -{ } -{ DISCLAIMER } -{ ---------- } -{ This software is distributed in the hope that it will be } -{ useful, but WITHOUT ANY WARRANTY; without even the implied } -{ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR } -{ PURPOSE. } -{ } -{**************************************************************} -// -// Revision History -// ---------------- -// -// 03-FEB-2008 -// David (dreamfly1024@126.com) wrote: -// I notice there is a bug of PCRE Workbench: -// Regex-Replace '1234567890' with '(?<=\d)(?=(\d{3})+$)' to ',' -// Result : 1,,234,,567,,890 => ERROR -// Should be: 1,234,567,890 -// -// Modified TRegex.Replace and TRegex.Split to use fix -// provided by David -// -// 27-AUG-2005 -// Added support for DFA matching -// -// 30-JUN-2005 -// Added preliminary support for PCRE 6.1 -// -// 26-OCT-2004 -// Updated for PCRE 5.0 -// -// 01-MAR-2004 -// Added support for named capture groups using code -// contributed by Sacha De Vos -// -// 29-FEB-2004 -// Added call to LocaleLock.Free() in unit finalization -// thanks to Miha Vrhovnik - http://simail.sourceforge.net -// -//************************************************************** - -unit PCRE; - -{$ALIGN ON} -{$MINENUMSIZE 4} -{$B-} - -interface - -uses - SysUtils, dialogs,JclAnsiStrings; - -const - CAPTURE_GROUP_BEFORE_START = -1; - CAPTURE_GROUP_AFTER_END = -2; - CAPTURE_GROUP_ENTIRE_MATCH = 0; - -const - INVALID_INDEX_VALUE = -1; - -type - // Options used to control compilation of regex patterns - TRegCompileOption = - ( - rcoAnchored, // PCRE_ANCHORED - rcoIgnoreCase, // PCRE_CASELESS - rcoDollarEndOnly, // PCRE_DOLLAR_ENDONLY - rcoSingleLine, // PCRE_DOTALL - rcoIgnorePatternWhitespace, // PCRE_EXTENDED - rcoExtra, // PCRE_EXTRA - rcoMultiLine, // PCRE_MULTILINE - rcoUngreedy, // PCRE_UNGREEDY - rcoNoAutoCapture, // PCRE_NO_AUTO_CAPTURE - rcoUTF8, // PCRE_UTF8 - rcoNoUTF8Check, // PCRE_NO_UTF8_CHECK - rcoAutoCallout, // PCRE_AUTO_CALLOUT - rcoPartial, // PCRE_PARTIAL - rcoFirstLine // PCRE_FIRSTLINE -(* rcoDupNames, // PCRE_DUPNAMES -- DW - rcoNewLineCR, // PCRE_NEWLINE_CR - rcoNewLineLF, // PCRE_NEWLINE_LF - rcoNewLineCRLF, // PCRE_NEWLINE_CRLF - rcoNewLineAny, // PCRE_NEWLINE_ANY - rcoNewLineAnyCRLF, // PCRE_NEWLINE_ANYCRLF - rcoBSRAnyCRLF, // PCRE_BSR_ANYCRLF - rcoBSRUnicode // PCRE_BSR_UNICODE -*) - ); - - // Options used to control matching behavior - TRegMatchOption = - ( - rmoAnchored, // PCRE_ANCHORED - rmoNotBOL, // PCRE_NOTBOL - rmoNotEOL, // PCRE_NOTEOL - rmoNotEmpty, // PCRE_NOTEMPTY - rmoNoUTF8Check, // PCRE_NO_UTF8_CHECK - rmoDfaShortest // PCRE_DFA_SHORTEST - ); - - TRegSplitOption = ( rsoIncludeSeparators ); - - TRegCompileOptions = set of TRegCompileOption; - TRegMatchOptions = set of TRegMatchOption; - TRegSplitOptions = set of TRegSplitOption; - -type - ICaptureGroup = interface - ['{2AAF1F28-63F8-4977-95EE-13AAC0E3E866}'] - function GetMatched: Boolean; stdcall; - function GetValue: AnsiString; stdcall; - function GetIndex: Integer; stdcall; - function GetLength: Integer; stdcall; - - property Matched: Boolean - read GetMatched; - - property Value: Ansistring - read GetValue; - - property Index: Integer - read GetIndex; - - property Length: Integer - read GetLength; - end; - - ICaptureGroupCollection = interface - ['{662BAD69-E186-4582-A3EB-568AE049E16A}'] - function GetCount: Integer; stdcall; - function GetItem(Index: Integer): ICaptureGroup; stdcall; - function GetItemByName(const Name: ansistring): ICaptureGroup; stdcall; - - property Count: Integer - read GetCount; - - property Items[Index: Integer]: ICaptureGroup - read GetItem; default; - - property ItemsByName[const Name: ansistring]: ICaptureGroup - read GetItemByName; - end; - - IMatch = interface(ICaptureGroup) - ['{99E6F66B-1D9F-41D6-8C30-497AF04EF2BA}'] - function GetGroups: ICaptureGroupCollection; stdcall; - - property Success: Boolean - read GetMatched; - - property Groups: ICaptureGroupCollection - read GetGroups; - end; - - IMatchCollection = interface - ['{86D9C75F-754A-4A71-9965-3854DB68F8E9}'] - function GetCount: Integer; stdcall; - function GetItem(Index: Integer): IMatch; stdcall; - - property Count: Integer - read GetCount; - - property Items[Index: Integer]: IMatch - read GetItem; default; - end; - - IStringCollection = interface - ['{4FC62381-7D61-4399-B22E-4AB27BBC070C}'] - function GetCount: Integer; stdcall; - function GetString(Index: Integer): AnsiString; stdcall; - - property Count: Integer - read GetCount; - - property Strings[Index: Integer]: AnsiString - read GetString; default; - end; - - IDfaMatch = interface - ['{66D0477C-0ADB-4BB5-AA0A-73E4F578458B}'] - function GetValue: ansistring; stdcall; - function GetIndex: Integer; stdcall; - function GetLength: Integer; stdcall; - - property Value: ansistring - read GetValue; - - property Index: Integer - read GetIndex; - - property Length: Integer - read GetLength; - end; - - IDfaMatchCollection = interface - ['{4AAC53FA-9681-42D6-8949-086EF141B430}'] - function GetCount: Integer; stdcall; - function GetItem(Index: Integer): IDfaMatch; stdcall; - - property Count: Integer - read GetCount; - - property Items[Index: Integer]: IDfaMatch - read GetItem; default; - end; - - TRegexMatchEvaluator = function(theMatch: IMatch): ansistring of object; - TRegexMatchEvent = procedure(theMatch: IMatch) of object; - - IRegex = interface - ['{C8DA961E-33ED-4C3A-AA9F-400DD9A766EB}'] - { IsMatch } - function IsMatch(const Input : ansistring): Boolean; overload; stdcall; - - function IsMatch(const Input : ansistring; - Options : TRegMatchOptions): Boolean; overload; stdcall; - - function IsMatch(const Input : ansistring; - Start : Integer): Boolean; overload; stdcall; - - function IsMatch(const Input : ansistring; - Start : Integer; - Options : TRegMatchOptions): Boolean; overload; stdcall; - - { Match } - function Match(const Input : ansistring): IMatch; overload; stdcall; - - function Match(const Input : ansistring; - Options : TRegMatchOptions): IMatch; overload; stdcall; - - function Match(const Input : ansistring; - Start : Integer): IMatch; overload; stdcall; - - function Match(const Input : ansistring; - Start : Integer; - Options : TRegMatchOptions): IMatch; overload; stdcall; - - - { DFA Match } - function DfaMatch(const Input : ansistring): IDfaMatchCollection; overload; stdcall; - - function DfaMatch(const Input : ansistring; - Options : TRegMatchOptions): IDfaMatchCollection; overload; stdcall; - - function DfaMatch(const Input : ansistring; - Start : Integer): IDfaMatchCollection; overload; stdcall; - - function DfaMatch(const Input : ansistring; - Start : Integer; - Options : TRegMatchOptions): IDfaMatchCollection; overload; stdcall; - - { Matches } - function Matches(const Input : ansistring): IMatchCollection; overload; stdcall; - - function Matches(const Input : ansistring; - Options: TRegMatchOptions): IMatchCollection; overload; stdcall; - - { Grep } - procedure Grep(const Input : ansistring; - OnMatch : TRegexMatchEvent); overload; stdcall; - - procedure Grep(const Input : ansistring; - Options : TRegMatchOptions; - OnMatch : TRegexMatchEvent); overload; stdcall; - - { Split } - function Split(const Input : ansistring): IStringCollection; overload; stdcall; - - function Split(const Input : ansistring; - Options : TRegSplitOptions): IStringCollection; overload; stdcall; - - function Split(const Input : ansistring; - Options : TRegSplitOptions; - MatchOptions : TRegMatchOptions): IStringCollection; overload; stdcall; - - { Replace } - function Replace(const Input : ansistring; - const Replacement : ansistring): ansistring; overload; stdcall; - - function Replace(const Input : ansistring; - Evaluator : TRegexMatchEvaluator): ansistring; overload; stdcall; - - function Replace(const Input : ansistring; - const Replacement : ansistring; - MatchOptions : TRegMatchOptions): ansistring; overload; stdcall; - - function Replace(const Input : ansistring; - Evaluator : TRegexMatchEvaluator; - MatchOptions : TRegMatchOptions): ansistring; overload; stdcall; - - { Misc } - function GetOptions: TRegCompileOptions; stdcall; - - function GetPattern: ansistring; stdcall; - - { properties } - property Options: TRegCompileOptions - read GetOptions; - - property Pattern: ansistring - read GetPattern; - end; - - TNamedGroupInfo = record - Name : ansistring; - Index : Integer; - end; - - IRegexInfo = interface - ['{9BEAD385-793F-441A-8721-D161B2DCA6B7}'] - function GetCompiledSize : Cardinal; stdcall; - function GetCaptureCount : Integer; stdcall; - function GetBackRefMax : Integer; stdcall; - function GetFirstChar : Integer; stdcall; - function GetFirstTable : Pointer; stdcall; - function GetLastLiteral : Integer; stdcall; - function GetLocale : ansistring; stdcall; - function GetOptions : TRegCompileOptions; stdcall; - function GetPattern : ansistring; stdcall; - function GetNamedGroupCount : Integer; stdcall; - function GetNamedGroup(Index: Integer): TNamedGroupInfo; stdcall; - - property Options: TRegCompileOptions - read GetOptions; - - property Pattern: ansistring - read GetPattern; - - property CompiledSize: Cardinal - read GetCompiledSize; - - property CaptureCount: Integer - read GetCaptureCount; - - property BackRefMax: Integer - read GetBackRefMax; - - property FirstChar: Integer - read GetFirstChar; - - property FirstTable: Pointer - read GetFirstTable; - - property LastLiteral: Integer - read GetLastLiteral; - - property Locale: ansistring - read GetLocale; - - property NamedGroupCount: Integer - read GetNamedGroupCount; - - property NamedGroup[Index: Integer]: TNamedGroupInfo - read GetNamedGroup; - end; - -type - TRegexLocaleCategory = - ( - RXLC_ALL, // = LC_ALL, - RXLC_COLLATE, // = LC_COLLATE, - RXLC_CTYPE, // = LC_CTYPE, - RXLC_MONETARY, // = LC_MONETARY, - RXLC_NUMERIC, // = LC_NUMERIC, - RXLC_TIME // = LC_TIME - ); - -type - ERegexException = class(Exception); - EBadRegexLocale = class(ERegexException); - ERegexInvalidSubstitutionGroup = class(ERegexException); - ERegexBadGroupName = class(ERegexException); - -function RegexCreate(const thePattern : ansistring): IRegex; overload; - -function RegexCreate(const thePattern : ansistring; - theOptions : TRegCompileOptions): IRegex; overload; - -function RegexCreate(const thePattern : ansistring; - const theLocale : ansistring; - theLocaleCategory: TRegexLocaleCategory = RXLC_ALL): IRegex; overload; - -function RegexCreate(const thePattern : ansistring; - theOptions : TRegCompileOptions; - const theLocale : ansistring; - theLocaleCategory: TRegexLocaleCategory = RXLC_ALL): IRegex; overload; - -function EncodeRegCompileOptions(theOptions : TRegCompileOptions): LongWord; -function DecodeRegCompileOptions(theOptions : LongWord): TRegCompileOptions; - -function EncodeRegMatchOptions (theOptions : TRegMatchOptions): LongWord; -function DecodeRegMatchOptions (theOptions : LongWord): TRegMatchOptions; - -implementation - -uses - Classes, - SyncObjs, - Math, - pcre_dll; - -{ ********************************************************* } -{ ********************************************************* } -{ ********************************************************* } - -type - INameIndexLookup = interface - ['{4EB901AE-50F9-4552-84B6-1676613B6F0E}'] - function GetGroupIndex(const theName: ansistring): Integer; - procedure AddMapping(const theName: ansistring; theIndex: Integer); - function GetMappingCount: Integer; - function GetMappingAt(theIndex: Integer): TNamedGroupInfo; - end; - - TNameIndexLookup = class(TInterfacedObject, INameIndexLookup) - private - FMappings : TAnsiStringList; - - public - constructor Create; - destructor Destroy; override; - - // INameIndexLookup - function GetGroupIndex(const theName: ansistring): Integer; - procedure AddMapping(const theName: ansistring; theIndex: Integer); - function GetMappingCount: Integer; - function GetMappingAt(theIndex: Integer): TNamedGroupInfo; - end; - - TRegexLocale = class - private - FNlsTable: TPcre_tableH; - FDispose : Boolean; - FLocale : ansistring; - public - constructor Create(const theLocale: ansistring; theLocaleCategory: TRegexLocaleCategory); - destructor Destroy; override; - - property Locale: ansistring - read FLocale; - - property CharTable: TPcre_tableH - read FNlsTable; - end; - - TRegexStringCollection = class(TInterfacedObject, IStringCollection) - private - FStrings : TAnsiStringList; - public - constructor Create; - destructor Destroy; override; - procedure Add(const S: ansistring); - { IStringCollection } - function GetCount: Integer; stdcall; - function GetString(Index: Integer): Ansistring; stdcall; - end; - - TRegexMatchCollection = class(TInterfacedObject, IMatchCollection) - private - FList : TInterfaceList; - public - constructor Create; - destructor Destroy; override; - procedure Add(Element: IMatch); - { IMatchCollection } - function GetCount: Integer; stdcall; - function GetItem(Index: Integer): IMatch; stdcall; - end; - - TOVector = array of Integer; - - TMatchPos = record - First : Integer; - Last : Integer; - end; - - TRegexMatch = class(TInterfacedObject, IMatch, ICaptureGroupCollection) - private - FSubject : ansistring; - FCount : Integer; - FMatches : TOvector; - FNames : INameIndexLookup; - - public - constructor Create(const S: ansistring; var VOffset: TOVector; const Names: INameIndexLookup); - destructor Destroy; override; - - function InternalGetMatchPos(Index: Integer): TMatchPos; - function InternalGetMatched(Index: Integer): Boolean; - function InternalGetValue(Index: Integer): ansistring; - function InternalGetIndex(Index: Integer): Integer; - function InternalGetLength(Index: Integer): Integer; - - { ICaptureGroup } - function GetMatched: Boolean; stdcall; - function GetValue: Ansistring; stdcall; - function GetIndex: Integer; stdcall; - function GetLength: Integer; stdcall; - - { IMatch } - function GetGroups: ICaptureGroupCollection; stdcall; - - { ICaptureGroupCollection } - function GetCount: Integer; stdcall; - function GetItem(Index: Integer): ICaptureGroup; stdcall; - function GetItemByName(const Name: ansistring): ICaptureGroup; stdcall; - end; - - TRegexCaptureGroup = class(TInterfacedObject, ICaptureGroup) - private - FMatch : TRegexMatch; - FIndex : Integer; - public - constructor Create(Match: TRegexMatch; Index: Integer); - destructor Destroy; override; - { ICaptureGroup } - function GetMatched: Boolean; stdcall; - function GetValue: Ansistring; stdcall; - function GetIndex: Integer; stdcall; - function GetLength: Integer; stdcall; - end; - - TDfaMatchCollection = class(TInterfacedObject, IDfaMatchCollection) - private - FSubject : ansistring; - FCount : Integer; - FMatches : TOvector; - - public - constructor Create(const S: ansistring; var VOffset: TOVector); - destructor Destroy; override; - - function InternalGetMatchPos(Index: Integer): TMatchPos; - function InternalGetValue(Index: Integer): ansistring; - function InternalGetIndex(Index: Integer): Integer; - function InternalGetLength(Index: Integer): Integer; - - { IDfaMatchCollection } - function GetCount: Integer; stdcall; - function GetItem(Index: Integer): IDfaMatch; stdcall; - end; - - TDfaMatch = class(TInterfacedObject, IDfaMatch) - private - FMatchCollection: TDfaMatchCollection; - FIndex: Integer; - - public - constructor Create(MatchCollection: TDfaMatchCollection; Index: Integer); - destructor Destroy; override; - - { IDfaMatch } - function GetValue: ansistring; stdcall; - function GetIndex: Integer; stdcall; - function GetLength: Integer; stdcall; - end; - - TRegex = class(TInterfacedObject, IRegex, IRegexInfo) - private - FPattern : AnsiString; - FOptions : TRegCompileOptions; - FRegex : TPcreH; - FRegExtra : TPcre_extraH; - FLocaleInfo : TRegexLocale; - FNames : INameIndexLookup; - - procedure CompilePattern; - procedure RetrieveNames; - procedure PcreCheck(ErrorCode: Integer); - - public - constructor Create(const Pattern : ansistring; - Options : TRegCompileOptions; - const Locale : ansistring; - LocaleCategory : TRegexLocaleCategory = RXLC_ALL); - - destructor Destroy; override; - - { IRegex } - function IsMatch(const Input: ansistring): Boolean; overload; stdcall; - function IsMatch(const Input: ansistring; Options: TRegMatchOptions): Boolean; overload; stdcall; - function IsMatch(const Input: ansistring; Start: Integer): Boolean; overload; stdcall; - function IsMatch(const Input: ansistring; Start: Integer; Options: TRegMatchOptions): Boolean; overload; stdcall; - - function Match(const Input: ansistring): IMatch; overload; stdcall; - function Match(const Input: ansistring; Options: TRegMatchOptions): IMatch; overload; stdcall; - function Match(const Input: ansistring; Start: Integer): IMatch; overload; stdcall; - function Match(const Input: ansistring; Start: Integer; Options: TRegMatchOptions): IMatch; overload; stdcall; - - function DfaMatch(const Input : ansistring): IDfaMatchCollection; overload; stdcall; - - function DfaMatch(const Input : ansistring; - Options : TRegMatchOptions): IDfaMatchCollection; overload; stdcall; - - function DfaMatch(const Input : ansistring; - Start : Integer): IDfaMatchCollection; overload; stdcall; - - function DfaMatch(const Input : ansistring; - Start : Integer; - Options : TRegMatchOptions): IDfaMatchCollection; overload; stdcall; - - - function Matches(const Input: ansistring): IMatchCollection; overload; stdcall; - function Matches(const Input: ansistring; Options: TRegMatchOptions): IMatchCollection; overload; stdcall; - - procedure Grep(const Input: ansistring; OnMatch: TRegexMatchEvent); overload; stdcall; - procedure Grep(const Input: ansistring; Options: TRegMatchOptions; OnMatch: TRegexMatchEvent); overload; stdcall; - - function Split(const Input: ansistring): IStringCollection; overload; stdcall; - function Split(const Input: ansistring; Options: TRegSplitOptions): IStringCollection; overload; stdcall; - function Split(const Input: ansistring; Options: TRegSplitOptions; MatchOptions: TRegMatchOptions): IStringCollection; overload; stdcall; - - function Replace(const Input: ansistring; const Replacement: ansistring): ansistring; overload; stdcall; - function Replace(const Input: ansistring; Evaluator: TRegexMatchEvaluator): ansistring; overload; stdcall; - function Replace(const Input: ansistring; const Replacement: ansistring; MatchOptions: TRegMatchOptions): ansistring; overload; stdcall; - function Replace(const Input: ansistring; Evaluator: TRegexMatchEvaluator; MatchOptions: TRegMatchOptions): ansistring; overload; stdcall; - - function GetOptions: TRegCompileOptions; stdcall; - function GetPattern: ansistring; stdcall; - - { IRegexInfo } - function GetCompiledSize: Cardinal; stdcall; - function GetCaptureCount: Integer; stdcall; - function GetBackRefMax: Integer; stdcall; - function GetFirstChar: Integer; stdcall; - function GetFirstTable: Pointer; stdcall; - function GetLastLiteral: Integer; stdcall; - function GetLocale: ansistring; stdcall; - function GetNamedGroupCount : Integer; stdcall; - function GetNamedGroup(Index: Integer): TNamedGroupInfo; stdcall; - end; - - TSubstitute = class(TObject) - private - FMatch : IMatch; - public - constructor Create(theMatch: IMatch); - function RegexSubstitute(Match: IMatch): ansistring; - end; - -{ ********************************************************* } -{ ********************************************************* } -{ ********************************************************* } - -{ RegexCreate } - -//=========================================================================== - -function RegexCreate(const thePattern: ansistring): IRegex; - -begin - Result := RegexCreate(thePattern, [], 'C'); -end; - -//=========================================================================== - -function RegexCreate(const thePattern: ansistring; theOptions: TRegCompileOptions): IRegex; - -begin - Result := RegexCreate(thePattern, theOptions, 'C'); -end; - -//=========================================================================== - -function RegexCreate(const thePattern : ansistring; - const theLocale : ansistring; - theLocaleCategory : TRegexLocaleCategory = RXLC_ALL): IRegex; - -begin - Result := RegexCreate(thePattern, [], theLocale, theLocaleCategory); -end; - -//=========================================================================== - -function RegexCreate(const thePattern : ansistring; - theOptions : TRegCompileOptions; - const theLocale : ansistring; - theLocaleCategory: TRegexLocaleCategory = RXLC_ALL): IRegex; - -begin - Result := TRegex.Create(thePattern, theOptions, theLocale, theLocaleCategory); -end; - -//=========================================================================== - -{ Utility functions} - -function EncodeRegCompileOptions(theOptions: TRegCompileOptions): LongWord; - -begin - Result := 0; - - if rcoAnchored in theOptions then - Result := Result or PCRE_ANCHORED; - - if rcoIgnoreCase in theOptions then - Result := Result or PCRE_CASELESS; - - if rcoDollarEndOnly in theOptions then - Result := Result or PCRE_DOLLAR_ENDONLY; - - if rcoSingleLine in theOptions then - Result := Result or PCRE_DOTALL; - - if rcoIgnorePatternWhitespace in theOptions then - Result := Result or PCRE_EXTENDED; - - if rcoExtra in theOptions then - Result := Result or PCRE_EXTRA; - - if rcoMultiLine in theOptions then - Result := Result or PCRE_MULTILINE; - - if rcoUngreedy in theOptions then - Result := Result or PCRE_UNGREEDY; - - if rcoNoAutoCapture in theOptions then - Result := Result or PCRE_NO_AUTO_CAPTURE; - - if rcoUTF8 in theOptions then - Result := Result or PCRE_UTF8; - - if rcoNoUTF8Check in theOptions then - Result := Result or PCRE_NO_UTF8_CHECK; - - if rcoAutoCallout in theOptions then - Result := Result or PCRE_AUTO_CALLOUT; - - if rcoPartial in theOptions then - Result := Result or PCRE_PARTIAL; - - if rcoFirstLine in theOptions then - Result := Result or PCRE_FIRSTLINE; -end; - -//=========================================================================== - -function DecodeRegCompileOptions(theOptions: LongWord): TRegCompileOptions; - -begin - Result := []; - - if (theOptions and PCRE_ANCHORED <> 0) then - Include(Result, rcoAnchored); - - if (theOptions and PCRE_CASELESS <> 0) then - Include(Result, rcoIgnoreCase); - - if (theOptions and PCRE_DOLLAR_ENDONLY <> 0) then - Include(Result, rcoDollarEndOnly); - - if (theOptions and PCRE_DOTALL <> 0) then - Include(Result, rcoSingleLine); - - if (theOptions and PCRE_EXTENDED <> 0) then - Include(Result, rcoIgnorePatternWhitespace); - - if (theOptions and PCRE_EXTRA <> 0) then - Include(Result, rcoExtra); - - if (theOptions and PCRE_MULTILINE <> 0) then - Include(Result, rcoMultiLine); - - if (theOptions and PCRE_UNGREEDY <> 0) then - Include(Result, rcoUngreedy); - - if (theOptions and PCRE_NO_AUTO_CAPTURE <> 0) then - Include(Result, rcoNoAutoCapture); - - if (theOptions and PCRE_UTF8 <> 0) then - Include(Result, rcoUTF8); - - if (theOptions and PCRE_NO_UTF8_CHECK <> 0) then - Include(Result, rcoNoUTF8Check); - - if (theOptions and PCRE_AUTO_CALLOUT <> 0) then - Include(Result, rcoAutoCallout); - - if (theOptions and PCRE_PARTIAL <> 0) then - Include(Result, rcoPartial); - - if (theOptions and PCRE_FIRSTLINE <> 0) then - Include(Result, rcoFirstLine); -end; - -//=========================================================================== - -function EncodeRegMatchOptions(theOptions: TRegMatchOptions): LongWord; - -begin - Result := 0; - - if rmoAnchored in theOptions then - Result := Result or PCRE_ANCHORED; - - if rmoNotBOL in theOptions then - Result := Result or PCRE_NOTBOL; - - if rmoNotEOL in theOptions then - Result := Result or PCRE_NOTEOL; - - if rmoNotEmpty in theOptions then - Result := Result or PCRE_NOTEMPTY; - - if rmoNoUTF8Check in theOptions then - Result := Result or PCRE_NO_UTF8_CHECK; - - if rmoDfaShortest in theOptions then - Result := Result or PCRE_DFA_SHORTEST; -end; - -//=========================================================================== - -function DecodeRegMatchOptions(theOptions: LongWord): TRegMatchOptions; - -begin - Result := []; - - if (theOptions and PCRE_ANCHORED <> 0) then - Include(Result, rmoAnchored); - - if (theOptions and PCRE_NOTBOL <> 0) then - Include(Result, rmoNotBOL); - - if (theOptions and PCRE_NOTEOL <> 0) then - Include(Result, rmoNotEOL); - - if (theOptions and PCRE_NOTEMPTY <> 0) then - Include(Result, rmoNotEmpty); - - if (theOptions and PCRE_NO_UTF8_CHECK <> 0) then - Include(Result, rmoNoUTF8Check); - - if (theOptions and PCRE_DFA_SHORTEST <> 0) then - Include(Result, rmoDfaShortest); -end; - -//=========================================================================== - -constructor TSubstitute.Create(theMatch: IMatch); - -begin - inherited Create(); - FMatch := theMatch; -end; - -//=========================================================================== - -function TSubstitute.RegexSubstitute(Match: IMatch): ansistring; - -const - REGEX_SUBST_DOLLAR = '$'; - REGEX_SUBST_ALL_MATCH = '&'; - REGEX_SUBST_BEFORE_MATCH = '`'; - REGEX_SUBST_AFTER_MATCH = ''''; - REGEX_SUBST_LAST_GROUP = '+'; - REGEX_SUBST_ALL_INPUT = '_'; - REGEX_SUBST_NAMED_GROUP = '{'; - -var - theSubstitution : ansistring; - theIndex : Integer; - -begin - theSubstitution := Match.Groups[1].Value; - - case theSubstitution[1] of - REGEX_SUBST_DOLLAR : Result := '$'; - REGEX_SUBST_NAMED_GROUP : Result := FMatch.Groups.ItemsByName[Match.Groups[2].Value].Value; - REGEX_SUBST_ALL_MATCH : Result := FMatch.Value; - REGEX_SUBST_BEFORE_MATCH : Result := FMatch.Groups[CAPTURE_GROUP_BEFORE_START].Value; - REGEX_SUBST_AFTER_MATCH : Result := FMatch.Groups[CAPTURE_GROUP_AFTER_END].Value; - REGEX_SUBST_LAST_GROUP : Result := FMatch.Groups[FMatch.Groups.Count - 1].Value; - REGEX_SUBST_ALL_INPUT : Result := FMatch.Groups[CAPTURE_GROUP_BEFORE_START].Value + - FMatch.Value + - FMatch.Groups[CAPTURE_GROUP_AFTER_END].Value; - else - // it must be a number - theIndex := StrToInt(String(theSubstitution)); - - if theIndex >= FMatch.Groups.Count then - raise ERegexInvalidSubstitutionGroup.CreateFmt('Invalid substitution variable $%d', - [theIndex]); - - Result := FMatch.Groups[theIndex].Value; - end; -end; - -//=========================================================================== - -var - RegexSubstitute : TRegex; - -//=========================================================================== - -function Substitute(const Replace: ansistring; theMatch: IMatch): ansistring; - -var - theAction : TSubstitute; - -begin - theAction := TSubstitute.Create(theMatch); - try - Result := RegexSubstitute.Replace(Replace, theAction.RegexSubstitute); - finally - theAction.Free(); - end; -end; - -//=========================================================================== - -{ TRegexLocale } - -var - LocaleLock : TCriticalSection; - -//=========================================================================== - -function GetLocaleTable(const theLocale : ansistring; - theLocaleCategory : Integer; - var theCharTable : TPcre_tableH): ansistring; - -var - szLocale : PAnsiChar; - -begin - LocaleLock.Enter; - - try - szLocale := pcre_setlocale(theLocaleCategory, PAnsiChar(theLocale)); - - if szLocale = nil then - begin - raise EBadRegexLocale.CreateFmt('Invalid locale string %s or invalid locale category %d', - [theLocale, theLocaleCategory]); - end; - - theCharTable := pcre_maketables(); - - if theCharTable = nil then - OutOfMemoryError; - - Result := szLocale; - - finally - LocaleLock.Leave; - end; - -end; - -//=========================================================================== - -constructor TRegexLocale.Create(const theLocale : ansistring; - theLocaleCategory : TRegexLocaleCategory); - -begin - inherited Create; - - if (theLocale = 'C') and (theLocaleCategory = RXLC_ALL) then - begin - FNlsTable := nil; - FLocale := 'C'; - FDispose := false; - end - else - begin - FLocale := GetLocaleTable(theLocale, Ord(theLocaleCategory), FNlsTable); - FDispose := true; - end; -end; - -//=========================================================================== - -destructor TRegexLocale.Destroy; - -begin - if FDispose then - begin - pcre_free_ex(FNlsTable); - FDispose := false; - end; - - inherited; -end; - -//=========================================================================== - -{ TRegexStringCollection } - -procedure TRegexStringCollection.Add(const S: ansistring); - -begin - FStrings.Add(S); -end; - -//=========================================================================== - -constructor TRegexStringCollection.Create; - -begin - inherited; - FStrings := TAnsiStringList.Create(); -end; - -//=========================================================================== - -destructor TRegexStringCollection.Destroy; - -begin - FStrings.Free(); - inherited; -end; - -//=========================================================================== - -function TRegexStringCollection.GetCount: Integer; - -begin - Result := FStrings.Count; -end; - -//=========================================================================== - -function TRegexStringCollection.GetString(Index: Integer): AnsiString; - -begin - Result := FStrings[Index]; -end; - -//=========================================================================== - -{ TRegexMatchCollection } - -procedure TRegexMatchCollection.Add(Element: IMatch); - -begin - ASSERT(Element <> nil); - FList.Add(Element); -end; - -//=========================================================================== - -constructor TRegexMatchCollection.Create; - -begin - inherited; - FList := TInterfaceList.Create(); -end; - -//=========================================================================== - -destructor TRegexMatchCollection.Destroy; - -begin - FList.Free(); - inherited; -end; - -//=========================================================================== - -function TRegexMatchCollection.GetCount: Integer; - -begin - Result := FList.Count; -end; - -//=========================================================================== - -function TRegexMatchCollection.GetItem(Index: Integer): IMatch; - -begin - Result := FList[Index] as IMatch; -end; - -//=========================================================================== - -{ TRegexCaptureGroup } - -constructor TRegexCaptureGroup.Create(Match: TRegexMatch; Index: Integer); - -begin - inherited Create(); - FMatch := Match; - FIndex := Index; -end; - -//=========================================================================== - -destructor TRegexCaptureGroup.Destroy; - -begin - inherited; -end; - -//=========================================================================== - -function TRegexCaptureGroup.GetIndex: Integer; - -begin - Result := FMatch.InternalGetIndex(FIndex); -end; - -//=========================================================================== - -function TRegexCaptureGroup.GetLength: Integer; - -begin - Result := FMatch.InternalGetLength(FIndex); -end; - -//=========================================================================== - -function TRegexCaptureGroup.GetMatched: Boolean; - -begin - Result := FMatch.InternalGetMatched(FIndex); -end; - -//=========================================================================== - -function TRegexCaptureGroup.GetValue: Ansistring; - -begin - Result := FMatch.InternalGetValue(FIndex); -end; - -//=========================================================================== - -{ TRegexMatch } - -constructor TRegexMatch.Create(const S: ansistring; var VOffset: TOVector; const Names: INameIndexLookup); - -begin - ASSERT(Names <> nil); - - inherited Create(); - - FSubject := S; - FMatches := Voffset; - - if Assigned(FMatches) then - FCount := Length(FMatches) div 3; - - FNames := Names; - - ASSERT(((FCount <> 0) and (FMatches <> nil)) or ((FCount = 0) and (FMatches = nil))); - ASSERT((FMatches = nil) or (Length(FMatches) mod 3 = 0)); -end; - -//=========================================================================== - -destructor TRegexMatch.Destroy; - -begin - FMatches := nil; - inherited; -end; - -//=========================================================================== - -function TRegexMatch.InternalGetIndex(Index: Integer): Integer; - -var - MatchPos : TMatchPos; - -begin - MatchPos := InternalGetMatchPos(Index); - Result := MatchPos.First; -end; - -//=========================================================================== - -function TRegexMatch.InternalGetLength(Index: Integer): Integer; - -var - MatchPos : TMatchPos; - -begin - MatchPos := InternalGetMatchPos(Index); - Result := MatchPos.Last - MatchPos.First; -end; - -//=========================================================================== - -function TRegexMatch.InternalGetValue(Index: Integer): ansistring; - -var - MatchPos: TMatchPos; - -begin - Result := ''; - - MatchPos := InternalGetMatchPos(Index); - - if MatchPos.First <> INVALID_INDEX_VALUE then - begin - Result := System.Copy(FSubject, - MatchPos.First + 1, - MatchPos.Last - MatchPos.First); - end; -end; - -//=========================================================================== - -function TRegexMatch.InternalGetMatched(Index: Integer): Boolean; - -begin - Result := InternalGetMatchPos(Index).First <> INVALID_INDEX_VALUE; -end; - -//=========================================================================== - -function TRegexMatch.InternalGetMatchPos(Index: Integer): TMatchPos; -begin - // assume failure - Result.First := INVALID_INDEX_VALUE; - Result.Last := INVALID_INDEX_VALUE; - - // if no matches return - if (FCount = 0) or (FMatches[0] = INVALID_INDEX_VALUE) then - Exit; - - if (Index >= 0) and (Index < FCount) then - begin - // take values from OVector - Result.First := FMatches[Index * 2]; - Result.Last := FMatches[Index * 2 + 1]; - end - else if Index = CAPTURE_GROUP_BEFORE_START then - begin - // return index from the Start of the string to - // the Start of the match - Result.First := 0; - Result.Last := FMatches[0]; - end - else if Index = CAPTURE_GROUP_AFTER_END then - begin - // return everything from the end of the match - // until the end of the subject string - Result.First := FMatches[1]; - Result.Last := Length(FSubject); - end; -end; - -//=========================================================================== - -function TRegexMatch.GetCount: Integer; - -begin - Result := FCount; -end; - -//=========================================================================== - -function TRegexMatch.GetGroups: ICaptureGroupCollection; - -begin - Result := (Self as ICaptureGroupCollection); -end; - -//=========================================================================== - -function TRegexMatch.GetItem(Index: Integer): ICaptureGroup; - -begin - Result := TRegexCaptureGroup.Create(Self, Index) as ICaptureGroup; -end; - -//=========================================================================== - -function TRegexMatch.GetItemByName(const Name: ansistring): ICaptureGroup; - -begin - Result := GetItem(FNames.GetGroupIndex(Name)); -end; - -//=========================================================================== - -function TRegexMatch.GetIndex: Integer; - -begin - Result := InternalGetIndex(CAPTURE_GROUP_ENTIRE_MATCH); -end; - -//=========================================================================== - -function TRegexMatch.GetLength: Integer; - -begin - Result := InternalGetLength(CAPTURE_GROUP_ENTIRE_MATCH); -end; - -//=========================================================================== - -function TRegexMatch.GetMatched: Boolean; - -begin - Result := InternalGetMatched(CAPTURE_GROUP_ENTIRE_MATCH); -end; - -//=========================================================================== - -function TRegexMatch.GetValue: Ansistring; - -begin - Result := InternalGetValue(CAPTURE_GROUP_ENTIRE_MATCH); -end; - -//=========================================================================== - -{ TRegex } - -constructor TRegex.Create(const Pattern : ansistring; - Options : TRegCompileOptions; - const Locale : ansistring; - LocaleCategory: TRegexLocaleCategory); - -begin - inherited Create(); - - FPattern := Pattern; - FOptions := Options; - FLocaleInfo := TRegexLocale.Create(Locale, LocaleCategory); - - CompilePattern(); - RetrieveNames(); -end; - -//=========================================================================== - -destructor TRegex.Destroy; - -begin - pcre_free_ex(FRegex); - pcre_free_ex(FRegExtra); - FLocaleInfo.Free(); - inherited; -end; - -//=========================================================================== - -procedure TRegex.CompilePattern; - -var - Pcre : TPcreH; - CharTable : TPcre_tableH; - ErrMsg : PAnsiChar; - ErrOffs : Integer; - CompileOptions : LongWord; - -begin - CharTable := FLocaleInfo.CharTable; - CompileOptions := EncodeRegCompileOptions(FOptions); - - - Pcre := pcre_compile(PAnsiChar(FPattern), - CompileOptions, - ErrMsg, - ErrOffs, - CharTable); - - if Pcre = nil then - raise ERegexException.CreateFmt('Invalid Pattern ''%s'': error at position %d: %s', - [FPattern, ErrOffs, ErrMsg]); - - FRegex := Pcre; - - if not (rcoAnchored in GetOptions()) and (GetFirstChar() < 0) then - begin - FRegExtra := pcre_study(FRegex, 0, ErrMsg); - - if ErrMsg <> nil then - raise ERegexException.CreateFmt('Failed to study pattern''%s'' : %s', - [FPattern, ErrMsg]); - end; -end; - -//=========================================================================== - -procedure TRegex.RetrieveNames; - -var - NameCount : Integer; - NameEntrySize : Integer; - Ptr : PByte; - Idx : Word; - i : Integer; - -begin - FNames := TNameIndexLookup.Create(); - - //get count of names - PcreCheck(pcre_fullinfo(FRegex, FRegExtra, PCRE_INFO_NAMECOUNT, NameCount)); - - if NameCount <= 0 then - Exit; - - //get size of name - PcreCheck(pcre_fullinfo(FRegex, FRegExtra, PCRE_INFO_NAMEENTRYSIZE, NameEntrySize)); - - //get pointer to name table - PcreCheck(pcre_fullinfo(FRegex, FRegExtra, PCRE_INFO_NAMETABLE, Ptr)); - - for i := 0 to NameCount - 1 do - begin - WordRec(Idx).Hi := Ptr^; Inc(Ptr); - WordRec(Idx).Lo := Ptr^; Inc(Ptr); - FNames.AddMapping(PAnsiChar(Ptr), Idx); - Inc(Ptr, NameEntrySize - 2 ); - end; -end; - -//=========================================================================== - -procedure TRegex.PcreCheck(ErrorCode: Integer); - -begin - if ErrorCode < 0 then - case ErrorCode of - PCRE_ERROR_NOMATCH : raise ERegexException.Create('PCRE_ERROR_NOMATCH'); - PCRE_ERROR_NULL : raise ERegexException.Create('PCRE_ERROR_NULL'); - PCRE_ERROR_BADOPTION : raise ERegexException.Create('PCRE_ERROR_BADOPTION'); - PCRE_ERROR_BADMAGIC : raise ERegexException.Create('PCRE_ERROR_BADMAGIC'); - PCRE_ERROR_UNKNOWN_NODE : raise ERegexException.Create('PCRE_ERROR_UNKNOWN_NODE'); - PCRE_ERROR_NOMEMORY : raise ERegexException.Create('PCRE_ERROR_NOMEMORY'); - PCRE_ERROR_NOSUBSTRING : raise ERegexException.Create('PCRE_ERROR_NOSUBSTRING'); - PCRE_ERROR_BADUTF8 : raise ERegexException.Create('PCRE_ERROR_BADUTF8'); - PCRE_ERROR_BADUTF8_OFFSET : raise ERegexException.Create('PCRE_ERROR_BADUTF8_OFFSET'); - PCRE_ERROR_PARTIAL : raise ERegexException.Create('PCRE_ERROR_PARTIAL'); - PCRE_ERROR_BADPARTIAL : raise ERegexException.Create('PCRE_ERROR_BADPARTIAL'); - PCRE_ERROR_BADCOUNT : raise ERegexException.Create('PCRE_ERROR_BADCOUNT'); - PCRE_ERROR_INTERNAL : raise ERegexException.Create('PCRE_ERROR_INTERNAL'); - PCRE_ERROR_DFA_UITEM : raise ERegexException.Create('PCRE_ERROR_DFA_UITEM'); - PCRE_ERROR_DFA_UCOND : raise ERegexException.Create('PCRE_ERROR_DFA_UCOND'); - PCRE_ERROR_DFA_UMLIMIT : raise ERegexException.Create('PCRE_ERROR_DFA_UMLIMIT'); - PCRE_ERROR_DFA_WSSIZE : raise ERegexException.Create('PCRE_ERROR_DFA_WSSIZE'); - PCRE_ERROR_DFA_RECURSE : raise ERegexException.Create('PCRE_ERROR_DFA_RECURSE'); - PCRE_ERROR_RECURSIONLIMIT : raise ERegexException.Create('PCRE_ERROR_RECURSIONLIMIT'); - PCRE_ERROR_NULLWSLIMIT : raise ERegexException.Create('PCRE_ERROR_NULLWSLIMIT'); - PCRE_ERROR_BADNEWLINE : raise ERegexException.Create('PCRE_ERROR_BADNEWLINE'); - else - raise ERegexException.CreateFmt('Unknown PCRE error code %d', [ErrorCode]); - end; -end; - -//=========================================================================== - -function TRegex.GetBackRefMax: Integer; - -var - Value: Integer; - -begin - Value := 0; - PcreCheck(pcre_fullinfo(FRegex, FRegExtra, PCRE_INFO_BACKREFMAX, Value)); - Result := Value; -end; - -//=========================================================================== - -function TRegex.GetCaptureCount: Integer; - -var - Value: Integer; - -begin - Value := 0; - PcreCheck(pcre_fullinfo(FRegex, FRegExtra, PCRE_INFO_CAPTURECOUNT, Value)); - Result := Value; -end; - -//=========================================================================== - -function TRegex.GetCompiledSize: Cardinal; - -var - Value: Cardinal; - -begin - Value := 0; - PcreCheck(pcre_fullinfo(FRegex, FRegExtra, PCRE_INFO_SIZE, Value)); - Result := Value; -end; - -//=========================================================================== - -function TRegex.GetFirstChar: Integer; - -var - Value: Integer; - -begin - Value := 0; - PcreCheck(pcre_fullinfo(FRegex, FRegExtra, PCRE_INFO_FIRSTCHAR, Value)); - Result := Value; -end; - -//=========================================================================== - -function TRegex.GetFirstTable: Pointer; - -var - Value: Pointer; - -begin - Value := nil; - PcreCheck(pcre_fullinfo(FRegex, FRegExtra, PCRE_INFO_FIRSTTABLE, Value)); - Result := Value; -end; - -//=========================================================================== - -function TRegex.GetLastLiteral: Integer; - -var - Value: Integer; - -begin - Value := -1; - PcreCheck(pcre_fullinfo(FRegex, FRegExtra, PCRE_INFO_LASTLITERAL, Value)); - Result := Value; -end; - -//=========================================================================== - -function TRegex.GetLocale: ansistring; - -begin - Result := FLocaleInfo.Locale; -end; - -//=========================================================================== - -function TRegex.GetOptions: TRegCompileOptions; - -var - Value : LongWord; - -begin - Value := 0; - PcreCheck(pcre_fullinfo(FRegex, FRegExtra, PCRE_INFO_OPTIONS, Value)); - Result := DecodeRegCompileOptions(Value); -end; - -//=========================================================================== - -function TRegex.GetPattern: ansistring; - -begin - Result := FPattern; -end; - -//=========================================================================== - -function TRegex.IsMatch(const Input: ansistring): Boolean; - -begin - Result := Match(Input).Success; -end; - -//=========================================================================== - -function TRegex.IsMatch(const Input: ansistring; Start: Integer): Boolean; - -begin - Result := Match(Input, Start).Success; -end; - -//=========================================================================== - -function TRegex.IsMatch(const Input: ansistring; Options: TRegMatchOptions): Boolean; - -begin - Result := Match(Input, Options).Success; -end; - -//=========================================================================== - -function TRegex.IsMatch(const Input: ansistring; Start: Integer; Options: TRegMatchOptions): Boolean; - -begin - Result := Match(Input, Start, Options).Success; -end; - -//=========================================================================== - -function TRegex.Match(const Input: ansistring): IMatch; - -begin - Result := Match(Input, 0, []); -end; - -//=========================================================================== - -function TRegex.Match(const Input: ansistring; Options: TRegMatchOptions): IMatch; - -begin - Result := Match(Input, 0, Options); -end; - -//=========================================================================== - -function TRegex.Match(const Input: ansistring; Start: Integer): IMatch; - -begin - Result := Match(Input, Start, []); -end; - -//=========================================================================== - -function TRegex.Match(const Input: ansistring; Start: Integer; Options: TRegMatchOptions): IMatch; - -var - ErrorCode : Integer; - OVector : TOvector; - -begin - OVector := nil; - - // NOTE: - // - // If you are wondering whether the - // - // (Start <= Length(Input)) - // - // condition should instead be - // - // (Start < Length(Input)) - // - // This is NOT an off-by-one error: we need to be - // able to evaluate an empty string against an empty - // pattern and get a succesful match. - // - // Also note that an empty pattern evaluated against - // a string matches both at the Start - // and PAST the end of the string (and in case you wonder - // an empty pattern need not be '', in fact '\s*' can match - // the empty string as well). - // - if (Start >= 0) and (Start <= Length(Input)) then - begin - SetLength(OVector, (GetCaptureCount + 1) * 3); - - ErrorCode := pcre_exec(FRegex, - FRegExtra, - PAnsiChar(Input), - Length(Input), - Start, - EncodeRegMatchOptions(Options), - @OVector[0], - Length(OVector)); - - if ErrorCode = PCRE_ERROR_NOMATCH then - OVector := nil - else - PcreCheck(ErrorCode); - end; - - Result := TRegexMatch.Create(Input, OVector, FNames) as IMatch; -end; - -//=========================================================================== - -function TRegex.Matches(const Input: ansistring): IMatchCollection; - -begin - Result := Matches(Input, []); -end; - -//=========================================================================== - -function TRegex.Matches(const Input: ansistring; Options: TRegMatchOptions): IMatchCollection; - -var - theCollection: TRegexMatchCollection; - -begin - theCollection := TRegexMatchCollection.Create; - Result := theCollection as IMatchCollection; - Grep(Input, Options, theCollection.Add); -end; - -//=========================================================================== - -function TRegex.Replace(const Input, Replacement: ansistring): ansistring; - -begin - Result := Replace(Input, Replacement, []); -end; - -//=========================================================================== - -function TRegex.Replace(const Input: ansistring; Evaluator: TRegexMatchEvaluator): ansistring; - -begin - Result := Replace(Input, Evaluator, []); -end; - -//=========================================================================== - -function TRegex.Replace(const Input, Replacement : ansistring; - MatchOptions : TRegMatchOptions): ansistring; - -var - theOffset : Integer; - theToken : ansistring; - theMatch : IMatch; - firstPosition : Integer; - lastPosition : Integer; - -begin - Result := ''; - theOffset := 0; - firstPosition := 0; - theMatch := Match(Input, theOffset, MatchOptions); - - while theMatch.Matched do - begin - lastPosition := theMatch.Index; - theToken := System.Copy(Input, firstPosition + 1, lastPosition - firstPosition); - - if Length(theToken) <> 0 then - Result := Result + theToken; - - Result := Result + Substitute(Replacement, theMatch); - - firstPosition := theMatch.Index + theMatch.Length; - theOffset := Max(firstPosition, theMatch.Index + 1); - theMatch := Match(Input, theOffset, MatchOptions); - end; - - theToken := System.Copy(Input, firstPosition + 1, MaxInt); - - if Length(theToken) <> 0 then - Result := Result + theToken; -end; - -//=========================================================================== - -function TRegex.Replace(const Input : ansistring; - Evaluator : TRegexMatchEvaluator; - MatchOptions : TRegMatchOptions): ansistring; - -var - theOffset : Integer; - theToken : ansistring; - theMatch : IMatch; - firstPosition : Integer; - lastPosition : Integer; - -begin - if not Assigned(Evaluator) then - begin - Result := Input; - Exit; - end; - - Result := ''; - theOffset := 0; - firstPosition := 0; - theMatch := Match(Input, theOffset, MatchOptions); - - while theMatch.Matched do - begin - lastPosition := theMatch.Index; - theToken := System.Copy(Input, firstPosition + 1, lastPosition - firstPosition); - - if Length(theToken) <> 0 then - Result := Result + theToken; - - Result := Result + Evaluator(theMatch); - firstPosition := theMatch.Index + theMatch.Length; - theOffset := Max(firstPosition, theMatch.Index + 1); - theMatch := Match(Input, theOffset, MatchOptions); - end; - - theToken := System.Copy(Input, firstPosition + 1, MaxInt); - - if Length(theToken) <> 0 then - Result := Result + theToken; -end; - -//=========================================================================== - -function TRegex.Split(const Input: ansistring): IStringCollection; - -begin - Result := Split(Input, [], []); -end; - -//=========================================================================== - -function TRegex.Split(const Input: ansistring; Options: TRegSplitOptions): IStringCollection; - -begin - Result := Split(Input, Options, []); -end; - -//=========================================================================== - -function TRegex.Split(const Input : ansistring; - Options : TRegSplitOptions; - MatchOptions : TRegMatchOptions): IStringCollection; -var - theCollection : TRegexStringCollection; - theOffset : Integer; - theToken : ansistring; - theMatch : IMatch; - hasGroups : Boolean; - firstPosition : Integer; - lastPosition : Integer; - n : Integer; -begin - theCollection := TRegexStringCollection.Create; - Result := theCollection as IStringCollection; - hasGroups := GetCaptureCount() > 0; - theOffset := 0; - firstPosition := 0; - theMatch := Match(Input, theOffset, MatchOptions); - - while theMatch.Matched do - begin - lastPosition := theMatch.Index; - theToken := System.Copy(Input, firstPosition + 1, lastPosition - firstPosition); - - theCollection.Add(theToken); - - if (rsoIncludeSeparators in Options) then - theCollection.Add(theMatch.Value); - - if hasGroups then - begin - for n := 1 to theMatch.Groups.Count - 1 do - if theMatch.Groups[n].Matched then - theCollection.Add(theMatch.Groups[n].Value); - end; - - firstPosition := theMatch.Index + theMatch.Length; - theOffset := Max(firstPosition, theMatch.Index + 1); - theMatch := Match(Input, theOffset, MatchOptions); - end; - - theToken := System.Copy(Input, firstPosition + 1, MaxInt); - - theCollection.Add(theToken); -end; - -//=========================================================================== - -procedure TRegex.Grep(const Input: ansistring; OnMatch: TRegexMatchEvent); -begin - Grep(Input, [], OnMatch); -end; - -//=========================================================================== - -procedure TRegex.Grep(const Input: ansistring; Options: TRegMatchOptions; OnMatch: TRegexMatchEvent); - -var - theOffset : Integer; - theMatch : IMatch; - -begin - if not Assigned(OnMatch) then - Exit; - - theOffset := 0; - theMatch := Match(Input, theOffset, Options); - - while theMatch.Matched do - begin - OnMatch(theMatch); - theOffset := Max(theMatch.Index + theMatch.Length, theOffset + 1); - theMatch := Match(Input, theOffset, Options); - end; -end; - -//=========================================================================== - -function TRegex.GetNamedGroup(Index: Integer): TNamedGroupInfo; - -begin - Result := FNames.GetMappingAt(Index); -end; - -//=========================================================================== - -function TRegex.GetNamedGroupCount: Integer; - -begin - Result := FNames.GetMappingCount(); -end; - -//=========================================================================== - -function TRegex.DfaMatch(const Input: ansistring; Start: Integer; - Options: TRegMatchOptions): IDfaMatchCollection; - -var - ErrorCode : Integer; - OVector : TOvector; - WVector : TOvector; - VecLen : Integer; - -begin - OVector := nil; - WVector := nil; - - if (Start >= 0) and (Start <= Length(Input)) then - begin - VecLen := Max(10, 2 * (Length(Input) - Start + 1)); - SetLength(OVector, VecLen); - SetLength(WVector, Max(100, Length(OVector))); - - ErrorCode := pcre_dfa_exec(FRegex, - FRegExtra, - PAnsiChar(Input), - Length(Input), - Start, - EncodeRegMatchOptions(Options), - @OVector[0], - Length(OVector), - @WVector[0], - Length(WVector)); - - ASSERT(ErrorCode <> 0); - - if ErrorCode > 0 then - SetLength(OVector, 2 * ErrorCode) - else if ErrorCode = PCRE_ERROR_NOMATCH then - OVector := nil - else - PcreCheck(ErrorCode); - end; - - Result := TDfaMatchCollection.Create(Input, OVector) as IDfaMatchCollection; -end; - -//=========================================================================== - -function TRegex.DfaMatch(const Input: ansistring; - Start: Integer): IDfaMatchCollection; - -begin - Result := DfaMatch(Input, Start, []); -end; - -//=========================================================================== - -function TRegex.DfaMatch(const Input: ansistring; - Options: TRegMatchOptions): IDfaMatchCollection; - -begin - Result := DfaMatch(Input, 0, Options); -end; - -//=========================================================================== - -function TRegex.DfaMatch(const Input: ansistring): IDfaMatchCollection; - -begin - Result := DfaMatch(Input, 0, []); -end; - -//=========================================================================== - -{ TNameIndexLookup } - -constructor TNameIndexLookup.Create; - -begin - inherited Create(); - FMappings := TAnsiStringList.Create(); - - FMappings.Sorted := true; - FMappings.CaseSensitive := true; - FMappings.Duplicates := dupError; -end; - -//=========================================================================== - -destructor TNameIndexLookup.Destroy; - -begin - FMappings.Free; - inherited Destroy; -end; - -//=========================================================================== - -procedure TNameIndexLookup.AddMapping(const theName: ansistring; theIndex: Integer); - -begin - FMappings.AddObject(theName, Pointer(theIndex)); -end; - -//=========================================================================== - -function TNameIndexLookup.GetGroupIndex(const theName: ansistring): Integer; - -var - theIndex : Integer; - -begin - if not FMappings.Find(theName, theIndex) then - raise ERegexBadGroupName.CreateFmt('Invalid group name ''%s''', [theName]); - - Result := Integer(FMappings.Objects[theIndex]); -end; - -//=========================================================================== - -function TNameIndexLookup.GetMappingAt(theIndex: Integer): TNamedGroupInfo; - -begin - Result.Name := FMappings[theIndex]; - Result.Index := Integer(FMappings.Objects[theIndex]); -end; - -//=========================================================================== - -function TNameIndexLookup.GetMappingCount: Integer; - -begin - Result := FMappings.Count; -end; - -//=========================================================================== - -{ TDfaMatch } - -constructor TDfaMatch.Create( - MatchCollection: TDfaMatchCollection; - Index: Integer); - -begin - inherited Create(); - FMatchCollection := MatchCollection; - FIndex := Index; -end; - -//=========================================================================== - -destructor TDfaMatch.Destroy; - -begin - inherited; -end; - -//=========================================================================== - -function TDfaMatch.GetIndex: Integer; - -begin - Result := FMatchCollection.InternalGetIndex(FIndex); -end; - -//=========================================================================== - -function TDfaMatch.GetValue: ansistring; - -begin - Result := FMatchCollection.InternalGetValue(FIndex); -end; - -//=========================================================================== - -function TDfaMatch.GetLength: Integer; - -begin - Result := FMatchCollection.InternalGetLength(FIndex); -end; - -//=========================================================================== - -{ TDfaMatchCollection } - -constructor TDfaMatchCollection.Create(const S: ansistring; var VOffset: TOVector); - -begin - inherited Create(); - - FSubject := S; - FMatches := VOffset; - - if Assigned(FMatches) then - FCount := Length(FMatches) div 2; - - ASSERT(((FCount <> 0) and (FMatches <> nil)) or ((FCount = 0) and (FMatches = nil))); - ASSERT((FMatches = nil) or (Length(FMatches) mod 2 = 0)); -end; - -//=========================================================================== - -destructor TDfaMatchCollection.Destroy; - -begin - FMatches := nil; - inherited; -end; - -//=========================================================================== - -function TDfaMatchCollection.GetCount: Integer; - -begin - Result := FCount; -end; - -//=========================================================================== - -function TDfaMatchCollection.InternalGetIndex(Index: Integer): Integer; - -var - MatchPos : TMatchPos; - -begin - MatchPos := InternalGetMatchPos(Index); - Result := MatchPos.First; -end; - -//=========================================================================== - -function TDfaMatchCollection.InternalGetValue(Index: Integer): ansistring; - -var - MatchPos: TMatchPos; - -begin - Result := ''; - - MatchPos := InternalGetMatchPos(Index); - - if MatchPos.First <> INVALID_INDEX_VALUE then - begin - Result := System.Copy(FSubject, - MatchPos.First + 1, - MatchPos.Last - MatchPos.First); - end; -end; - -//=========================================================================== - -function TDfaMatchCollection.GetItem(Index: Integer): IDfaMatch; - -begin - Result := TDfaMatch.Create(Self, Index) as IDfaMatch; -end; - -//=========================================================================== - -function TDfaMatchCollection.InternalGetLength(Index: Integer): Integer; - -var - MatchPos : TMatchPos; - -begin - MatchPos := InternalGetMatchPos(Index); - Result := MatchPos.Last - MatchPos.First; -end; - -//=========================================================================== - -function TDfaMatchCollection.InternalGetMatchPos(Index: Integer): TMatchPos; - -begin - // assume failure - Result.First := INVALID_INDEX_VALUE; - Result.Last := INVALID_INDEX_VALUE; - - // if no matches return - if (FCount = 0) or (FMatches[0] = INVALID_INDEX_VALUE) then - Exit; - - if (Index >= 0) and (Index < FCount) then - begin - // take values from OVector - Result.First := FMatches[Index * 2]; - Result.Last := FMatches[Index * 2 + 1]; - end - else if Index = CAPTURE_GROUP_BEFORE_START then - begin - // return index from the Start of the string to - // the Start of the match - Result.First := 0; - Result.Last := FMatches[0]; - end - else if Index = CAPTURE_GROUP_AFTER_END then - begin - // return everything from the end of the match - // until the end of the subject string - Result.First := FMatches[1]; - Result.Last := Length(FSubject); - end; -end; - -//=========================================================================== - -initialization - LocaleLock := TCriticalSection.Create(); - RegexSubstitute := TRegex.Create('\$(\d+|\$|&|`|''''|\+|_|{([^}]*)})', [], 'C'); - -finalization - RegexSubstitute.Free(); - LocaleLock.Free(); -end. - diff --git a/Keyboard and Spell checker/Units/Phonetic_RegExp_Constants.pas b/Keyboard and Spell checker/Units/Phonetic_RegExp_Constants.pas index 08e31d6..7f205b3 100644 --- a/Keyboard and Spell checker/Units/Phonetic_RegExp_Constants.pas +++ b/Keyboard and Spell checker/Units/Phonetic_RegExp_Constants.pas @@ -1,25 +1,25 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= @@ -27,181 +27,36 @@ Unit Phonetic_RegExp_Constants; -{.$DEFINE FASTSEARCH_OFF} //Uncomment to turn OFF fast searching +{ .$DEFINE FASTSEARCH_OFF } // Uncomment to turn OFF fast searching Interface + Uses - BanglaChars; + BanglaChars; Var - r_A, - r_B, - r_C, - r_D, - r_E, - r_F, - r_G, - r_H, - r_I, - r_J, - r_K, - r_L, - r_M, - r_N, - r_O, - r_OFirst, - r_P, - r_Q, - r_R, - r_S, - r_T, - r_U, - r_V, - r_W, - r_X, - r_Y, - r_Z : String; - - r_AI, - r_AU, - r_AA, - r_AZ, - r_BH, - r_BB, - r_BD, - r_BV, - r_CH, - r_CK, - r_CC, - r_CN, - r_DB, - r_DD, - r_DG, - r_DH, - r_EY, - r_EE, - r_FF, - r_GH, - r_GG, - r_HL, - r_HH, - r_HM, - r_HN, - r_IA, - r_JJ, - r_JH, - r_KH, - r_KK, - r_KS, - r_KX, - r_LL, - r_LK, - r_LG, - r_LP, - r_LD, - r_LB, - r_MM, - r_MB, - r_MP, - r_MT, - r_NC, - r_NN, - r_NG, - r_NK, - r_NJ, - r_ND, - r_NT, - r_OO, - r_OI, - r_OU, - r_PH, - r_PP, - r_QQ, - r_RI, - r_RH, - r_SS, - r_SH, - r_TT, - r_TH, - r_UU, - r_VV, - r_XM, - r_XN, - r_ZH, - r_ZZ : String; - - r_BBH, - r_BDH, - r_BHL, - r_CCH, - r_CHH, - r_CNG, - r_DHM, - r_DHN, - r_DBH, - r_DDH, - r_DGH, - r_GDH, - r_GGH, - r_GHN, - r_JNG, - r_JJH, - r_KSH, - r_KKH, - r_KXM, - r_KXN, - r_LKH, - r_LGH, - r_LPH, - r_LDH, - r_LBH, - r_MBH, - r_MPH, - r_MTH, - r_NSH, - r_NDH, - r_NKH, - r_NTH, - r_NGJ, - r_NGM, - r_NGG, - r_NGX, - r_NGK, - r_NGH, - r_NCH, - r_NJH, - r_NGC, - r_PHL, - r_RRI, - r_SSH, - r_SHM, - r_SHN, - r_T_Acnt_Acnt, - r_TTH, - r_ZZH : String; + r_A, r_B, r_C, r_D, r_E, r_F, r_G, r_H, r_I, r_J, r_K, r_L, r_M, r_N, r_O, + r_OFirst, r_P, r_Q, r_R, r_S, r_T, r_U, r_V, r_W, r_X, r_Y, r_Z: String; - r_KSHM, - r_KKHM, - r_KSHN, - r_KKHN, - r_NGKH, - r_NGCH, - r_NGGH, - r_NGKX, - r_NGJH, - r_SHSH, - r_THTH : String; + r_AI, r_AU, r_AA, r_AZ, r_BH, r_BB, r_BD, r_BV, r_CH, r_CK, r_CC, r_CN, r_DB, + r_DD, r_DG, r_DH, r_EY, r_EE, r_FF, r_GH, r_GG, r_HL, r_HH, r_HM, r_HN, + r_IA, r_JJ, r_JH, r_KH, r_KK, r_KS, r_KX, r_LL, r_LK, r_LG, r_LP, r_LD, + r_LB, r_MM, r_MB, r_MP, r_MT, r_NC, r_NN, r_NG, r_NK, r_NJ, r_ND, r_NT, + r_OO, r_OI, r_OU, r_PH, r_PP, r_QQ, r_RI, r_RH, r_SS, r_SH, r_TT, r_TH, + r_UU, r_VV, r_XM, r_XN, r_ZH, r_ZZ: String; + r_BBH, r_BDH, r_BHL, r_CCH, r_CHH, r_CNG, r_DHM, r_DHN, r_DBH, r_DDH, r_DGH, + r_GDH, r_GGH, r_GHN, r_JNG, r_JJH, r_KSH, r_KKH, r_KXM, r_KXN, r_LKH, r_LGH, + r_LPH, r_LDH, r_LBH, r_MBH, r_MPH, r_MTH, r_NSH, r_NDH, r_NKH, r_NTH, r_NGJ, + r_NGM, r_NGG, r_NGX, r_NGK, r_NGH, r_NCH, r_NJH, r_NGC, r_PHL, r_RRI, r_SSH, + r_SHM, r_SHN, r_T_Acnt_Acnt, r_TTH, r_ZZH: String; - r_CHCHH, - r_NGKSH, - r_NGKKH : String; + r_KSHM, r_KKHM, r_KSHN, r_KKHN, r_NGKH, r_NGCH, r_NGGH, r_NGKX, r_NGJH, + r_SHSH, r_THTH: String; + r_CHCHH, r_NGKSH, r_NGKKH: String; - r_InjectFola, - r_InjectHasanta, - r_InjectChandraBisharga: String; - + r_InjectFola, r_InjectHasanta, r_InjectChandraBisharga: String; Procedure Initialize_RVals; @@ -210,290 +65,466 @@ Procedure Initialize_RVals; Begin - r_InjectFola := '(' + b_Hasanta + '[' + b_Z + b_B + b_M + '])?'; - r_InjectHasanta := '(' + b_Hasanta + '?)'; - r_InjectChandraBisharga := '([' + b_Bisharga + b_Chandra + ']?)'; - - {Single characters} - {FastSearch OFF} - {$IFDEF FASTSEARCH_OFF} - r_A := '(([' + b_A + b_E + ']' + b_Hasanta + b_Z + b_AAkar + '?)|([' + b_AA + b_E + '])|([' + ZWJ + ZWNJ + ']?(' + b_Hasanta + b_Z + ')?' + b_AAkar + ')|(' + b_Y + b_AAkar + '))'; - r_B := '(' + b_B + '|(' + b_B + b_Ikar + '))'; - r_C := '(([' + b_C + b_CH + '])|(' + b_S + b_Ikar + '))'; - r_D := '(([' + b_D + b_Dd + '])|(' + b_Dd + b_Ikar + '))'; - r_E := '((' + b_E + b_Hasanta + b_Z + b_AAkar + '?)|([' + b_E + b_Ekar + '])|([' + ZWJ + ZWNJ + ']?(' + b_Hasanta + b_Z + ')' + b_AAkar + ')|(' + b_Y + b_Ekar + '))'; - r_F := '(' + b_Ph + '|(' + b_E + b_Ph + '))'; - r_G := '(' + b_G + '|(' + b_J + b_Ikar + ')|(' + b_J + b_Hasanta + b_NYA + '))'; - r_H := '(' + b_H + '|(' + b_E + b_I + b_C + ')|' + b_Bisharga + '|(' + b_H + b_Hasanta + ZWNJ + '?))'; - r_I := '(([' + b_I + b_II + b_Ikar + b_IIkar + '])|(' + b_Y + '[' + b_Ikar + b_IIkar + ']))'; - r_J := '(([' + b_J + b_Z + '])|(' + b_J + b_Ekar + ')|(' + b_J + b_Nukta + '))'; - r_K := '(' + b_K + '|(' + b_K + b_Ekar + '))'; - r_L := '(' + b_L + '|(' + b_E + b_L + '))'; - r_M := '(' + b_M + '|(' + b_E + b_M + '))'; - r_N := '(([' + b_N + b_Nn + b_Chandra + b_NGA + b_NYA + b_Anushar + '])|(' + b_E + b_N + '))'; - r_O := '(([' + b_O + b_Okar + b_A + '])|(' + b_A + b_Hasanta + b_Z + ')|(' + b_Y + b_Okar + '?))?'; - r_OFirst := '(([' + b_O + b_Okar + b_A + '])|(' + b_A + b_Hasanta + b_Z + ')|(' + b_Y + b_Okar + '?))'; - r_P := '(' + b_P + '|(' + b_P + b_Ikar + '))'; - r_Q := '((' + b_K + ')|(' + b_K + b_Ikar + b_U + '))'; - r_R := '(([' + b_R + b_Rr + b_Rrh + '])|(' + b_AA + b_R + ')|(' + b_H + b_Hasanta + b_R + '))'; - r_S := '(([' + b_S + b_Sh + b_Ss + '])|(' + b_E + b_S + '))'; - r_T := '(([' + b_T + b_Tt + b_Khandatta + '])|(' + b_Tt + b_Ikar + '))'; - r_U := '(([' + b_U + b_UU + b_Ukar + b_UUkar + '])|(' + b_I + b_U + ')|(' + b_Y + '[' + b_Ukar + b_UUkar + ']))'; - r_V := '(' + b_Bh + '|(' + b_Bh + b_Ikar + '))'; - r_W := '(' + b_O + '|(' + b_O + b_Y + ')|(' + b_Hasanta + b_B + ')|(' + b_Dd + b_B + b_Hasanta + b_L + b_Ikar + b_U + '))'; - r_X := '((' + b_K + b_Hasanta + b_S + ')|(' + b_E + b_K + b_Hasanta + b_S + ')|' + b_Ss + ')'; - r_Y := '(' + b_Y + '|(' + b_I + b_Y + ')|(' + b_O + b_Y + b_AAkar + b_I + ')|([' + ZWJ + ZWNJ + ']?' + b_Hasanta + b_Z + '))'; - r_Z := '(' + b_J + '|' + b_Z + '|(' + b_J + b_Nukta + ')|(' + b_J + b_Ekar + b_Dd + ')|([' + ZWJ + ZWNJ + ']?' + b_Hasanta + b_Z + '))'; - {$ELSE} - {FastSearch On} - r_A := '(([' + b_A + b_E + ']' + b_Hasanta + b_Z + b_AAkar + '?)|([' + b_AA + b_E + '])|([' + ZWJ + ZWNJ + ']?(' + b_Hasanta + b_Z + ')?' + b_AAkar + ')|(' + b_Y + b_AAkar + '))'; - r_B := '(' + b_B + ')'; - r_C := '([' + b_C + b_CH + '])'; - r_D := '([' + b_D + b_Dd + '])'; - r_E := '((' + b_E + b_Hasanta + b_Z + b_AAkar + '?)|([' + b_E + b_Ekar + '])|([' + ZWJ + ZWNJ + ']?(' + b_Hasanta + b_Z + ')' + b_AAkar + ')|(' + b_Y + b_Ekar + '))'; - r_F := '(' + b_Ph + ')'; - r_G := '(' + b_G + '|(' + b_J + b_Hasanta + b_NYA + '))'; - r_H := '(' + b_H + '|' + b_Bisharga + '|(' + b_H + b_Hasanta + ZWNJ + '?))'; - r_I := '(([' + b_I + b_II + b_Ikar + b_IIkar + '])|(' + b_Y + '[' + b_Ikar + b_IIkar + ']))'; - r_J := '(([' + b_J + b_Z + '])|(' + b_J + b_Nukta + '))'; - r_K := '(' + b_K + ')'; - r_L := '(' + b_L + ')'; - r_M := '(' + b_M + ')'; - r_N := '([' + b_N + b_Nn + b_Chandra + b_NGA + b_NYA + b_Anushar + '])'; - r_O := '(([' + b_O + b_Okar + b_A + '])|(' + b_A + b_Hasanta + b_Z + ')|(' + b_Y + b_Okar + '?))?'; - r_OFirst := '(([' + b_O + b_Okar + b_A + '])|(' + b_A + b_Hasanta + b_Z + ')|(' + b_Y + b_Okar + '?))'; - r_P := '(' + b_P + ')'; - r_Q := '(' + b_K + ')'; - r_R := '(([' + b_R + b_Rr + b_Rrh + '])|(' + b_H + b_Hasanta + b_R + '))'; - r_S := '([' + b_S + b_Sh + b_Ss + '])'; - r_T := '([' + b_T + b_Tt + b_Khandatta + '])'; - r_U := '(([' + b_U + b_UU + b_Ukar + b_UUkar + '])|(' + b_Y + '[' + b_Ukar + b_UUkar + ']))'; - r_V := '(' + b_Bh + ')'; - r_W := '(' + b_O + '|(' + b_O + b_Y + ')|(' + b_Hasanta + b_B + '))'; - r_X := '((' + b_K + b_Hasanta + b_S + ')|' + b_Ss + ')'; - r_Y := '(' + b_Y + '|(' + b_I + b_Y + ')|([' + ZWJ + ZWNJ + ']?' + b_Hasanta + b_Z + '))'; - r_Z := '(' + b_J + '|' + b_Z + '|(' + b_J + b_Nukta + ')|([' + ZWJ + ZWNJ + ']?' + b_Hasanta + b_Z + '))'; - {$ENDIF} - - {Two character combinations} - //A - r_AI := '(' + b_OI + '|' + b_OIkar + '|' + r_A + r_I + ')'; - r_AU := '(' + b_OU + '|' + b_OUkar + r_A + r_U + ')'; - r_AZ:= '('+ r_A + '('+r_Z+')?)'; - r_AA := '((' + b_AA + ')|(' + b_Y + b_AAkar + ')|(' + b_AAkar + ')|(' + r_a + '(' + r_a + ')?))'; - //B - r_BH := '((' + b_Bh + ')|(' + r_b + '(' + b_Hasanta + '?)' + r_h + '))'; - r_BB := '(' + r_b + '(' + b_Hasanta + '?)(' + r_b + ')?)'; - r_BV := '((' + r_b + ')?(' + b_Hasanta + '?)' + r_v + ')'; - r_BD := '(' + r_b + '(' + b_Hasanta + '?)' + r_d + ')'; - //C - r_CH := '((' + b_C + ')|(' + b_CH + ')|(' + r_c + '(' + b_Hasanta + '?)' + r_h + '))'; - r_CK := '((' + b_K + ')|(' + r_c + '(' + b_Hasanta + '?)' + r_k + '))'; - r_CC := '(' + r_c + '(' + b_Hasanta + '?)(' + r_c + ')?)'; - r_CN := '(' + r_c + '(' + b_Hasanta + '?)' + r_n + ')'; - //D - r_DB := '(' + r_d + '(' + b_Hasanta + '?)' + r_b + ')'; - r_DD := '(' + r_d + '(' + b_Hasanta + '?)(' + r_d + ')?)'; - r_DG := '(' + r_d + '(' + b_Hasanta + '?)' + r_g + ')'; - r_DH := '((' + b_Dh + ')|(' + b_Ddh + ')|(' + r_d + '(' + b_Hasanta + '?)' + r_h + '))'; - //E - r_EY := '((' + b_E + ')|(' + b_I + ')|(' + b_Ekar + ')|(' + b_Ekar + b_I + ')|(' + b_E + b_I + ')|(' + b_II + ')|(' + b_IIkar + ')|(' + r_e + r_y + '))'; - r_EE := '((' + b_I + ')|(' + b_II + ')|(' + b_Ikar + ')|(' + b_IIkar + ')|(' + b_Y + b_Ekar + b_I + ')|(' + r_e + r_e + '))'; - //F - r_FF := '(' + r_f + '(' + b_Hasanta + '?)(' + r_f + ')?)'; - //G - r_GH := '((' + b_GH + ')|(' + r_g + '(' + b_Hasanta + '?)' + r_h + '))'; - r_GG := '((' + b_J + b_Hasanta + b_NYA + ')|(' + r_g + '(' + b_Hasanta + '?)(' + r_g + ')?))'; - //H - r_HL := '(' + r_h + '(' + b_Hasanta + '?)' + r_l + ')'; - r_HH := '(' + r_h + '(' + b_Hasanta + '?)' + r_h + ')'; - r_HM := '(' + r_h + '(' + b_Hasanta + '?)' + r_m + ')'; - r_HN := '(' + r_h + '(' + b_Hasanta + '?)' + r_n + ')'; - //I - r_IA := '((' + b_NYA + b_AAkar + ')|(' + r_i + r_a + '))'; - //J - r_JJ := '((' + b_H + b_Hasanta + b_Z + ')|(' + r_j + '(' + b_Hasanta + '?)(' + r_j + ')?))'; - r_JH := '((' + b_JH + ')|(' + r_j + '(' + b_Hasanta + '?)' + r_h + '))'; - //K - r_KH := '((' + b_KH + ')|(' + b_K + b_Hasanta + b_Ss + ')|(' + r_k + '(' + b_Hasanta + '?)' + r_h + '))'; - r_KK := '(' + r_k + '(' + b_Hasanta + '?)(' + r_k + ')?)'; - r_KS := '(' + r_k + '(' + b_Hasanta + '?)' + r_s + ')'; - r_KX := '((' + b_K + b_Hasanta + b_Ss + ')|(' + r_k + '(' + b_Hasanta + '?)' + r_x + '))'; - //L - r_LL := '((' + b_H + b_Hasanta + b_L + ')|((' + r_l + ')?(' + b_Hasanta + '?)' + r_l + ')|(' + r_l + '(' + b_Hasanta + '?)' + r_l + '))'; - r_LK := '(' + r_l + '(' + b_Hasanta + '?)' + r_k + ')'; - r_LG := '(' + r_l + '(' + b_Hasanta + '?)' + r_g + ')'; - r_LP := '(' + r_l + '(' + b_Hasanta + '?)' + r_p + ')'; - r_LD := '(' + r_l + '(' + b_Hasanta + '?)' + r_d + ')'; - r_LB := '(' + r_l + '(' + b_Hasanta + '?)' + r_b + ')'; - //M - r_MM := '((' + b_H + b_Hasanta + b_M + ')|(' + r_m + '(' + b_Hasanta + '?)(' + r_m + ')?))'; - r_MB := '(' + r_m + '(' + b_Hasanta + '?)' + r_b + ')'; - r_MP := '(' + r_m + '(' + b_Hasanta + '?)' + r_p + ')'; - r_MT := '(' + r_m + '(' + b_Hasanta + '?)' + r_t + ')'; - //N - r_NC := '((' + b_NYA + b_Hasanta + b_C + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_c + '))'; - r_NN := '((' + b_H + b_Hasanta + b_Nn + ')|(' + b_H + b_Hasanta + b_N + ')|(' + r_n + '(' + b_Hasanta + '?)(' + r_n + ')?))'; - r_NG := '((' + b_NGA + ')|(' + b_Anushar + ')|(' + b_NYA + ')|(' + b_NGA + b_Hasanta + b_G + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_g + '))'; - r_NK := '((' + b_NGA + b_Hasanta + b_K + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_k + '))'; - r_NJ := '((' + b_NYA + b_Hasanta + b_J + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_j + '))'; - r_ND := '(' + r_n + '(' + b_Hasanta + '?)' + r_d + ')'; - r_NT := '(' + r_n + '(' + b_Hasanta + '?)' + r_t + ')'; - //O - r_OO := '((' + r_u + ')|(' + r_o + r_o + '))'; - r_OI := '((' + b_OI + ')|(' + b_OIkar + ')|(' + r_o + r_i + '))'; - r_OU := '((' + b_OU + ')|(' + b_OUkar + ')|(' + r_o + r_u + '))'; - //P - r_PH := '((' + b_Ph + ')|(' + r_p + '(' + b_Hasanta + '?)' + r_h + '))'; - r_PP := '(' + r_p + '(' + b_Hasanta + '?)(' + r_p + ')?)'; - //Q - r_QQ := '(' + r_q + '(' + b_Hasanta + '?)(' + r_q + ')?)'; - //R - r_RI := '((' + b_RRI + ')|(' + b_RRIkar + ')|(' + b_H + b_RRIkar + ')|(' + r_r + r_i + '))'; - r_RH := '((' + r_r + ')|(' + r_r + '(' + b_Hasanta + '?)' + r_h + '))'; - //S - r_SS := '(' + r_s + '(' + b_Hasanta + '?)(' + r_s + ')?)'; - r_SH := '((' + b_S + ')|(' + b_Sh + ')|(' + b_Ss + ')|(' + r_s + '(' + b_Hasanta + '?)' + r_h + '))'; - //T - r_TT := '(' + r_t + '(' + b_Hasanta + '?)(' + r_t + ')?)'; - r_TH := '((' + b_Th + ')|(' + b_Tth + ')|(' + r_t + '(' + b_Hasanta + '?)' + r_h + '))'; - //U - r_UU := '((' + b_UU + ')|(' + b_UUkar + ')|(' + r_u + '(' + r_u + ')?))'; - //V - r_VV := '(' + r_v + '(' + b_Hasanta + '?)(' + r_v + ')?)'; - //W - //X - r_XM := '(' + r_x + '(' + b_Hasanta + '?)' + r_m + ')'; - r_XN := '(' + r_x + '(' + b_Hasanta + '?)' + r_n + ')'; - //Y - //Z - r_ZH := '((' + b_JH + ')|(' + r_j + '(' + b_Hasanta + '?)' + r_h + '))'; - r_ZZ := '((' + b_H + b_Hasanta + b_Z + ')|(' + r_z + '(' + b_Hasanta + '?)(' + r_z + ')?))'; - - - {Three character combinations} - //A - //B - r_BBH := '(((' + r_b + ')?(' + b_Hasanta + '?)' + r_bh + ')|(' + r_bb + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_b + '(' + b_Hasanta + '?)' + r_b + '(' + b_Hasanta + '?)' + r_h + '))'; - r_BDH := '((' + r_b + '(' + b_Hasanta + '?)' + r_dh + ')|(' + r_bd + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_b + '(' + b_Hasanta + '?)' + r_d + '(' + b_Hasanta + '?)' + r_h + '))'; - r_BHL := '((' + r_bh + '(' + b_Hasanta + '?)' + r_l + ')|(' + r_b + '(' + b_Hasanta + '?)' + r_hl + ')|(' + r_b + '(' + b_Hasanta + '?)' + r_h + '(' + b_Hasanta + '?)' + r_l + '))'; - //C - r_CCH := '((' + r_c + '(' + b_Hasanta + '?)' + r_ch + ')|(' + r_c + '(' + b_Hasanta + '?)' + r_c + '(' + b_Hasanta + '?)' + r_h + '))'; - r_CHH := '((' + r_ch + '(' + b_Hasanta + '?)' + '(' + r_h + ')?' + ')|(' + r_c + '(' + b_Hasanta + '?)' + r_hh + ')|(' + r_c + '(' + b_Hasanta + '?)' + r_h + '(' + b_Hasanta + '?)' + r_h + '))'; - r_CNG := '((' + b_C + b_Hasanta + b_NYA + ')|(' + r_c + '(' + b_Hasanta + '?)' + r_ng + ')|(' + r_c + '(' + b_Hasanta + '?)' + r_n + '(' + b_Hasanta + '?)' + r_g + ')|(' + r_cn + '(' + b_Hasanta + '?)' + r_g + '))'; - //D - r_DHM := '((' + r_dh + '(' + b_Hasanta + '?)' + r_m + ')|(' + r_d + '(' + b_Hasanta + '?)' + r_hm + ')|(' + r_d + '(' + b_Hasanta + '?)' + r_h + '(' + b_Hasanta + '?)' + r_m + '))'; - r_DHN := '((' + r_dh + '(' + b_Hasanta + '?)' + r_n + ')|(' + r_d + '(' + b_Hasanta + '?)' + r_hn + ')|(' + r_d + '(' + b_Hasanta + '?)' + r_h + '(' + b_Hasanta + '?)' + r_n + '))'; - r_DBH := '((' + r_d + '(' + b_Hasanta + '?)' + r_bh + ')|(' + r_db + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_d + '(' + b_Hasanta + '?)' + r_b + '(' + b_Hasanta + '?)' + r_h + '))'; - r_DDH := '(((' + r_d + ')?(' + b_Hasanta + '?)' + r_dh + ')|(' + r_dd + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_d + '(' + b_Hasanta + '?)' + r_d + '(' + b_Hasanta + '?)' + r_h + '))'; - r_DGH := '((' + r_d + '(' + b_Hasanta + '?)' + r_gh + ')|(' + r_dg + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_d + '(' + b_Hasanta + '?)' + r_g + '(' + b_Hasanta + '?)' + r_h + '))'; - //E - //F - //G - r_GDH := '((' + r_g + '(' + b_Hasanta + '?)' + r_dh + ')|(' + r_g + '(' + b_Hasanta + '?)' + r_d + '(' + b_Hasanta + '?)' + r_h + '))'; - r_GGH := '((' + r_gg + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_g + '(' + b_Hasanta + '?)' + r_gh + ')|(' + r_g + '(' + b_Hasanta + '?)' + r_g + '(' + b_Hasanta + '?)' + r_h + '))'; - r_GHN := '((' + r_gh + '(' + b_Hasanta + '?)' + r_n + ')|(' + r_g + '(' + b_Hasanta + '?)' + r_hn + ')|(' + r_g + '(' + b_Hasanta + '?)' + r_h + '(' + b_Hasanta + '?)' + r_n + '))'; - //H - //I - //J - r_JNG := '((' + b_J + b_Hasanta + b_NYA + ')|(' + r_j + '(' + b_Hasanta + '?)' + r_ng + ')|(' + r_j + '(' + b_Hasanta + '?)' + r_n + '(' + b_Hasanta + '?)' + r_g + '))'; - r_JJH := '(((' + r_j + ')?(' + b_Hasanta + '?)' + r_jh + ')|(' + b_H + b_Hasanta + b_Z + ')|(' + r_jj + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_j + '(' + b_Hasanta + '?)' + r_j + '(' + b_Hasanta + '?)' + r_h + '))'; - //K - r_KSH := '((' + r_k + '(' + b_Hasanta + '?)' + r_sh + ')|(' + r_ks + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_k + '(' + b_Hasanta + '?)' + r_s + '(' + b_Hasanta + '?)' + r_h + '))'; - r_KKH := '((' + b_K + b_Hasanta + b_Ss + ')|(' + r_kk + '(' + b_Hasanta + '?)' + r_h + ')|((' + r_k + ')?(' + b_Hasanta + '?)' + r_kh + ')|(' + r_k + '(' + b_Hasanta + '?)' + r_k + '(' + b_Hasanta + '?)' + r_h + '))'; - r_KXM := '((' + r_kx + '(' + b_Hasanta + '?)' + r_m + ')|(' + r_k + '(' + b_Hasanta + '?)' + r_xm + ')|(' + r_k + '(' + b_Hasanta + '?)' + r_x + '(' + b_Hasanta + '?)' + r_m + '))'; - r_KXN := '((' + r_kx + '(' + b_Hasanta + '?)' + r_n + ')|(' + r_k + '(' + b_Hasanta + '?)' + r_xn + ')|(' + r_k + '(' + b_Hasanta + '?)' + r_x + '(' + b_Hasanta + '?)' + r_n + '))'; - //L - r_LKH := '((' + r_l + '(' + b_Hasanta + '?)' + r_kh + ')|(' + r_lk + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_l + '(' + b_Hasanta + '?)' + r_k + '(' + b_Hasanta + '?)' + r_h + '))'; - r_LGH := '((' + r_l + '(' + b_Hasanta + '?)' + r_gh + ')|(' + r_lg + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_l + '(' + b_Hasanta + '?)' + r_g + '(' + b_Hasanta + '?)' + r_h + '))'; - r_LPH := '((' + r_l + '(' + b_Hasanta + '?)' + r_ph + ')|(' + r_lp + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_l + '(' + b_Hasanta + '?)' + r_p + '(' + b_Hasanta + '?)' + r_h + '))'; - r_LDH := '((' + r_l + '(' + b_Hasanta + '?)' + r_dh + ')|(' + r_ld + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_l + '(' + b_Hasanta + '?)' + r_d + '(' + b_Hasanta + '?)' + r_h + '))'; - r_LBH := '((' + r_l + '(' + b_Hasanta + '?)' + r_bh + ')|(' + r_lb + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_l + '(' + b_Hasanta + '?)' + r_b + '(' + b_Hasanta + '?)' + r_h + '))'; - //M - r_MBH := '((' + r_m + '(' + b_Hasanta + '?)' + r_bh + ')|(' + r_mb + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_m + '(' + b_Hasanta + '?)' + r_b + '(' + b_Hasanta + '?)' + r_h + '))'; - r_MPH := '((' + r_m + '(' + b_Hasanta + '?)' + r_ph + ')|(' + r_mp + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_m + '(' + b_Hasanta + '?)' + r_p + '(' + b_Hasanta + '?)' + r_h + '))'; - r_MTH := '((' + r_m + '(' + b_Hasanta + '?)' + r_th + ')|(' + r_mt + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_m + '(' + b_Hasanta + '?)' + r_t + '(' + b_Hasanta + '?)' + r_h + '))'; - //N - r_NSH := '((' + r_n + '(' + b_Hasanta + '?)' + r_sh + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_s + '(' + b_Hasanta + '?)' + r_h + '))'; - r_NDH := '((' + r_n + '(' + b_Hasanta + '?)' + r_dh + ')|(' + r_nd + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_d + '(' + b_Hasanta + '?)' + r_h + '))'; - r_NKH := '((' + r_n + '(' + b_Hasanta + '?)' + r_kh + ')|(' + r_nk + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_k + '(' + b_Hasanta + '?)' + r_h + '))'; - r_NTH := '((' + r_n + '(' + b_Hasanta + '?)' + r_th + ')|(' + r_nt + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_t + '(' + b_Hasanta + '?)' + r_h + '))'; - r_NGJ := '((' + r_ng + '(' + b_Hasanta + '?)' + r_j + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_g + '(' + b_Hasanta + '?)' + r_j + '))'; - r_NGM := '((' + r_ng + '(' + b_Hasanta + '?)' + r_m + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_g + '(' + b_Hasanta + '?)' + r_m + '))'; - r_NGG := '((' + b_NGA + b_Hasanta + b_G + ')|(' + r_ng + '(' + b_Hasanta + '?)' + r_g + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_g + '(' + b_Hasanta + '?)' + r_g + '))'; - r_NGX := '((' + r_ng + '(' + b_Hasanta + '?)' + r_x + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_g + '(' + b_Hasanta + '?)' + r_x + '))'; - r_NGK := '((' + r_ng + '(' + b_Hasanta + '?)' + r_k + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_g + '(' + b_Hasanta + '?)' + r_k + '))'; - r_NGH := '((' + b_NGA + b_Hasanta + b_GH + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_gh + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_g + '(' + b_Hasanta + '?)' + r_h + '))'; - r_NCH := '((' + r_n + '(' + b_Hasanta + '?)' + r_ch + ')|(' + r_nc + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_c + '(' + b_Hasanta + '?)' + r_h + '))'; - r_NJH := '((' + r_n + '(' + b_Hasanta + '?)' + r_jh + ')|(' + r_nj + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_j + '(' + b_Hasanta + '?)' + r_h + '))'; - r_NGC := '((' + r_ng + '(' + b_Hasanta + '?)' + r_c + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_g + '(' + b_Hasanta + '?)' + r_c + '))'; - //O - //P - r_PHL := '((' + r_ph + '(' + b_Hasanta + '?)' + r_l + ')|(' + r_p + '(' + b_Hasanta + '?)' + r_hl + ')|(' + r_p + '(' + b_Hasanta + '?)' + r_h + '(' + b_Hasanta + '?)' + r_l + '))'; - //Q - //R - r_RRI := '((' + b_RRI + ')|(' + b_RRIkar + ')|(' + r_r + r_r + r_i + '))'; - //S - r_SSH := '(((' + r_s + ')?(' + b_Hasanta + '?)' + r_sh + ')|(' + r_s + '(' + b_Hasanta + '?)' + r_s + '(' + b_Hasanta + '?)' + r_h + '))'; - r_SHM := '((' + r_sh + '(' + b_Hasanta + '?)' + r_m + ')|(' + r_s + '(' + b_Hasanta + '?)' + r_hm + ')|(' + r_s + '(' + b_Hasanta + '?)' + r_h + '(' + b_Hasanta + '?)' + r_m + '))'; - r_SHN := '((' + r_sh + '(' + b_Hasanta + '?)' + r_n + ')|(' + r_s + '(' + b_Hasanta + '?)' + r_hn + ')|(' + r_s + '(' + b_Hasanta + '?)' + r_h + '(' + b_Hasanta + '?)' + r_n + '))'; - //T - r_T_Acnt_Acnt := '(' + b_Khandatta + ')'; - r_TTH := '(((' + r_t + ')?(' + b_Hasanta + '?)' + r_th + ')|(' + r_tt + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_t + '(' + b_Hasanta + '?)' + r_t + '(' + b_Hasanta + '?)' + r_h + '))'; - //U - //V - //W - //X - //Y - //Z - r_ZZH := '((' + b_H + b_Hasanta + b_Z + ')|(' + r_z + '(' + b_Hasanta + '?)' + r_zh + ')|(' + r_zz + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_z + '(' + b_Hasanta + '?)' + r_z + '(' + b_Hasanta + '?)' + r_h + '))'; - - - {Four character combinations} - //A - //B - //C - //D - //E - //F - //G - //H - //I - //J - //K - r_KSHM := '((' + r_ksh + '(' + b_Hasanta + '?)' + r_m + ')|(' + r_k + '(' + b_Hasanta + '?)' + r_shm + ')|(' + r_ks + '(' + b_Hasanta + '?)' + r_hm + ')|(' + r_k + '(' + b_Hasanta + '?)' + r_sh + '(' + b_Hasanta + '?)' + r_m + ')|(' + r_k + '(' + b_Hasanta + '?)' + r_s + '(' + b_Hasanta + '?)' + r_h + '(' + b_Hasanta + '?)' + r_m + '))'; - r_KKHM := '((' + r_kkh + '(' + b_Hasanta + '?)' + r_m + ')|(' + r_kk + '(' + b_Hasanta + '?)' + r_hm + ')|(' + r_k + '(' + b_Hasanta + '?)' + r_k + '(' + b_Hasanta + '?)' + r_h + '(' + b_Hasanta + '?)' + r_m + ')|(' + r_k + '(' + b_Hasanta + '?)' + r_kh + '(' + b_Hasanta + '?)' + r_m + '))'; - r_KSHN := '((' + r_ksh + '(' + b_Hasanta + '?)' + r_n + ')|(' + r_k + '(' + b_Hasanta + '?)' + r_shn + ')|(' + r_ks + '(' + b_Hasanta + '?)' + r_hn + ')|(' + r_k + '(' + b_Hasanta + '?)' + r_sh + '(' + b_Hasanta + '?)' + r_n + ')|(' + r_k + '(' + b_Hasanta + '?)' + r_s + '(' + b_Hasanta + '?)' + r_h + '(' + b_Hasanta + '?)' + r_n + '))'; - r_KKHN := '((' + r_kkh + '(' + b_Hasanta + '?)' + r_n + ')|(' + r_kk + '(' + b_Hasanta + '?)' + r_hn + ')|(' + r_k + '(' + b_Hasanta + '?)' + r_k + '(' + b_Hasanta + '?)' + r_h + '(' + b_Hasanta + '?)' + r_n + ')|(' + r_k + '(' + b_Hasanta + '?)' + r_kh + '(' + b_Hasanta + '?)' + r_n + '))'; - //L - //M - //N - r_NGCH := '((' + r_ng + '(' + b_Hasanta + '?)' + r_ch + ')|(' + r_ngc + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_g + '(' + b_Hasanta + '?)' + r_c + '(' + b_Hasanta + '?)' + r_h + '))'; - r_NGGH := '((' + r_ng + '(' + b_Hasanta + '?)' + r_gh + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_gg + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_ggh + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_g + '(' + b_Hasanta + '?)' + r_g + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_ng + '(' + b_Hasanta + '?)' + r_g + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_ngg + '(' + b_Hasanta + '?)' + r_h + '))'; - r_NGKH := '((' + r_ng + '(' + b_Hasanta + '?)' + r_kh + ')|(' + r_ng + '(' + b_Hasanta + '?)' + r_k + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_g + '(' + b_Hasanta + '?)' + r_k + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_ngk + '(' + b_Hasanta + '?)' + r_h + '))'; - r_NGKX := '((' + r_ng + '(' + b_Hasanta + '?)' + r_kx + ')|(' + r_ngk + '(' + b_Hasanta + '?)' + r_x + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_g + '(' + b_Hasanta + '?)' + r_kx + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_g + '(' + b_Hasanta + '?)' + r_k + '(' + b_Hasanta + '?)' + r_x + '))'; - r_NGJH := '((' + r_ng + '(' + b_Hasanta + '?)' + r_jh + ')|(' + r_ngj + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_g + '(' + b_Hasanta + '?)' + r_j + '(' + b_Hasanta + '?)' + r_h + '))'; - //O - //P - //Q - //R - //S - r_SHSH := '(((' + r_sh + ')?(' + b_Hasanta + '?)' + r_sh + ')|(' + r_s + '(' + b_Hasanta + '?)' + r_h + '(' + b_Hasanta + '?)' + r_s + '(' + b_Hasanta + '?)' + r_h + '))'; - //T - r_THTH := '((' + b_T + b_Hasanta + b_Th + ')|((' + r_th + ')?(' + b_Hasanta + '?)' + r_th + ')|(' + r_t + '(' + b_Hasanta + '?)' + r_h + '(' + b_Hasanta + '?)' + r_t + '(' + b_Hasanta + '?)' + r_h + '))'; - //U - //V - //W - //X - //Y - //Z - - {Five character combinations} - //C - r_CHCHH := '((' + b_C + b_Hasanta + b_CH + ')|(' + r_ch + '(' + b_Hasanta + '?)' + r_chh + ')|(' + r_ch + '(' + b_Hasanta + '?)' + r_ch + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_c + '(' + b_Hasanta + '?)' + r_h + '(' + b_Hasanta + '?)' + r_c + '(' + b_Hasanta + '?)' + r_h + '(' + b_Hasanta + '?)' + r_h + '))'; - r_NGKSH := '((' + r_ngk + '(' + b_Hasanta + '?)' + r_sh + ')|(' + r_ng + '(' + b_Hasanta + '?)' + r_k + '(' + b_Hasanta + '?)' + r_sh + ')|(' + r_ng + '(' + b_Hasanta + '?)' + r_ksh + ')|(' + r_ng + '(' + b_Hasanta + '?)' + r_ks + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_g + '(' + b_Hasanta + '?)' + r_k + '(' + b_Hasanta + '?)' + r_s + '(' + b_Hasanta + '?)' + r_h + '))'; - r_NGKKH := '((' + r_ng + '(' + b_Hasanta + '?)' + r_kkh + ')|(' + r_ngk + '(' + b_Hasanta + '?)' + r_kh + ')|(' + r_ng + '(' + b_Hasanta + '?)' + r_k + '(' + b_Hasanta + '?)' + r_kh + ')|(' + r_ng + '(' + b_Hasanta + '?)' + r_kk + '(' + b_Hasanta + '?)' + r_h + ')|(' + r_n + '(' + b_Hasanta + '?)' + r_g + '(' + b_Hasanta + '?)' + r_k + '(' + b_Hasanta + '?)' + r_k + '(' + b_Hasanta + '?)' + r_h + '))'; + r_InjectFola := '(' + b_Hasanta + '[' + b_Z + b_B + b_M + '])?'; + r_InjectHasanta := '(' + b_Hasanta + '?)'; + r_InjectChandraBisharga := '([' + b_Bisharga + b_Chandra + ']?)'; + + { Single characters } + { FastSearch OFF } +{$IFDEF FASTSEARCH_OFF} + r_A := '(([' + b_A + b_E + ']' + b_Hasanta + b_Z + b_AAkar + '?)|([' + b_AA + + b_E + '])|([' + ZWJ + ZWNJ + ']?(' + b_Hasanta + b_Z + ')?' + b_AAkar + + ')|(' + b_Y + b_AAkar + '))'; + r_B := '(' + b_B + '|(' + b_B + b_Ikar + '))'; + r_C := '(([' + b_C + b_CH + '])|(' + b_S + b_Ikar + '))'; + r_D := '(([' + b_D + b_Dd + '])|(' + b_Dd + b_Ikar + '))'; + r_E := '((' + b_E + b_Hasanta + b_Z + b_AAkar + '?)|([' + b_E + b_Ekar + + '])|([' + ZWJ + ZWNJ + ']?(' + b_Hasanta + b_Z + ')' + b_AAkar + ')|(' + b_Y + + b_Ekar + '))'; + r_F := '(' + b_Ph + '|(' + b_E + b_Ph + '))'; + r_G := '(' + b_G + '|(' + b_J + b_Ikar + ')|(' + b_J + b_Hasanta + + b_NYA + '))'; + r_H := '(' + b_H + '|(' + b_E + b_I + b_C + ')|' + b_Bisharga + '|(' + b_H + + b_Hasanta + ZWNJ + '?))'; + r_I := '(([' + b_I + b_II + b_Ikar + b_IIkar + '])|(' + b_Y + '[' + b_Ikar + + b_IIkar + ']))'; + r_J := '(([' + b_J + b_Z + '])|(' + b_J + b_Ekar + ')|(' + b_J + + b_Nukta + '))'; + r_K := '(' + b_K + '|(' + b_K + b_Ekar + '))'; + r_L := '(' + b_L + '|(' + b_E + b_L + '))'; + r_M := '(' + b_M + '|(' + b_E + b_M + '))'; + r_N := '(([' + b_N + b_Nn + b_Chandra + b_NGA + b_NYA + b_Anushar + '])|(' + + b_E + b_N + '))'; + r_O := '(([' + b_O + b_Okar + b_A + '])|(' + b_A + b_Hasanta + b_Z + ')|(' + + b_Y + b_Okar + '?))?'; + r_OFirst := '(([' + b_O + b_Okar + b_A + '])|(' + b_A + b_Hasanta + b_Z + + ')|(' + b_Y + b_Okar + '?))'; + r_P := '(' + b_P + '|(' + b_P + b_Ikar + '))'; + r_Q := '((' + b_K + ')|(' + b_K + b_Ikar + b_U + '))'; + r_R := '(([' + b_R + b_Rr + b_Rrh + '])|(' + b_AA + b_R + ')|(' + b_H + + b_Hasanta + b_R + '))'; + r_S := '(([' + b_S + b_Sh + b_Ss + '])|(' + b_E + b_S + '))'; + r_T := '(([' + b_T + b_Tt + b_Khandatta + '])|(' + b_Tt + b_Ikar + '))'; + r_U := '(([' + b_U + b_UU + b_Ukar + b_UUkar + '])|(' + b_I + b_U + ')|(' + + b_Y + '[' + b_Ukar + b_UUkar + ']))'; + r_V := '(' + b_Bh + '|(' + b_Bh + b_Ikar + '))'; + r_W := '(' + b_O + '|(' + b_O + b_Y + ')|(' + b_Hasanta + b_B + ')|(' + b_Dd + + b_B + b_Hasanta + b_L + b_Ikar + b_U + '))'; + r_X := '((' + b_K + b_Hasanta + b_S + ')|(' + b_E + b_K + b_Hasanta + b_S + + ')|' + b_Ss + ')'; + r_Y := '(' + b_Y + '|(' + b_I + b_Y + ')|(' + b_O + b_Y + b_AAkar + b_I + + ')|([' + ZWJ + ZWNJ + ']?' + b_Hasanta + b_Z + '))'; + r_Z := '(' + b_J + '|' + b_Z + '|(' + b_J + b_Nukta + ')|(' + b_J + b_Ekar + + b_Dd + ')|([' + ZWJ + ZWNJ + ']?' + b_Hasanta + b_Z + '))'; +{$ELSE} + { FastSearch On } + r_A := '(([' + b_A + b_E + ']' + b_Hasanta + b_Z + b_AAkar + '?)|([' + b_AA + + b_E + '])|([' + ZWJ + ZWNJ + ']?(' + b_Hasanta + b_Z + ')?' + b_AAkar + + ')|(' + b_Y + b_AAkar + '))'; + r_B := '(' + b_B + ')'; + r_C := '([' + b_C + b_CH + '])'; + r_D := '([' + b_D + b_Dd + '])'; + r_E := '((' + b_E + b_Hasanta + b_Z + b_AAkar + '?)|([' + b_E + b_Ekar + + '])|([' + ZWJ + ZWNJ + ']?(' + b_Hasanta + b_Z + ')' + b_AAkar + ')|(' + b_Y + + b_Ekar + '))'; + r_F := '(' + b_Ph + ')'; + r_G := '(' + b_G + '|(' + b_J + b_Hasanta + b_NYA + '))'; + r_H := '(' + b_H + '|' + b_Bisharga + '|(' + b_H + b_Hasanta + ZWNJ + '?))'; + r_I := '(([' + b_I + b_II + b_Ikar + b_IIkar + '])|(' + b_Y + '[' + b_Ikar + + b_IIkar + ']))'; + r_J := '(([' + b_J + b_Z + '])|(' + b_J + b_Nukta + '))'; + r_K := '(' + b_K + ')'; + r_L := '(' + b_L + ')'; + r_M := '(' + b_M + ')'; + r_N := '([' + b_N + b_Nn + b_Chandra + b_NGA + b_NYA + b_Anushar + '])'; + r_O := '(([' + b_O + b_Okar + b_A + '])|(' + b_A + b_Hasanta + b_Z + ')|(' + + b_Y + b_Okar + '?))?'; + r_OFirst := '(([' + b_O + b_Okar + b_A + '])|(' + b_A + b_Hasanta + b_Z + + ')|(' + b_Y + b_Okar + '?))'; + r_P := '(' + b_P + ')'; + r_Q := '(' + b_K + ')'; + r_R := '(([' + b_R + b_Rr + b_Rrh + '])|(' + b_H + b_Hasanta + b_R + '))'; + r_S := '([' + b_S + b_Sh + b_Ss + '])'; + r_T := '([' + b_T + b_Tt + b_Khandatta + '])'; + r_U := '(([' + b_U + b_UU + b_Ukar + b_UUkar + '])|(' + b_Y + '[' + b_Ukar + + b_UUkar + ']))'; + r_V := '(' + b_Bh + ')'; + r_W := '(' + b_O + '|(' + b_O + b_Y + ')|(' + b_Hasanta + b_B + '))'; + r_X := '((' + b_K + b_Hasanta + b_S + ')|' + b_Ss + ')'; + r_Y := '(' + b_Y + '|(' + b_I + b_Y + ')|([' + ZWJ + ZWNJ + ']?' + b_Hasanta + + b_Z + '))'; + r_Z := '(' + b_J + '|' + b_Z + '|(' + b_J + b_Nukta + ')|([' + ZWJ + ZWNJ + + ']?' + b_Hasanta + b_Z + '))'; +{$ENDIF} + { Two character combinations } + // A + r_AI := '(' + b_OI + '|' + b_OIkar + '|' + r_A + r_I + ')'; + r_AU := '(' + b_OU + '|' + b_OUkar + r_A + r_U + ')'; + r_AZ := '(' + r_A + '(' + r_Z + ')?)'; + r_AA := '((' + b_AA + ')|(' + b_Y + b_AAkar + ')|(' + b_AAkar + ')|(' + r_A + + '(' + r_A + ')?))'; + // B + r_BH := '((' + b_Bh + ')|(' + r_B + '(' + b_Hasanta + '?)' + r_H + '))'; + r_BB := '(' + r_B + '(' + b_Hasanta + '?)(' + r_B + ')?)'; + r_BV := '((' + r_B + ')?(' + b_Hasanta + '?)' + r_V + ')'; + r_BD := '(' + r_B + '(' + b_Hasanta + '?)' + r_D + ')'; + // C + r_CH := '((' + b_C + ')|(' + b_CH + ')|(' + r_C + '(' + b_Hasanta + '?)' + + r_H + '))'; + r_CK := '((' + b_K + ')|(' + r_C + '(' + b_Hasanta + '?)' + r_K + '))'; + r_CC := '(' + r_C + '(' + b_Hasanta + '?)(' + r_C + ')?)'; + r_CN := '(' + r_C + '(' + b_Hasanta + '?)' + r_N + ')'; + // D + r_DB := '(' + r_D + '(' + b_Hasanta + '?)' + r_B + ')'; + r_DD := '(' + r_D + '(' + b_Hasanta + '?)(' + r_D + ')?)'; + r_DG := '(' + r_D + '(' + b_Hasanta + '?)' + r_G + ')'; + r_DH := '((' + b_Dh + ')|(' + b_Ddh + ')|(' + r_D + '(' + b_Hasanta + '?)' + + r_H + '))'; + // E + r_EY := '((' + b_E + ')|(' + b_I + ')|(' + b_Ekar + ')|(' + b_Ekar + b_I + + ')|(' + b_E + b_I + ')|(' + b_II + ')|(' + b_IIkar + ')|(' + r_E + + r_Y + '))'; + r_EE := '((' + b_I + ')|(' + b_II + ')|(' + b_Ikar + ')|(' + b_IIkar + ')|(' + + b_Y + b_Ekar + b_I + ')|(' + r_E + r_E + '))'; + // F + r_FF := '(' + r_F + '(' + b_Hasanta + '?)(' + r_F + ')?)'; + // G + r_GH := '((' + b_GH + ')|(' + r_G + '(' + b_Hasanta + '?)' + r_H + '))'; + r_GG := '((' + b_J + b_Hasanta + b_NYA + ')|(' + r_G + '(' + b_Hasanta + '?)(' + + r_G + ')?))'; + // H + r_HL := '(' + r_H + '(' + b_Hasanta + '?)' + r_L + ')'; + r_HH := '(' + r_H + '(' + b_Hasanta + '?)' + r_H + ')'; + r_HM := '(' + r_H + '(' + b_Hasanta + '?)' + r_M + ')'; + r_HN := '(' + r_H + '(' + b_Hasanta + '?)' + r_N + ')'; + // I + r_IA := '((' + b_NYA + b_AAkar + ')|(' + r_I + r_A + '))'; + // J + r_JJ := '((' + b_H + b_Hasanta + b_Z + ')|(' + r_J + '(' + b_Hasanta + '?)(' + + r_J + ')?))'; + r_JH := '((' + b_JH + ')|(' + r_J + '(' + b_Hasanta + '?)' + r_H + '))'; + // K + r_KH := '((' + b_KH + ')|(' + b_K + b_Hasanta + b_Ss + ')|(' + r_K + '(' + + b_Hasanta + '?)' + r_H + '))'; + r_KK := '(' + r_K + '(' + b_Hasanta + '?)(' + r_K + ')?)'; + r_KS := '(' + r_K + '(' + b_Hasanta + '?)' + r_S + ')'; + r_KX := '((' + b_K + b_Hasanta + b_Ss + ')|(' + r_K + '(' + b_Hasanta + '?)' + + r_X + '))'; + // L + r_LL := '((' + b_H + b_Hasanta + b_L + ')|((' + r_L + ')?(' + b_Hasanta + '?)' + + r_L + ')|(' + r_L + '(' + b_Hasanta + '?)' + r_L + '))'; + r_LK := '(' + r_L + '(' + b_Hasanta + '?)' + r_K + ')'; + r_LG := '(' + r_L + '(' + b_Hasanta + '?)' + r_G + ')'; + r_LP := '(' + r_L + '(' + b_Hasanta + '?)' + r_P + ')'; + r_LD := '(' + r_L + '(' + b_Hasanta + '?)' + r_D + ')'; + r_LB := '(' + r_L + '(' + b_Hasanta + '?)' + r_B + ')'; + // M + r_MM := '((' + b_H + b_Hasanta + b_M + ')|(' + r_M + '(' + b_Hasanta + '?)(' + + r_M + ')?))'; + r_MB := '(' + r_M + '(' + b_Hasanta + '?)' + r_B + ')'; + r_MP := '(' + r_M + '(' + b_Hasanta + '?)' + r_P + ')'; + r_MT := '(' + r_M + '(' + b_Hasanta + '?)' + r_T + ')'; + // N + r_NC := '((' + b_NYA + b_Hasanta + b_C + ')|(' + r_N + '(' + b_Hasanta + '?)' + + r_C + '))'; + r_NN := '((' + b_H + b_Hasanta + b_Nn + ')|(' + b_H + b_Hasanta + b_N + ')|(' + + r_N + '(' + b_Hasanta + '?)(' + r_N + ')?))'; + r_NG := '((' + b_NGA + ')|(' + b_Anushar + ')|(' + b_NYA + ')|(' + b_NGA + + b_Hasanta + b_G + ')|(' + r_N + '(' + b_Hasanta + '?)' + r_G + '))'; + r_NK := '((' + b_NGA + b_Hasanta + b_K + ')|(' + r_N + '(' + b_Hasanta + '?)' + + r_K + '))'; + r_NJ := '((' + b_NYA + b_Hasanta + b_J + ')|(' + r_N + '(' + b_Hasanta + '?)' + + r_J + '))'; + r_ND := '(' + r_N + '(' + b_Hasanta + '?)' + r_D + ')'; + r_NT := '(' + r_N + '(' + b_Hasanta + '?)' + r_T + ')'; + // O + r_OO := '((' + r_U + ')|(' + r_O + r_O + '))'; + r_OI := '((' + b_OI + ')|(' + b_OIkar + ')|(' + r_O + r_I + '))'; + r_OU := '((' + b_OU + ')|(' + b_OUkar + ')|(' + r_O + r_U + '))'; + // P + r_PH := '((' + b_Ph + ')|(' + r_P + '(' + b_Hasanta + '?)' + r_H + '))'; + r_PP := '(' + r_P + '(' + b_Hasanta + '?)(' + r_P + ')?)'; + // Q + r_QQ := '(' + r_Q + '(' + b_Hasanta + '?)(' + r_Q + ')?)'; + // R + r_RI := '((' + b_RRI + ')|(' + b_RRIkar + ')|(' + b_H + b_RRIkar + ')|(' + r_R + + r_I + '))'; + r_RH := '((' + r_R + ')|(' + r_R + '(' + b_Hasanta + '?)' + r_H + '))'; + // S + r_SS := '(' + r_S + '(' + b_Hasanta + '?)(' + r_S + ')?)'; + r_SH := '((' + b_S + ')|(' + b_Sh + ')|(' + b_Ss + ')|(' + r_S + '(' + + b_Hasanta + '?)' + r_H + '))'; + // T + r_TT := '(' + r_T + '(' + b_Hasanta + '?)(' + r_T + ')?)'; + r_TH := '((' + b_Th + ')|(' + b_Tth + ')|(' + r_T + '(' + b_Hasanta + '?)' + + r_H + '))'; + // U + r_UU := '((' + b_UU + ')|(' + b_UUkar + ')|(' + r_U + '(' + r_U + ')?))'; + // V + r_VV := '(' + r_V + '(' + b_Hasanta + '?)(' + r_V + ')?)'; + // W + // X + r_XM := '(' + r_X + '(' + b_Hasanta + '?)' + r_M + ')'; + r_XN := '(' + r_X + '(' + b_Hasanta + '?)' + r_N + ')'; + // Y + // Z + r_ZH := '((' + b_JH + ')|(' + r_J + '(' + b_Hasanta + '?)' + r_H + '))'; + r_ZZ := '((' + b_H + b_Hasanta + b_Z + ')|(' + r_Z + '(' + b_Hasanta + '?)(' + + r_Z + ')?))'; + + { Three character combinations } + // A + // B + r_BBH := '(((' + r_B + ')?(' + b_Hasanta + '?)' + r_BH + ')|(' + r_BB + '(' + + b_Hasanta + '?)' + r_H + ')|(' + r_B + '(' + b_Hasanta + '?)' + r_B + '(' + + b_Hasanta + '?)' + r_H + '))'; + r_BDH := '((' + r_B + '(' + b_Hasanta + '?)' + r_DH + ')|(' + r_BD + '(' + + b_Hasanta + '?)' + r_H + ')|(' + r_B + '(' + b_Hasanta + '?)' + r_D + '(' + + b_Hasanta + '?)' + r_H + '))'; + r_BHL := '((' + r_BH + '(' + b_Hasanta + '?)' + r_L + ')|(' + r_B + '(' + + b_Hasanta + '?)' + r_HL + ')|(' + r_B + '(' + b_Hasanta + '?)' + r_H + '(' + + b_Hasanta + '?)' + r_L + '))'; + // C + r_CCH := '((' + r_C + '(' + b_Hasanta + '?)' + r_CH + ')|(' + r_C + '(' + + b_Hasanta + '?)' + r_C + '(' + b_Hasanta + '?)' + r_H + '))'; + r_CHH := '((' + r_CH + '(' + b_Hasanta + '?)' + '(' + r_H + ')?' + ')|(' + r_C + + '(' + b_Hasanta + '?)' + r_HH + ')|(' + r_C + '(' + b_Hasanta + '?)' + r_H + + '(' + b_Hasanta + '?)' + r_H + '))'; + r_CNG := '((' + b_C + b_Hasanta + b_NYA + ')|(' + r_C + '(' + b_Hasanta + '?)' + + r_NG + ')|(' + r_C + '(' + b_Hasanta + '?)' + r_N + '(' + b_Hasanta + '?)' + + r_G + ')|(' + r_CN + '(' + b_Hasanta + '?)' + r_G + '))'; + // D + r_DHM := '((' + r_DH + '(' + b_Hasanta + '?)' + r_M + ')|(' + r_D + '(' + + b_Hasanta + '?)' + r_HM + ')|(' + r_D + '(' + b_Hasanta + '?)' + r_H + '(' + + b_Hasanta + '?)' + r_M + '))'; + r_DHN := '((' + r_DH + '(' + b_Hasanta + '?)' + r_N + ')|(' + r_D + '(' + + b_Hasanta + '?)' + r_HN + ')|(' + r_D + '(' + b_Hasanta + '?)' + r_H + '(' + + b_Hasanta + '?)' + r_N + '))'; + r_DBH := '((' + r_D + '(' + b_Hasanta + '?)' + r_BH + ')|(' + r_DB + '(' + + b_Hasanta + '?)' + r_H + ')|(' + r_D + '(' + b_Hasanta + '?)' + r_B + '(' + + b_Hasanta + '?)' + r_H + '))'; + r_DDH := '(((' + r_D + ')?(' + b_Hasanta + '?)' + r_DH + ')|(' + r_DD + '(' + + b_Hasanta + '?)' + r_H + ')|(' + r_D + '(' + b_Hasanta + '?)' + r_D + '(' + + b_Hasanta + '?)' + r_H + '))'; + r_DGH := '((' + r_D + '(' + b_Hasanta + '?)' + r_GH + ')|(' + r_DG + '(' + + b_Hasanta + '?)' + r_H + ')|(' + r_D + '(' + b_Hasanta + '?)' + r_G + '(' + + b_Hasanta + '?)' + r_H + '))'; + // E + // F + // G + r_GDH := '((' + r_G + '(' + b_Hasanta + '?)' + r_DH + ')|(' + r_G + '(' + + b_Hasanta + '?)' + r_D + '(' + b_Hasanta + '?)' + r_H + '))'; + r_GGH := '((' + r_GG + '(' + b_Hasanta + '?)' + r_H + ')|(' + r_G + '(' + + b_Hasanta + '?)' + r_GH + ')|(' + r_G + '(' + b_Hasanta + '?)' + r_G + '(' + + b_Hasanta + '?)' + r_H + '))'; + r_GHN := '((' + r_GH + '(' + b_Hasanta + '?)' + r_N + ')|(' + r_G + '(' + + b_Hasanta + '?)' + r_HN + ')|(' + r_G + '(' + b_Hasanta + '?)' + r_H + '(' + + b_Hasanta + '?)' + r_N + '))'; + // H + // I + // J + r_JNG := '((' + b_J + b_Hasanta + b_NYA + ')|(' + r_J + '(' + b_Hasanta + '?)' + + r_NG + ')|(' + r_J + '(' + b_Hasanta + '?)' + r_N + '(' + b_Hasanta + '?)' + + r_G + '))'; + r_JJH := '(((' + r_J + ')?(' + b_Hasanta + '?)' + r_JH + ')|(' + b_H + + b_Hasanta + b_Z + ')|(' + r_JJ + '(' + b_Hasanta + '?)' + r_H + ')|(' + r_J + + '(' + b_Hasanta + '?)' + r_J + '(' + b_Hasanta + '?)' + r_H + '))'; + // K + r_KSH := '((' + r_K + '(' + b_Hasanta + '?)' + r_SH + ')|(' + r_KS + '(' + + b_Hasanta + '?)' + r_H + ')|(' + r_K + '(' + b_Hasanta + '?)' + r_S + '(' + + b_Hasanta + '?)' + r_H + '))'; + r_KKH := '((' + b_K + b_Hasanta + b_Ss + ')|(' + r_KK + '(' + b_Hasanta + '?)' + + r_H + ')|((' + r_K + ')?(' + b_Hasanta + '?)' + r_KH + ')|(' + r_K + '(' + + b_Hasanta + '?)' + r_K + '(' + b_Hasanta + '?)' + r_H + '))'; + r_KXM := '((' + r_KX + '(' + b_Hasanta + '?)' + r_M + ')|(' + r_K + '(' + + b_Hasanta + '?)' + r_XM + ')|(' + r_K + '(' + b_Hasanta + '?)' + r_X + '(' + + b_Hasanta + '?)' + r_M + '))'; + r_KXN := '((' + r_KX + '(' + b_Hasanta + '?)' + r_N + ')|(' + r_K + '(' + + b_Hasanta + '?)' + r_XN + ')|(' + r_K + '(' + b_Hasanta + '?)' + r_X + '(' + + b_Hasanta + '?)' + r_N + '))'; + // L + r_LKH := '((' + r_L + '(' + b_Hasanta + '?)' + r_KH + ')|(' + r_LK + '(' + + b_Hasanta + '?)' + r_H + ')|(' + r_L + '(' + b_Hasanta + '?)' + r_K + '(' + + b_Hasanta + '?)' + r_H + '))'; + r_LGH := '((' + r_L + '(' + b_Hasanta + '?)' + r_GH + ')|(' + r_LG + '(' + + b_Hasanta + '?)' + r_H + ')|(' + r_L + '(' + b_Hasanta + '?)' + r_G + '(' + + b_Hasanta + '?)' + r_H + '))'; + r_LPH := '((' + r_L + '(' + b_Hasanta + '?)' + r_PH + ')|(' + r_LP + '(' + + b_Hasanta + '?)' + r_H + ')|(' + r_L + '(' + b_Hasanta + '?)' + r_P + '(' + + b_Hasanta + '?)' + r_H + '))'; + r_LDH := '((' + r_L + '(' + b_Hasanta + '?)' + r_DH + ')|(' + r_LD + '(' + + b_Hasanta + '?)' + r_H + ')|(' + r_L + '(' + b_Hasanta + '?)' + r_D + '(' + + b_Hasanta + '?)' + r_H + '))'; + r_LBH := '((' + r_L + '(' + b_Hasanta + '?)' + r_BH + ')|(' + r_LB + '(' + + b_Hasanta + '?)' + r_H + ')|(' + r_L + '(' + b_Hasanta + '?)' + r_B + '(' + + b_Hasanta + '?)' + r_H + '))'; + // M + r_MBH := '((' + r_M + '(' + b_Hasanta + '?)' + r_BH + ')|(' + r_MB + '(' + + b_Hasanta + '?)' + r_H + ')|(' + r_M + '(' + b_Hasanta + '?)' + r_B + '(' + + b_Hasanta + '?)' + r_H + '))'; + r_MPH := '((' + r_M + '(' + b_Hasanta + '?)' + r_PH + ')|(' + r_MP + '(' + + b_Hasanta + '?)' + r_H + ')|(' + r_M + '(' + b_Hasanta + '?)' + r_P + '(' + + b_Hasanta + '?)' + r_H + '))'; + r_MTH := '((' + r_M + '(' + b_Hasanta + '?)' + r_TH + ')|(' + r_MT + '(' + + b_Hasanta + '?)' + r_H + ')|(' + r_M + '(' + b_Hasanta + '?)' + r_T + '(' + + b_Hasanta + '?)' + r_H + '))'; + // N + r_NSH := '((' + r_N + '(' + b_Hasanta + '?)' + r_SH + ')|(' + r_N + '(' + + b_Hasanta + '?)' + r_S + '(' + b_Hasanta + '?)' + r_H + '))'; + r_NDH := '((' + r_N + '(' + b_Hasanta + '?)' + r_DH + ')|(' + r_ND + '(' + + b_Hasanta + '?)' + r_H + ')|(' + r_N + '(' + b_Hasanta + '?)' + r_D + '(' + + b_Hasanta + '?)' + r_H + '))'; + r_NKH := '((' + r_N + '(' + b_Hasanta + '?)' + r_KH + ')|(' + r_NK + '(' + + b_Hasanta + '?)' + r_H + ')|(' + r_N + '(' + b_Hasanta + '?)' + r_K + '(' + + b_Hasanta + '?)' + r_H + '))'; + r_NTH := '((' + r_N + '(' + b_Hasanta + '?)' + r_TH + ')|(' + r_NT + '(' + + b_Hasanta + '?)' + r_H + ')|(' + r_N + '(' + b_Hasanta + '?)' + r_T + '(' + + b_Hasanta + '?)' + r_H + '))'; + r_NGJ := '((' + r_NG + '(' + b_Hasanta + '?)' + r_J + ')|(' + r_N + '(' + + b_Hasanta + '?)' + r_G + '(' + b_Hasanta + '?)' + r_J + '))'; + r_NGM := '((' + r_NG + '(' + b_Hasanta + '?)' + r_M + ')|(' + r_N + '(' + + b_Hasanta + '?)' + r_G + '(' + b_Hasanta + '?)' + r_M + '))'; + r_NGG := '((' + b_NGA + b_Hasanta + b_G + ')|(' + r_NG + '(' + b_Hasanta + + '?)' + r_G + ')|(' + r_N + '(' + b_Hasanta + '?)' + r_G + '(' + b_Hasanta + + '?)' + r_G + '))'; + r_NGX := '((' + r_NG + '(' + b_Hasanta + '?)' + r_X + ')|(' + r_N + '(' + + b_Hasanta + '?)' + r_G + '(' + b_Hasanta + '?)' + r_X + '))'; + r_NGK := '((' + r_NG + '(' + b_Hasanta + '?)' + r_K + ')|(' + r_N + '(' + + b_Hasanta + '?)' + r_G + '(' + b_Hasanta + '?)' + r_K + '))'; + r_NGH := '((' + b_NGA + b_Hasanta + b_GH + ')|(' + r_N + '(' + b_Hasanta + + '?)' + r_GH + ')|(' + r_N + '(' + b_Hasanta + '?)' + r_G + '(' + b_Hasanta + + '?)' + r_H + '))'; + r_NCH := '((' + r_N + '(' + b_Hasanta + '?)' + r_CH + ')|(' + r_NC + '(' + + b_Hasanta + '?)' + r_H + ')|(' + r_N + '(' + b_Hasanta + '?)' + r_C + '(' + + b_Hasanta + '?)' + r_H + '))'; + r_NJH := '((' + r_N + '(' + b_Hasanta + '?)' + r_JH + ')|(' + r_NJ + '(' + + b_Hasanta + '?)' + r_H + ')|(' + r_N + '(' + b_Hasanta + '?)' + r_J + '(' + + b_Hasanta + '?)' + r_H + '))'; + r_NGC := '((' + r_NG + '(' + b_Hasanta + '?)' + r_C + ')|(' + r_N + '(' + + b_Hasanta + '?)' + r_G + '(' + b_Hasanta + '?)' + r_C + '))'; + // O + // P + r_PHL := '((' + r_PH + '(' + b_Hasanta + '?)' + r_L + ')|(' + r_P + '(' + + b_Hasanta + '?)' + r_HL + ')|(' + r_P + '(' + b_Hasanta + '?)' + r_H + '(' + + b_Hasanta + '?)' + r_L + '))'; + // Q + // R + r_RRI := '((' + b_RRI + ')|(' + b_RRIkar + ')|(' + r_R + r_R + r_I + '))'; + // S + r_SSH := '(((' + r_S + ')?(' + b_Hasanta + '?)' + r_SH + ')|(' + r_S + '(' + + b_Hasanta + '?)' + r_S + '(' + b_Hasanta + '?)' + r_H + '))'; + r_SHM := '((' + r_SH + '(' + b_Hasanta + '?)' + r_M + ')|(' + r_S + '(' + + b_Hasanta + '?)' + r_HM + ')|(' + r_S + '(' + b_Hasanta + '?)' + r_H + '(' + + b_Hasanta + '?)' + r_M + '))'; + r_SHN := '((' + r_SH + '(' + b_Hasanta + '?)' + r_N + ')|(' + r_S + '(' + + b_Hasanta + '?)' + r_HN + ')|(' + r_S + '(' + b_Hasanta + '?)' + r_H + '(' + + b_Hasanta + '?)' + r_N + '))'; + // T + r_T_Acnt_Acnt := '(' + b_Khandatta + ')'; + r_TTH := '(((' + r_T + ')?(' + b_Hasanta + '?)' + r_TH + ')|(' + r_TT + '(' + + b_Hasanta + '?)' + r_H + ')|(' + r_T + '(' + b_Hasanta + '?)' + r_T + '(' + + b_Hasanta + '?)' + r_H + '))'; + // U + // V + // W + // X + // Y + // Z + r_ZZH := '((' + b_H + b_Hasanta + b_Z + ')|(' + r_Z + '(' + b_Hasanta + '?)' + + r_ZH + ')|(' + r_ZZ + '(' + b_Hasanta + '?)' + r_H + ')|(' + r_Z + '(' + + b_Hasanta + '?)' + r_Z + '(' + b_Hasanta + '?)' + r_H + '))'; + + { Four character combinations } + // A + // B + // C + // D + // E + // F + // G + // H + // I + // J + // K + r_KSHM := '((' + r_KSH + '(' + b_Hasanta + '?)' + r_M + ')|(' + r_K + '(' + + b_Hasanta + '?)' + r_SHM + ')|(' + r_KS + '(' + b_Hasanta + '?)' + r_HM + + ')|(' + r_K + '(' + b_Hasanta + '?)' + r_SH + '(' + b_Hasanta + '?)' + r_M + + ')|(' + r_K + '(' + b_Hasanta + '?)' + r_S + '(' + b_Hasanta + '?)' + r_H + + '(' + b_Hasanta + '?)' + r_M + '))'; + r_KKHM := '((' + r_KKH + '(' + b_Hasanta + '?)' + r_M + ')|(' + r_KK + '(' + + b_Hasanta + '?)' + r_HM + ')|(' + r_K + '(' + b_Hasanta + '?)' + r_K + '(' + + b_Hasanta + '?)' + r_H + '(' + b_Hasanta + '?)' + r_M + ')|(' + r_K + '(' + + b_Hasanta + '?)' + r_KH + '(' + b_Hasanta + '?)' + r_M + '))'; + r_KSHN := '((' + r_KSH + '(' + b_Hasanta + '?)' + r_N + ')|(' + r_K + '(' + + b_Hasanta + '?)' + r_SHN + ')|(' + r_KS + '(' + b_Hasanta + '?)' + r_HN + + ')|(' + r_K + '(' + b_Hasanta + '?)' + r_SH + '(' + b_Hasanta + '?)' + r_N + + ')|(' + r_K + '(' + b_Hasanta + '?)' + r_S + '(' + b_Hasanta + '?)' + r_H + + '(' + b_Hasanta + '?)' + r_N + '))'; + r_KKHN := '((' + r_KKH + '(' + b_Hasanta + '?)' + r_N + ')|(' + r_KK + '(' + + b_Hasanta + '?)' + r_HN + ')|(' + r_K + '(' + b_Hasanta + '?)' + r_K + '(' + + b_Hasanta + '?)' + r_H + '(' + b_Hasanta + '?)' + r_N + ')|(' + r_K + '(' + + b_Hasanta + '?)' + r_KH + '(' + b_Hasanta + '?)' + r_N + '))'; + // L + // M + // N + r_NGCH := '((' + r_NG + '(' + b_Hasanta + '?)' + r_CH + ')|(' + r_NGC + '(' + + b_Hasanta + '?)' + r_H + ')|(' + r_N + '(' + b_Hasanta + '?)' + r_G + '(' + + b_Hasanta + '?)' + r_C + '(' + b_Hasanta + '?)' + r_H + '))'; + r_NGGH := '((' + r_NG + '(' + b_Hasanta + '?)' + r_GH + ')|(' + r_N + '(' + + b_Hasanta + '?)' + r_GG + '(' + b_Hasanta + '?)' + r_H + ')|(' + r_N + '(' + + b_Hasanta + '?)' + r_GGH + ')|(' + r_N + '(' + b_Hasanta + '?)' + r_G + '(' + + b_Hasanta + '?)' + r_G + '(' + b_Hasanta + '?)' + r_H + ')|(' + r_NG + '(' + + b_Hasanta + '?)' + r_G + '(' + b_Hasanta + '?)' + r_H + ')|(' + r_NGG + + '(' + b_Hasanta + '?)' + r_H + '))'; + r_NGKH := '((' + r_NG + '(' + b_Hasanta + '?)' + r_KH + ')|(' + r_NG + '(' + + b_Hasanta + '?)' + r_K + '(' + b_Hasanta + '?)' + r_H + ')|(' + r_N + '(' + + b_Hasanta + '?)' + r_G + '(' + b_Hasanta + '?)' + r_K + '(' + b_Hasanta + + '?)' + r_H + ')|(' + r_NGK + '(' + b_Hasanta + '?)' + r_H + '))'; + r_NGKX := '((' + r_NG + '(' + b_Hasanta + '?)' + r_KX + ')|(' + r_NGK + '(' + + b_Hasanta + '?)' + r_X + ')|(' + r_N + '(' + b_Hasanta + '?)' + r_G + '(' + + b_Hasanta + '?)' + r_KX + ')|(' + r_N + '(' + b_Hasanta + '?)' + r_G + '(' + + b_Hasanta + '?)' + r_K + '(' + b_Hasanta + '?)' + r_X + '))'; + r_NGJH := '((' + r_NG + '(' + b_Hasanta + '?)' + r_JH + ')|(' + r_NGJ + '(' + + b_Hasanta + '?)' + r_H + ')|(' + r_N + '(' + b_Hasanta + '?)' + r_G + '(' + + b_Hasanta + '?)' + r_J + '(' + b_Hasanta + '?)' + r_H + '))'; + // O + // P + // Q + // R + // S + r_SHSH := '(((' + r_SH + ')?(' + b_Hasanta + '?)' + r_SH + ')|(' + r_S + '(' + + b_Hasanta + '?)' + r_H + '(' + b_Hasanta + '?)' + r_S + '(' + b_Hasanta + + '?)' + r_H + '))'; + // T + r_THTH := '((' + b_T + b_Hasanta + b_Th + ')|((' + r_TH + ')?(' + b_Hasanta + + '?)' + r_TH + ')|(' + r_T + '(' + b_Hasanta + '?)' + r_H + '(' + b_Hasanta + + '?)' + r_T + '(' + b_Hasanta + '?)' + r_H + '))'; + // U + // V + // W + // X + // Y + // Z + + { Five character combinations } + // C + r_CHCHH := '((' + b_C + b_Hasanta + b_CH + ')|(' + r_CH + '(' + b_Hasanta + + '?)' + r_CHH + ')|(' + r_CH + '(' + b_Hasanta + '?)' + r_CH + '(' + + b_Hasanta + '?)' + r_H + ')|(' + r_C + '(' + b_Hasanta + '?)' + r_H + '(' + + b_Hasanta + '?)' + r_C + '(' + b_Hasanta + '?)' + r_H + '(' + b_Hasanta + + '?)' + r_H + '))'; + r_NGKSH := '((' + r_NGK + '(' + b_Hasanta + '?)' + r_SH + ')|(' + r_NG + '(' + + b_Hasanta + '?)' + r_K + '(' + b_Hasanta + '?)' + r_SH + ')|(' + r_NG + '(' + + b_Hasanta + '?)' + r_KSH + ')|(' + r_NG + '(' + b_Hasanta + '?)' + r_KS + + '(' + b_Hasanta + '?)' + r_H + ')|(' + r_N + '(' + b_Hasanta + '?)' + r_G + + '(' + b_Hasanta + '?)' + r_K + '(' + b_Hasanta + '?)' + r_S + '(' + + b_Hasanta + '?)' + r_H + '))'; + r_NGKKH := '((' + r_NG + '(' + b_Hasanta + '?)' + r_KKH + ')|(' + r_NGK + '(' + + b_Hasanta + '?)' + r_KH + ')|(' + r_NG + '(' + b_Hasanta + '?)' + r_K + + '(' + b_Hasanta + '?)' + r_KH + ')|(' + r_NG + '(' + b_Hasanta + '?)' + r_KK + + '(' + b_Hasanta + '?)' + r_H + ')|(' + r_N + '(' + b_Hasanta + '?)' + r_G + + '(' + b_Hasanta + '?)' + r_K + '(' + b_Hasanta + '?)' + r_K + '(' + + b_Hasanta + '?)' + r_H + '))'; End; End. - diff --git a/Keyboard and Spell checker/Units/SkinLoader.pas b/Keyboard and Spell checker/Units/SkinLoader.pas index 24ba3bd..437b120 100644 --- a/Keyboard and Spell checker/Units/SkinLoader.pas +++ b/Keyboard and Spell checker/Units/SkinLoader.pas @@ -1,551 +1,745 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - -{COMPLETE TRANSFERING EXCEPT SKIN CONVERSION} +{ COMPLETE TRANSFERING EXCEPT SKIN CONVERSION } Unit SkinLoader; Interface Uses - Classes, - SysUtils, - Forms, - Windows, - NativeXml, - Graphics; + Classes, + SysUtils, + Forms, + Windows, + XMLIntf, XMLDoc, + Graphics; Function LoadSkin(Const FullSkinPath: String): Boolean; Procedure GetSkinPreviewPicture(Const SkinPath: String; Pic: TPicture); Function GetSkinDescription(Const SkinPath: String): Boolean; Function InstallSkin(Const SkinPath: String): Boolean; - Implementation + {$R ../Skin/Internal_Skin.res} { DONE : Add final skin here } Uses - uTopBar, - ufrmAboutSkinLayout, - uWindowHandlers, - clsSkinLayoutConverter, - uFileFolderHandling; + uTopBar, + ufrmAboutSkinLayout, + uWindowHandlers, + Soap.EncdDecd, + clsSkinLayoutConverter, + uFileFolderHandling; {$HINTS Off} Function LoadSkin(Const FullSkinPath: String): Boolean; Var - XML : TNativeXml; - Stream : TStringStream; - - AvroIconAdded : Boolean; - KeyboardModeAdded : Boolean; - KeyboardLayoutAdded : Boolean; - LayoutViewerAdded : Boolean; - AvroMouseAdded : Boolean; - ToolsAdded : Boolean; - WebAdded : Boolean; - HelpAdded : Boolean; - ExitAdded : Boolean; - Resource : TResourceStream; - m_Converter : TSkinLayoutConverter; + XML: IXMLDocument; + Stream: TStringStream; + AvroIconAdded: Boolean; + KeyboardModeAdded: Boolean; + KeyboardLayoutAdded: Boolean; + LayoutViewerAdded: Boolean; + AvroMouseAdded: Boolean; + ToolsAdded: Boolean; + WebAdded: Boolean; + HelpAdded: Boolean; + ExitAdded: Boolean; + Resource: TResourceStream; + m_Converter: TSkinLayoutConverter; + Begin - Result := False; - AvroIconAdded := False; - KeyboardModeAdded := False; - KeyboardLayoutAdded := False; - LayoutViewerAdded := False; - AvroMouseAdded := False; - ToolsAdded := False; - WebAdded := False; - HelpAdded := False; - ExitAdded := False; - Try - Try - XML := TNativeXml.Create; - XML.ExternalEncoding := seUTF8; - - - If LowerCase(FullSkinPath) <> 'internalskin*' Then Begin - m_Converter := TSkinLayoutConverter.Create; - m_Converter.CheckConvertSkin(FullSkinPath); - FreeAndNil(m_Converter); - XML.LoadFromFile(FullSkinPath); - End - Else Begin - Resource := TResourceStream.Create(Hinstance, 'SKIN0', RT_RCDATA); - XML.LoadFromStream(Resource); - FreeAndNil(Resource); - End; - - //---------------------------------------------- - //Check if the skin is a compatible one - If trim(Xml.Root.FindNode('AvroKeyboardVersion').ValueAsUnicodeString) <> '5' Then Begin - Application.MessageBox('This Skin is not compatible with current version of Avro Keyboard.', 'Error loading skin...', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - Result := False; - Exit; - End; - //---------------------------------------------- - - //'Which buttons are added? - If trim(Xml.Root.FindNode('AvroIconAdded').ValueAsUnicodeString) = '1' Then - AvroIconAdded := True; - - If trim(Xml.Root.FindNode('KeyboardModeAdded').ValueAsUnicodeString) = '1' Then - KeyboardModeAdded := True; - - If trim(Xml.Root.FindNode('KeyboardLayoutAdded').ValueAsUnicodeString) = '1' Then - KeyboardLayoutAdded := True; - - If trim(Xml.Root.FindNode('LayoutViewerAdded').ValueAsUnicodeString) = '1' Then - LayoutViewerAdded := True; - - If trim(Xml.Root.FindNode('AvroMouseAdded').ValueAsUnicodeString) = '1' Then - AvroMouseAdded := True; - - If trim(Xml.Root.FindNode('ToolsAdded').ValueAsUnicodeString) = '1' Then - ToolsAdded := True; - - If trim(Xml.Root.FindNode('WebAdded').ValueAsUnicodeString) = '1' Then - WebAdded := True; - - If trim(Xml.Root.FindNode('HelpAdded').ValueAsUnicodeString) = '1' Then - HelpAdded := True; - - If trim(Xml.Root.FindNode('ExitAdded').ValueAsUnicodeString) = '1' Then - ExitAdded := True; - - //---------------------------------------------- - - //Skin the TopBar - Stream := TStringStream.Create(Xml.Root.FindNode('TopBarMain').BinaryString); - Topbar.ImgMain.Picture.Bitmap.LoadFromStream(Stream); - Stream.Free; - TopBar.Height := Xml.Root.FindNode('TopBarHeight').ValueAsInteger; - TopBar.Width := Xml.Root.FindNode('TopBarWidth').ValueAsInteger; - //---------------------------------------------- - - //Skin Buttons - If AvroIconAdded = True Then Begin - Topbar.ImgAppIcon.Visible := True; - Stream := TStringStream.Create(Xml.Root.FindNode('AvroIconNormal').BinaryString); - Topbar.BMP_AppIcon.LoadFromStream(Stream); - Stream.Free; - Stream := TStringStream.Create(Xml.Root.FindNode('AvroIconDown').BinaryString); - Topbar.BMP_AppIcon_Down.LoadFromStream(Stream); - Stream.Free; - Stream := TStringStream.Create(Xml.Root.FindNode('AvroIconOver').BinaryString); - Topbar.BMP_AppIcon_Over.LoadFromStream(Stream); - Stream.Free; - TopBar.ImgAppIcon.Height := Xml.Root.FindNode('AvroIconHeight').ValueAsInteger; - TopBar.ImgAppIcon.Width := Xml.Root.FindNode('AvroIconWidth').ValueAsInteger; - TopBar.ImgAppIcon.Top := Xml.Root.FindNode('AvroIconTop').ValueAsInteger; - TopBar.ImgAppIcon.Left := Xml.Root.FindNode('AvroIconLeft').ValueAsInteger; - End - Else Begin - Topbar.ImgAppIcon.Visible := False; - End; - - - - If KeyboardModeAdded = True Then Begin - Topbar.ImgButtonMode.Visible := True; - Stream := TStringStream.Create(Xml.Root.FindNode('KeyboardModeEnglishNormal').BinaryString); - Topbar.BMP_ButtonModeE.LoadFromStream(Stream); - Stream.Free; - Stream := TStringStream.Create(Xml.Root.FindNode('KeyboardModeEnglishDown').BinaryString); - Topbar.BMP_ButtonModeE_Down.LoadFromStream(Stream); - Stream.Free; - Stream := TStringStream.Create(Xml.Root.FindNode('KeyboardModeEnglishOver').BinaryString); - Topbar.BMP_ButtonModeE_Over.LoadFromStream(Stream); - Stream.Free; - Stream := TStringStream.Create(Xml.Root.FindNode('KeyboardModeBanglaNormal').BinaryString); - Topbar.BMP_ButtonModeB.LoadFromStream(Stream); - Stream.Free; - Stream := TStringStream.Create(Xml.Root.FindNode('KeyboardModeBanglaDown').BinaryString); - Topbar.BMP_ButtonModeB_Down.LoadFromStream(Stream); - Stream.Free; - Stream := TStringStream.Create(Xml.Root.FindNode('KeyboardModeBanglaOver').BinaryString); - Topbar.BMP_ButtonModeB_Over.LoadFromStream(Stream); - Stream.Free; - TopBar.ImgButtonMode.Height := Xml.Root.FindNode('KeyboardModeHeight').ValueAsInteger; - TopBar.ImgButtonMode.Width := Xml.Root.FindNode('KeyboardModeWidth').ValueAsInteger; - TopBar.ImgButtonMode.Top := Xml.Root.FindNode('KeyboardModeTop').ValueAsInteger; - TopBar.ImgButtonMode.Left := Xml.Root.FindNode('KeyboardModeLeft').ValueAsInteger; - End - Else Begin - Topbar.ImgButtonMode.Visible := False; - End; - - - If KeyboardLayoutAdded = True Then Begin - Topbar.ImgButtonLayoutDown.Visible := True; - Stream := TStringStream.Create(Xml.Root.FindNode('KeyboardLayoutNormal').BinaryString); - Topbar.BMP_ButtonLayoutDown.LoadFromStream(Stream); - Stream.Free; - Stream := TStringStream.Create(Xml.Root.FindNode('KeyboardLayoutDown').BinaryString); - Topbar.BMP_ButtonLayoutDown_Down.LoadFromStream(Stream); - Stream.Free; - Stream := TStringStream.Create(Xml.Root.FindNode('KeyboardLayoutOver').BinaryString); - Topbar.BMP_ButtonLayoutDown_Over.LoadFromStream(Stream); - Stream.Free; - TopBar.ImgButtonLayoutDown.Height := Xml.Root.FindNode('KeyboardLayoutHeight').ValueAsInteger; - TopBar.ImgButtonLayoutDown.Width := Xml.Root.FindNode('KeyboardLayoutWidth').ValueAsInteger; - TopBar.ImgButtonLayoutDown.Top := Xml.Root.FindNode('KeyboardLayoutTop').ValueAsInteger; - TopBar.ImgButtonLayoutDown.Left := Xml.Root.FindNode('KeyboardLayoutLeft').ValueAsInteger; - End - Else Begin - Topbar.ImgButtonLayoutDown.Visible := False; - End; - - - If LayoutViewerAdded = True Then Begin - Topbar.ImgButtonLayout.Visible := True; - Stream := TStringStream.Create(Xml.Root.FindNode('LayoutViewerNormal').BinaryString); - Topbar.BMP_ButtonLayout.LoadFromStream(Stream); - Stream.Free; - Stream := TStringStream.Create(Xml.Root.FindNode('LayoutViewerDown').BinaryString); - Topbar.BMP_ButtonLayout_Down.LoadFromStream(Stream); - Stream.Free; - Stream := TStringStream.Create(Xml.Root.FindNode('LayoutViewerOver').BinaryString); - Topbar.BMP_ButtonLayout_Over.LoadFromStream(Stream); - Stream.Free; - TopBar.ImgButtonLayout.Height := Xml.Root.FindNode('LayoutViewerHeight').ValueAsInteger; - TopBar.ImgButtonLayout.Width := Xml.Root.FindNode('LayoutViewerWidth').ValueAsInteger; - TopBar.ImgButtonLayout.Top := Xml.Root.FindNode('LayoutViewerTop').ValueAsInteger; - TopBar.ImgButtonLayout.Left := Xml.Root.FindNode('LayoutViewerLeft').ValueAsInteger; - End - Else Begin - Topbar.ImgButtonLayout.Visible := False; - End; - - - If AvroMouseAdded = True Then Begin - Topbar.ImgButtonMouse.Visible := True; - Stream := TStringStream.Create(Xml.Root.FindNode('AvroMouseNormal').BinaryString); - Topbar.BMP_ButtonMouse.LoadFromStream(Stream); - Stream.Free; - Stream := TStringStream.Create(Xml.Root.FindNode('AvroMouseDown').BinaryString); - Topbar.BMP_ButtonMouse_Down.LoadFromStream(Stream); - Stream.Free; - Stream := TStringStream.Create(Xml.Root.FindNode('AvroMouseOver').BinaryString); - Topbar.BMP_ButtonMouse_Over.LoadFromStream(Stream); - Stream.Free; - TopBar.ImgButtonMouse.Height := Xml.Root.FindNode('AvroMouseHeight').ValueAsInteger; - TopBar.ImgButtonMouse.Width := Xml.Root.FindNode('AvroMouseWidth').ValueAsInteger; - TopBar.ImgButtonMouse.Top := Xml.Root.FindNode('AvroMouseTop').ValueAsInteger; - TopBar.ImgButtonMouse.Left := Xml.Root.FindNode('AvroMouseLeft').ValueAsInteger; - End - Else Begin - Topbar.ImgButtonMouse.Visible := False; - End; - - - If ToolsAdded = True Then Begin - Topbar.ImgButtonTools.Visible := True; - Stream := TStringStream.Create(Xml.Root.FindNode('ToolsNormal').BinaryString); - Topbar.BMP_ButtonTools.LoadFromStream(Stream); - Stream.Free; - Stream := TStringStream.Create(Xml.Root.FindNode('ToolsDown').BinaryString); - Topbar.BMP_ButtonTools_Down.LoadFromStream(Stream); - Stream.Free; - Stream := TStringStream.Create(Xml.Root.FindNode('ToolsOver').BinaryString); - Topbar.BMP_ButtonTools_Over.LoadFromStream(Stream); - Stream.Free; - TopBar.ImgButtonTools.Height := Xml.Root.FindNode('ToolsHeight').ValueAsInteger; - TopBar.ImgButtonTools.Width := Xml.Root.FindNode('ToolsWidth').ValueAsInteger; - TopBar.ImgButtonTools.Top := Xml.Root.FindNode('ToolsTop').ValueAsInteger; - TopBar.ImgButtonTools.Left := Xml.Root.FindNode('ToolsLeft').ValueAsInteger; - End - Else Begin - Topbar.ImgButtonTools.Visible := False; - End; - - - - If WebAdded = True Then Begin - Topbar.ImgButtonWWW.Visible := True; - Stream := TStringStream.Create(Xml.Root.FindNode('WebNormal').BinaryString); - Topbar.BMP_ButtonWWW.LoadFromStream(Stream); - Stream.Free; - Stream := TStringStream.Create(Xml.Root.FindNode('WebDown').BinaryString); - Topbar.BMP_ButtonWWW_Down.LoadFromStream(Stream); - Stream.Free; - Stream := TStringStream.Create(Xml.Root.FindNode('WebOver').BinaryString); - Topbar.BMP_ButtonWWW_Over.LoadFromStream(Stream); - Stream.Free; - TopBar.ImgButtonWWW.Height := Xml.Root.FindNode('WebHeight').ValueAsInteger; - TopBar.ImgButtonWWW.Width := Xml.Root.FindNode('WebWidth').ValueAsInteger; - TopBar.ImgButtonWWW.Left := Xml.Root.FindNode('WebLeft').ValueAsInteger; - TopBar.ImgButtonWWW.Top := Xml.Root.FindNode('WebTop').ValueAsInteger; - End - Else Begin - Topbar.ImgButtonWWW.Visible := False; - End; - - - If HelpAdded = True Then Begin - Topbar.ImgButtonHelp.Visible := True; - Stream := TStringStream.Create(Xml.Root.FindNode('HelpNormal').BinaryString); - Topbar.BMP_ButtonHelp.LoadFromStream(Stream); - Stream.Free; - Stream := TStringStream.Create(Xml.Root.FindNode('HelpDown').BinaryString); - Topbar.BMP_ButtonHelp_Down.LoadFromStream(Stream); - Stream.Free; - Stream := TStringStream.Create(Xml.Root.FindNode('HelpOver').BinaryString); - Topbar.BMP_ButtonHelp_Over.LoadFromStream(Stream); - Stream.Free; - TopBar.ImgButtonHelp.Height := Xml.Root.FindNode('HelpHeight').ValueAsInteger; - TopBar.ImgButtonHelp.Width := Xml.Root.FindNode('HelpWidth').ValueAsInteger; - TopBar.ImgButtonHelp.Left := Xml.Root.FindNode('HelpLeft').ValueAsInteger; - TopBar.ImgButtonHelp.Top := Xml.Root.FindNode('HelpTop').ValueAsInteger; - End - Else Begin - Topbar.ImgButtonHelp.Visible := False; - End; - - - If ExitAdded = True Then Begin - Topbar.ImgButtonMinimize.Visible := True; - Stream := TStringStream.Create(Xml.Root.FindNode('ExitNormal').BinaryString); - Topbar.BMP_ButtonMinimize.LoadFromStream(Stream); - Stream.Free; - Stream := TStringStream.Create(Xml.Root.FindNode('ExitDown').BinaryString); - Topbar.BMP_ButtonMinimize_Down.LoadFromStream(Stream); - Stream.Free; - Stream := TStringStream.Create(Xml.Root.FindNode('ExitOver').BinaryString); - Topbar.BMP_ButtonMinimize_Over.LoadFromStream(Stream); - Stream.Free; - TopBar.ImgButtonMinimize.Height := Xml.Root.FindNode('ExitHeight').ValueAsInteger; - TopBar.ImgButtonMinimize.Width := Xml.Root.FindNode('ExitWidth').ValueAsInteger; - TopBar.ImgButtonMinimize.Left := Xml.Root.FindNode('ExitLeft').ValueAsInteger; - TopBar.ImgButtonMinimize.Top := Xml.Root.FindNode('ExitTop').ValueAsInteger; - End - Else Begin - Topbar.ImgButtonMinimize.Visible := False; - End; - - //---------------------------------------------- - - - //Loading skin is succefull - Result := True; - Except - On E: Exception Do Begin - Application.MessageBox(PChar('Error loading skin!' + #10 + '' + #10 + 'Make sure ' + ExtractFileName(FullSkinPath) + ' is a valid skin file or skin is not corrupt.'), 'Avro Keyboard', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - Result := False; - End; - End; - Finally - FreeAndNil(XML); - End; + Result := False; + AvroIconAdded := False; + KeyboardModeAdded := False; + KeyboardLayoutAdded := False; + LayoutViewerAdded := False; + AvroMouseAdded := False; + ToolsAdded := False; + WebAdded := False; + HelpAdded := False; + ExitAdded := False; + Try + Try + XML := TXMLDocument.Create(nil); + + XML.Active := true; + XML.Encoding := 'UTF-8'; + + If LowerCase(FullSkinPath) <> 'internalskin*' Then + Begin + m_Converter := TSkinLayoutConverter.Create; + m_Converter.CheckConvertSkin(FullSkinPath); + FreeAndNil(m_Converter); + XML.LoadFromFile(FullSkinPath); + End + Else + Begin + Resource := TResourceStream.Create(Hinstance, 'SKIN0', RT_RCDATA); + XML.LoadFromStream(Resource); + FreeAndNil(Resource); + End; + + // ---------------------------------------------- + // Check if the skin is a compatible one + If trim(XML.DocumentElement.childnodes.FindNode('AvroKeyboardVersion') + .nodevalue) <> '5' Then + Begin + Application.MessageBox + ('This Skin is not compatible with current version of Avro Keyboard.', + 'Error loading skin...', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + + MB_APPLMODAL); + Result := False; + Exit; + End; + // ---------------------------------------------- + + // 'Which buttons are added? + If trim(XML.DocumentElement.childnodes.FindNode('AvroIconAdded') + .nodevalue) = '1' Then + AvroIconAdded := true; + + If trim(XML.DocumentElement.childnodes.FindNode('KeyboardModeAdded') + .nodevalue) = '1' Then + KeyboardModeAdded := true; + + If trim(XML.DocumentElement.childnodes.FindNode('KeyboardLayoutAdded') + .nodevalue) = '1' Then + KeyboardLayoutAdded := true; + + If trim(XML.DocumentElement.childnodes.FindNode('LayoutViewerAdded') + .nodevalue) = '1' Then + LayoutViewerAdded := true; + + If trim(XML.DocumentElement.childnodes.FindNode('AvroMouseAdded') + .nodevalue) = '1' Then + AvroMouseAdded := true; + + If trim(XML.DocumentElement.childnodes.FindNode('ToolsAdded').nodevalue) + = '1' Then + ToolsAdded := true; + + If trim(XML.DocumentElement.childnodes.FindNode('WebAdded').nodevalue) + = '1' Then + WebAdded := true; + + If trim(XML.DocumentElement.childnodes.FindNode('HelpAdded').nodevalue) + = '1' Then + HelpAdded := true; + + If trim(XML.DocumentElement.childnodes.FindNode('ExitAdded').nodevalue) + = '1' Then + ExitAdded := true; + + // ---------------------------------------------- + + // Skin the TopBar + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('TopBarMain').nodevalue)); + Topbar.ImgMain.Picture.Bitmap.LoadFromStream(Stream); + Stream.Free; + Topbar.Height := XML.DocumentElement.childnodes.FindNode('TopBarHeight') + .nodevalue; + Topbar.Width := XML.DocumentElement.childnodes.FindNode('TopBarWidth') + .nodevalue; + // ---------------------------------------------- + + // Skin Buttons + If AvroIconAdded = true Then + Begin + Topbar.ImgAppIcon.Visible := true; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('AvroIconNormal').nodevalue)); + Topbar.BMP_AppIcon.LoadFromStream(Stream); + Stream.Free; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('AvroIconDown').nodevalue)); + Topbar.BMP_AppIcon_Down.LoadFromStream(Stream); + Stream.Free; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('AvroIconOver').nodevalue)); + Topbar.BMP_AppIcon_Over.LoadFromStream(Stream); + Stream.Free; + Topbar.ImgAppIcon.Height := XML.DocumentElement.childnodes.FindNode + ('AvroIconHeight').nodevalue; + Topbar.ImgAppIcon.Width := XML.DocumentElement.childnodes.FindNode + ('AvroIconWidth').nodevalue; + Topbar.ImgAppIcon.Top := XML.DocumentElement.childnodes.FindNode + ('AvroIconTop').nodevalue; + Topbar.ImgAppIcon.Left := XML.DocumentElement.childnodes.FindNode + ('AvroIconLeft').nodevalue; + End + Else + Begin + Topbar.ImgAppIcon.Visible := False; + End; + + If KeyboardModeAdded = true Then + Begin + Topbar.ImgButtonMode.Visible := true; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('KeyboardModeEnglishNormal').nodevalue)); + Topbar.BMP_ButtonModeE.LoadFromStream(Stream); + Stream.Free; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('KeyboardModeEnglishDown').nodevalue)); + Topbar.BMP_ButtonModeE_Down.LoadFromStream(Stream); + Stream.Free; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('KeyboardModeEnglishOver').nodevalue)); + Topbar.BMP_ButtonModeE_Over.LoadFromStream(Stream); + Stream.Free; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('KeyboardModeBanglaNormal').nodevalue)); + Topbar.BMP_ButtonModeB.LoadFromStream(Stream); + Stream.Free; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('KeyboardModeBanglaDown').nodevalue)); + Topbar.BMP_ButtonModeB_Down.LoadFromStream(Stream); + Stream.Free; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('KeyboardModeBanglaOver').nodevalue)); + Topbar.BMP_ButtonModeB_Over.LoadFromStream(Stream); + Stream.Free; + Topbar.ImgButtonMode.Height := XML.DocumentElement.childnodes.FindNode + ('KeyboardModeHeight').nodevalue; + Topbar.ImgButtonMode.Width := XML.DocumentElement.childnodes.FindNode + ('KeyboardModeWidth').nodevalue; + Topbar.ImgButtonMode.Top := XML.DocumentElement.childnodes.FindNode + ('KeyboardModeTop').nodevalue; + Topbar.ImgButtonMode.Left := XML.DocumentElement.childnodes.FindNode + ('KeyboardModeLeft').nodevalue; + End + Else + Begin + Topbar.ImgButtonMode.Visible := False; + End; + + If KeyboardLayoutAdded = true Then + Begin + Topbar.ImgButtonLayoutDown.Visible := true; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('KeyboardLayoutNormal').nodevalue)); + Topbar.BMP_ButtonLayoutDown.LoadFromStream(Stream); + Stream.Free; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('KeyboardLayoutDown').nodevalue)); + Topbar.BMP_ButtonLayoutDown_Down.LoadFromStream(Stream); + Stream.Free; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('KeyboardLayoutOver').nodevalue)); + Topbar.BMP_ButtonLayoutDown_Over.LoadFromStream(Stream); + Stream.Free; + Topbar.ImgButtonLayoutDown.Height := + XML.DocumentElement.childnodes.FindNode('KeyboardLayoutHeight') + .nodevalue; + Topbar.ImgButtonLayoutDown.Width := + XML.DocumentElement.childnodes.FindNode('KeyboardLayoutWidth') + .nodevalue; + Topbar.ImgButtonLayoutDown.Top := + XML.DocumentElement.childnodes.FindNode('KeyboardLayoutTop') + .nodevalue; + Topbar.ImgButtonLayoutDown.Left := + XML.DocumentElement.childnodes.FindNode('KeyboardLayoutLeft') + .nodevalue; + End + Else + Begin + Topbar.ImgButtonLayoutDown.Visible := False; + End; + + If LayoutViewerAdded = true Then + Begin + Topbar.ImgButtonLayout.Visible := true; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('LayoutViewerNormal').nodevalue)); + Topbar.BMP_ButtonLayout.LoadFromStream(Stream); + Stream.Free; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('LayoutViewerDown').nodevalue)); + Topbar.BMP_ButtonLayout_Down.LoadFromStream(Stream); + Stream.Free; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('LayoutViewerOver').nodevalue)); + Topbar.BMP_ButtonLayout_Over.LoadFromStream(Stream); + Stream.Free; + Topbar.ImgButtonLayout.Height := XML.DocumentElement.childnodes.FindNode + ('LayoutViewerHeight').nodevalue; + Topbar.ImgButtonLayout.Width := XML.DocumentElement.childnodes.FindNode + ('LayoutViewerWidth').nodevalue; + Topbar.ImgButtonLayout.Top := XML.DocumentElement.childnodes.FindNode + ('LayoutViewerTop').nodevalue; + Topbar.ImgButtonLayout.Left := XML.DocumentElement.childnodes.FindNode + ('LayoutViewerLeft').nodevalue; + End + Else + Begin + Topbar.ImgButtonLayout.Visible := False; + End; + + If AvroMouseAdded = true Then + Begin + Topbar.ImgButtonMouse.Visible := true; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('AvroMouseNormal').nodevalue)); + Topbar.BMP_ButtonMouse.LoadFromStream(Stream); + Stream.Free; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('AvroMouseDown').nodevalue)); + Topbar.BMP_ButtonMouse_Down.LoadFromStream(Stream); + Stream.Free; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('AvroMouseOver').nodevalue)); + Topbar.BMP_ButtonMouse_Over.LoadFromStream(Stream); + Stream.Free; + Topbar.ImgButtonMouse.Height := XML.DocumentElement.childnodes.FindNode + ('AvroMouseHeight').nodevalue; + Topbar.ImgButtonMouse.Width := XML.DocumentElement.childnodes.FindNode + ('AvroMouseWidth').nodevalue; + Topbar.ImgButtonMouse.Top := XML.DocumentElement.childnodes.FindNode + ('AvroMouseTop').nodevalue; + Topbar.ImgButtonMouse.Left := XML.DocumentElement.childnodes.FindNode + ('AvroMouseLeft').nodevalue; + End + Else + Begin + Topbar.ImgButtonMouse.Visible := False; + End; + + If ToolsAdded = true Then + Begin + Topbar.ImgButtonTools.Visible := true; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('ToolsNormal').nodevalue)); + Topbar.BMP_ButtonTools.LoadFromStream(Stream); + Stream.Free; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('ToolsDown').nodevalue)); + Topbar.BMP_ButtonTools_Down.LoadFromStream(Stream); + Stream.Free; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('ToolsOver').nodevalue)); + Topbar.BMP_ButtonTools_Over.LoadFromStream(Stream); + Stream.Free; + Topbar.ImgButtonTools.Height := XML.DocumentElement.childnodes.FindNode + ('ToolsHeight').nodevalue; + Topbar.ImgButtonTools.Width := XML.DocumentElement.childnodes.FindNode + ('ToolsWidth').nodevalue; + Topbar.ImgButtonTools.Top := XML.DocumentElement.childnodes.FindNode + ('ToolsTop').nodevalue; + Topbar.ImgButtonTools.Left := XML.DocumentElement.childnodes.FindNode + ('ToolsLeft').nodevalue; + End + Else + Begin + Topbar.ImgButtonTools.Visible := False; + End; + + If WebAdded = true Then + Begin + Topbar.ImgButtonWWW.Visible := true; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('WebNormal').nodevalue)); + Topbar.BMP_ButtonWWW.LoadFromStream(Stream); + Stream.Free; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('WebDown').nodevalue)); + Topbar.BMP_ButtonWWW_Down.LoadFromStream(Stream); + Stream.Free; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('WebOver').nodevalue)); + Topbar.BMP_ButtonWWW_Over.LoadFromStream(Stream); + Stream.Free; + Topbar.ImgButtonWWW.Height := XML.DocumentElement.childnodes.FindNode + ('WebHeight').nodevalue; + Topbar.ImgButtonWWW.Width := XML.DocumentElement.childnodes.FindNode + ('WebWidth').nodevalue; + Topbar.ImgButtonWWW.Left := XML.DocumentElement.childnodes.FindNode + ('WebLeft').nodevalue; + Topbar.ImgButtonWWW.Top := XML.DocumentElement.childnodes.FindNode + ('WebTop').nodevalue; + End + Else + Begin + Topbar.ImgButtonWWW.Visible := False; + End; + + If HelpAdded = true Then + Begin + Topbar.ImgButtonHelp.Visible := true; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('HelpNormal').nodevalue)); + Topbar.BMP_ButtonHelp.LoadFromStream(Stream); + Stream.Free; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('HelpDown').nodevalue)); + Topbar.BMP_ButtonHelp_Down.LoadFromStream(Stream); + Stream.Free; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('HelpOver').nodevalue)); + Topbar.BMP_ButtonHelp_Over.LoadFromStream(Stream); + Stream.Free; + Topbar.ImgButtonHelp.Height := XML.DocumentElement.childnodes.FindNode + ('HelpHeight').nodevalue; + Topbar.ImgButtonHelp.Width := XML.DocumentElement.childnodes.FindNode + ('HelpWidth').nodevalue; + Topbar.ImgButtonHelp.Left := XML.DocumentElement.childnodes.FindNode + ('HelpLeft').nodevalue; + Topbar.ImgButtonHelp.Top := XML.DocumentElement.childnodes.FindNode + ('HelpTop').nodevalue; + End + Else + Begin + Topbar.ImgButtonHelp.Visible := False; + End; + + If ExitAdded = true Then + Begin + Topbar.ImgButtonMinimize.Visible := true; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('ExitNormal').nodevalue)); + Topbar.BMP_ButtonMinimize.LoadFromStream(Stream); + Stream.Free; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('ExitDown').nodevalue)); + Topbar.BMP_ButtonMinimize_Down.LoadFromStream(Stream); + Stream.Free; + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('ExitOver').nodevalue)); + Topbar.BMP_ButtonMinimize_Over.LoadFromStream(Stream); + Stream.Free; + Topbar.ImgButtonMinimize.Height := + XML.DocumentElement.childnodes.FindNode('ExitHeight').nodevalue; + Topbar.ImgButtonMinimize.Width := + XML.DocumentElement.childnodes.FindNode('ExitWidth').nodevalue; + Topbar.ImgButtonMinimize.Left := XML.DocumentElement.childnodes.FindNode + ('ExitLeft').nodevalue; + Topbar.ImgButtonMinimize.Top := XML.DocumentElement.childnodes.FindNode + ('ExitTop').nodevalue; + End + Else + Begin + Topbar.ImgButtonMinimize.Visible := False; + End; + + // ---------------------------------------------- + + // Loading skin is succefull + Result := true; + Except + On E: Exception Do + Begin + Application.MessageBox(PChar('Error loading skin!' + #10 + '' + #10 + + 'Make sure ' + ExtractFileName(FullSkinPath) + + ' is a valid skin file or skin is not corrupt.'), 'Avro Keyboard', + MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); + Result := False; + End; + End; + Finally + + XML.Active := False; + XML := Nil; + + End; End; {$HINTS On} Procedure GetSkinPreviewPicture(Const SkinPath: String; Pic: TPicture); Var - XML : TNativeXml; - Stream : TStringStream; - Resource : TResourceStream; - m_Converter : TSkinLayoutConverter; + XML: IXMLDocument; + Stream: TStringStream; + Resource: TResourceStream; + m_Converter: TSkinLayoutConverter; + Begin - Try - Try - XML := TNativeXml.Create; - XML.ExternalEncoding := seUTF8; - - If LowerCase(SkinPath) <> 'internalskin*' Then Begin - m_Converter := TSkinLayoutConverter.Create; - m_Converter.CheckConvertSkin(SkinPath); - FreeAndNil(m_Converter); - XML.LoadFromFile(SkinPath); - End - Else Begin - Resource := TResourceStream.Create(Hinstance, 'SKIN0', RT_RCDATA); - XML.LoadFromStream(Resource); - FreeAndNil(Resource); - End; - - //---------------------------------------------- - //Check if the skin is a compatible one - If trim(Xml.Root.FindNode('AvroKeyboardVersion').ValueAsUnicodeString) <> '5' Then Begin - Application.MessageBox('This Skin is not compatible with current version of Avro Keyboard.', 'Error loading skin...', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - Exit; - End; - //---------------------------------------------- - - - Stream := TStringStream.Create(Xml.Root.FindNode('Preview').BinaryString); - Pic.Bitmap.LoadFromStream(Stream); - Stream.Free; - - Except - On E: Exception Do Begin - Application.MessageBox(Pchar('Error loading skin preview image!' + #10 + '' + #10 + 'Make sure ' + ExtractFileName(SkinPath) + ' is a valid skin file or skin is not corrupt.'), 'Avro Keyboard', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - End; - End; - Finally - FreeAndNil(XML); - End; + Try + Try + + XML := TXMLDocument.Create(nil); + XML.Active := true; + XML.Encoding := 'UTF-8'; + + If LowerCase(SkinPath) <> 'internalskin*' Then + Begin + m_Converter := TSkinLayoutConverter.Create; + m_Converter.CheckConvertSkin(SkinPath); + FreeAndNil(m_Converter); + XML.LoadFromFile(SkinPath); + End + Else + Begin + Resource := TResourceStream.Create(Hinstance, 'SKIN0', RT_RCDATA); + XML.LoadFromStream(Resource); + FreeAndNil(Resource); + End; + + // ---------------------------------------------- + // Check if the skin is a compatible one + If trim(XML.DocumentElement.childnodes.FindNode('AvroKeyboardVersion') + .nodevalue) <> '5' Then + Begin + Application.MessageBox + ('This Skin is not compatible with current version of Avro Keyboard.', + 'Error loading skin...', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + + MB_APPLMODAL); + Exit; + End; + // ---------------------------------------------- + + Stream := TStringStream.Create + (Soap.EncdDecd.DecodeBase64(XML.DocumentElement.childnodes.FindNode + ('Preview').nodevalue)); + Pic.Bitmap.LoadFromStream(Stream); + Stream.Free; + + Except + On E: Exception Do + Begin + Application.MessageBox(PChar('Error loading skin preview image!' + #10 + + '' + #10 + 'Make sure ' + ExtractFileName(SkinPath) + + ' is a valid skin file or skin is not corrupt.'), 'Avro Keyboard', + MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); + End; + End; + Finally + XML.Active := False; + XML := Nil; + + End; End; Function GetSkinDescription(Const SkinPath: String): Boolean; Var - XML : TNativeXml; - Resource : TResourceStream; + XML: IXMLDocument; + Resource: TResourceStream; + + SkinName, DesignerName, SkinVersion, DesignerComment: String; + m_Converter: TSkinLayoutConverter; - SkinName, DesignerName, SkinVersion, DesignerComment: String; - m_Converter : TSkinLayoutConverter; Begin - result := False; - Try - Try - XML := TNativeXml.Create; - XML.ExternalEncoding := seUTF8; - - If LowerCase(SkinPath) <> 'internalskin*' Then Begin - m_Converter := TSkinLayoutConverter.Create; - m_Converter.CheckConvertSkin(SkinPath); - FreeAndNil(m_Converter); - XML.LoadFromFile(SkinPath); - End - Else Begin - Resource := TResourceStream.Create(Hinstance, 'SKIN0', RT_RCDATA); - XML.LoadFromStream(Resource); - FreeAndNil(Resource); - End; - - //---------------------------------------------- - //Check if the skin is a compatible one - If trim(Xml.Root.FindNode('AvroKeyboardVersion').ValueAsUnicodeString) <> '5' Then Begin - Application.MessageBox('This Skin is not compatible with current version of Avro Keyboard.', 'Error loading skin...', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - Exit; - End; - //---------------------------------------------- - - SkinName := Xml.Root.FindNode('SkinName').Nodes[0].ValueAsUnicodeString; - DesignerName := Xml.Root.FindNode('DesignerName').Nodes[0].ValueAsUnicodeString; - SkinVersion := Xml.Root.FindNode('SkinVersion').Nodes[0].ValueAsUnicodeString; - DesignerComment := Xml.Root.FindNode('DesignerComment').Nodes[0].ValueAsUnicodeString; - - CheckCreateForm(TfrmAboutSkinLayout, frmAboutSkinLayout, 'frmAboutSkinLayout'); - - frmAboutSkinLayout.txtName.text := SkinName; - frmAboutSkinLayout.txtVersion.text := SkinVersion; - frmAboutSkinLayout.txtDeveloper.text := DesignerName; - frmAboutSkinLayout.txtComment.text := DesignerComment; - - frmAboutSkinLayout.ShowDescription; - - Except - On E: Exception Do Begin - Application.MessageBox(PChar('Error loading skin description!' + #10 + '' + #10 + 'Make sure ' + ExtractFileName(SkinPath) + ' is a valid skin file or skin is not corrupt.'), 'Avro Keyboard', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - result := False; - End; - End; - Finally - FreeAndNil(XML); - End; + Result := False; + Try + Try + + XML := TXMLDocument.Create(nil); + XML.Active := true; + XML.Encoding := 'UTF-8'; + + If LowerCase(SkinPath) <> 'internalskin*' Then + Begin + m_Converter := TSkinLayoutConverter.Create; + m_Converter.CheckConvertSkin(SkinPath); + FreeAndNil(m_Converter); + XML.LoadFromFile(SkinPath); + End + Else + Begin + Resource := TResourceStream.Create(Hinstance, 'SKIN0', RT_RCDATA); + XML.LoadFromStream(Resource); + FreeAndNil(Resource); + End; + + // ---------------------------------------------- + // Check if the skin is a compatible one + If trim(XML.DocumentElement.childnodes.FindNode('AvroKeyboardVersion') + .nodevalue) <> '5' Then + Begin + Application.MessageBox + ('This Skin is not compatible with current version of Avro Keyboard.', + 'Error loading skin...', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + + MB_APPLMODAL); + Exit; + End; + // ---------------------------------------------- + + SkinName := XML.DocumentElement.childnodes.FindNode('SkinName') + .childnodes.nodes[0].nodevalue; + DesignerName := XML.DocumentElement.childnodes.FindNode('DesignerName') + .childnodes.nodes[0].nodevalue; + SkinVersion := XML.DocumentElement.childnodes.FindNode('SkinVersion') + .childnodes.nodes[0].nodevalue; + DesignerComment := XML.DocumentElement.childnodes.FindNode + ('DesignerComment').childnodes.nodes[0].nodevalue; + + CheckCreateForm(TfrmAboutSkinLayout, frmAboutSkinLayout, + 'frmAboutSkinLayout'); + + frmAboutSkinLayout.txtName.text := SkinName; + frmAboutSkinLayout.txtVersion.text := SkinVersion; + frmAboutSkinLayout.txtDeveloper.text := DesignerName; + frmAboutSkinLayout.txtComment.text := DesignerComment; + + frmAboutSkinLayout.ShowDescription; + + Except + On E: Exception Do + Begin + Application.MessageBox(PChar('Error loading skin description!' + #10 + + '' + #10 + 'Make sure ' + ExtractFileName(SkinPath) + + ' is a valid skin file or skin is not corrupt.'), 'Avro Keyboard', + MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); + Result := False; + End; + End; + Finally + XML.Active := False; + XML := Nil; + + End; End; - {$HINTS Off} +{$HINTS Off} + Function InstallSkin(Const SkinPath: String): Boolean; Var - XML : TNativeXml; + XML: IXMLDocument; - SkinName, DesignerName, SkinVersion, DesignerComment: String; - m_Converter : TSkinLayoutConverter; - FileName : String; - Overwrite : boolean; + SkinName, DesignerName, SkinVersion, DesignerComment: String; + m_Converter: TSkinLayoutConverter; + FileName: String; + Overwrite: Boolean; Begin - result := False; - - Try - Try - XML := TNativeXml.Create; - XML.ExternalEncoding := seUTF8; - XML.LoadFromFile(SkinPath); - - - - SkinName := Xml.Root.FindNode('SkinName').Nodes[0].ValueAsUnicodeString; - DesignerName := Xml.Root.FindNode('DesignerName').Nodes[0].ValueAsUnicodeString; - SkinVersion := Xml.Root.FindNode('SkinVersion').Nodes[0].ValueAsUnicodeString; - DesignerComment := Xml.Root.FindNode('DesignerComment').Nodes[0].ValueAsUnicodeString; - - FreeAndNil(XML); - Filename := ExtractFilename(SkinPath); - - If FileExists(GetAvroDataDir + 'Skin\' + Filename) Then Begin - If Application.MessageBox(pchar('Skin "' + Filename + '" is already installed.' + #10 + 'Do you want to overwrite it?'), 'Avro Keyboard', MB_YESNO + MB_ICONQUESTION + MB_DEFBUTTON2 + MB_SYSTEMMODAL) = ID_YES Then - Overwrite := True - Else - Overwrite := False; - End; - - If MyCopyFile(SkinPath, GetAvroDataDir + 'Skin\' + Filename, Overwrite) Then Begin - Result := True; - Application.MessageBox(Pchar('Skin "' + Filename + '" has been installed successfully!' + #10 + '' + #10 + - 'Skin name: ' + SkinName + #10 + - 'Version: ' + SkinVersion + #10 + - 'Designer: ' + DesignerName + #10 + - 'Comment: ' + DesignerComment + #10 + - '' + #10 + 'Please use the settings dialog box to activate this skin.'), 'Avro Keyboard', MB_OK + MB_ICONASTERISK + MB_DEFBUTTON1 + MB_SYSTEMMODAL); - - //Check and convert the skin - m_Converter := TSkinLayoutConverter.Create; - m_Converter.CheckConvertSkin(GetAvroDataDir + 'Skin\' + Filename); - FreeAndNil(m_Converter); - - - End - Else Begin - Result := False; - Application.MessageBox(pchar('Skin "' + Filename + '" was not installed!'), - 'Avro Keyboard', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_SYSTEMMODAL); - End; - Except - On e: exception Do Begin - result := False; - - Application.MessageBox(pchar('Error installing skin!' + #10 + '' + #10 + '' + #10 + - 'Make sure this is a valid skin file' + #10 + 'or,' - + #10 + 'You have enough permission to write in skin folder' + #10 + - 'or,' + #10 + 'Skin directory is writable'), - 'Avro Keyboard', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_SYSTEMMODAL); - - End; - End; - Finally - FreeAndNil(XML); - End; + Result := False; + + Try + Try + + XML := TXMLDocument.Create(nil); + XML.Active := true; + XML.Encoding := 'UTF-8'; + + XML.LoadFromFile(SkinPath); + + SkinName := XML.DocumentElement.childnodes.FindNode('SkinName') + .childnodes.nodes[0].nodevalue; + DesignerName := XML.DocumentElement.childnodes.FindNode('DesignerName') + .childnodes.nodes[0].nodevalue; + SkinVersion := XML.DocumentElement.childnodes.FindNode('SkinVersion') + .childnodes.nodes[0].nodevalue; + DesignerComment := XML.DocumentElement.childnodes.FindNode + ('DesignerComment').childnodes.nodes[0].nodevalue; + + XML.Active := False; + XML := Nil; + + FileName := ExtractFileName(SkinPath); + + If FileExists(GetAvroDataDir + 'Skin\' + FileName) Then + Begin + If Application.MessageBox + (PChar('Skin "' + FileName + '" is already installed.' + #10 + + 'Do you want to overwrite it?'), 'Avro Keyboard', + MB_YESNO + MB_ICONQUESTION + MB_DEFBUTTON2 + MB_SYSTEMMODAL) + = ID_YES Then + Overwrite := true + Else + Overwrite := False; + End; + + If MyCopyFile(SkinPath, GetAvroDataDir + 'Skin\' + FileName, + Overwrite) Then + Begin + Result := true; + Application.MessageBox + (PChar('Skin "' + FileName + '" has been installed successfully!' + + #10 + '' + #10 + 'Skin name: ' + SkinName + #10 + 'Version: ' + + SkinVersion + #10 + 'Designer: ' + DesignerName + #10 + 'Comment: ' + + DesignerComment + #10 + '' + #10 + + 'Please use the settings dialog box to activate this skin.'), + 'Avro Keyboard', MB_OK + MB_ICONASTERISK + MB_DEFBUTTON1 + + MB_SYSTEMMODAL); + + // Check and convert the skin + m_Converter := TSkinLayoutConverter.Create; + m_Converter.CheckConvertSkin(GetAvroDataDir + 'Skin\' + FileName); + FreeAndNil(m_Converter); + + End + Else + Begin + Result := False; + Application.MessageBox + (PChar('Skin "' + FileName + '" was not installed!'), 'Avro Keyboard', + MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_SYSTEMMODAL); + End; + Except + On E: Exception Do + Begin + Result := False; + + Application.MessageBox(PChar('Error installing skin!' + #10 + '' + #10 + + '' + #10 + 'Make sure this is a valid skin file' + #10 + 'or,' + #10 + + 'You have enough permission to write in skin folder' + #10 + 'or,' + + #10 + 'Skin directory is writable'), 'Avro Keyboard', + MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_SYSTEMMODAL); + + End; + End; + Finally + XML.Active := False; + XML := Nil; + + End; End; - {$HINTS On} -End. +{$HINTS On} +End. diff --git a/Keyboard and Spell checker/Units/VirtualKeyCode.pas b/Keyboard and Spell checker/Units/VirtualKeyCode.pas index 9231c51..15244ae 100644 --- a/Keyboard and Spell checker/Units/VirtualKeyCode.pas +++ b/Keyboard and Spell checker/Units/VirtualKeyCode.pas @@ -1,25 +1,25 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= @@ -30,234 +30,232 @@ {$ELSE} {$INCLUDE ../ProjectDefines.inc} {$ENDIF} - Unit VirtualKeyCode; Interface Const - //--------------------------------------------------- - //Regularly used keycodes - - VK_ADD = $6B; - VK_APPS = $5D; - VK_BACK = $8; - VK_CAPITAL = $14; - VK_CONTROL = $11; - VK_DECIMAL = $6E; - VK_DELETE = $2E; - VK_DIVIDE = $6F; - VK_DOWN = $28; - VK_END = $23; - VK_F1 = $70; - VK_F10 = $79; - VK_F11 = $7A; - VK_F12 = $7B; - VK_F2 = $71; - VK_F3 = $72; - VK_F4 = $73; - VK_F5 = $74; - VK_F6 = $75; - VK_F7 = $76; - VK_F8 = $77; - VK_F9 = $78; - VK_HOME = $24; - VK_INSERT = $2D; - VK_LBUTTON = $1; - VK_LCONTROL = $A2; - VK_LEFT = $25; - VK_LMENU = $A4; - VK_LSHIFT = $A0; - VK_LWIN = $5B; - VK_MENU = $12; - VK_MULTIPLY = $6A; - VK_NEXT = $22; - VK_NUMLOCK = $90; + // --------------------------------------------------- + // Regularly used keycodes - VK_NUMPAD0 = $60; - VK_NUMPAD1 = $61; - VK_NUMPAD2 = $62; - VK_NUMPAD3 = $63; - VK_NUMPAD4 = $64; - VK_NUMPAD5 = $65; - VK_NUMPAD6 = $66; - VK_NUMPAD7 = $67; - VK_NUMPAD8 = $68; - VK_NUMPAD9 = $69; + VK_ADD = $6B; + VK_APPS = $5D; + VK_BACK = $8; + VK_CAPITAL = $14; + VK_CONTROL = $11; + VK_DECIMAL = $6E; + VK_DELETE = $2E; + VK_DIVIDE = $6F; + VK_DOWN = $28; + VK_END = $23; + VK_F1 = $70; + VK_F10 = $79; + VK_F11 = $7A; + VK_F12 = $7B; + VK_F2 = $71; + VK_F3 = $72; + VK_F4 = $73; + VK_F5 = $74; + VK_F6 = $75; + VK_F7 = $76; + VK_F8 = $77; + VK_F9 = $78; + VK_HOME = $24; + VK_INSERT = $2D; + VK_LBUTTON = $1; + VK_LCONTROL = $A2; + VK_LEFT = $25; + VK_LMENU = $A4; + VK_LSHIFT = $A0; + VK_LWIN = $5B; + VK_MENU = $12; + VK_MULTIPLY = $6A; + VK_NEXT = $22; + VK_NUMLOCK = $90; - VK_OEM_1 = $BA; - VK_OEM_2 = $BF; - VK_OEM_3 = $C0; - VK_OEM_4 = $DB; - VK_OEM_5 = $DC; - VK_OEM_6 = $DD; - VK_OEM_7 = $DE; - VK_OEM_COMMA = $BC; - VK_OEM_MINUS = $BD; - VK_OEM_PERIOD = $BE; - VK_OEM_PLUS = $BB; - VK_PRIOR = $21; - VK_RBUTTON = $2; - VK_RCONTROL = $A3; - VK_RETURN = $D; - VK_RIGHT = $27; - VK_RMENU = $A5; - VK_RSHIFT = $A1; - VK_RWIN = $5C; - VK_SHIFT = $10; - VK_SPACE = $20; - VK_SUBTRACT = $6D; - VK_TAB = $9; - VK_UP = $26; + VK_NUMPAD0 = $60; + VK_NUMPAD1 = $61; + VK_NUMPAD2 = $62; + VK_NUMPAD3 = $63; + VK_NUMPAD4 = $64; + VK_NUMPAD5 = $65; + VK_NUMPAD6 = $66; + VK_NUMPAD7 = $67; + VK_NUMPAD8 = $68; + VK_NUMPAD9 = $69; - //Keycodes with custom name - VK_0 = $30; - VK_1 = $31; - VK_2 = $32; - VK_3 = $33; - VK_4 = $34; - VK_5 = $35; - VK_6 = $36; - VK_7 = $37; - VK_8 = $38; - VK_9 = $39; + VK_OEM_1 = $BA; + VK_OEM_2 = $BF; + VK_OEM_3 = $C0; + VK_OEM_4 = $DB; + VK_OEM_5 = $DC; + VK_OEM_6 = $DD; + VK_OEM_7 = $DE; + VK_OEM_COMMA = $BC; + VK_OEM_MINUS = $BD; + VK_OEM_PERIOD = $BE; + VK_OEM_PLUS = $BB; + VK_PRIOR = $21; + VK_RBUTTON = $2; + VK_RCONTROL = $A3; + VK_RETURN = $D; + VK_RIGHT = $27; + VK_RMENU = $A5; + VK_RSHIFT = $A1; + VK_RWIN = $5C; + VK_SHIFT = $10; + VK_SPACE = $20; + VK_SUBTRACT = $6D; + VK_TAB = $9; + VK_UP = $26; - A_Key = $41; - B_Key = $42; - C_Key = $43; - D_Key = $44; - E_Key = $45; - F_Key = $46; - G_Key = $47; - H_Key = $48; - I_Key = $49; - J_Key = $4A; - K_Key = $4B; - L_Key = $4C; - M_Key = $4D; - N_Key = $4E; - O_Key = $4F; - P_Key = $50; - Q_Key = $51; - R_Key = $52; - S_Key = $53; - T_Key = $54; - U_Key = $55; - V_Key = $56; - W_Key = $57; - X_Key = $58; - Y_Key = $59; - Z_Key = $5A; + // Keycodes with custom name + VK_0 = $30; + VK_1 = $31; + VK_2 = $32; + VK_3 = $33; + VK_4 = $34; + VK_5 = $35; + VK_6 = $36; + VK_7 = $37; + VK_8 = $38; + VK_9 = $39; - //--------------------------------------------------- - //Below is the Keys that are not used or rarely used - VK_ACCEPT = $1E; - VK_ATTN = $F6; - VK_BROWSER_BACK = $A6; - VK_BROWSER_FAVORITES = $AB; - VK_BROWSER_FORWARD = $A7; - VK_BROWSER_HOME = $AC; - VK_BROWSER_REFRESH = $A8; - VK_BROWSER_SEARCH = $AA; - VK_BROWSER_STOP = $A9; - VK_CANCEL = $3; - VK_CONVERT = $1C; - VK_CRSEL = $F7; - VK_DBE_ALPHANUMERIC = $F0; - VK_DBE_CODEINPUT = $FA; - VK_DBE_DBCSCHAR = $F4; - VK_DBE_DETERMINESTRING = $FC; - VK_DBE_ENTERDLGCONVERSIONMODE = $FD; - VK_DBE_ENTERIMECONFIGMODE = $F8; - VK_DBE_ENTERWORDREGISTERMODE = $F7; - VK_DBE_FLUSHSTRING = $F9; - VK_DBE_HIRAGANA = $F2; - VK_DBE_KATAKANA = $F1; - VK_DBE_NOCODEINPUT = $FB; - VK_DBE_NOROMAN = $F6; - VK_DBE_ROMAN = $F5; - VK_DBE_SBCSCHAR = $F3; - VK_CLEAR = $C; - VK_EREOF = $F9; - VK_ESCAPE = $1B; - VK_EXECUTE = $2B; - VK_EXSEL = $F8; - VK_F13 = $7C; - VK_F14 = $7D; - VK_F15 = $7E; - VK_F16 = $7F; - VK_F17 = $80; - VK_F18 = $81; - VK_F19 = $82; - VK_F20 = $83; - VK_F21 = $84; - VK_F22 = $85; - VK_F23 = $86; - VK_F24 = $87; - VK_FINAL = $18; - VK_HANGEUL = $15; - VK_HANGUL = $15; - VK_HANJA = $19; - VK_HELP = $2F; - VK_ICO_00 = $E4; - VK_ICO_CLEAR = $E6; - VK_ICO_HELP = $E3; - VK_JUNJA = $17; - VK_KANA = $15; - VK_KANJI = $19; - VK_LAUNCH_APP1 = $B6; - VK_LAUNCH_APP2 = $B7; - VK_LAUNCH_MAIL = $B4; - VK_LAUNCH_MEDIA_SELECT = $B5; - VK_MBUTTON = $4; - VK_MEDIA_NEXT_TRACK = $B0; - VK_MEDIA_PLAY_PAUSE = $B3; - VK_MEDIA_PREV_TRACK = $B1; - VK_MEDIA_STOP = $B2; - VK_MODECHANGE = $1F; - VK_NONAME = $FC; - VK_NONCONVERT = $1D; - VK_OEM_102 = $E2; - VK_OEM_8 = $DF; - VK_OEM_ATTN = $F0; - VK_OEM_AUTO = $F3; - VK_OEM_AX = $E1; - VK_OEM_BACKTAB = $F5; - VK_OEM_CLEAR = $FE; - VK_OEM_COPY = $F2; - VK_OEM_CUSEL = $EF; - VK_OEM_ENLW = $F4; - VK_OEM_FINISH = $F1; - VK_OEM_FJ_JISHO = $92; - VK_OEM_FJ_LOYA = $95; - VK_OEM_FJ_MASSHOU = $93; - VK_OEM_FJ_ROYA = $96; - VK_OEM_FJ_TOUROKU = $94; - VK_OEM_JUMP = $EA; - VK_OEM_NEC_EQUAL = $92; - VK_OEM_PA1 = $EB; - VK_OEM_PA2 = $EC; - VK_OEM_PA3 = $ED; - VK_OEM_RESET = $E9; - VK_OEM_WSCTRL = $EE; - VK_PA1 = $FD; - VK_PACKET = $E7; - VK_PAUSE = $13; - VK_PLAY = $FA; - VK_PRINT = $2A; - VK_PROCESSKEY = $E5; - VK_SCROLL = $91; - VK_SELECT = $29; - VK_SEPARATOR = $6C; - VK_VOLUME_DOWN = $AE; - VK_VOLUME_MUTE = $AD; - VK_VOLUME_UP = $AF; - VK_XBUTTON1 = $5; - VK_XBUTTON2 = $6; - VK_ZOOM = $FB; - VK_SLEEP = $5F; - VK_SNAPSHOT = $2C; + A_Key = $41; + B_Key = $42; + C_Key = $43; + D_Key = $44; + E_Key = $45; + F_Key = $46; + G_Key = $47; + H_Key = $48; + I_Key = $49; + J_Key = $4A; + K_Key = $4B; + L_Key = $4C; + M_Key = $4D; + N_Key = $4E; + O_Key = $4F; + P_Key = $50; + Q_Key = $51; + R_Key = $52; + S_Key = $53; + T_Key = $54; + U_Key = $55; + V_Key = $56; + W_Key = $57; + X_Key = $58; + Y_Key = $59; + Z_Key = $5A; + // --------------------------------------------------- + // Below is the Keys that are not used or rarely used + VK_ACCEPT = $1E; + VK_ATTN = $F6; + VK_BROWSER_BACK = $A6; + VK_BROWSER_FAVORITES = $AB; + VK_BROWSER_FORWARD = $A7; + VK_BROWSER_HOME = $AC; + VK_BROWSER_REFRESH = $A8; + VK_BROWSER_SEARCH = $AA; + VK_BROWSER_STOP = $A9; + VK_CANCEL = $3; + VK_CONVERT = $1C; + VK_CRSEL = $F7; + VK_DBE_ALPHANUMERIC = $F0; + VK_DBE_CODEINPUT = $FA; + VK_DBE_DBCSCHAR = $F4; + VK_DBE_DETERMINESTRING = $FC; + VK_DBE_ENTERDLGCONVERSIONMODE = $FD; + VK_DBE_ENTERIMECONFIGMODE = $F8; + VK_DBE_ENTERWORDREGISTERMODE = $F7; + VK_DBE_FLUSHSTRING = $F9; + VK_DBE_HIRAGANA = $F2; + VK_DBE_KATAKANA = $F1; + VK_DBE_NOCODEINPUT = $FB; + VK_DBE_NOROMAN = $F6; + VK_DBE_ROMAN = $F5; + VK_DBE_SBCSCHAR = $F3; + VK_CLEAR = $C; + VK_EREOF = $F9; + VK_ESCAPE = $1B; + VK_EXECUTE = $2B; + VK_EXSEL = $F8; + VK_F13 = $7C; + VK_F14 = $7D; + VK_F15 = $7E; + VK_F16 = $7F; + VK_F17 = $80; + VK_F18 = $81; + VK_F19 = $82; + VK_F20 = $83; + VK_F21 = $84; + VK_F22 = $85; + VK_F23 = $86; + VK_F24 = $87; + VK_FINAL = $18; + VK_HANGEUL = $15; + VK_HANGUL = $15; + VK_HANJA = $19; + VK_HELP = $2F; + VK_ICO_00 = $E4; + VK_ICO_CLEAR = $E6; + VK_ICO_HELP = $E3; + VK_JUNJA = $17; + VK_KANA = $15; + VK_KANJI = $19; + VK_LAUNCH_APP1 = $B6; + VK_LAUNCH_APP2 = $B7; + VK_LAUNCH_MAIL = $B4; + VK_LAUNCH_MEDIA_SELECT = $B5; + VK_MBUTTON = $4; + VK_MEDIA_NEXT_TRACK = $B0; + VK_MEDIA_PLAY_PAUSE = $B3; + VK_MEDIA_PREV_TRACK = $B1; + VK_MEDIA_STOP = $B2; + VK_MODECHANGE = $1F; + VK_NONAME = $FC; + VK_NONCONVERT = $1D; + VK_OEM_102 = $E2; + VK_OEM_8 = $DF; + VK_OEM_ATTN = $F0; + VK_OEM_AUTO = $F3; + VK_OEM_AX = $E1; + VK_OEM_BACKTAB = $F5; + VK_OEM_CLEAR = $FE; + VK_OEM_COPY = $F2; + VK_OEM_CUSEL = $EF; + VK_OEM_ENLW = $F4; + VK_OEM_FINISH = $F1; + VK_OEM_FJ_JISHO = $92; + VK_OEM_FJ_LOYA = $95; + VK_OEM_FJ_MASSHOU = $93; + VK_OEM_FJ_ROYA = $96; + VK_OEM_FJ_TOUROKU = $94; + VK_OEM_JUMP = $EA; + VK_OEM_NEC_EQUAL = $92; + VK_OEM_PA1 = $EB; + VK_OEM_PA2 = $EC; + VK_OEM_PA3 = $ED; + VK_OEM_RESET = $E9; + VK_OEM_WSCTRL = $EE; + VK_PA1 = $FD; + VK_PACKET = $E7; + VK_PAUSE = $13; + VK_PLAY = $FA; + VK_PRINT = $2A; + VK_PROCESSKEY = $E5; + VK_SCROLL = $91; + VK_SELECT = $29; + VK_SEPARATOR = $6C; + VK_VOLUME_DOWN = $AE; + VK_VOLUME_MUTE = $AD; + VK_VOLUME_UP = $AF; + VK_XBUTTON1 = $5; + VK_XBUTTON2 = $6; + VK_ZOOM = $FB; + VK_SLEEP = $5F; + VK_SNAPSHOT = $2C; Implementation diff --git a/Keyboard and Spell checker/Units/WindowsVersion.pas b/Keyboard and Spell checker/Units/WindowsVersion.pas index f4f8ac6..e89f130 100644 --- a/Keyboard and Spell checker/Units/WindowsVersion.pas +++ b/Keyboard and Spell checker/Units/WindowsVersion.pas @@ -1,25 +1,25 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= @@ -30,22 +30,18 @@ {$ELSE} {$INCLUDE ../ProjectDefines.inc} {$ENDIF} - -{COMPLETE TRANSFERING} +{ COMPLETE TRANSFERING } Unit WindowsVersion; Interface -Uses - Windows, - Sysutils; - +Uses + Windows, + Sysutils; Function GetOSVersionInfo(Var Info: TOSVersionInfoEx): Boolean; - - Function IsWin2000: Boolean; Function IsWin2000Plus: Boolean; Function IsWin2000OrLater: Boolean; @@ -59,232 +55,244 @@ Function IsWinXPSP2Plus: Boolean; Function IsWinXPSP3Plus: Boolean; - - - Implementation {$HINTS Off} Function GetOSVersionInfo(Var Info: TOSVersionInfoEx): Boolean; Begin - Result := False; - FillChar(Info, SizeOf(TOSVersionInfoEx), 0); - Info.dwOSVersionInfoSize := SizeOf(TOSVersionInfoEx); - Result := GetVersionEx(TOSVersionInfo(Addr(Info)^)); - If (Not Result) Then Begin - FillChar(Info, SizeOf(TOSVersionInfoEx), 0); - Info.dwOSVersionInfoSize := SizeOf(TOSVersionInfoEx); - Result := GetVersionEx(TOSVersionInfo(Addr(Info)^)); - If (Not Result) Then - Info.dwOSVersionInfoSize := 0; - End; + Result := False; + FillChar(Info, SizeOf(TOSVersionInfoEx), 0); + Info.dwOSVersionInfoSize := SizeOf(TOSVersionInfoEx); + Result := GetVersionEx(TOSVersionInfo(Addr(Info)^)); + If (Not Result) Then + Begin + FillChar(Info, SizeOf(TOSVersionInfoEx), 0); + Info.dwOSVersionInfoSize := SizeOf(TOSVersionInfoEx); + Result := GetVersionEx(TOSVersionInfo(Addr(Info)^)); + If (Not Result) Then + Info.dwOSVersionInfoSize := 0; + End; End; Function IsWin2000: Boolean; Var - osv : TOSVERSIONINFO; + osv: TOSVersionInfo; Begin - Result := False; - osv.dwOSVersionInfoSize := SizeOf(TOSVERSIONINFO); - - If GetVersionEx(osv) Then Begin - Result := (osv.dwPlatformID = VER_PLATFORM_WIN32_NT) And - ((osv.dwMajorVersion = 5) And (osv.dwMinorVersion = 0)) And - (osv.dwBuildNumber >= 2195); - End - Else - Result := False; + Result := False; + osv.dwOSVersionInfoSize := SizeOf(TOSVersionInfo); + + If GetVersionEx(osv) Then + Begin + Result := (osv.dwPlatformID = VER_PLATFORM_WIN32_NT) And + ((osv.dwMajorVersion = 5) And (osv.dwMinorVersion = 0)) And + (osv.dwBuildNumber >= 2195); + End + Else + Result := False; End; Function IsWin2000OrLater: Boolean; Var - osv : TOSVERSIONINFO; + osv: TOSVersionInfo; Begin - Result := False; - osv.dwOSVersionInfoSize := SizeOf(TOSVERSIONINFO); - - If GetVersionEx(osv) Then Begin - Result := (osv.dwPlatformID = VER_PLATFORM_WIN32_NT) And - (osv.dwMajorVersion >= 5); - End - Else - Result := False; + Result := False; + osv.dwOSVersionInfoSize := SizeOf(TOSVersionInfo); + + If GetVersionEx(osv) Then + Begin + Result := (osv.dwPlatformID = VER_PLATFORM_WIN32_NT) And + (osv.dwMajorVersion >= 5); + End + Else + Result := False; End; Function IsWin2000Plus: Boolean; Var - osv : TOSVERSIONINFO; + osv: TOSVersionInfo; Begin - Result := False; - osv.dwOSVersionInfoSize := SizeOf(TOSVERSIONINFO); + Result := False; + osv.dwOSVersionInfoSize := SizeOf(TOSVersionInfo); - If GetVersionEx(osv) Then Begin - Result := (osv.dwPlatformID = VER_PLATFORM_WIN32_NT) And - (osv.dwMajorVersion = 5); - End - Else - Result := False; + If GetVersionEx(osv) Then + Begin + Result := (osv.dwPlatformID = VER_PLATFORM_WIN32_NT) And + (osv.dwMajorVersion = 5); + End + Else + Result := False; End; Function IsWin2003Server: Boolean; Var - osv : TOSVERSIONINFO; + osv: TOSVersionInfo; Begin - Result := False; - osv.dwOSVersionInfoSize := SizeOf(TOSVERSIONINFO); - - If GetVersionEx(osv) Then Begin - Result := (osv.dwPlatformID = VER_PLATFORM_WIN32_NT) And - ((osv.dwMajorVersion = 5) And (osv.dwMinorVersion = 2)) And - (osv.dwBuildNumber = 3790); - End - Else - Result := False; + Result := False; + osv.dwOSVersionInfoSize := SizeOf(TOSVersionInfo); + + If GetVersionEx(osv) Then + Begin + Result := (osv.dwPlatformID = VER_PLATFORM_WIN32_NT) And + ((osv.dwMajorVersion = 5) And (osv.dwMinorVersion = 2)) And + (osv.dwBuildNumber = 3790); + End + Else + Result := False; End; Function IsWinNT4: Boolean; Var - osv : TOSVERSIONINFO; + osv: TOSVersionInfo; Begin - Result := False; - osv.dwOSVersionInfoSize := SizeOf(TOSVERSIONINFO); - - If GetVersionEx(osv) Then Begin - Result := (osv.dwPlatformID = VER_PLATFORM_WIN32_NT) And - ((osv.dwMajorVersion = 4) And (osv.dwMinorVersion = 0)) And - (osv.dwBuildNumber >= 1381); - End - Else - Result := False; + Result := False; + osv.dwOSVersionInfoSize := SizeOf(TOSVersionInfo); + + If GetVersionEx(osv) Then + Begin + Result := (osv.dwPlatformID = VER_PLATFORM_WIN32_NT) And + ((osv.dwMajorVersion = 4) And (osv.dwMinorVersion = 0)) And + (osv.dwBuildNumber >= 1381); + End + Else + Result := False; End; Function IsWinNT4OrLater: Boolean; Var - osv : TOSVERSIONINFO; + osv: TOSVersionInfo; Begin - Result := False; - osv.dwOSVersionInfoSize := SizeOf(TOSVERSIONINFO); + Result := False; + osv.dwOSVersionInfoSize := SizeOf(TOSVersionInfo); - If GetVersionEx(osv) Then Begin - Result := (osv.dwPlatformID = VER_PLATFORM_WIN32_NT) And - (osv.dwMajorVersion >= 4); - End - Else - Result := False; + If GetVersionEx(osv) Then + Begin + Result := (osv.dwPlatformID = VER_PLATFORM_WIN32_NT) And + (osv.dwMajorVersion >= 4); + End + Else + Result := False; End; - Function IsWinVista: Boolean; Var - osv : TOSVERSIONINFO; + osv: TOSVersionInfo; Begin - Result := False; - osv.dwOSVersionInfoSize := SizeOf(TOSVERSIONINFO); + Result := False; + osv.dwOSVersionInfoSize := SizeOf(TOSVersionInfo); - If GetVersionEx(osv) Then Begin - Result := (osv.dwPlatformID = VER_PLATFORM_WIN32_NT) And - (osv.dwMajorVersion = 6); - End - Else - Result := False; + If GetVersionEx(osv) Then + Begin + Result := (osv.dwPlatformID = VER_PLATFORM_WIN32_NT) And + (osv.dwMajorVersion = 6); + End + Else + Result := False; End; Function IsWinVistaOrLater: Boolean; Var - osv : TOSVERSIONINFO; + osv: TOSVersionInfo; Begin - Result := False; - osv.dwOSVersionInfoSize := SizeOf(TOSVERSIONINFO); - If GetVersionEx(osv) Then Begin - Result := (osv.dwPlatformID = VER_PLATFORM_WIN32_NT) And - (osv.dwMajorVersion >= 6); - End - Else - Result := False; + Result := False; + osv.dwOSVersionInfoSize := SizeOf(TOSVersionInfo); + If GetVersionEx(osv) Then + Begin + Result := (osv.dwPlatformID = VER_PLATFORM_WIN32_NT) And + (osv.dwMajorVersion >= 6); + End + Else + Result := False; End; Function IsWinXP: Boolean; Var - osv : TOSVERSIONINFO; + osv: TOSVersionInfo; Begin - Result := False; - osv.dwOSVersionInfoSize := SizeOf(TOSVERSIONINFO); - If GetVersionEx(osv) Then Begin - Result := (osv.dwPlatformID = VER_PLATFORM_WIN32_NT) And - ((osv.dwMajorVersion = 5) And (osv.dwMinorVersion = 1)) And - (osv.dwBuildNumber >= 2600); - End - Else - Result := False; + Result := False; + osv.dwOSVersionInfoSize := SizeOf(TOSVersionInfo); + If GetVersionEx(osv) Then + Begin + Result := (osv.dwPlatformID = VER_PLATFORM_WIN32_NT) And + ((osv.dwMajorVersion = 5) And (osv.dwMinorVersion = 1)) And + (osv.dwBuildNumber >= 2600); + End + Else + Result := False; End; Function IsWinXPSP2: Boolean; Var - osv : TOSVersionInfoEx; + osv: TOSVersionInfoEx; Begin - Result := False; - If IsWinXP Then Begin - If GetOSVersionInfo(osv) Then Begin - If pos(osv.szCSDVersion, 'Service Pack 2') > 0 Then - Result := True; - End; - End; + Result := False; + If IsWinXP Then + Begin + If GetOSVersionInfo(osv) Then + Begin + If pos(osv.szCSDVersion, 'Service Pack 2') > 0 Then + Result := True; + End; + End; End; Function IsWinXPSP2Plus: Boolean; Var - osv : TOSVersionInfoEx; + osv: TOSVersionInfoEx; Begin - Result := False; - If IsWinXP Then Begin - If GetOSVersionInfo(osv) Then Begin - If pos(osv.szCSDVersion, 'Service Pack 2') > 0 Then - Result := True - Else If pos(osv.szCSDVersion, ('Service Pack 3')) > 0 Then - Result := True - Else If pos(osv.szCSDVersion, 'Service Pack 4') > 0 Then - Result := True - Else If pos(osv.szCSDVersion, 'Service Pack 5') > 0 Then - Result := True - Else If pos(osv.szCSDVersion, 'Service Pack 6') > 0 Then - Result := True; - End; - End; + Result := False; + If IsWinXP Then + Begin + If GetOSVersionInfo(osv) Then + Begin + If pos(osv.szCSDVersion, 'Service Pack 2') > 0 Then + Result := True + Else If pos(osv.szCSDVersion, ('Service Pack 3')) > 0 Then + Result := True + Else If pos(osv.szCSDVersion, 'Service Pack 4') > 0 Then + Result := True + Else If pos(osv.szCSDVersion, 'Service Pack 5') > 0 Then + Result := True + Else If pos(osv.szCSDVersion, 'Service Pack 6') > 0 Then + Result := True; + End; + End; End; Function IsWinXPSP3Plus: Boolean; Var - osv : TOSVersionInfoEx; + osv: TOSVersionInfoEx; Begin - Result := False; - If IsWinXP Then Begin - If GetOSVersionInfo(osv) Then Begin - If pos(osv.szCSDVersion, 'Service Pack 3') > 0 Then - Result := True - Else If pos(osv.szCSDVersion, 'Service Pack 4') > 0 Then - Result := True - Else If pos(osv.szCSDVersion, 'Service Pack 5') > 0 Then - Result := True - Else If pos(osv.szCSDVersion, 'Service Pack 6') > 0 Then - Result := True - Else If pos(osv.szCSDVersion, 'Service Pack 7') > 0 Then - Result := True - Else If pos(osv.szCSDVersion, 'Service Pack 8') > 0 Then - Result := True - Else If pos(osv.szCSDVersion, 'Service Pack 9') > 0 Then - Result := True; - End; - End; + Result := False; + If IsWinXP Then + Begin + If GetOSVersionInfo(osv) Then + Begin + If pos(osv.szCSDVersion, 'Service Pack 3') > 0 Then + Result := True + Else If pos(osv.szCSDVersion, 'Service Pack 4') > 0 Then + Result := True + Else If pos(osv.szCSDVersion, 'Service Pack 5') > 0 Then + Result := True + Else If pos(osv.szCSDVersion, 'Service Pack 6') > 0 Then + Result := True + Else If pos(osv.szCSDVersion, 'Service Pack 7') > 0 Then + Result := True + Else If pos(osv.szCSDVersion, 'Service Pack 8') > 0 Then + Result := True + Else If pos(osv.szCSDVersion, 'Service Pack 9') > 0 Then + Result := True; + End; + End; End; {$HINTS On} -End. +End. diff --git a/Keyboard and Spell checker/Units/pcre_chartables.obj b/Keyboard and Spell checker/Units/pcre_chartables.obj deleted file mode 100644 index b16e9be31caa9e4eea9c1c5a817e425ee648217d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2593 zcmZn=W)Lh$E=rA0&PXgONleN~E!InB=n!FGU=VQ1FUm>GOHpvv)>bgpvoK=lkYZqX zfkpk_jCf0i4qgU^m%_82Sg@8R7wBa$bnpTB9KEWRY#{SN0%kw~hJZX{J!h+!fTH~L zqQqPUw@jdoF;JUgoLquqO!N$5JoA!sN>fr}a#M3b8qGl(CGw5+iPjjOlb;OIX$jS7 zNVHC%#>5=3bHTO(olAnP#U({>TY)->w-u-{GcO&a*8=Kd1EO7=T2z#m54RQ=Oe9#F znpl*a0oO~SlT&gsli+$uvNt|24H)lm?*i>5-n+#mDVgMYw=>P zX{tE2Br6x3C&)?3nczG?x~(~xxtS%!Am3U+)07d>X(~4w5B|Q(peJc(Os@&O=^-|45&Ec zNX`eQUT{i~1PX!5K5Qi@GbqfbX)v(Hhqy+BusHj>xB}TOjv`o>=ggfqf5E~dRhmRaRcKpQ2Q>V|IJ$L@X#Y>m3 zT)lSv#?4!|@7%q2|G~pYkDok!_WZ@mSFhi^efR#u$4{TXeEs(Q$IoBC|NQ;;pXUB| zbaHlab#wRd^z!!c_45x13rf*=7YFc885fEpSE@XLeEpp01H!obA9LYWyr-QA$F1OWeQ BC13ym diff --git a/Keyboard and Spell checker/Units/pcre_compile.obj b/Keyboard and Spell checker/Units/pcre_compile.obj deleted file mode 100644 index 0b6d4f0b4b6df60806232029ed52a2837e5d26fd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32119 zcmb__4SZD9weOjaWF{YQ28etKItpkopn;$QgAxdnAUF_6WdxRdQK*(Z=$Pl<w#3 zUtJT+7Hs+k*_N01OV`KJenXPWsw$s|rTs?vuC1;hDT@{t`F{Q4)=FiS|J~wBWo6|R z|2>kCZHb@N&^MQ<+Hz^bM%E_&JCa<<+Q2u@wW@MsrBq9$og0y}HWVu@)SFJ~Ol0b?vRW$lSC_ED zI1oeX%wAdp>1C2IIs$y1?z9lY|0P{WSX<~`U1-f&zQ_&#q6LKutn^4+l(%xZH{ZH; zVL^cfPI%EK{N!w@$t*D6mQ-s3_X&c{E(qUC6cWRhuvyqX+myoS+E`KrJtZWuj|zWz zxiDfa^UG4j?6p$K6IJC|*9XlK#3+=swz_0vd99EX3lN6KylZPKpDq{D_%~QuB3DTq zX|3Skq095vR+U$;lh)V9vMDWF>n|^@@t4JbWCYbpCF{y(M3corW(tW=d8HdS2{yc| z$rHg`S-ZBnd~;Q0b-7@J`rladRJo7{584oWmu}h`B^7ziqyqEsK@?AwR8^L()$hK^F1EHS-6qw21@PL)g<0(_=7mb& ziXde_(2g#*ZjN?D`Eo{h#pe(B=Ol9@ag}TqV;9cor-RgZr6Xs zKG#WiD0+f43SiQ3MYo7euM+GJ5XoqnLbSY$uZE{h^Q1&P@064Gp9Tf`3q150`N7aa zvoWe+_H=1j*3lMwf8+ENL9j|G*$uM=DWPF@K>h>yMEIoS{XLYn5NY3_axOH?Sx13& zx@`Yd^t(T+-4GXA+C$cctdCp9TMj9`neaSn>Q@+M`47SN0B6+$M4k=Ef=8vag$;89 z5)X&I74$y=VT`HJqJsWA3h9?_cDWtfIG{+uod{m6c^nx>v<{_x;>DBtYY0&SV+HwP z?QP`#jmX(TX$O+)5|B%MGRIejFzr2(7G+?z-@YWPU0*?9Ks{_>N4EuhOSW|2Q+qd8 zxnvHcf+d-LV)y+|eM0gj25$rW17VOWetR@wBT303>h1Uf;4@;d37@D7)jg2auDUOP zjrVGv0dZea*gXJ7Bq*0MrAcA;1?5tS-=gTwj&3V5y|kd#_C_X>8VPTphZ8b7cp_ep zcKI!QHp~ggQ-kewW00({B~vF>CG0U*QxYn8>9N&Y1z^+?Fa)xLl6vb#jcK6 zyXG21Jf9aWQ+foEh_!#2|zVb>I)$5v?WDezf) zN`01|pBI`>FNga{q4~`0Li5=%aL+?%nYysbwk|W6F63r?9K-n%zLfz8c=Mu(r*f1p zZ>{UWrx*+&yc0o!VQY4u>U94OEV8RJk-g`NM&c{D0#~-J(u%KGK6&rUko7U~^)xpH zHy)(t%8=*OieB<5hwb3V#0Z2HA&^*g1pBtS8ISG_wr@+!QH!q_X6;L$t^bMUPU{lx zAy~>(ITAKTXx_9g^W7}DU7dlTL3V*lZ&C|`{%ib{M6KVNY?TwT+KUfmvzAStUr>X# z?Wgh=9|B~9tK&}b@`xwL>q(@mL75Fqc4OwR$SB{1a(Q-VL_8m0$v6d6cxy)?x zMcaK(@OYiQ@p2fXZL@bJqMH?rM<`pX_O_7=brX<4Cr}&>rK$|YJ5Yqzpg0N?mxiDi z?Rt;U5lf9^tvFR3rFk7{@|wpYDdB ztKl%0@>q3x(on&gOj?1YMESCyeuT71Idnxa%>FXP7$v0{Ta-gTQVffKs&Z(6-Ybj> z3=KvDezi&1HACoG;m*LxS{L>QSrlKucz2Tv6cba$i9}IIADB3)vxNYR8nz3+gwBO@DxFD3^!VV~8*k zdP6y95}y?*?3`JAwg8?b%=ZurvWw52fk$6YkO%+FVvbYH!OP0I1o7EP49X%tJ3Rv4 z^e}ixi`j%Y_nj!WI27DmD1quYVUwu15-iRW1Q3VMoFj zSS@~}R{=N|4Wi#Y%q}*q!B<4O8$WFaNaLjjJf+X|MK?g&ryR2Kba%w3qZF}psW(c8 z*0a>2TyjXsL?;R>$`;T7bo!~kp}dF8xjFiA`1T`pSSN(U9aG0=c1mhac~3d`iRB~Z z&}}Ui>zmWe{#5H#JQLw;h8u0n$iD`jzI^4U{kLFv;0Lll%TIh&bj(Z zq69Dr`eOLjJoZSmk0@r%^>~XTcwDw&{PZEnQ!eMrqkw#|spC_s$$WFl+m;UFL*?>X z`F0AoAY9zH$(r)6%i|E6sFN1=eFsm$a?toC#&#WDik|4Fk+1)DdRV2KjZB7-Gm3C4 zmqd92wbL;SWh?@`Bo4Mi#9CSy&W_;6V$*6cPdV6wmf}xAOB&`+(B0G&L0-5~*cA|Z z=K7L)JaAtYntH;8rqdQU8(a#U2sa9D4BX9dx57<=yAv)0?jE=-xclK;aP#4E;PT*> z!Yzj@fLjIk7~I-I(;2~+bT$b0p)ZN6q14OmpjX^JD@vF0+5Evm=o6{>$Kny~0x`nE z00OmXreS1OJJgIauu@LY4l*BALVL?X)|@a-H>Vu395de2PAZ4GFx>%np+9e@2j?yg z<&`f<47rcEdyu$`PfIKUKH}~{GlE}a+&vLIDmHBfSxS44(hKe`R(grMWmF2}A7)c9 zaeHC(Tj|D3tbwIHray>KeGVRj-FhGu+Hr$vgRntB`ndL4(7OYp4CSyxJL&pTd@dK7 zgaDL*)$*ikW%nZ<6KUi604aolbrJ@b>mls}HS%<%h_rj~cqtQAv_Eso5zB{&V!DLs z2mLLUc8w%Le-VOWLh!g;eodB`fB{fola#D}3<^f0^IKKWdj|@q9L8`#N?-#75O$4< zi)f=?BMmj7TA(57^&EK6JwT;jULihzFTPs7b2lu&(Ao`nB@X@(GlfL{OiZ-d$l-~9 z8^Q5dyb=-;6B81w*2ILw1R7YeKZ}J_vI&1a%)7GSb_4rfxbg6t;Qj{xT#Ab_ifQM! zEgz!$w}c9AYe{bCc(XxAKSdmc$3K#NJsbH-G0etRlQ$+l_G;#Hr=lUnwZ+8+nx@f6JG22CC-FU2qL>O>oU{+u>e-+X43?+|EMN*|kws z;y6UpeEDsr6ksZ$LIqNPH2{WWeQZpJcqud>a1F>et@4Fs`;bA}A!97)|7QYNX!%P{ z!~Z59kXC0#~L%Kyu3qNY)W}gTb5>dJG9p1dPlwq46(f3amn6nH+xeX zJ_|SJn+!X&vn$u>KS~d3h^ts{*4~n5PC2IKrdcq6wENRyNtc@|%$ug{VxM4R;mL(%8@Ku)9twZB=SdD7Gos%3}}Du?@+5IePiBP5UQ zcTd1*hPqe798S~{sjjr8sr}XwCizcVV#Dl7@)l#g@=U%UWoV;a1rut=tqLtIToJCF z5U$M+-xraMw216yvAm3FTET>jfK)jCF(Puz40#4t_+Ow_4U*G8j;lC>O^!rmZD!LU@ugD`&&CpHGIv;(NF6k|d3HYhOD^s4uQ z=Dt7{tZbMk@R8OEC}EQK%8AcZ?-e6W=}kn$XmQ_2^t>lNOY#Dj=DDD_FOV(pQ)85t zDDD$LQaI6Ini^y0Yq%Rn7jbuV!`yi84tFhO+|4P>zae*z8(D8sTLX8OPRLkV=o$|0 zCbl@{77TKCc*_ECo49)%wjP2G9tU?Z${5bL3yy-j!mbB|p3$(K++JvI%k&NJ$${U4 z3D7gXl+z(!>ggT69Tz4V@8GlLJ6>3N(Q#Gdm6DufxAEQz zJ(87V8h;kEY1CNsH&_5jyGanf55SXHIq<_xgIf-F260Jv@5cKO9ICxU38dC=!)W$$+JFwL)Mnk6Y)5k5}BkbA&3Fo_PVpy8&nd!?Xgc=DC7`Ta%3p z&3gs<2lTK(Z^x%LCj9l5BhWw|%2l&+4dlM!a;J)|2bIrE+CjY^_8McHw$uu6G?X-x z%Zo@d1L+?l3S4w~uSCZ-M-c*nH!*VF!UuR!dP8ztASZZyD@Ka-9ha}6YDzr@30o5u zD@Pi#zlyva5%N~uh&*Pc(&r%x0#{!@N-IbOAIL1m^u#1YuzJsa4aXHAcI&q2i}Z?ih>McaWGn>7{~_rz_-TB!_g4x zZ;@Qexg_a6<=hx)M&miEa%pPgxo$KL={DnTSR%WjBG0Ax)0A_QF*-e$DJ3_a`vJyj zFc*nRz&H${>PyDFI)X`2WY zvIG;O6>!yXez>RLo`%~7_bl9Va4m4(hWifOzrcMD?msc2`K`}#+JzC#O1$?%?HqyH z`He66%u-*!)u66 zv9b{@_+>JEbTh1yh~JF&4!Ff|Pr~hnI|OHjn*w)uydeA)4g&o+Yut}suTt{3N)h+{ z5~v03gJ`?9?xpXc8l{hG6l&A+OjuPyn?9QqfJW&fjdJDUNu~WVruyRZZ$pEJCkHQs z#^P}pX2bmut^rPm>x4T1x^CoB5l-&uh$FgrV}R|^YUYhW#o(TcaXowtgbN@*U^gbs zT@eE*ih^)4CJ^2ja$+FNghUw)V&RR!83P%8Jr>>={)V!0TK)>(HMH=?@KFrp7<^#( z*J=zi|9)c_1?_P0L*-JmLC6gCm5U!Km!pm137*?mHi{^UXv3H}h$1Sfw;~AK9E%qe z%4O+RJTFS)@a)G*Uf{~-(l9&?rWXDRf#ICc;Y0AHh`4{mKL=QfODx3~EJa5w#p@j8 z;&n*L_REp(h+-KH)PIy5lmVu$fh%9ILD?1tWqb<(pYwc;a`?|*2e_OAE=Hsg0h|Ya zzeIR1GVsqCUW4Iva&Rj07cBS^3r^y}=B#!M(j#j?jfeX%qhiC<$$VK1L%=>-e-U;C zg&x>cdS=2cgIfvbgL@Qi4crrO6>uBiu2n^CP&Kb%rKlfqm*K9$)?$WBgiD4S4mT2R zG~9T&Ti|Yoy94enxVzzy@9FyrO?GJ1DQ-u<`#-TdO`VzQ-Hs2l*xI3dYEnJDn!8u&LyDd^$*!k*PpaPc zRqrX)+uiRzj8?Z_fFQw83M|JoZ=1MprV>aO#HQy_w_1)PL2%Ig?Wy5xoKJ#{CA?}XicXIOqMIxEyXJ2O15Wn9wSuc_{x2JpXz;u|-|$jEWl#?dhg=#{`L zg7gGdb=N3Yi{!DIr>$Wt)>1^qu&}#Lw*kmlpafnNr14ZRSu6<4ZDIMv-hF>%Q*C18 zi{Mzc*!0f*f}jRoB!E@DB|KUi&|gEaa`i6hcI9e@G*P)aUmB}ieMT0M*@6|lW6y@e zk3{Ayd={bxtH>5}fS!V!!SbG>dD|6tdl;Jvt|8-|2pLqBs1Zz|{ukpslwzhy4Cc+I z%qNM#?FdCvqUqB;s3)2~O$f`|<7QBD+ci_D`*?%6Co+Zdw)t-c&3qCyf=!}CV7k#P zDhacwB_?m1kpdnPQ!$fj(%fwr^NT^^M^-m341Wk{Y8o6e0ypp>A0c`vDU2t~J=thpy>ka`Cu z`|2Fcjk$Z93VoH1u@0njKa*h-6IRzj+Fp>>Wnwb?8z9YKa&DT<*r|6R1Qlf_rP+NI ztHEvzX~@Eh2H9yFpQrBt0JThf-JGXCM^wcFYVK~;{XP+cwiwt6R94CQs<10bX#1Pb z@p5i-Qsf+Fm|sn87V~r;<(QLW7Mtc#iKu;LQ-O04u1`e}(4ain1~69|Nwu`abhnhm zLmrT4hCI7hK%{%0{1ep-Rzaj&InZ3$_U14k!u;-5yntAB=zj)2P#@Ytg+k@Kp%OBw zaiQrFX1APxV50}~vwJZ=LoN&B*D9TgyUk*BDhDXNAdgV4u8~u_g7gJFBN(qJSBvFL zDvfkk1PG<4qHaV{Z@?&hH4$`NZIyrm%{urv-d({WJn3(PbAu3S9ShwSqk?$&0*XfXeJa@n$q$ZHHgn{!bLr89%XVO-CMD zh@P~r{E!-&%mUamNWqh41(8ZPai%Lc4WCp!bPMnq9bS-^}Uv|iS92*Jd4 zC(57|*wt1Cc_L`It|!^i-^@Zb?lv>wo4ZCH)5TH{H@bpUbL3;XWOs(Ajfvw_o{1Wq zfN13aJ%vc`aSLHw4~(pf8o?vY^;qOlTM14J(UVmNc{VsThD1vX79k%Cqj6;@G=Q!@ zx_u%w2J$#S)Yh>vG@3O;8+6oQ8iJGq6d}|tR}RppP&WySs6i@oC@oV9Q6y%;_NIFY zcdl~PS@)@NLy-Ps&N!e?BIp8%7kBY&=xKt{_N7ZebO<}cSbk>N*6@-A!d$N$aI$?V zKY(53-+jYhn&BI9x*ijopZF|iXBC=%l;<0Hb`|!eY>4hlAt6H_m(}0G^X)$dDydyC zD$g0CV=?jJ*!i}5q3UhxV$CX<_@07R%>?T|U3d@IKEQ5VIgnH|J?PJm*X<8qY zg+iUdpJza-KA<6P0(K@q)&yg%)`@w?z-WB0rtjtadj!5$()WD+Jzk#5g|A2+$pp&m zmXk8Z&L$USf&&Oj+%Z$f#uHmI|sMU*l>5UPlWe!Ew+Ylmn zyPgGj<38o;C9x?TUghd#vFTRk`9f?O%{zm_r#uF|P@pLAf|W zb3u&(t<$i%`4l1itFooUCVYzvI!)Q8sfIsv`~%;pmk+>w2zTB$>PL3C$#B_lN8mn&yXYImCnV{t z-iBRMH^k6r?&8omA~uY!AdY@5zHBK&`A^_?4-H~f8O5GCG>*X63=KlxK1j^tL*p1R z_k1-mrlA$iz@c>GXx9s1XXY|+lf0gbyfxC4_{+gx&W2Dr8i146>_nuB)@(d|>DSXY zb!d?O8L2cvIk6XVFNIq9%g$erJqmP^>@iPEE4|`n@0Xmy zXOK;l!ua~3X<%IWi6wUqrEp07TtoehI5>g|#JUCt#u=<+q8MyI$*4C8UIEwgL#+bH z#6Cy#Eo(odzQv&i2N0tipeM#;pJc@7z4&|Os)O4HTtP}FS$}CU%)f+9xw+W^mC+KS zMD%5+uU5(eLfAY4U&_yD;AqyLNnpc@Y%CzrKpOQW=+7XJNIbeEOo5FgHi3)|Xr4A< zeKpcYNvAP(QiGX5rd%C{HTtW`vQ=5S2mPchq>0&U2ETZVq3@gLr!91!+ zz9%wRlMG{WG=sTCY&yy2u8Ax~QltaKmQ6RNU6el?sjZOSAwuQ|*szTZWj2z-g70vx zl}JKYuD8Ny$?KYCPk?4i7QqW(M&ki`wj)^FPS!=OmA>Qlf2g7J#IxY}tHQ2_gtlbg zsJ1)c=D>O3*26Wy{VUvmz;(iX2KR+;)Jp|$6>#vs4At^7RLjfv`$nDpi_gkc3I@e& zQA`c?QXV1pY-RabTS1I4iP4Dl687#2_5lo12`b6wVxaYNl%G*TjHg+88c$PfY&@OB z5{Fsh_=MZKG*&i@sWF})14@fS<;76SiRErK;%D)qBC0?KT;!rTORK~b4{a?W`UWAMf7MfZ~muQT5HB>~ZfNW+# zKY${&^iLI(;9ccY+aA;LZtVlUNM-A|Y_T`pG#1F&)MloZgZ0&xv`n@2eS~QtdPdW* zpzG4*Mug*sI-OnN?fhl1r12`NZS0Gu+Gdtnn&fJTidXlMAy0gHd5V1i)H;LhSW9cK z?-;OwtQQa@&=!Mt8$YdQYiSQDM;jJc-V%!SaFHdJKfSK9Fh|QzMy# z_fqH}7lmC@g`NpM3v3*tUVapA7u>5Db%dZMUiGD%{lC7{v+w(o2S*{9%|_urWa1rI zRiwp9Y-?b!zcd~HELsv<$AHDYBY_wmX0rr!FI5-KM46(82dK(nkozG*l)wuB{4Vot7o?k_hK$t41BAT+5rJ*o!V`^}GSsvI zla%NEPTMVcEzFY9Y|GOn$^{k*X{y4o)NgZ!T4w@|l7 zs*43fBn16QL=DX@&g8^sZ)zsm4@gKS$n~s|VRqi!Y0J-3y3A3Ut$R#l7;d)l!VBAG zG>B%bPBmxz*UD9)<<8jLdV@0*Bo^ndiV&Hq1)7yECz)`YwXO{J&W-`>d)e8%&_rh9 zoeiI&@$GD0Y}V^Rs@6)@Ar~|7$ktbv!4|ZfY(d*f^{3-Z6~K@V9jnYiZT<~l#$D9y zU+8i}1fantbh$4OL!;lRWLcqD3M6wj9od40#%w{*4xsQ`pww z^7OIITnYOHC~npLYr-->Cbmt;1bk54dwAcTA!D5%J4?EP6hoPirENSPFU%*s*n|Be z6oys&UOGbJ-bvk|6}L+a5kX6&U{Uzoi@!8(wUAFa~HcL~b4N!+&?E#-n~TZ-mBmeQG$vsiVX zQVtNwU}Fl%Rswy37^0JGFr^=63=f3}7wkUUeG#Hp_Ky2K)xiX^GW`~quPM6TfiPXz zb(8Q?Dn=Fm)8}~URo}>$Gkha|)Z`n%g(2rK-+yAZt4B`?;?~))l@lg6<`$Wb107}bH|9GHq;{W!D6TYk*4($ zUUnG^Cw)R-+EDZx1Yhs+7<%y<^f9~+343g@oVYE!6xhj%*i=Ci_duUXqEV?ya}StkZxaObA%uqI;Vs@P4F_*+9s|=f zuPYP6JXabzCXua~y08}a73&nJBN`xES5<6cx{>s~g7h(>*GR&yVZzH+sD%o+ z(^0iBd$7D~X&0$ZUK8|Uf3nuZ~)cD!@MltqFF21<&Ej9RKLg&4( z1T!<(#XkLsw?;w(jj+@J;+C=Shs3Rooc8JU&Q2CtJB;&TtN!0okv~m;O1k? z2M}JQX&%8slk-j5yXN<(v~~f>z=17+y=@nOm&me zz|{P5lrc}TxN^<=mU7T0{=(ab&5mm8Zjkda8i?mDrNgF%XothcL3(~AndgAf|wh3&f!Ur`oy`->i>V$21>{mgaZb)l%CXjjvA?2h**}vB2?z@w0ZNiBdk-P!G zLzbA(Ni4*eob!2y{s*cQWJqd54ZeV<)=E!k7Ip|H@&!d?PU+wu8OPMt?EoRo>(fF6 z-3*I8O<8GZqy;IGk0gu5re`TAL_un(8BZvo@Loz2-bFjf zx%Y5V7huff*~1ael5;d~1ZIJJ8;8kfM>&RZpaty6n~j}X$E@Z!f#ALZByU8P*f4MM z?xFSnJ!)$cs8tTo6UXi8q<%D;_D_`or}#W=o@#0EJV*;m!D_rxL3Xl0(*XS0VN*<` zji2;q6)YI_o5s%dR6kw6gR<#L(TW^X2+-uaa(e z#W2q{%EEi8PT=wk-TQsbI1GTdZPep2KQrHFBjs_+h-e+~?O4tx!JR9n?#gA&_S6 zZWu%F5`)xrU}C|a z9nA9QjKaAXEYL}N7wFKJvjW0qJ2hf+o=2f`DAe1Q!RS+48;Ht&<5A7}#aoDW1t~zD z7v4+n@LnoZcrO(t+Vf+}(Jd`$U$g@lBXltjg504DRLjn;9CnVz7^9^zRIpZ2>Ri{o zq|WQU&)?$qJvR~GF@0s^{1jjMhuAQ{=$|hJ|0n#Mg}mj>tq))=5Ezt>Pn1j8Z{Lk| zVl1p)&c>OYTx@{A=Iy@3965GZb>8%2dHeqwx=Ux*7KG*mmv2NB#WO8v(3`Xj1UpE z00Ug+u`JD0nJ1DI77tc@SI#Wh=Ba&)grx>pD1z-MU5x!2>#&Jk#yOaOhQt1i9^51H z|6`}<>ABc3`XC%s*6CchC2-5&R>Jw<9>vkTj#$^X%v$QR!5JHAQ48K#)P(E?n*KEIx3I47OHb>@&FEM zZw5{;1(9wMD~fXGXfr)@}FKZi8iHT5Nrg0iUKN`?xhf14#D zEW)<*m=xE8j}&%;T#5%1;Jz2wHZkztPsN4Yt7bhJWoDK!=s;T5LPON=LK4ypq)n&F z!#iyo(J5ggul`%41KcA-NCJSMJ1|Rb&~KB*H0Tp>io}W7M-fX}PXB|QK|dD#K7ntp zr!d80=LsER@K%(H@}fqM!J?pVMIJieS8=`=0YuPukrMk-yWH)>gHBsP9?Wm8tHC)e zEQRRJ?uv;hLCf2?E(W6z1oKj$zN5Mf({-rbxzvG^LL}v?+mK`90S1mwClKrN8=y zpUsP^hsCU#=Amw>2SMFZnRrh@rH^TM)?W@)(bQiKQPH%E)*s;_SI!YW-9|6yz+fqj;tbb;)L|r}w)%?J{ic z$S#Ajn~&@aYMUe%_=}_sq-zD~8B7a_zbKeSYcv4h3ed82TFgL$X->{G6Qd^5_@nAl z+`aqt^1oBaJ;hc1RH%3E)QqmP9 zsi7u7HA|ZpSij9`mJOjJ2V5N(3DJO*b-ui2sAgC5dWbG|khth~LFasBg%4xBF4e3v z(kfWJ^`q;d_D2dwe;Zh??}rxsqkc#p#W|xf-PurwYZuWq6-+ZRIfyWr$%1QXdfltB zUMg^VtT#%=acj;==;?e@%G$f0YGO37j@*|g&tMXVsUWWELpNpI79E%1q&T1EL?Fec zo6zWiAUYU>#hdZ;x^Y&d%egMAW31+cT@!`2Kl##LdK`9=12CVy0`;I`N9ljSU5KiQ zhoi%-NQ<6G1Qvk6D0$h@?u$2VHmstZhFU>p1|w@BCnEw@KZhw$#<^4~Cl)(te3l_Q zZ-D3=bruDgCWeSMxi3vqL-`OaKD_$?#K5*0NhpmE@1^P?b46`h@8(}om8F8|1b={@ zf?UcgnU0-8F%a|yS`KRK4ew_a%&r!U4eXwz?3bol*a(4VjBVu^Icc<-S>S9ohn8D2 zmZqU!)^ePfXF~sAPQWS1ULdK07^qde5gkhT&cW4#ulcO$5<3s{G87(R_ zwNg^7$hZzlj!xS+tRzuD!>2abLi>Y{z>m{bBvPuoSM&BNf5927o_>}g&R4w=IbQ_} z#4(Kps&1@_+ErW}1fzt06?0V#e)E*`+T!a4eZeh7OUPPH2QjrO2@4BmXP(1`y7P~*19j{;6FZ=vF9`XxY0uk+t$KSRj6n+`M)axbtmfZNEJ9fZGbdG28rQcEXM9;m}8DhZb1C$UZjs zrB5W-z#ed?LTtjZI`p5XRQE~E+l>QxRCzx}RB_!#ws9jvIY5C9_%ORa??g+ zTqGH3%3bdF5fP@2f`g7l`6x|5)LJPd#d`$oh9?p(ZvP%^B^ocd=ajx3U&wN`7<`s| zJh8Z4CLksuSk~9q(H91T-rclV9)A+R_H)u*aVG&50hG4pe-63i+djufOd{AlNz?a+ zEwLT`4!}lt__K53Y?~~5d_XZfACe;Gs_kMAfS3Ft>JA{}Gl1i6q(zZKW@a+aI!jGhF0 zMxH~(rp$;(ZU{Yi^d=kr;|?6K>`r{rGyvzp0(hy+&Z2+u1&|A{yPe${9TgO^z3~(4 zWbDZ8{DaCmQdVoxIznIFXMX87di1+TL1bv;&7jsY_?;bQ>YBbP?s^n~UWNQca_16M z;^?y>zSww!W1{uj#zyvU#WvgVty@Mp*6@R~Pz{57wu}{ne(i&1w(pA}n#0eg)y*(& z=91ll&VL@#HaFcwD8g*p7pe~<%mwkgdEP@IX=fkyNKeEb=?N%KR=;a6B@K+i86ipx zlChnTg6ckRI6xuTQOZ5B9i=$pxHO_`qC46sfk{eK0>=b-G9;7jKTGi(Q$5|v0Uo&k zXvPKX{Z>-4m#xV12HsvD9i z2<;%@lLhQ@?qAdCZh3YnFo1?eN2ssxGtxHgR?S8iA!BxpwbD%0^K1G(7C8sqt9s9C z?#W7fBJ`XlcH*3nW}^$6H1A|Adzi*(o>|(0OdQpOmR15zf!fh5&2v&+l8Lk07#QGs z6KRY#rqetwY-{n@F(A-v*m!PJ+^4XiV}c;vLXkybnHbLYMr8<|le7CLgHD(p#^Hr?x+=~#;ws=P zstLurlZtnY)_6UA%_Am54EkvIp!-V0>^fX_juc>Dx@OBb1nnGuOC?`5T}rE_IcDu( z#z{=qPEkd80qnj&L-#R+NzCxjHX~HoVzXki&_zNR;(1fCVFa6@V8BYF8l$SkF?3A`Y$@Z!y>?^&6AB-RE@}9yKI-aroKr!yB zT8?&P8qLpU=gI?Th-!YAUTX1 zNd4ga;B5zVnKHZ8P}pGhp*dN=n-{<;!E$0{uY+~i4(%8sFtlGIPlnpWC1<{sy|Av5 zrlgJ0ZvqPa24bWw(3z1@>h2P}41UGqN5j2pZ9bqNFt@ixXdy3lueEGmu8^tDX z0;cW2WURyGi5OT$?=&1A%Q-Iwy9k^q#bUz190Ht6mme;a$Kd)tlX7_&_9S^6lRRnC zEr5E!7^@7JAiM)+X?TC48CRPRjAsK@>Z#*p!4kcmQEbwo(HX(fTP+7!C0ug>BzV>H z3S-D1uWsXvI>gAu(zh7gjdG!Qv{}7XZ(lWZd8im?ytQ^WC z+-po#LpCCQA>d3vtuUqyWf1OtAqJ(&2|?K*;o1Y^ZX@YyupVM)ET$ffUJO`- z`%k^fIjiI`hAHP(x+;M4i3$ZIOuv%odFX0l1)K$G2FDEWNgL+{1#I6hW z2NE<~!22Lwz&nSog)L-T0UAE2Q=dCTVozyKJsC98$2#6qG#Ww+2a9=7&jXwi7M4#~hQT(S%uMQdX2 zzO0W!dnp(l1BU8KAPt5@c2^|&3`du_l)N>HmWX-@5tqzixWM=S;1{O^{XD_|xQGDV-Ihb~#!3i!1kfqy zhX^oX{o=0%v;kwL!1gh0u&$@2-5X&{Rt_ZsFk3LB4fgc~Uk#NEsC>a#wjp(W(N{pF zDu;%5xliGsgJ9eNxJrV%L2;2MhZ9V=#tAAv6&+*vpTa4Z)Ich3_rpdrX$oX=3QiPW zO`%yH_V#u+%p0FhTL`-w>c*LH)5S|rNCbrJObV{WxMe!P1!>H5%3s1z)S&vC4L<21 z)COHq^qC-R!gZs>7qq|!m2)QlM2iz7&r8qZM$NVgkv$(JoicSJ%a8R`3BXcLU- z`(epO$@tf;`;*DAJ(iltsQsWNJec1^WvkKe=00L1(;cHPt@Yh>`nx{+>G!ev@EKMj{)QXTQ+&hE+=2Hj zyzwIoFBjvD#nP7*y#EdFpWuB6@Av4|bOZZ59!DOOadR&8q?$XMvY&@Gv}~5TER#ag zDP$V?CSy}DF1b*B4s4z!&oZ1dWS(3nnOuBm-@NTSVnIvIoj_<7qZZU$Ot)0uB2#g9 zBqh5zr&Cx%!!RGNnDAV{>45=k8K?h{w-0uZZiMvaYrbsSts8zSyZ0l^lwb&9d-#Hr zz!zLuhs(i)ZB&!kNFeCL5vVPjhK^qR#jhjczt~^*P@C0f+v7ZFbvFSpEmOHIN%^P2# z`O+)YRTB_;3x05g@Vh({Fy?H>xeWINH4my$T{T%-mI+=G`!b0K>Ei3l$69`)E}JaA zo;O~6ebt1E=PbFCae4|430WT&7K5QwrtHs@HoJj_-PV*YYj?V_TZ01oP-JL@UW^9A z%=DJw?ZGXA+hjzIL6lLYR6EVuGAC|l9EZ#GwOr~9VDtY7ML~yV9Y=;IZx4pb505vc zbmaHvB}IPY2P5#F-q(Ljv{4U@k!|0-gmFB;wIdmx9-7pq(pQGN2O_^{JoeLpx)d&N zbm6SR0!CD5%STqYmOGvzg30bp!P0%Jq80A$&Y(MCp~u5=U$0{qZWF>VSOq#XXRHD` zF!E&s{@)^Pf1VwSpU=Ukt+M0(nDA5ch|ec6f9UCb1l9vKio?`wx!qwrK{uKP(g5H- z$;#u0wSi3H?g5Ia!(41&N|>;^FPX5H&WG7ZORCw`Az3RBg=$EvP?o2faXT?(Ls{Gg zLj&W8lt58-+O}Nx08u3+_Pf6@OEa*IHG=aC^vHuaS8xgQga?ENh516Z5Ds4n|0R4md=}-o z8vY}dO86UllJC#qGvPml2iW)daDVt5e0umXp-3ne)(C5b$FXJaON3nt-^`55pEJlF z_9Wfe2j4K^Vwh~|M)(UB-Wy(!ljF`W6mph(JP#ELxkB!OhaML4S9+JZg@UCI)RtCO3QyqY9iJ3RtMM~gLRsayN=d-aGHzNgY{KsmO2Q_&x>OQsH6$REMeCxu1RX5%~RZ;$hL z$N7agcm&7bcgOjiasKKWCw?ul#xE2(OC)D`b(yoK!nvtLqF;Fvib`(~C|A>unystG zFQSz>OV^k9OG*Lktf;{cux+k&771YG6XpI|XN@coGB63zmDSE?0?u#ACDl@8MI~6y zp`21pjq{1hb=SvltgNlY4?sGBdt+sFiA4TlLZv$U$DwpOUDWop#GBTb>-I)b}dwOjkKO+UE}nZZz?a5gc=A5{pcr(BUiIu5k%Q} zoU^n>t}1hGERjmrJEisI&hm|$q^(Z=^Oc~D|6Cqt@?4}Y-?FJ342vcgzJi@46~xr^ z`CuQO(}n!y1rM!u(ofWZ=~V3UT4#wLrG)_3_z7Q4b=6kq=1L;nS;Aq2C=;g&{_=`) zKVyqj1#7KTUM&I96VYlXfvBj!&&xp&kWrblq}I92`|!h{^~vg* z&DGADO;Tk|HR?@Dubm2pOM@9XIpO$4xsAXoYyyqd;0lpjU5=c}SdEvJmv5@t3ZmA@ zRV98Wc;YWdbpvN*EdxO4x^khS1iy(%DV*y-41V&i#=jLrFkT}(4*7MAF0Cm;ML$*U zuYgqkBPP#-GN^g-iE^-x3R_$5XXOJe5CvyN}5R#H=r?eSz51A?jZ=iUhS;nLzTL0-n z`uvq#2p-FrUd)sY@W{22^NI3EqXRKdY;{hJRS%aHCMArvi13u6h4OY(UR6%D!zGA{ z7?UCa;#2Dc+gN2l-1Bo*x~WnKD)KXdWlYLg%vx_@?(Ar4(uyb^S0{sQ3XM}{jj?FU zGk4#8cOb5T#@BVU700*-u}{yODir0gyy@p1H>02s?iGWBvZZpPywRC8 zb5Kp!qNo7aSW?Xqmc_BBb}-3|O#G2fBjpUCh|4D~3!$b|LKBS0UoF}qLHl|8E6Te6 zerGzB8Fj$9wGk>~DmXY)W0MX+JB@IKx&?ImPx1l4wXo1)PgT~)wN+cEqg|Ii3DRPE zcLm= z;3~UTC_+~oQERNj=DMSV@+d7YBe_^tRX&}*o-7AzS(EveTti%@8op;x>p|s|I5$;6 zuSHa$P!jRP7n`dpE?ds0%l$P%`dvQv%7s(85&>hO>1EPJQMv|oQ52F=4~{va%{Nlh z7(84jXR$`h)Mcy<$8>atP)xZY^Jsf1E0NG=#s)Je(~^>>N(xH-m7BQUgW`OmvZ@k- zPGW)q)HnM}jr~Q^+1cM$Bl$=1U!C&59kaU*wkjBBzQNy$BDe5N<}`ucTqK2@l~aX> lbEo1>&jrgKVGsVbuwdm{gbaRompw$k1U!|p)Myy|{{Z3%g<${y diff --git a/Keyboard and Spell checker/Units/pcre_config.obj b/Keyboard and Spell checker/Units/pcre_config.obj deleted file mode 100644 index a6a4a1067459ea2ab273d3c698dfc01a3a8984f1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1706 zcmbVMU2D@|6h7%Uv$JLD`~oSWV{;Ib1^g%iIPt3QdP7YLDg~Xkt#C7t0GY|+k{&V94~}+tlG9|jbw3~BFL(e zEpLsu5iKjawlU&H(iO4C{%kTW7j?sz>$r+GZn>_asGH+iMp?9Myeh&^s|s zCu{T$L|4@{LvtNc?Q+ml#n3%vY{>5O4!s7^8&Wj8x=wV*pyK)bwTyic-m-`%6r65! z-BGm{ajT5?mn%6s3^mhLZBwGfN}``Gwan-Xq7 z0xMrRVNB_iMdj7^eZ6|gih?=It14?2CE8guYxcrL6UUS+x_RZ&s?f5^MJp;-P{m19 zG4H+!V|!e2an*fGspgG|n&Wz06BUmfw}Eds*!+UU@g@o*XXP?fGzPg3FeF z+TjM5Evvly({&lmE~(}ex_q9hsSMt`g3pOh!^z9}9Ju^etCp`=9;~6!PD$|8_#X4r zio2Eu*RD!Y2-NL4g%+<2RaGU4dwEqspH!E@7d`LtVo)eS-OHat$yg0bzuByrj7bi_*xuO)Xvm{g%6a{ON1(z;cTwS^JzUpN)%##3zq?+K8 zuUC${C}n)A+N#B0uUtu7!ZNW=FI}~k^}_Fp`&L(4W!5aIS-i4xP1W+1l@_4osT8+p z?180KOKOt630ALNe0SCIRjVqOSyfgqsan2lF%6Nitq@DL-W`P1$OVi`tDSb%F@v$4 zPN$7AzkZ^8H}J{A`3#m?-JKQ(}l-GPG zI8e9dZ|6YW84Uf<LhZ&@r{i@^KBvhiCmhuLExOM=p<%O4IkPzE z*8T1Y`!{DRXYUI2+6~5Far=Y@hwN4w(B8Yc|6P&0NK(rHd_sdJ??x5Pe^~b&29TM~ z##Wc^Ka5gk899xb{Gu+u=#_V`&(!@dYX04cQnpkndrqTGKCH`!Cmh`DQ9h{%zNFN? z%7RlTG@x4Tmvz6#>u+8?$MkvP4tToH_h zzmlNzex=c&`JUEgK5)6PcDTTY!;iF+8t`{=!hWsHi3kn8+?77!(O;$pIO%PTM}T=6 ze7Qa64V&+9ll(MTlp}<5T1D_t-CqD$*&vW6w`!p?dgz=kp8;C}?VA4(@_a2AoKj*# zN!@pdH+v|-yQg&jIn94k_qBR``y@pN>?V09IFfPhsn+FI8l2|e7OvgafaK~mx^J6u zWIB)-MikRxtM1?GI2g^nRr7DreOq)SX_oD( zy;g5Q+ur|m2=E9M(0vhI0Mz<$jE3I%8CFm|Xu(D}V|5@CqABl;@~iW?Gxk+`b8F2^d7P`Waqc zetnB*$R=-(_qPV3`y=R#+phWQ74yb*t97|vY52Qx#SG&3x^H6=9+7V7Y@6I5J`VShYn>0S6?+`$dG*e zu`90_oQMC&7z8zgv4Ly={rrFTmz&$af4_cx`}WQ4->+|C^d65S_36{QcW;l>2fI%G z=XU4hWM^k(Ww~>*vl3}8SFc`~nHd=wu3nj72>$1EIvjSp&1PdeZf0$7R@mGAR$)Ij zAmBJQJzzh!6yZnUUa7Dh+XL4K_Zr-OxZlIQ4fhAQKf(QXh3)-uaMQq4T+?tl9d_Gu z<&0fD0h4ePV_SwX)`H)viHyBm%-Fg@#v1VZ_&CO17|Gab5dW9>Jv)Z6dq*%fwt%r3 z{2m<5*dxOkTXYq482qkxGxj3jw&bAfT*e0D_oZycqF6#0;%*H1cEoo;(!E&5*j1&B zeK()6>0qC|0~vdAFk{(QGWPwMj1^8}?BrC&N~bgSwHa8B5uSjZdF%CzIf39$(AG?B z-Twu|7DDG;I|*aK2Eq^5>Se4LZYnk-H-jBpCC2)}z1EMhas2@wZa?ZOa9EnW@?j|w zMHhAdAyYm?;`{38d?)~?G^~uL67mZIM98mGNs0YOj7c&5Qe-g#smeEq^=qckS!jtU zgU(X?E&Z13xo)KBJ+tUADIbCueB`?_9yH6vw9 zlMlr6C}({?Q$C>k4>%5b{rT%MNManI^iYN_=f~k4a5N|l=QX)bsjXw{2kZX2#-sLI z%@AZ!p3>-AV2OU-z#yRs>Ha(odSq*{uUVJ#w0V#nuG6#n*`&yFbOC}-z)BT|Zc!&u6RJnol`XAme9!vzxbdi* zPQzpqz*<-RvzmB|*W`4*Xz1}5OlEbrK!&DaYjalE+FWpMI1gMdTpnCLTmf7mToK%8xDvRD zaFgMt!p(r24L1+&OK|0I6>zu1ErPofZW-J?a8+=t;DT@uz^#L;gNwjzg4+VO6|Np` z8{Brdop8J0o`!oC?s>Qu;daBl3fBO)53U*R09*^)A-H$p4#Ty=wZXN+oq#(DcM9$d z+&L_X49*GXs<1tIMIc)&i&#(+3~cAhC}&_t&Komrz6fb+q?24Qr)^xdA-$3IA=uGa zq%P_Ksf`&RonY@>oQPtj_EUf0WIEYhpxWvS$&US7=VX@!*{5+bLZZ5gIoYcVAyqbGujZOE zs~|K8xyo8lyC1l1bGZ%CDGM$jvf77wlH6(%kx!CD?PQB-ya$~@pk*#98HW%Rqj>|N z)IL2O2HTOvo>&;jd8#bn7E6NX!kw$}!z5S-f!%6>jcjKG_6vZd$T?_CAcgMRS3ED@ z>jM)U=P4FLb~`tIgQ5a$!!R`Cd8$eBzOPME-^UO+4kM4#V2NIQAt1w)3*06+0?Cc} zFhqbCh}LHHMGL|HxcrI@5aQFQo8{=Kt9U^^0DvPvdsu8hdg2J#r98kn0?R^KYTECQ zXYl&!ekmfMgS1eE`k^gd-X~Z~Qa^_Jm{K*m9r6Jb6+_B9W!0yV}zv>v_`*~7Ce zJ68JqxM(tb2So+uP9tO}@I+f{5lXaGb7dFp_)(_wd3aGfqfk_|^DsijmAocjD8H41 z;b0lLS&LR-E6hzf1@TOi$8?p_NIHj)HehVwPwLeXpv}A??C~Y40?=0US4R!jmmRWB{NZzk3$rYUUGVr*6HuGW?}QsE2mdn--JOB zg=^e88F%YXJ8d2=dWE3WVnKk7yRb8eQi!Ov{#uJtFz}tw{o77EJygeBf!i~fp za}HdSx(GE0>&7qO=^OxU(`?GwtYD$85$4UExZ6{6d&|(B9UY%AT zVG&I9#_nyA>bX^3l$<9@0uVIKDYNVXe_E7-DHiS0`WKn90C|K`jdwLJDW)f3-{+7h z%5m@IbtQESw!JCI2%Q64qb_Bm4TS~bD-kmOj%_lx06H~a9p4#FOf5E7M;FpgMe7S4 z23E>)nE6iW+-R7-T^Ry6f_6^;Sc0Ld2P(Doy@DS2S;1`hIg&~gORhp|Q5MN=N!?6j z_##M8_1I)Wq*xgtzv{2qNQ*GEY;7D>SW@)IG={uyXU^{MNZH|DW?K;?I z?g(TaTNUVaY;7O|HX7TpN8x@5_rKwug8K<r)mQ35B?j=$otkZl6T5u%5^C! z794L9wUNo2pYB{WQ3^O$*nca7hLD;-hA;hJ`&RKCLz>QqUG>f zUo4`nf$^tXq6JVuF=r>pb;^@MvQW>voGL?5QJ^`DkkN-4x=b|Bqqb`a%`LEB^%Tv! zQ1**9H$3Q5w`l&`^@QeGouK(@ixZw-`}T&ZDb)%bjvaZI9DXmF z7TA9iA>%)ISCi@=4lOmDEaC93j<5Y#i|D|JPVtPAWX*c2Ih5Dry9{ALMXQ%Gor%_P z_#{LR(fZFYO81o3KSkLu8m+HDpSq>>+3_?<F(y z>&cqGL&&(D*Gv)xmg0{30I2|%&<7NN5Nloz2i9|4t~{m7+0%8okFH`Y<7&oo;rwtL z;I_jxsTCb{IRcQb%kg-cF301Y>2d^zbh%`Kj=G#9rOWY>(B-J4rOP=iU5;l$m*bg2 zmqVV=<#=AYE=LJq;G{A~aV!@lggxM03Y+&qO--^&NA-a1xSl;R4a>#TST0_`GVzN* z=KHS)dcFTvAOo8e+xs8E{S)pi+`lVqAK2iQ23*3nQDCjeooN^K=z-v+GYARhWI=m6HV~R9M~l|0u*%rfi!ewDxJ(QSRxtKlUp6~PEGw1@C0o%Hjm>^U`k2H zlpdub{HT9A(wo#7h!Q+KQ5Q%3vDruq?;*bdIntJAC_hT^^mBi8G7|I{`Qr3HHjxsd z+!vXNYXBS|ZUXS%CUq)`@g}1b@hxWYReeh1?XHVfTQ#%flAzLF??ez zHhKXeV;a2A$VSTnLM$vFT}NZlVkOjd+|)SRdqcnAB*n-M-g>iQ*sF&aZ=pokP%*}! zC){{PE69rU4C7^_LwcW{(XUQYe~d^RbD?z>48S$8LeixS+URA6vYS)_&T*BPjgKJG zVK(*@D+I{G$|N)?CfB0~8Aa3`x`6TNw_ghZLSW@DqY2nHW$$U_xU;&Sa(qp&cX%%! z`*C}R_c8p|g-wI^5eLv8v?eRcH+cN>zv0*r1_F)tA4mL6Wz$WG#mJ)}x zWE2X^0Rh0GH6XF+=Kv+O9xYpo)^EB*)2Qy4hfZ3>^^>^(CQ$SfgpA32RG$e&OL_Nb z{fXmb8z>5Y(kBmMRX5JpfG1FtaO94h_Svt~Xb@8=0(}(*q+_&Lg zf%_v|lUkU-R>JN=0McbOkEh9M9`8(66C9G&$pT%jrD#3mTFC=EtesZVC6@EbqRTW z4hk5JNk|xqr3+t*OX^nvCT#vXG3JKO$2_`wPDn{#cXGU|5HkK<_*ut05@5u5Utl{1 zv$n-Bm1@v3Bxo69p=C^lsdT!vM2tprpPzg_(*b)FOP9|Sm(=NKF>L-gfxTxxBlbQT zW^s!jaE+sghRqcOd}0UFVdkaHBe@(ENxg?;^mhRcMv9Ta}Lsk|Yj<2SZC!n8m# zO+ASbCa$$Om9xpSk?3-$jJ0rE;C>JHFn8P70%Jl(a{!665IP%)62OFtOlKo8 z9v5dPbT(p{y)+I7GCEa2cSfmCiQZ&*8?9|IwHTi#O7er=$dq{**1-wSEEet3Z2_E{ zAdk+Sv?$LLGFoh~DM83+I(6~JC@!gsuOSlL-+`{3UFYH3oI3AbSkID|3}8J2p}Mr5 zIRRRT?t2h2{yCJ!*CXrM8z?Gjj-i^rLNsiK(Z>teqz6{C4|%H{*rbY*F2yDnZ3U&s zM5^a&b@+B_(G#4~n%a)vu&JVJsf9E~nRI1FnU3@(wG~kWuzeP_aJH(pQN2CnHy|e= ztYZ}KaEtq0BMo7BT7#(N&4ke3%FnNJlV^Lc%h2Bq@? zX)>QiV)FVTOVlNqPtDn)gcF^&(uK_D2)c}2IuSzWU~L@DI`3DS%UfA68sgU2qJJJF9b0`VN^9`q!c4u{8rF~7%oxyDm z?FpO1fduBD!$1Y3n9yNp8TUphE~$)nsC1L!EV9bLTHlO)axc(+@zXPt% zUdeHN6E|Mu!{F7P6&$a$4+>s)T^;fEwbyae#nthV8QgNwo>SdlX)g@+QQAv_S=Xfu z7tI|=LNTEj36fA;Qn#S7u=(8QMv_i(J_3!11x826$fE%!MQ9Ik{@xW9jJX8k5TZig zd;=k@2VQ@@r2d-1J}#Vb8+(}Jj_uuDAl#Y+c?uyT43C41tl=TLHS|{?TmTQ<)N{a- zl7Js2z(w$I-bKW#>970Sus4Ew<;>R9eV{>n92)4}Afvng;6!DIZ<`jSD!BIJ<#i?X zz~FRTiV-JFw;eZv{5|S|^5yvoP9OhKUA@me!M3Y1C1Qar41I@N1L08&L#cJ`lxVK1hDs zCvDt;uTX}t_kRvs#%r);9Dw!^g(k5Rn#3~*KW{A)xa>fi)wIt5)#s_T82Jg~!n2eR z<-W-5_*Gz&`l8j9D22RHs!Mmgs0vgJQImS9$EZL`#lV+;ys}95@QDC&W8qB+!II0cmSTD^h$(4X(5vDRUnc} z5+b<*Ih~2*sZ_%f$zv&!WVdebBRWx3Fz`K8DPhxJm~PWgml@rSt!bv4n1|1c=LT9} z`vR=-7@{c*b=#quWX=CV$XG_+Vt4{EeuM}y+*U7bq?>85*GrL`5J+k$(#A1}#xsl& zR64nOb=&MY7_S8$?nEWyLqtW3?;(_Iv3dZV4s_6keoOg1Yhzoo4QkEM;E6Ui5R9aG zeY_M|Nm<9Uq(~(X43Z*?5D=zzDN@eEB(tQ*Z20ksNt3&@aRL%xc9$Zfc%Vdz3`Ibg z-=)X^DxP8V!A}o6{a&txn7OEA970rd`VE9qogNyTNoN96=}dszE8MVG+yG7D8E6u( zLX&t6n#2KXiI_SmacnR)acnTccnsi@!>AraCkHr+DZx>UI625L)=`5!!}J0a71aDs zgp676M5iYsgqzB?U~euq>bcmU57+B8^=Uqhx!j9*P!5ZjH%f_8#75ENgc3qQd>PCY zA)FYbU(R`_zt#FA)HC)W+VQYzQtGbYHM)PhIt|nbD;pN?{E_|DFExWC_#$ju3{T%k@WD0BrKC&xjra?#@-l}fu+K_ z;HsFTrR~=B)wX`rGaM-QRm_pW48^=5spfY$1TE;|2$U}vKLij#F$accY(+F>`ME~- zZFl@`=B154O}r~)^SK3~CUxiMh9rV?0g@=G1Cl7ADMqBzjUy;-&PA zI#d_vX+y}kAKs@x&(qWieyy$qp(b_v=Y}4FbOCxOsRMc_A&DMb+d8%!_KJ0|S133Y zc^F#7kDygN4Nc-XXcZ06Dw+Zr!Y(m`#7a8L?etJW5n=QCPOy2k#c7>rY?Y`gFu5Ng zBLFXLauVy5BB@E;)-7)2`U|az^&PB)P5HH=JqV&>in{8N&6cd(Vf*HrH$WBaT z4qqg#3Hs6#lwV+mwk1AabZIKp)>Y~TKH$~VEfkGWbaQrH<1g!Qt)u{+v@wRh@xTyh zk32w@B7@$=Ns39@c(nZhn#6O^BwoaF(Fe=LP%IZkfsChq66h_KiP^Qo^cc0%19AEf zHwe6k`UoZJ0Yp;h?{4+@GD?cc^K*oZ>AYf+lOY2qC;NOEow*xelAVd?;LD5j%R}AH z$vr47Iy96z^ixDrf?=2*C3N&aaJHddvIomK5X&NeZ4$^y`nJEb4+keFJFy)hV$}rUjuW#qeh)M zZ)nj7kU%KKHD4ZHH(%L9X)HJ^rPUP)-cj~uko15)L{AW<9sF`N<;!R)L4Smd>C|%1 z7SG&d%?GGv2E60|&Sa&7!FTkqCllc`oZWPW?`D)2y%5i=%)W`nhWl=N7V;V7B|6L zi~Y@b3Zc~uMa+<^y>>U2oPDD;wGP>ed3!KRF~6FW_%vS1VA2jtb7Z{FmIT3p74-oN zN%v12yy3D&KZXYWD?}4(lvoDlIq>}z0op_UvQYN!zk&RQ3x!3}-JyjkuDdaD8>i#T z6OMPe5bg34WM8rmFCb)0gC}5DO6u!a&=MVTroK$iAV#c0hr)Zv2Od~3(X*9QyS9X_ z$69M4L!6;?+5Yc)SvVL+?f)9lRNYTEq;Doc{uLqP8ysXr+3V0^%g|vxN`8uWcueq) zL#2qO-U%N}#(z^2o>CJN-WH>X&V5W(Jb+daypYM%d2fNY1jEJJ|7x1}K)w|ZX+XHN zn*T`+5vvV;DZy&@AVFaM_F!)jAeOU^RFyqc04&GPHur|))J-qkVWQsPX$i=uuI~pK zcV$|rejOoWA-vCuYAFe_hCnh7vSb#fQrcv5J&(yI@Sr~Zn-24>bC#7G$_X{+UreB8 z5l0RA40GTF5N9~ilCp;QDM^n+seOmstf{wC zoEOx$#Ga*8U$Yjipj4HYtyd{kR4lIN6}4D7&!@UxmCDwP$M=KyH90)ug!CuoLiiT- z!Wz|YDtjo6t(Q~l?HIf`g9qbaN$n_?#4_+DdU^&I&QUAvm9F>f4LoL8(`sqk-BjG)Di5m@%6&IAUQfn1qNxhw%dhjS=uJSW08}>;z|HDUHrUb$t5W ziU;&SK5HqR@rwizXCqtLLq1M}e@r@&KcdBEAdc(W@QXPBEjpD_R7y|HJRTFG)+VZO zKRNS6dGWl8rcNdZX$1nQ~$ncPMX|T5KYU zDto9~EHpi(6hXM1(s^4X+&XzE$T*8Z3L4!3p<^89W8Q_U#)p6a+6dORFiG7>i!2|t zjjkVS^3D`rz+3slz@p*f}V zG2wl_&K{vLW+l7*Btpgnc=V=3jOdFS*YI^;vxC!2i;kwKN{L>T!ZaZ$X7aSoCWN4G zsz&vjsqv1(9d}gjY$}L3K$X+yK;repe`5hi4xcUPLh_RV62T|rtARrkqvk_@hCu2GwK-`Vdm*JkuRHV@3N$Ly=_?z*C00reU)Q@xWz;Ja$^MkTM5 zk<$Wkhb(*}1E0Foq~4AY{qc|53i0VN;!)n^a{5G?v9D-q5k{vr)aK|sWW0b>We+8? zP@0N+HNP3tl~j*=I0oZu;=T9-ckz{`ybDhja@G&fiU8K%FrPnYRnA|rEaN8szI8#U z`1IaP^^H)<@C4TCaf#=se4fM`R9GSR0YiAS3eRfdtq+fW8$!C%s&rk4nkI8mbXA4~k5FgKgW>{w<11{x;k5DXYzUQ=j)v6FGp2IUDuzdUT z!$%ogg_j-}z82arI57fxL)wg#bTFC?yV=6ootsWcCZBa2VPe4z+UviMkV*227- z$WXCH8YfJhCJ=a zz#FVCwP9WM?$gv_Iki}u$MxzwFTEAoc3Z&qWNDz!Q%3@l&=M;AxwRAV-Yu3I2u|4M z@Gfm_!-n+*;mU>v0$AI?g8jp_JOV!YCjst5fFE?@I!jY2cHQXdLcGq4V`xy>ouo28 z00nWgol=b7yz`w*439#z<_a@(Cb}^HRu(8t zXwa7oL?UQ_2QhOL*6H!tjM|?9L<4)KqxsejDIy+&b3}sTU zs}Jk`SMd}#iNtmH>vDVX>o<|9qP7w%LtSVwCu!={N5|{*2-nR@?I9Mt$}6|mjGu6j zUwN7ta6YjFPu9GKCu@F&*Q|yGa@fuVHXFNrvuB3ae;}AaZ@oF@#S2iY+K3OP%DJ0e zGeG>ekxy9}lyw50q>xU7_m=Nv_ripEPM_z(7_fh(&7B!4G(!b=J~CiVSlIs9Q(Vng z&fwzEyF_=a5R&>P51n8^i{on&vnt8)9r+-Q)2@NmAcKK&*BJlKMwPI5|B;PP|(3U_KU=2Bgk0eo1-F zW } -{ } -{ Copyright (C) 2003-2004 Renato Mancuso } -{ } -{ ============================================================== } -{ } -{ Regular expression support is provided by the PCRE library } -{ package, which is open source software, written by Philip } -{ Hazel, and copyright by the University of Cambridge, } -{ England. } -{ } -{ The latest release of PCRE is always available from: } -{ } -{ ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ } -{ } -{ ============================================================== } -{ } -{ DISCLAIMER } -{ ---------- } -{ This software is distributed in the hope that it will be } -{ useful, but WITHOUT ANY WARRANTY; without even the implied } -{ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR } -{ PURPOSE. } -{ } -{ ************************************************************** } -{ To do : } -{ SetLocale Implementation } - -{ .$define USE_MSVCRT } - -unit pcre_dll; -{$ALIGN ON} -{$MINENUMSIZE 4} -// OBJ files, do not reorder them. -{$L pcreposix} -{$L pcre_exec.obj} -{$L pcre_compile.obj} -{$L pcre_config.obj} -{$L pcre_dfa_exec.obj} -{$L pcre_get.obj} -{$L pcre_study.obj} -{$L pcre_info.obj} -{$L pcre_fullinfo.obj} -{$L pcre_refcount.obj} -{$L pcre_ucd.obj} -{$L pcre_try_flipped.obj} -{$L pcre_valid_utf8.obj} -{$L pcre_maketables.obj} -{$L pcre_version.obj} -{$L pcre_xclass.obj} -{$L pcre_ord2utf8.obj} -{$L pcre_globals.obj} -{$L pcre_tables.obj} -{$L pcre_newline.obj} -{$L pcre_chartables.obj} - -interface - -// =========================================================================== -// Native API -// =========================================================================== - -const - (* - --- Options used with pcre_compile --- - - PCRE_ANCHORED - If this bit is set, the pattern is forced to be "anchored", - that is, it is constrained to match only at the start of the - string which is being searched (the "subject string"). - This effect can also be achieved by appropriate constructs in the - pattern itself, which is the only way to do it in Perl. - - PCRE_AUTO_CALLOUT - If this bit is set, pcre_compile() automatically inserts callout items, - all with number 255, before each pattern item. - For discussion of the callout facility, see the pcrecallout documentation. - - PCRE_CASELESS - If this bit is set, letters in the pattern match both upper and lower - case letters. It is equivalent to Perl's /i option. - - PCRE_DOLLAR_ENDONLY - If this bit is set, a dollar metacharacter in the pattern matches - only at the end of the subject string. - Without this option, a dollar also matches immediately before - the final character if it is a newline (but not before any other newlines). - The PCRE_DOLLAR_ENDONLY option is ignored if PCRE_MULTILINE is set. - There is no equivalent to this option in Perl. - - PCRE_DOTALL - If this bit is set, a dot metacharater in the pattern matches all - characters, including newlines. Without it, newlines are excluded. - This option is equivalent to Perl's /s option. - A negative class such as [^a] always matches a newline character, - independent of the setting of this option. - - PCRE_EXTENDED - If this bit is set, whitespace data characters in the pattern are - totally ignored except when escaped or inside a character class, - and characters between an unescaped # outside a character class - and the next newline character, inclusive, are also ignored. - This is equivalent to Perl's /x option, and makes it possible to - include comments inside complicated patterns. - Note, however, that this applies only to data characters. - Whitespace characters may never appear within special character sequences - in a pattern, for example within the sequence - (?( which introduces a conditional subpattern. - - PCRE_EXTRA - This option was invented in order to turn on additional functionality - of PCRE that is incompatible with Perl, but it is currently of very - little use. When set, any backslash in a pattern that is followed by a - letter that has no special meaning causes an error, thus reserving - these combinations for future expansion. - By default, as in Perl, a backslash followed by a letter with no - special meaning is treated as a literal. - There are at present no other features controlled by this option. - It can also be set by a (?X) option setting within a pattern. - - PCRE_FIRSTLINE - If this option is set, an unanchored pattern is required to match - before or at the first newline character in the subject string, - though the matched text may continue over the newline. - - PCRE_MULTILINE - By default, PCRE treats the subject string as consisting of a single "line" - of characters (even if it actually contains several newlines). - The "start of line" metacharacter (^) matches only at the start of - the string, while the "end of line" metacharacter ($) matches only - at the end of the string, or before a terminating newline - (unless PCRE_DOLLAR_ENDONLY is set). This is the same as Perl. - When PCRE_MULTILINE it is set, the "start of line" and "end of line" - constructs match immediately following or immediately before any - newline in the subject string, respectively, as well as at the very - start and end. - This is equivalent to Perl's /m option. - If there are no "\n" characters in a subject string, or no occurrences - of ^ or $ in a pattern, setting PCRE_MULTILINE has no effect. - - PCRE_NO_AUTO_CAPTURE - If this option is set, it disables the use of numbered capturing - parentheses in the pattern. Any opening parenthesis that is not - followed by ? behaves as if it were followed by ?: but named - parentheses can still be used for capturing - (and they acquire numbers in the usual way). - There is no equivalent of this option in Perl. - - PCRE_UNGREEDY - This option inverts the "greediness" of the quantifiers so that they are - not greedy by default, but become greedy if followed by "?". - It is not compatible with Perl. - It can also be set by a (?U) option setting within the pattern. - - PCRE_UTF8 - This option causes PCRE to regard both the pattern and the subject as - strings of UTF-8 characters instead of single-byte character strings. - However, it is available only if PCRE has been built to include UTF-8 support. - If not, the use of this option provokes an error. - - PCRE_NO_UTF8_CHECK - When PCRE_UTF8 is set, the validity of the pattern as a UTF-8 string is - automatically checked. If an invalid UTF-8 sequence of bytes is found, - pcre_compile() returns an error. - If you already know that your pattern is valid, and you want to skip this - check for performance reasons, you can set the PCRE_NO_UTF8_CHECK option. - When it is set, the effect of passing an invalid UTF-8 string as a pattern - is undefined. It may cause your program to crash. - Note that there is a similar option for suppressing the checking of subject - strings passed to pcre_exec(). - - --- Options that can be used with pcre_exec --- - - PCRE_ANCHORED - - PCRE_NOTBOL - The first character of the string is not the beginning of a line, - so the circumflex metacharacter should not match before it. - Setting this without PCRE_MULTILINE (at compile time) causes - circumflex never to match. - - PCRE_NOTEOL - The end of the string is not the end of a line, so the dollar - metacharacter should not match it nor (except in multiline mode) a - newline immediately before it. - Setting this without PCRE_MULTILINE (at compile time) - causes dollar never to match. - - PCRE_NOTEMPTY - An empty string is not considered to be a valid match if this option is set. - If there are alternatives in the pattern, they are tried. - If all the alternatives match the empty string, the entire match - fails. For example, if the pattern - - a?b? - - is applied to a string not beginning with "a" or "b", it matches - the empty string at the start of the subject. - With PCRE_NOTEMPTY set, this match is not valid, so PCRE searches - further into the string for occurrences of "a" or "b". - - PCRE_NO_UTF8_CHECK - - PCRE_PARTIAL - This option turns on the partial matching feature. - If the subject string fails to match the pattern, but at some point during - the matching process the end of the subject was reached (that is, the - subject partially matches the pattern and the failure to match occurred only - because there were not enough subject characters), pcre_exec() returns - PCRE_ERROR_PARTIAL instead of PCRE_ERROR_NOMATCH. - When PCRE_PARTIAL is used, there are restrictions on what may appear in - the pattern. These are discussed in the pcrepartial documentation. - - --- Options that can be used with pcre_dfa_exec --- - - PCRE_ANCHORED Match only at the first position - PCRE_NOTBOL Subject is not the beginning of a line - PCRE_NOTEOL Subject is not the end of a line - PCRE_NOTEMPTY An empty string is not a valid match - PCRE_NO_UTF8_CHECK Do not check the subject for UTF-8 - validity (only relevant if PCRE_UTF8 - was set at compile time) - PCRE_PARTIAL Return PCRE_ERROR_PARTIAL for a partial match - PCRE_DFA_SHORTEST Return only the shortest match - PCRE_DFA_RESTART This is a restart after a partial match - - *) - - // Options - - PCRE_CASELESS = $00000001; // case insensitive: same as Perl /i - PCRE_MULTILINE = $00000002; // same as Perl /m option - PCRE_DOTALL = $00000004; // same as Perl /s option - PCRE_EXTENDED = $00000008; // same as Perl /x option - PCRE_ANCHORED = $00000010; - PCRE_DOLLAR_ENDONLY = $00000020; - PCRE_EXTRA = $00000040; // turn ON pcre functionality incompatible with Perl - PCRE_NOTBOL = $00000080; - PCRE_NOTEOL = $00000100; - PCRE_UNGREEDY = $00000200; // make the match ungreedy: incompatible with Perl - PCRE_NOTEMPTY = $00000400; - PCRE_UTF8 = $00000800; // evaluate both the pattern and the subject as UTF8 strings - PCRE_NO_AUTO_CAPTURE = $00001000; // disables the use of numbered capturing - PCRE_NO_UTF8_CHECK = $00002000; // skip validity check for UTF8 pattern - PCRE_AUTO_CALLOUT = $00004000; // automatically insert callout items - PCRE_PARTIAL = $00008000; // turns on partial matching - PCRE_DFA_SHORTEST = $00010000; // return only the shortest match - PCRE_DFA_RESTART = $00020000; // this is a restart after a partial match - PCRE_FIRSTLINE = $00040000; // force matching to be before newline - PCRE_DUPNAMES = $00080000; // DW 7.1 - PCRE_NEWLINE_CR = $00100000; - PCRE_NEWLINE_LF = $00200000; - PCRE_NEWLINE_CRLF = $00300000; - PCRE_NEWLINE_ANY = $00400000; - PCRE_NEWLINE_ANYCRLF = $00500000; - PCRE_BSR_ANYCRLF = $00800000; - PCRE_BSR_UNICODE = $01000000; - - // Exec-time and get-time error codes - PCRE_ERROR_NOMATCH = -1; - PCRE_ERROR_NULL = -2; - PCRE_ERROR_BADOPTION = -3; - PCRE_ERROR_BADMAGIC = -4; - PCRE_ERROR_UNKNOWN_NODE = -5; - PCRE_ERROR_NOMEMORY = -6; - PCRE_ERROR_NOSUBSTRING = -7; - PCRE_ERROR_MATCHLIMIT = -8; - PCRE_ERROR_CALLOUT = -9; // never used by PCRE itself - PCRE_ERROR_BADUTF8 = -10; - PCRE_ERROR_BADUTF8_OFFSET = -11; - PCRE_ERROR_PARTIAL = -12; - PCRE_ERROR_BADPARTIAL = -13; - PCRE_ERROR_INTERNAL = -14; - PCRE_ERROR_BADCOUNT = -15; - PCRE_ERROR_DFA_UITEM = -16; - PCRE_ERROR_DFA_UCOND = -17; - PCRE_ERROR_DFA_UMLIMIT = -18; - PCRE_ERROR_DFA_WSSIZE = -19; - PCRE_ERROR_DFA_RECURSE = -20; - PCRE_ERROR_RECURSIONLIMIT = -21; - PCRE_ERROR_NULLWSLIMIT = -22; // actually not used - PCRE_ERROR_BADNEWLINE = -23; - - // Request types for pcre_fullinfo() - PCRE_INFO_OPTIONS = 0; - PCRE_INFO_SIZE = 1; - PCRE_INFO_CAPTURECOUNT = 2; - PCRE_INFO_BACKREFMAX = 3; - PCRE_INFO_FIRSTCHAR = 4; - PCRE_INFO_FIRSTTABLE = 5; - PCRE_INFO_LASTLITERAL = 6; - PCRE_INFO_FIRSTBYTE = 4; - PCRE_INFO_NAMEENTRYSIZE = 7; - PCRE_INFO_NAMECOUNT = 8; - PCRE_INFO_NAMETABLE = 9; - PCRE_INFO_STUDYSIZE = 10; - PCRE_INFO_DEFAULT_TABLES = 11; - PCRE_INFO_OKPARTIAL = 12; // DW 7.2 - PCRE_INFO_JCHANGED = 13; // DW 7.2 - PCRE_INFO_HASCRORLF = 14; // DW 7.6 - - // Request type for pcre_config() - PCRE_CONFIG_UTF8 = 0; - PCRE_CONFIG_NEWLINE = 1; - PCRE_CONFIG_LINK_SIZE = 2; - PCRE_CONFIG_POSIX_MALLOC_THRESHOLD = 3; - PCRE_CONFIG_MATCH_LIMIT = 4; - PCRE_CONFIG_STACKRECURSE = 5; - PCRE_CONFIG_UNICODE_PROPERTIES = 6; - PCRE_CONFIG_MATCH_LIMIT_RECURSION = 7; // DW 7.1 - PCRE_CONFIG_BSR = 8; // DW 7.6 - - // Bit flags for the pcre_extra structure - PCRE_EXTRA_STUDY_DATA = $0001; - PCRE_EXTRA_MATCH_LIMIT = $0002; - PCRE_EXTRA_CALLOUT_DATA = $0004; - PCRE_EXTRA_TABLES = $0008; - PCRE_EXTRA_MATCH_LIMIT_RECURSION = $0010; // DW 7.1 - -type - // Pseudo classes (handles) - TPcreH = class - end; - - TPcre_extraH = class - end; - - TPcre_tableH = class - end; - -type - PLongWord = ^LongWord; - PPAnsiChar = ^PAnsiChar; - -const - MAX_CAPTURING_SUBPATTERNS = 65535; - -type - PIntArray = ^TIntArray; - TIntArray = array [0 .. ((MAX_CAPTURING_SUBPATTERNS + 1) * 3) - 1] of Integer; - -type - // The structure for passing additional data to pcre_exec(). - // This is defined in such as way as to be extensible. - - TPcreExtra = record - flags: Cardinal; - study_data: Pointer; - match_limit: Cardinal; - callout_data: Pointer; - tables: PAnsiChar; // Pointer to character tables - match_limit_recursion: Cardinal; // Max recursive calls to match() - end; - - // The structure for passing out data via the pcre_callout_function. We use a - // structure so that new fields can be added on the end in future versions, - // without changing the API of the function, thereby allowing old clients to work - // without modification. - - pcre_callout_block = record - version: Integer; // Identifies version of block - // ------------------------ Version 0 ------------------------------- - callout_number: Integer; // Number compiled into pattern - offset_vector: PIntArray; // The offset vector - subject: PAnsiChar; // The subject being matched - subject_length: Integer; // The length of the subject - start_match: Integer; // Offset to start of this match attempt - current_position: Integer; // Where we currently are - capture_top: Integer; // Max current capture - capture_last: Integer; // Most recently closed capture - callout_data: Pointer; // Data passed in with the call - // ------------------- Added for Version 1 -------------------------- - pattern_position: Integer; // Offset to next item in the pattern - next_item_length: Integer; // Length of next item in the pattern - end; - - TPcreCalloutBlock = pcre_callout_block; - TPcreCalloutCallback = function(const theCalloutData: TPcreCalloutBlock): Integer; cdecl; - - // Version information - removed - // function PCRE_MAJOR : Integer; cdecl; - // function PCRE_MINOR : Integer; cdecl; - // function PCRE_DATE : PAnsiChar; cdecl; - - // extern const char *pcre_version(void); -function pcre_version: PAnsiChar; cdecl; - -// Memory management - -type - TPcreMemAlloc = function(amount: Cardinal): Pointer; cdecl; - TPcreMemFree = procedure(P: Pointer); cdecl; - TPcreStackAlloc = function(amount: Cardinal): Pointer; cdecl; - TPcreStackMemFree = procedure(P: Pointer); cdecl; - - (* function pcre_set_malloc(Func: TPcreMemAlloc): TPcreMemAlloc; cdecl; - function pcre_set_free(Proc: TPcreMemFree): TPcreMemFree; cdecl; - function pcre_set_stack_malloc(Func: TPcreMemAlloc): TPcreMemAlloc; cdecl; - function pcre_set_stack_free(Proc: TPcreMemFree): TPcreMemFree; cdecl; *) - - // function pcre_malloc_ex(size: LongWord): Pointer; cdecl; -procedure pcre_free_ex(P: Pointer); cdecl; - -// Callout management -// function pcre_set_callout_handler(Func: TPcreCalloutCallback): TPcreCalloutCallback; cdecl; - -// Locale management -const - // Locale categories (from ) - LC_ALL = 0; - LC_COLLATE = 1; - LC_CTYPE = 2; - LC_MONETARY = 3; - LC_NUMERIC = 4; - LC_TIME = 5; - -function pcre_setlocale(category: Integer; locale: PAnsiChar): PAnsiChar; stdcall; - -function pcre_isalnum(c: AnsiChar): Boolean; -function pcre_isalpha(c: AnsiChar): Boolean; -function pcre_iscntrl(c: AnsiChar): Boolean; -function pcre_isdigit(c: AnsiChar): Boolean; -function pcre_isgraph(c: AnsiChar): Boolean; -function pcre_islower(c: AnsiChar): Boolean; -function pcre_isprint(c: AnsiChar): Boolean; -function pcre_ispunct(c: AnsiChar): Boolean; -function pcre_isspace(c: AnsiChar): Boolean; -function pcre_isupper(c: AnsiChar): Boolean; -function pcre_isxdigit(c: AnsiChar): Boolean; - -// extern const unsigned char *pcre_maketables(void); -function pcre_maketables: TPcre_tableH; cdecl; - -// extern pcre *pcre_compile(const char *, int, const char **, int *, -// const unsigned char *); -function pcre_compile(pattern: PAnsiChar; options: LongWord; out errptr: PAnsiChar; out erroffset: Integer; tableptr: TPcre_tableH = nil): TPcreH; cdecl; - -// extern pcre *pcre_compile2(const char *, int, int *, const char **, -// int *, const unsigned char *); -function pcre_compile2(pattern: PAnsiChar; options: LongWord; out errorcodeptr: Integer; out errptr: PAnsiChar; out erroffset: Integer; tableptr: TPcre_tableH = nil): TPcreH; cdecl; - -// extern pcre_extra *pcre_study(const pcre *, int, const char **); -function pcre_study(pcre: TPcreH; options: LongWord; // must be set to 0 - out errptr: PAnsiChar): TPcre_extraH; cdecl; - -// extern int pcre_info(const pcre *, int *, int *); -function pcre_info(pcre: TPcreH; optptr: PLongWord = nil; firstcharptr: PPAnsiChar = nil): Integer; cdecl; - -// extern int pcre_fullinfo(const pcre *, const pcre_extra *, int, void *); -function pcre_fullinfo(pattern: TPcreH; PCRE_EXTRA: TPcre_extraH; what: Integer; out where): Integer; cdecl; - -// extern int pcre_exec(const pcre *, const pcre_extra *, const char *, -// int, int, int, int *, int); -// -// Captured substrings are returned to the caller via a vector of integer -// offsets whose address is passed in ovector. -// The number of elements in the vector is passed in ovecsize. -// The first two-thirds of the vector is used to pass back captured substrings, -// each substring using a pair of integers. -// The remaining third of the vector is used as workspace by pcre_exec() -// while matching capturing subpatterns, and is not available for passing back -// information. -// The length passed in ovecsize should always be a multiple of three. -// If it is not, it is rounded down. -// -// Note that pcre_info() can be used to find out how many capturing subpatterns -// there are in a compiled pattern. -// The smallest size for ovector that will allow for n captured substrings -// in addition to the offsets of the substring matched by the whole pattern -// is (n+1)*3. -// -// When a match has been successful, information about captured substrings is -// returned in pairs of integers, starting at the beginning of ovector, -// and continuing up to two-thirds of its length at the most. -// The first element of a pair is set to the offset of the first character in -// a substring, and the second is set to the offset of the first character after -// the end of a substring. The first pair, ovector[0] and ovector[1], -// identify the portion of the subject string matched by the entire pattern. -// The next pair is used for the first capturing subpattern, and so on. -// The value returned by pcre_exec() is the number of pairs that have been set. -// If there are no capturing subpatterns, the return value from a successful -// match is 1, indicating that just the first pair of offsets has been set. -// - -function pcre_exec(pcre: TPcreH; PCRE_EXTRA: TPcre_extraH; subject: PAnsiChar; length: Integer; startoffset: Integer; options: LongWord; ovector: PIntArray; ovecsize: Cardinal): Integer; cdecl; - -// int pcre_dfa_exec(const pcre *code, const pcre_extra *extra, -// const char *subject, int length, int startoffset, -// int options, int *ovector, int ovecsize, -// int *workspace, int wscount); -// -// This function matches a compiled regular expression against a given subject string, using a DFA matching algorithm (not Perl-compatible). Note that the main, Perl-compatible, matching function is pcre_exec(). The arguments for this function are: -// -// code Points to the compiled pattern -// extra Points to an associated pcre_extra structure, -// or is NULL -// subject Points to the subject string -// length Length of the subject string, in bytes -// startoffset Offset in bytes in the subject at which to -// start matching -// options Option bits -// ovector Points to a vector of ints for result offsets -// ovecsize Number of elements in the vector -// workspace Points to a vector of ints used as working space -// wscount Number of elements in the vector -// -function pcre_dfa_exec(pcre: TPcreH; PCRE_EXTRA: TPcre_extraH; subject: PAnsiChar; length: Integer; startoffset: Integer; options: LongWord; ovector: PIntArray; ovecsize: Cardinal; - workspace: PIntArray; wscount: Cardinal): Integer; cdecl; - -// extern int pcre_copy_substring(const char *, int *, int, int, char *, int); -function pcre_copy_substring(subject: PAnsiChar; ovector: PIntArray; stringcount: Integer; stringnumber: Integer; buffer: PAnsiChar; bufsize: Integer): Integer; cdecl; - -// extern int pcre_get_substring(const char *, int *, int, int, const char **); -function pcre_get_substring(subject: PAnsiChar; ovector: PIntArray; stringcount: Integer; stringnumber: Integer; out stringptr: PAnsiChar): Integer; cdecl; - -// extern int pcre_get_substring_list(const char *, int *, int, const char ***); -function pcre_get_substring_list(subject: PAnsiChar; ovector: PIntArray; stringcount: Integer; out listptr: PPAnsiChar): Integer; cdecl; - -// void pcre_free_substring(const char *stringptr); -procedure pcre_free_substring(stringptr: PAnsiChar); cdecl; - -// void pcre_free_substring_list(const char **stringptr); -procedure pcre_free_substring_list(stringptr: PPAnsiChar); cdecl; - -// extern int pcre_config(int what, void * where); -function pcre_config(what: Integer; out where): Integer; cdecl; - -// extern int pcre_copy_named_substring(const pcre *code, const char *subject, -// int *ovector, int stringcount, const char *stringname, -// char *buffer, int buffersize); -function pcre_copy_named_substring(code: TPcreH; subject: PAnsiChar; ovector: PIntArray; stringcount: Integer; stringname: PAnsiChar; buffer: PAnsiChar; buffersize: Integer): Integer; cdecl; - -// extern int pcre_get_named_substring(const pcre *code, const char *subject, -// int *ovector, int stringcount, const char *stringname, -// const char **stringptr); -function pcre_get_named_substring(code: TPcreH; subject: PAnsiChar; ovector: PIntArray; stringcount: Integer; stringname: PAnsiChar; stringptr: PPAnsiChar): Integer; cdecl; - -// extern int pcre_get_stringnumber(const pcre *code, const char *name); -function pcre_get_stringnumber(code: TPcreH; name: PAnsiChar): Integer; cdecl; - -// extern int pcre_get_stringtable_entries(const pcre *, const char *, -// char **, char **); -function pcre_get_stringtable_entries(code: TPcreH; name: PAnsiChar; first: PPAnsiChar; last: PPAnsiChar): Integer; cdecl; - -// extern pcre_extra* pcre_set_match_limit(pcre_extra* extraptr, long value); -// function pcre_extra_set_match_limit(var pcre_extra: TPcre_extraH; value: Longint): Integer; cdecl; - -// extern pcre_extra* pcre_extra_set_callout_data(pcre_extra* extraptr, void* data); -// function pcre_extra_set_callout_data(var pcre_extra: TPcre_extraH; Data: Pointer): Integer; cdecl; - -// =========================================================================== -// POSIX-style API -// =========================================================================== - -const - // Options defined by POSIX with a couple of extra - REG_ICASE = $01; - REG_NEWLINE = $02; - REG_NOTBOL = $04; - REG_NOTEOL = $08; - REG_DOTALL = $10; - REG_NOSUB = $20; - REG_UTF8 = $40; - - // These are not used by PCRE, but by defining them we make it easier - // to slot PCRE into existing programs that make POSIX calls. - REG_EXTENDED = 0; - - // Error values. Not all these are relevant or used by the wrapper. - REG_ASSERT = 1; // internal error ? - REG_BADBR = 2; // invalid repeat counts in {} - REG_BADPAT = 3; // pattern error - REG_BADRPT = 4; // ? * + invalid - REG_EBRACE = 5; // unbalanced {} - REG_EBRACK = 6; // unbalanced [] - REG_ECOLLATE = 7; // collation error - not relevant - REG_ECTYPE = 8; // bad class - REG_EESCAPE = 9; // bad escape sequence - REG_EMPTY = 10; // empty expression - REG_EPAREN = 11; // unbalanced () - REG_ERANGE = 12; // bad range inside [] - REG_ESIZE = 13; // expression too big - REG_ESPACE = 14; // failed to get memory - REG_ESUBREG = 15; // bad back reference - REG_INVARG = 16; // bad argument - REG_NOMATCH = 17; // match failed - -type - // The structure representing a compiled regular expression. - regex_t = record - re_pcre: Pointer; - re_nsub: Cardinal; - re_erroffset: Cardinal; - end; - - // The structure in which a captured offset is returned. - regmatch_t = record - rm_so: Integer; - rm_eo: Integer; - end; - - regmatch_ptr = ^regmatch_t; - - // The functions - - // extern int regcomp(regex_t *, const char *, int); -function regcomp(out preg: regex_t; pattern: PAnsiChar; cflags: Cardinal): Integer; cdecl; - -// int -// regexec(regex_t *preg, const char *string, size_t nmatch, -// regmatch_t pmatch[], int eflags) - -function regexec(var preg: regex_t; str: PAnsiChar; nmatch: Cardinal; pmatch: regmatch_ptr; eflags: Cardinal): Integer; cdecl; - -// size_t -// regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size) -function regerror(errcode: Integer; var preg: regex_t; errbuf: PAnsiChar; errbuf_size: Cardinal): Integer; cdecl; - -// extern void regfree(regex_t *); -procedure regfree(var preg: regex_t); cdecl; -function _ltolower(c: Integer): Integer; cdecl; -function _ltoupper(c: Integer): Integer; cdecl; - -implementation - -uses - sysutils, - windows; -{$IFDEF USE_MSVCRT} -function _setlocale(category: Integer; locale: PAnsiChar): PAnsiChar; cdecl; external 'MSVCRT.DLL' name 'setlocale'; -{$ENDIF} - -// setlocale function -function pcre_setlocale(category: Integer; locale: PAnsiChar): PAnsiChar; stdcall; -begin - {$IFDEF USE_MSVCRT} - result := _setlocale(category, locale); - {$ELSE} - result := ''; - {$ENDIF} -end; - -// function pcre_malloc_ex(size: LongWord): Pointer; cdecl; external;// PCRE_DLL_NAME name 'pcre_malloc_ex'; -procedure pcre_free_ex(P: Pointer); cdecl; // PCRE_DLL_NAME name 'pcre_free_ex'; -begin - freemem(P); -end; - -function pcre_compile(pattern: PAnsiChar; options: LongWord; out errptr: PAnsiChar; out erroffset: Integer; tableptr: TPcre_tableH = nil): TPcreH; cdecl; external; -// PCRE_DLL_NAME name 'pcre_compile'; -function pcre_compile2(pattern: PAnsiChar; options: LongWord; out errorcodeptr: Integer; out errptr: PAnsiChar; out erroffset: Integer; tableptr: TPcre_tableH = nil): TPcreH; cdecl; external; -// PCRE_DLL_NAME name 'pcre_compile2'; -function pcre_exec(pcre: TPcreH; PCRE_EXTRA: TPcre_extraH; subject: PAnsiChar; length: Integer; startoffset: Integer; options: LongWord; ovector: PIntArray; ovecsize: Cardinal): Integer; cdecl; -external; // PCRE_DLL_NAME name 'pcre_exec'; -function pcre_dfa_exec(pcre: TPcreH; PCRE_EXTRA: TPcre_extraH; subject: PAnsiChar; length: Integer; startoffset: Integer; options: LongWord; ovector: PIntArray; ovecsize: Cardinal; - workspace: PIntArray; wscount: Cardinal): Integer; cdecl; external; // PCRE_DLL_NAME name 'pcre_dfa_exec'; -function pcre_study(pcre: TPcreH; options: LongWord; // must be set to 0 - out errptr: PAnsiChar): TPcre_extraH; cdecl; external; // PCRE_DLL_NAME name 'pcre_study'; -function pcre_info(pcre: TPcreH; optptr: PLongWord = nil; firstcharptr: PPAnsiChar = nil): Integer; cdecl; external; // PCRE_DLL_NAME name 'pcre_info'; -function pcre_fullinfo(pattern: TPcreH; PCRE_EXTRA: TPcre_extraH; what: Integer; out where): Integer; cdecl; external; // PCRE_DLL_NAME name 'pcre_fullinfo'; -function pcre_maketables: TPcre_tableH; cdecl; external; // PCRE_DLL_NAME name 'pcre_maketables'; -function pcre_version: PAnsiChar; cdecl; external; // // PCRE_DLL_NAME name 'pcre_version'; -function pcre_get_substring(subject: PAnsiChar; ovector: PIntArray; stringcount: Integer; stringnumber: Integer; out stringptr: PAnsiChar): Integer; cdecl; external; -// PCRE_DLL_NAME name 'pcre_get_substring'; -function pcre_get_substring_list(subject: PAnsiChar; ovector: PIntArray; stringcount: Integer; out listptr: PPAnsiChar): Integer; cdecl; external; // PCRE_DLL_NAME name 'pcre_get_substring_list'; -function pcre_copy_substring(subject: PAnsiChar; ovector: PIntArray; stringcount: Integer; stringnumber: Integer; buffer: PAnsiChar; bufsize: Integer): Integer; cdecl; external; -// PCRE_DLL_NAME name 'pcre_copy_substring'; -procedure pcre_free_substring(stringptr: PAnsiChar); cdecl; external; // PCRE_DLL_NAME name 'pcre_free_substring'; -procedure pcre_free_substring_list(stringptr: PPAnsiChar); cdecl; external; // PCRE_DLL_NAME name 'pcre_free_substring_list'; - -function regcomp(out preg: regex_t; pattern: PAnsiChar; cflags: Cardinal): Integer; cdecl; external; // PCRE_DLL_NAME name 'regcomp'; -function regexec(var preg: regex_t; str: PAnsiChar; nmatch: Cardinal; pmatch: regmatch_ptr; eflags: Cardinal): Integer; cdecl; external; // PCRE_DLL_NAME name 'regexec'; -function regerror(errcode: Integer; var preg: regex_t; errbuf: PAnsiChar; errbuf_size: Cardinal): Integer; cdecl; external; // PCRE_DLL_NAME name 'regerror'; -procedure regfree(var preg: regex_t); cdecl; external; // PCRE_DLL_NAME name 'regfree'; - -// function pcre_set_callout_handler(Func: TPcreCalloutCallback): TPcreCalloutCallback; cdecl; external;// PCRE_DLL_NAME name 'pcre_set_callout_handler'; -function pcre_config(what: Integer; out where): Integer; cdecl; external; // PCRE_DLL_NAME name 'pcre_config'; -function pcre_copy_named_substring(code: TPcreH; subject: PAnsiChar; ovector: PIntArray; stringcount: Integer; stringname: PAnsiChar; buffer: PAnsiChar; buffersize: Integer): Integer; cdecl; -external; // PCRE_DLL_NAME name 'pcre_copy_named_substring'; -function pcre_get_named_substring(code: TPcreH; subject: PAnsiChar; ovector: PIntArray; stringcount: Integer; stringname: PAnsiChar; stringptr: PPAnsiChar): Integer; cdecl; external; -// PCRE_DLL_NAME name 'pcre_get_named_substring'; -function pcre_get_stringnumber(code: TPcreH; name: PAnsiChar): Integer; cdecl; external; // PCRE_DLL_NAME name 'pcre_get_stringnumber'; -function pcre_get_stringtable_entries(code: TPcreH; name: PAnsiChar; first: PPAnsiChar; last: PPAnsiChar): Integer; cdecl; external; -// function pcre_extra_set_match_limit(var pcre_extra: TPcre_extraH; value: Longint): Integer; cdecl; external;// PCRE_DLL_NAME name 'pcre_extra_set_match_limit'; -// function pcre_extra_set_callout_data(var pcre_extra: TPcre_extraH; Data: Pointer): Integer; cdecl; external;// PCRE_DLL_NAME name 'pcre_extra_set_callout_data'; - -// === for c ref - -function strchr(s: PAnsiChar; c: Integer): PAnsiChar; cdecl; -begin - result := StrScan(s, AnsiChar(c)); -end; - -function isalnum(c: Integer): LongBool; cdecl; -begin - result := CharInSet(AnsiChar(c), ['A' .. 'Z', 'a' .. 'z', '0' .. '9']); -end; - -function isalpha(c: Integer): LongBool; cdecl; -begin - result := CharInSet(AnsiChar(c) , ['A' .. 'Z', 'a' .. 'z']); -end; - -function iscntrl(c: Integer): LongBool; cdecl; -begin - result := CharInSet(AnsiChar(c) , [#0 .. #$1F, #$7F]); -end; - -function isdigit(c: Integer): LongBool; cdecl; -begin - result := CharInSet(AnsiChar(c) , ['0' .. '9']); -end; - -function isgraph(c: Integer): LongBool; cdecl; -begin - result := CharInSet(AnsiChar(c) , [#$21 .. #$7E]); -end; - -function islower(c: Integer): LongBool; cdecl; -begin - result := CharInSet(AnsiChar(c) , ['a' .. 'z']); -end; - -function isprint(c: Integer): LongBool; cdecl; -begin - result := CharInSet(AnsiChar(c) , [#$20 .. #$7E]); -end; - -function ispunct(c: Integer): LongBool; cdecl; -begin - result := CharInSet(AnsiChar(c) , [#$21 .. #$2F, #$3A .. #$40, #$5B .. #$60, #$7B .. #$7E]); -end; - -function isspace(c: Integer): LongBool; cdecl; -begin - result := CharInSet(AnsiChar(c) , [#$09 .. #$0D, #$20]); -end; - -function isupper(c: Integer): LongBool; cdecl; -begin - result := CharInSet(AnsiChar(c) , ['A' .. 'Z']); -end; - -function isxdigit(c: Integer): LongBool; cdecl; -begin - result := CharInSet(AnsiChar(c) , ['0' .. '9', 'A' .. 'F', 'a' .. 'f']); -end; - -{ - function _ltolower(c: Char): Char; cdecl; - begin - Result:= c; - if Result in ['A'..'Z'] then Inc(Result,$20); - end; - - function _ltoupper(c: Char): Char; cdecl; - begin - Result:= c; - if Result in ['a'..'z'] then Dec(Result,$20); - end; -} - -function strncmp(s1, s2: PAnsiChar; maxlen: Cardinal): Integer; cdecl; -begin - result := AnsiStrLComp(s1, s2, maxlen); -end; - -function strcmp(s1, s2: PAnsiChar): Integer; cdecl; -begin - result := AnsiStrComp(s1, s2); -end; - -procedure free(P: Pointer); cdecl; -begin - freemem(P); -end; - -function strncpy(strDest, strSource: PAnsiChar; count: Cardinal): PAnsiChar; cdecl; -var - Len: Cardinal; -begin - Len := StrLen(strSource); - if count <= Len then - StrLCopy(strDest, strSource, count) - else - begin - StrLCopy(strDest, strSource, Len); - FillChar((strDest + Len)^, count - Len, 0); - end; - result := strDest; -end; - -function memmove(dest, src: Pointer; n: Cardinal): Pointer; cdecl; -begin - Move(src^, dest^, n); - result := dest; -end; - -procedure memset(P: Pointer; B: Integer; count: Integer); cdecl; -begin - FillChar(P^, count, B); -end; - -function malloc(size: Integer): Pointer; cdecl; -begin - GetMem(result, size); -end; - -function memcmp(s1, s2: Pointer; n: Integer): Integer; cdecl; -begin - result := AnsiStrLComp(PAnsiChar(s1), PAnsiChar(s2), n); -end; - -procedure memcpy(dest, source: Pointer; count: Integer); cdecl; -begin - Move(source^, dest^, count); -end; - -procedure sprintf(buffer, Format: PAnsiChar; Arguments: va_list); cdecl; -// Optional parameters are passed in a va_list as the last parameter. -begin - wvsprintfA(buffer, Format, @Arguments); -end; - -// =========================================================================== -// -// These are strongly typed versions of the same named functions -// exported by the pcre.dll -// -// =========================================================================== - -function pcre_isalnum(c: AnsiChar): Boolean; -begin - result := isalnum(Ord(c)); -end; - -// =========================================================================== - -function pcre_isalpha(c: AnsiChar): Boolean; -begin - result := isalnum(Ord(c)); -end; - -// =========================================================================== - -function pcre_iscntrl(c: AnsiChar): Boolean; -begin - result := iscntrl(Ord(c)); -end; - -// =========================================================================== - -function pcre_isdigit(c: AnsiChar): Boolean; -begin - result := isdigit(Ord(c)); -end; - -// =========================================================================== - -function pcre_isgraph(c: AnsiChar): Boolean; -begin - result := isgraph(Ord(c)); -end; - -// =========================================================================== - -function pcre_islower(c: AnsiChar): Boolean; -begin - result := islower(Ord(c)); -end; - -// =========================================================================== - -function pcre_isprint(c: AnsiChar): Boolean; -begin - result := isprint(Ord(c)); -end; - -// =========================================================================== - -function pcre_ispunct(c: AnsiChar): Boolean; -begin - result := ispunct(Ord(c)); -end; - -// =========================================================================== - -function pcre_isspace(c: AnsiChar): Boolean; -begin - result := isspace(Ord(c)); -end; - -// =========================================================================== - -function pcre_isupper(c: AnsiChar): Boolean; -begin - result := isupper(Ord(c)); -end; - -// =========================================================================== - -function pcre_isxdigit(c: AnsiChar): Boolean; -begin - result := isxdigit(Ord(c)); -end; - -// =========================================================================== -function _ltolower(c: Integer): Integer; cdecl; -var - s: array [0 .. 3] of char; - res: PAnsiChar; -begin - s[0] := char(c); - s[1] := #0; - res := sysutils.AnsiStrLower(PAnsiChar(@(s[0]))); - result := Ord(res[0]); -end; - -function _ltoupper(c: Integer): Integer; cdecl; -var - s: array [0 .. 3] of char; - res: PAnsiChar; -begin - s[0] := char(c); - s[1] := #0; - res := sysutils.AnsiStrUpper(PAnsiChar(@(s[0]))); - result := Ord(res[0]); -end; - -end. diff --git a/Keyboard and Spell checker/Units/pcre_exec.obj b/Keyboard and Spell checker/Units/pcre_exec.obj deleted file mode 100644 index 65b0d14318ccc47668bb62dbc7e7f52889180bbb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 60748 zcmdRX3wRVo)^<-aAt6L3VAP;dQRB)AC<-bvpg@R50vZg7xPpLyf(wXYg1B-CPFfh6 zRuo3@62%p7ySn0f!wVV|35c$U?#iyXBIZInsH`GJWq1DfJ=HxuorH^i`#<0RKhM;u z>guXfr%s(Zb?VYJRflOErjM_fIA-FkiQ`WnuPw~cG%b73^%YabO`FiApj)>tXP@5Z zEQ#LfNjdet&gW?h57RX3h27@(owxn?>Xw?Y2&9cpwccrG*MUf=7CL(Vv6 z%Jt)!^E^A}nTMPc8OKc#a-~#|`!h<#k6r! znQXkFI?EV;J)~D8;RrjiS8Jw{+jn)<(#DJ^967>YaOvPega;2CG0;!YZtz8yU0PP+ zA2X=5G!;%;o~}J{(O-QjnuM}6f0_zuT6%`2-P=xU7f+3+Xp1NKR5??}O@Wfq+6#r( zR7{+xb(G+Y(75rx9b>;$^s6XIlO<`O+ooJ!8PYnAk;lr=HGRf}#$7#SVz1Uwy|o;b z3S1pmIVGeL&d{<|?4>1Rrc9i6ZD`VrMAq>W##Brke|^P-M50PWfrx7-p6O&u#GK`3 zn?B~+iPI==S~@iT)az$X)Y>61e)>&Lnj6Q>7&C3+jZ-F1o9G~#?8am%ie`Z1j!PejNVmYupGGHhS4a9<$Y2N8i6dJdTXpIQvNvj-V}34eA$ z;Drbtw8*e#V{~)s$7bG@#wKG<^U1x}F#3bWSavwp&e#-qp-;H!f)AQHd_TY#)*LQu zj_VueHT3#;(J_PO|5S^Vvx|&P$>{bN!}g?ZG_x*_4BKtsH)qeuc?#v{u}89LwCq;I?_HN1A-+8@$w3fF#?Zu~UAX`ZH4-IR7|_`Rx& zQr`=_m^F-KrslothZp=djAj^vsqY=AA z3UZCI{77k@F|2E(xC`8CPaZ>Q8V6p$kPDX)0SdcX{6H#@8hLUZD!L;EYt`97@1SQAw&5xmqR>PX} zpP*@j;TFN|I7zu>ztXg2r^0oG`!(EYaNRVm=P8=@Ioxo(zxpiYmUY*(eLXa-+Zmcx z-c!@AI#biC&xTq9uDTO7?Jih|e>o1y4*2gMigGT|v@^$O+TzRFcHa-zG`bCN=OE2x zaMR(w!Slj#ZM)aUY8qV>?muwHA>H|Kzkz#UM%(Vo3QePX6|Otd6vIt{TL^d3M&-1c zVZQo_<>~da%iGmI2mihDb`9y}9U4w9&uTcWJhS2P^3=vo<^INt;657RYy24QQ@GFJ zn&4t^U&DP1_dVQCaPbkorc}6exDIduxFg_>hC3GS1h|voPKE0RcLrQ9xO3rxa2LQ8 zz+D7a40kD9Dct37SHg{f8xMCa+;8EohnoR+Bizk!^Weg83*Zd6+u@eN-3@mi+=Flr z!#xJ~N4Tfqo`ri6?iIM#;ogL+gWCl69^40TAHjVL_bJ@xa7}PAxUb>9h5LSlPg~*l z`+iDw*xS-y+E3HymRzW58(~C!+ey=2>!@kR=4#r`&aV3dL~2(+(;WXhsP3ug|JS#N z=%s5~W2QHpT+U$N`U&oJD68YzY1&`mreQ3;56|olPotd3=$%I4PWIcKZof_Mwby!Z zou)z4FMCVVl9f(fcz_QtH1=bEq{MF&vwwE%wQ1_-Qg-$aEZ)PM}F$?g5$BKN2Sx!a7wZ6tS_OH7*eThIY= z$AXB+=&eTCR+78bO_BLpXOcUZ@3C%^8)@;Uf_`gH<(?2?Nzhe}>Lt@@> ziAl5kitZoaMMiHh$~KVA8{8C`ujP^4Pu7B53BAV*r5O;?A*pLW%TQxViNC|!5o0B3 z7MQv*Vm!{L!d#;yC%Ba1z-_A_?J`hi84_b;Er}SCa0}rU!!3bZ2DcpUez>Q~{q>v5Q|n{p?HhWR z`y0yPepjB_a4()ehq_OL`!&@6#pUfA??iYF+-K#fO}_H>O+(84O;gJKO5LSr8Ci=W z#;Xp0rbL#mVi=Z2fxp|pkskJdRhMN&{ENb`aJ;^{GJSOl{8$Ptl)To`g@*X=NY{WL zM7mC!{~rnmbibRG?v4zLCc1H$vU+toSDIGTZ zN}=;8Uzy<_Mg*!afYl>n#RxXUA%8y6M%Tyan7@V25oCnNkL zh+K{m!Z+t>l}D?3_@Kv^AWlPNtY5*#YuyAr@s?_$$ZyvcS?*w#)Y6Pd3HXr}DatZR zvm+(hMsZH0D90$xjg&yMn!SkbmuVTNsC=by%BP8&T3GFj$a1r&F>JhWpLe=J;3xCNjJV}bci`qqlQaWrP1CD3miaV*{AFio9iJf+oQL5GS(CSN|N~V{$ zuU`u_G8(QHYUBf`lW(Cu&VuT=1gc~j!Y?^$ql2jC)@=S7B(;`8l9rId@EfUZN*-o7 zCAoD2@>r{6gX4GK#pB`s_$r6g6^xR1ii3W)JEwKn45Z+24E9RfgxMV?+&m(*EjA3& z)ZLb*{K)86jj~rc9=)0@+OyD|A=*n!=5t+W^w*nIw4Y;Baa!8f(+|=mQj`){@q|L)Ex~U zEY7L~qgNS)t4Q-Imu4!)!$39c))aCax|BxE1QJHAG)V@ctjIu^IZqm8PqLk!bhBr^ zMv1UCy$riSLTktYTLv(hMvYUf&%SL-Gy2&AjzJt=o7$!kj45qVE(OzL0`L4rBr;SE zIZ7In9ybafXZ0R;=}WVEf;7m{DM@s>8V3pzGW^xo8gr}su+GP@JheCi*(Ov)2R zQMQByEO8591&>x0%mV6ID)W^3X~@j~tQKsY|3ejE2y?`J;lh1!y>{Lcv5VR)^4H0w zft`zuvc)WIvA47*UKDmdfI_7r@9suL`lAdO+tnwaG3#_Lb+P+7#YD_iG#6-1XGNmV zF-(JLWJF)hFb$?rc-yULWW;>cjw#OSHUy8gcE(bFw~~>O=sG^yMw_d6Q#-7U=pXV` zTVp{ax|Od=v)}&_D}-CLNOS|ANx_te{tm;SU{Mtaj+mSAXi5bf%f{HP*Ukky78+#> z$&Q6ycHH}du;X@cMc+FIrf9WMR?T$PZn`upgjA5K$w&pJwX>FgO^VtWo4|(Dq7jke zeBsK7U~zsWS16A(O7l5*r%I*sIS=xq(glNssk0-c1I*$92t!9pSA{iKS|nA(dg6%i z%_EMV*TGy`%PN+Z#0DD0BdEk}3L^z2;hRgeO6ZI#qp*rysLCZi^EJ%n;?|#^hX_k( zCF@c;V(pHU%TPl6hOGFElEe^D0R2CddbAX)2PD}SZf;@Nw$L0tt>$d4egq~k)o>p| zeVh&VFx*?^X^r>7{Tb@xA5a;y%dzfL?tkp9@<7w~R3AR9&m5s?SQJT^6J$-MYt-f+ zU@UEI)ZX)@(j}$jYUzMT$!yag&w|Azp-j}$;aAOUs%2eZZv1)r$^4R$XDucSs>?qM z&c)7!>gi?M7~LW@vxp!n@R<1X^j!pLmX5rTmfshL|DwMnOK>PidzDp66%)g!$ zId3Fsl&(G;n2YJTDxhSbra^IS_U)FVOxPU;}-(D6-*;KMNZ^WtnaDU(fg* z+9ti2W2W>|SVgkjCcUC81S8)cEbUj>Ui9cXtgqXu4KtF?l}BLRExe=Ij`DZdOq0r? z`|^N(7x>(o`x*ZO?%(@`OspWDlgI^KAQ(>H3_8W3a*~?GqtQk>WgSBC=bz zwMiA0IukO{r%lUB34~+bCQUTc5=2c9q6C5{`XGwB<7muOrk1DFFNFTsSnglhTpnl` zP@d9oC3J`mQ{;Q-kE@|SQelEjf`5-~dNdymva~C(HcxXp&ZD zev;U1vn~RWXsCga;-0OW1nawr%J)1##B7~ zuG-J+>%ZOU)NYj2P9SPWKe=`S&>-+!uv2YD*M2@^n-@$_I9MW4`dnjPT_ckz6YCx`VHG!Mm9FHVrdj|JoZsqbz}&| zGd;$)D?<6qD{Du;2|>-;X|4=m47AgXt}LW3@J?nTH6vMdQy|n0eYfhi?fBxKoPp#C za>6NSObByKyP&HBx=iP#uz|`(AU$Fus6{D(iKPTkA`6^c4Wm_NFP6^36fU=JV0R8+ zu@UknyW3J()S|VNW#la3FoJ-rc|>wx6Un;ZAhj-Nudqf2-{Ch3vV*c<0i2RJyf#It z!SF0BrBsMwoNWyB2ZgfAaVjEW%8W-Bh#gQF`P36kN7xkV{lFZKg+`Rg;uTB>GbCYy z*y%AyVJCWGjK7ozWQNjw zEcPcIEnQ7aP8-0mNnY_x*3O;4!`A&JE2+O^{LKDxb%WDiN>FJ-7l{5s-xZoP>rYsV zg*JHjDQGe*4u)=SO~zSCWE@Bxx8Cjfq#lb6HA95}fgpf>G66jl0Vja~aEf~78RW7| z6xy1U!$^v~Alc_<8EcmTsnU)`LXJR?LqD0E2mUDh;P$ht*-t=bNKN>ro?57n2>Qri zslO5iz+fUX1)@jNcahNmxD@Cxn;Z;udkb<>0@X3r0Nr57NbF_@sz2l-`_w2PRBN>5L^RE3%{x&jaEc z&yk3{@BabjE%J9n_P&FRT!& zMrwMKIl4fwn7)@eKRzzZ`5HWmog?+_t&yocna>mmIi~N;_lC;%BJz=qO`oBQ${<3P zDHPoWg+QR7??o|Bp$Gwm6g)r+=pU2o4zmN*>;8L<@IT^Ys3SW>ky>TQv*oTU>lYOW zxufr`--C|{YnP##WYN0qNKWbJv6Y!%aX$0w0?{<|z4^ze{3GoA)yes7*6=ut$Y%nt z$S0y}^VCFd6u23`p_P2r#tLP23Hg+)s9v`sRt!Q`>R-h5+P*~;GB&3O8ANZOs|RXh zYO_MG1#7$*C_Pks@%*Eljr|=}?%NOF9IqqhV%_LXOw7R(DO3pF&Fa0%OnSn!C*xl^9*PoIt zD=^O9&e()>--vaFNa;xHE0$S|RhmUUsYk_i#^&&j3sBQVTFtMu`Z6dD6K*qBM9(bm z*su!9V>gt>(DIIro1iexD^G74U*1k^jlCzcHW4!$G#gRE)GcPtWsztWBTRu3eX>8w zlpkytEftiwdHLa|n4%r1K}|bKO&P(O4pM36ZaZ-GM#jpdf?RS8!CJzIv1o`|x&tpV z$qQ!)i4>1zr;>qg<`Fgrr0tQ?=jGZ+*hUZ(wto1Bw93Pc0u(Sduw|_oDBW!Co*-F%oxu1S|emA_t28Zz%i!nVv!4@eADoK{tIb z-8VlhbWaEQ;BUNuYrMhXqbiV9ldJ-fmA*IY0G0J@WRPnOsc;tK0c0-?-08#5cJdc(!b?FRew}N>c6!`{WnN{fyhtaoBvLge*y9z zTK(4%VU*CWe=Q?SffDVhKci89dE2V~L=x5slj`rbzmJoLSBYI02>R)J>EH5zsz0hB z_5Y|v{Z~tVfyhtaoBvLge*y9zTK%6R!YH9#|5c1I1xmE1{)|TbPnOsc=z z{@HB*Cy8Ab2>R)J>EBYL>W^wj{r}dY{*Oz3fyhtaoBvLge*y9zTK!i7g;q0AtA}c+ zhia&YYN&^5Xuxv=o*VGofagX$A6%7mGonOjvvLKAH3dqvhn0*5E9Gq~RuV~ACro0c zD@xfErTd9p7YJ6+_p)Nk{fd>~h_LdnEm*l+@(Vuj0mHIcKw$y z!W1acp87Ky^_RD;>Q5wLolxo@Za!?@5ur=NJ2TbdKv8&SO2w#H#~!+dvAQ&E^mZgi z)WwmS#Vk`7h+5J2*6P*!ge%XWa;^z*k!=Emf6S~5!Z^UBkn_wEnG`M*i~@m?z8B+l z3gZ}HB%g2pumzv1CBH!Ar|->wn#z9yDH28;Y{ai3!YHB5=h=)f1xmDs&x{72PnRC0EBuBOe)3!N9<**?@eyz}VL89l1V;;ucm9|`Zo*w8dhc-^7m$nehmPJ?vsM*d=dUv5QE;I-!SMSCd_%$*z%F&3SFB5-g53G{Fiv z749milZCKEj)E0}L#It9ERz?V$&AhM;fmu!V#g*pem*&lrs)~#tvC*DPhwqkf#4Q> zFSoK4x6;5Za{KHpEx0{F@(Vc+XmDHJ zw&FICgmprt1Zww&cls-i2=BZxba@Tp>OkLH2fwPr5Aeu?UvF-~gTaztAoA1q=3j^1Q_LM-LjFVJ!2lwR652fI#|TrP zM0&dKTq<^*KqhRZZ$5&uB3#vBCi}^NPic(oTUh^59CRy0#Pb` zZ>hfr4v5^{KyYZCFjwdzv^!xABTRu&MteFTqtOZFZL3bm)M1_Q;GHn=g8wbFyk_Lk zM#K5BY-V0Vm=e&>6`{z&1J>sV(Y@$<>-xf-QrADC%2pb3)ae;WL#$lLsl<_4E+D2@ zSlJ;n817$-aNrhX)LN{QXe=g5X!Bv;zgfCKiB9mLPWRiz7$!qOley-d9e#?5!5zti zQz>isHt<4DUwZ{5E*XC5aV}9=X zL3t%{tTNXS3_g^a*eF=A3plCC-*_9i+d5d|eB47(Q#;DRVjhLpYKCj|CqTUnFF&mQ zR`@%hTF!&RNsor7;ToY`&q!=qv!)>(%s%@rx!(z!2Pt?sQ8SWcx7(AE-b%E&n^u7JTw?z8G zUU-JE58_~T*$51;5G#(79)X9tLJnS9>^E(fI5D}zJ<2(Lh4L8*J7dg%rbGiMJdxd1d6OZhIc6uQc@iyhH-qa^iB<>7dT^+?iD z;ExRS8&L`4gUTTphNQDUtF+T(M+Rm)X>uY%a-1~s#f_xF_Q^o`>_(xD4DX`S;LFPz z;m!-BmPgCm9eVrRBp?y_}uxq)gKIUUJx z+KDvJUT4+8OFl{v(d$8#Y6MK*G((=DM)`TG$#*cEA_Ft9ILa_Sa>55%b{hHA$xf3K z8JOdw$&C!rYEIPf)m=*c9V1e(-Rp0711jSLeENdVVw#SHTWKF8+Z)VP=n_Y`)FZx; zRp=te7&R=~S_{Ui_S#NLbb)9u`Yu<~tizx;(OxNRHetfAp)L90MDIYj2a-l=wn=`0 z$WPzR&sN#ASX!l)h~&6bcl6y8(c2gK653~|g{|9Pu6-)!xr!lXA7lT&sCGKahNn_Z z5$UQNIs?^LLcVN8VFf8`$u`JVVUs|xiN2RjD-B`OJ>VAP1?we=k+-7d?!<>g6(zJs z-OY?J1xj>c)aC93qcOh9+g8>GkzjclP^^#saWuosKFTJ%q;e+KmWf&y2(syW$^LSY zki7%c<1|0EOw(l_@Pi#|ccvP}-C?o#PTovCyn%?K0%6M0_aa)U5Zwbr>||y8f}-dG zx4powi|yS6Yr!FRXP@TXIzcTEsOfuAU#w7{57aJe4@7INAQT9M^t}k1BT{MB-An64 zq%@2bATVf9MFgsSZ#v5RzEovm1**HGfDnaIZM3 z;{pf0d}ME<&y5U(mBgZO>Tn1?1?@6GJw^s~F(gf-vr)tM)*se78f7)9)CEFj=)3Go zv-ZN2fJTXdhn^9jL&6ASn?6SzQGsXz`YsM?l~uq3UH=HN9HhIf5>$kCcX^T#robqp zJ>7-T=q~cMRd-?Puuiz2?(#TZ8M;7JoxYdsA23$}*`qTF!TBQ&@ z0z~!@_b;Tew)n|a3Se6n!U`l&qScY2W%Ajv5F~6{2ohEoFW706g`mhsG4p+F#{??rflLf9J!ZHBL)Vj72DjRGR2z10|y!oDpUATn&9^&Qw; zr!N6A31x6X25ZpR_F&?E1lcAu=*PLB3F~nK& zaCXJFp4k;649O&_10UJeKLoc0Yb5)yMluqr1J4Z~!`hew)j^8`SGP17n6NzWEUy-* z@;EVLxxOfCtj3ZK_E-`+H+Iba*pEYkibn;0N1clDT)Yn)_A19JAXXCGNhFxhjs#2C zmS73n60FiF307&81gkVkf*DSdU_OcjO8^o~-%4HMNbqbt;TlXOq zaM32%9~T4FA0ZJ8hh!eke#KggST7T2fnLSLBZyY#Gi8`Is)TJDRl>H7s?sPMRi#lj zs!9VJ6^19nNropM#qg8>3{U#jYp*y=46#^UAecx$nTeTUkhb26!&6@pl8515NEE4= z&YY$|Oa$n=IobLDa*K5SH;JM&L%uP<*S?(B+Gq6TdpGr!Gz{`Z*;Q}6T=hk}ip;7n zQYvg)wAh{r`@%nOCj7r{i#itQH*DKv3v`O`TOjyN-^;b-^Mz|BmbzsQLa_qSghXmh`=~{H#i9`8QP7=_o6}slaVyWs z_Qgw%?e-Bn=6)@W*5UrW)~mD z?2-V?F8Wr@YNtPqWU;zH)SSLs^EAtv2h!GC|3vi{$;33x?I@ z#BvZBDG^kJ_UJW~5vIT>qdkqzXf(RKZPn;Zjm;Xs{WN+JUSXGp5LKt|C41LgA^S5> zZx7ymId~t#!CD4ycgX%bny^kE3>0YdwcH zOooCcb8*OKVz5H;aLDFc&ydXsBPkQdU1s)0Nw&93aBP*zsBwX7OloZ9nN{zw&>NYR z7$3>1>U?&F1qs{3f`sj1L8Vc{f=Z)?1(ik(3k)X>3wV?b-JJ4vD=#hYgzG*0^&6l% zu7m3M6WphmsI)I{_vqmAPK^_xLO#Uvf6CiEc6E8DrrVv#O0gPQh?+|p^sT==@AQP8 zq+AyWaiH&tLz;Ec9Mo>Tbu?rG)w74^(5cFP>yEVh9i#(z8L8<`>`{T}BlKPD>?3c? z7GZl4#VDK;AxU*%S&#x_vB0WUK{F!;mH@T+uMpP41#Wp1&aq!v{Me;@9b2kxZmmLP1G7@4WC+%m@jS{P;9U-a^7sWXZj~ zWR6RuVG>19ik@4CBj!XXHBlo=H>?C1tk|4s*k!>>Ll+3H)A#b_4>t>69t3-07k~v| z1dfM8E(`p9GkA_Emk6Q)!C3lU1d|nltAIeQMTLcwxV~lHDy!-_WR_+8ZUz3LIY5^q z=mY{CeJ{FW6uJP>ac9hzOiQ+87KqIBy_rAxom6HEa9}wr#qyze)!Gk2sr-*xJA*}= zgm!EDB|@MsFWYYIEF@E{%}`L1vbC8Jtu6W4+I-upwHb+RBW9GM+1f0t?bZf&HD=HS zqP6LJ8T9H+!k}lsCne!k5R(~Ksdne_YdNx=zbMNV0iG6S)PVfHS=oW=Xa3Btwr?K_ zi3&t3(02-v$;z2f9k;_ZVFR}#CM%CYee8tFI2R7rdo=zPsw0kF6`T`k`q9~_z4YS{ zd+FthzM-Jcnuo&d;S7XD%w`lce+^+Rh_0B6{R4zOU2+d1aJU!HZlv83AyAi>b|XcZ z69`7pQ*w8Bid)V(m_D zfQhca2AE0}{%l_A`_49)k@FVT1+-M@*+D5KP`wEGBQ?8(Y=JPP={p=&Z0b2nn(-8H z%NofN#iB&NznEQYCv)opAq4cjxxcwlayJ2q(s}4)+|1ffvr`Gw6J=B&nw-8D<%0_4 zGN6=>_vR|3Z)=|}A_JY;TSCfI>r=4cb#@R;^u(4sKsGg7z=48asZRs22PQb~Yl*{M zc!oNQ%@h1}f}JIK-;VQ?uHG>fa~9ei0~5S(?Pot{>&>$(ChO39(~>n15JyV8+7*h3 zz_c22L@*$O&gqYcxlLM@Ftyh74~Xbn8DR>H%1ia#$H{{5gY61&oxUB(LFygb<&MG0Fh{{*N4Q5@Hx!I~PLpA&Juk zLJsMBh32|Sk;5@FIdaIs_6xASF&U>*x0ZLP|EfHz{ySVtdm_}w7&u<@@eC#|uVLbH z0@gV$h6=$kGqo98%HnaQm)aim1#UYM+{Sl*zR(!e^SB*dyJ$XA;m}OFVY7B#>KnN7 zxsb7jU#@&kl}bnS&E%7WL&up*v2>ta7Jr_RJDE7VE+Z1ILLkP=4Ge~y3Er~^J6oS! z-48aiFb_K1Q07K~-@+O-Hffnpt2_hi`Q%hoAi5WQFQ?{(gi|3fEOuG^S>|(yN_-NE z64+BW5S1wqs)N24Rd0pr*Fa?~B_eLeCGB$tZaW`YRI56BoxPuOrd*pLMf+dLT!+$> zt$Gv?8z!Hfbs!1b>p&8=*MU?TwGO1xsC6KfMy&%eoU{(aM_C7w0M>!%TTOp-49!{= zs|$qO(RW#pX7!o@($-sD!G{A(xn3oXs6ey`eHRA@D&Dq?Dc24l+iz<-+mkI@do^*J z0?|bDy}0jCxNimSgSGZ^f=VDz(f6XdP@xL4&WYAmo38^o*ZPX>*<$l`qTP+9d-IdQ zG5e`uhlD)GPPc_Q)NB9JiLVW%r}*%l5d^MqpAxUxOZ0d^fBz3HCqAoC86`|dQ<$QB zCaK(Uk+3~~moPrnzgVk36>0-V!|Df@XRf@i{D_tJmgiu})W33Hc}~M|P$6@%2GRv; z1iLMdE-cS!tcCwYc}`P@a{pu3mFGN$^i8-XRjHKA)h3QARxJsrV%3s>DpoBCFr2g` zz(-jUkN}nh=v((b;mGHctcflV@=4!qG+duD9kpF=eS8BvUI5dZ`*e>pizyK8OyA8y zaeM}uAdZhB6V~O_R7pP0^L|aa(~6F+|_5fs`)8NfdT)|4%nSmFwGJ|42QFW~#3A#Y=g}#@B zcdnO8t_3B@i$rsu@GcPj{c%TI^`mslu;12}-u);*30STO7@r*hldvsd61EqJR2n4> zDvgo`l}1Se!%5P>N09~zKpN;jpoX0&Y?V z^0}d`M$5{ME!Vm?v3nPyx^1j^F99{G2|CMw!DnZ{kgz>qNZ1}QR2ns4s5EN8P-)bF z!En-m!ABV|B!B^fzSaIwu%g(n&RZ;I$+|#ri9XgtaK2+ICNe9aI#S?txW7Y%+zb`+ zF(xmg993~8muBpnf-ajX4R#URO}ekMJid@6m;%wk=zH6tGcuwb4o60-iL+I^(+qN( z*X=6RLasoNOW%v^ohhoT0H>#`JlmqHJmPefvkur*s!)Jxr(>k6@Y(4q61KaFgzc`P z(x|SY(x|SY(x|S&a8g&{qjVJspsUcg7O!-=%4`;^3q-ByyR}AF`K@sNT~yuERgQDJ zN~gAXIZLn#1XlVkR(6mo;6=k!00)<~{dJ4KvRhn%sF>j7Z+LTJa{5uudo|-fDg! z-wyM7Qy)}CA2_IqdZ>v8sELO6p(=`?GQNbmz^x!q8UCibFnOtUHfhIbGx*OYwhpzY zn;ahzcNz35#>ce*eai3AQZ=JUxGoUfq3`8RC&is~aL4M494ExaL_gn%`9hN4>X0hZf`q3 zh>}_S3=eK_Wq&o|Vgly;Nt=ux{?a+W66I)(Zsd>3dmUdaba&2rb~Y zT(X5#lYuvFTUct5GZ!^>=Al2KR9D+Y%o3D0e+^+R-f;DdVbAK>P()y}2hd(UE0PF- zy1aB&&zO~~XY{#x#w6%9lCtIM8Pgb&JuFaG&lDwclLqe~f%q$Wuws_uQ+SoVHO`3Ko5kt^(J1s?cBNUXCV;f{)+6AVXGHcMD(gucQGsANeHRA@i|c>| zgT)wPNm#lOvmX-9Uqk2!G{YW&?v4n36==rT0xfy$g<^&&(D{N#Ab3aLTkneTQtxX~ecSH%0qglzZ5Fw?0r}c5Ot&P)-BCiel9F@Dt1|h zW0&PqsEp3AG+u$aI960fdeghKGBm$$@3m4au7VMy?h3Dz8J9BED^(s>cuAtqBr{ZH zZP8Z4kICw)3BI6E>#0HE0`|5gTZ?6$z~ZgY!!&x+?rpi$qXC-|+T+RiD4!i=CShBd zN!V6qDveTRDveTRDveTR3@0fwK8iAv0F)Vh>o3b4q22crn@k{tioPpU_^Yb1APs+2 zH4a{4gE~;nHHQ6eP0RVQV<KPXK2`o2z<2yXb%nb5+P8Rm(I|@tQ;EXb7)`^bVNzna%f;0?7RVn1=>4> zOF%_X5Kwn*XChM|>Pz2S-)BZkeIG@&lTD1kZJm)aR_+)wgV4yfA!E-mfqNTqM+IUm zr4QU($G9645`OmfAymXns0!RNhGoz6rn6yTV0}X_OaBJbF|~|AwwEa~hO{7KZi^*^ ztM5W(`*YlGemh!mv@LGDiG|Z@8Td2 zI|2(tw;i!0$>&xioWF*!795~_GVGDh4T!)t4xlZc>m)*;E-xMVWLC;2eaa`3Kt3g9 zOZj9PL$ZejdgPNYDWA1WWD10Q()U)X-<49SGf_8tY~{DR)*>z#?$<7P6=+nWpU6fx z`Rv#w61MFU3EOswN~7!&l}6bmDvh#B7*4WF_$YRX1YnoYw~kusH2P{5s|!S<(|7BZ zW?lUokhb2s92N95`hixE$g$@Ht3Y6-?_#AGWCAb5APz5i1!*KY48$UFO1*=}8rcgz z;lDC~481AY8rj81#~N9M_w&~f)*{-mM)>TpMph!i&uswwS?{CbP~3Y)2TG-IGswPj?<|$>Np+4Nyq8H;A#^j(QbvpS9hY3r?aSHMd$HMmB5U{fO-DO^*di)(6h0Unwf z_6l+<14C9L{{r&bFff*ZI>oY+$+9S)9epifTVG4q*4HYH($^}D($^}D($@?p>1#fU zzLo&=HGS*O+Z~oIVX?YEu#A2(%l=s|Ec@W{HVll#%xMaQLZk2IWcU0%@}hg*jl2g~ z98zai>I(Nzu;tjv&t3Hz@c+xISKZH9^%CH8|vZ(sEHjotnu}T z6uIsA>lw+1Vv?7*7L%i|5N3zkt3aT#yB)Bk1~J zRo$b8L9sr#>b8)L9~Fopn!dO3H;<6Uf2)intN;l(biNbI?%|s!L6J;sN12!;7pk0y zFfLSCje`U4z^$&-w2T`ytz?#_-Ek8$OqWZvszuraLfYti3ml^g9DxEI`}H1_sum2f z-Olgqs)$1u2wA7^#c`~{kqsQ^*vbk_kwx%J`qu(k#YHWygqTf)Q9^qWe3q2Jh*)O$ zDL%CW8eE=*P*^AA5_bdDDrX@pfHZL1NW@y3um$80-jn(!c>zC!jQDzl5QNkB5`J~5 zaQkx5--7V{-1#}3sG@{6;Zqo43Y2Ki>OG?|zQ|kQOY)tcM1m`=0A=<5fEVjvP?8%e zA_cR;H_vL1+rMs}l@`hbOuow|SUR1<|0E$vAX=Qhx6)HDlS;GhUW0xu?WUVMyZr1* zemb{aP!J{%byOgvm%bNuCxtp4s1J>wV+A3h&CgMcFa<^#?cpb*!B2VHil0o4ORE46 zjh}Mc&qCN2Z{Z(lH^RLO_deWT;r46o{%VB%mg{wIp#nl{t z!qprxC>4B2+cXDrm&Y)7X~fkWd&{$Ab@a;{shXW@SV}`iaVS_k#lD}XK$>bKs5PPj z!B6^Lex5R1n(7#^)!S73k0h%X4hlG;e`3p~8X>3!0yTXv>bFY-_3J3%(3+}55E9x= zHIxyiz$l|VO~q(5mAq}$R7{OeH2@E-smMo&zEL_WSPBNpB}B!-z#`zlHywoN;Pkz< ztiM!h`FB*-%fQWK;5SDdfPsUFG%64br0+!?QK;tv^`S9vfFLBa8Q6~zrobqpJq%@*dz-NvG-kRRb zZ3=|Kq3`0bFJKx4H0lDTOMuC`3Hj7`dQ?C^7V`{8jDMmSOLeiFr-qRIXyTqMG)ic5 zv%63sP@+BDWHh)bZ(DJbNWwbdp>fmOt;08maIX@F9$bheGzbJIx@tA!IEBfqPseRP zXG7I2fvdxz(tlxvv}bt-{O?m%LlF*@VhKd{W;38-&Vq`$0V-xbR7?aa=0&KUpP*vO zp<=3_VqS-ec@MY$e1zM7{%PO-^X1JX9!yPIFBv8cHw28g{)6~BJs)XEItS*Td4*FR z>lG!mnVriBQ=mjAm|drLv5UcCKSDv1x%kBr6SqU#s(5@`kclaw!of?hcG)4~>j$mTw9~C!+5y|7KPG^j}#1+&is_C|fNE z`f&L9a+eZoG&)G4Sx8J4iO~f@KhpOS^VP+|jL$)ntGATV+ww-145Eq>+MUSH2veX$ zCpr;NelQvuOWwB9SVR)m2}NV!mR_yqCapdV>SZL<%PpAxe1XHKKSI5vK)tjtKdb?F z6E@&(!Uo(;*nqnU8*n#a1MVhlm9+S;h#RSQ$h%g z^t~A0DUwE73&h?*Y#FV9e*_YeXyvp0lP%t6B8>_}XQ1yzeS<=M4NxDf{r3neLc9HU zGr|-YWwfXL8IAUrx2@Wrsqyg-ptOJg|HAFTyMPQE6NKO)eQ!kfK!pDnAO!#Ddn;LVq42Li>gwg+`{W7ZKqWTqcf z&~0!QESh65aT*Lu2WQ?fd2(-G=G7om;U0kc*x;y-@B!`^eg}o%eknrmmcEw(-4p}5 zfB|0K?jdi_!+7r4mp`=R?FJ%^3IuQIdr@y5EWCXSB^->m>jV{{&D&Z=m;$4W_VAX` z;H|uE#apJv9~uDKycOoOzIgamq`-|#gkTJPFZG=i_35DA%a~>|rVGp(hcVx^WXx(J zjS2)~=zCGWSRjmf5+xjrG0zDqLYpzG7-0&GGTOr!MuRc(wiRQT8vk?vs5)&G$e!W; z(}Da^%9D7D?->Ze6#8Du|2;@3{{|KCGKDwESRFDGOo@$6bilQ7t3@?YY35~V+B z24AGf62}O@mrVKljTI!%6bPe^zL&g71Lb4gGoU&a!My@2rU9y>2xFBTnab$F6(zL$v=~&@|PL+3rhuprS!cte?347 zt{?bIS^AIkU&zvIuJbJymI?$*>3hj5QREepJTG6aM!AuiWs+YY^3!+o+tc>LfI>~% z;|N)&A)m2SW=3!P82%A6qlR`so*%72{+G7Fv5CC6WI^nB>yzW13vt3O7%~ON&i8~KPqhVKPU^;e^8#U zL=;lqP5y(j0{=1Ym)_cUIR9ymlP&qDIsE^ed~n>i$or3z`~+wTSrior383$?h+8#Z zo-Y!x;{uU@WG)A8>x0Bra~djRtU#483AMi9Q&^rb@7RVXNBzo?5y#l&ykjv-)&)X| z(f5`-LzO%UC95vCD6`7KpLDQsF0QgtDoR3URavt__+yTRf=VDz(f6Y2s!$zAR1OIT zwzsPVqd;J!@5T7H{=$|`Kz8Ce)3iWiLcI&Ox zOxEgu3pJ4mHw11zCM-H!1kQxJ11<`84_po0LvWA4JpuO=+%s^`!@UHz25v1TJ8?{Q zV5KzTR9n+oaMf^__^72_qkZV`D(mP_`zou-`TvdC!WDtw3Vko>y%gzWx0fr^$d!RE zS7P%Lx}PkWB`gsLmeBX&{kWfSdo$3xENLG)m-Imfswl`Ip-muYqwmFWx5BX)IJ~q~ zkhVus-4>hQvc;wgc>+NmeJ|>M3iX-Eyc-?nO%VbGf{VsvAIUeRs66yqkI{IF`4=B7#fj7ZCMIBgoBUv{=C=&?E=zB4YQW%D}qAWzp zu1iURY4e&{Qe{|Y4~SAOo(7SCwdI;3s%94JN! zdVxSs-;4fUh5q)|=%2(??m+0p@)#-T1p+;NFZ!TD-?KIPVFyD`>PHBAfk02+i+0EmXz{aC6~4aa70cXf_Os2d0b_A1agy1ZDKSlpU`qJE8?;bD!p)A`~&RDG-A@ zeK)f`xc{?{Gq`UCCUs6jU9=sj-V2jY9ixkP=3X*4pVMI(8^x2tKj7ay-h{Cl&o^Ji zSiTu<=AD{WwM^4)xeGSnawL;MuC1?J2ZIuIdLy5TB+6&!^oE4((;E`DPj9F+>hy+6 zqfT$AH0tyQ!%3$%_$a40B!JT!^sQM?7V7)T0W4M*2;S0n*^_3iI~Sy_w_XB+JO{75 zr|tR?M^qqG3w;*{jf1(s0=skuu_&w9`J04R`{8{A6`?&t>dgq95!?^wliCkwOjzPM z|7mbG`Fl!ofv66BFDc)iBc$vEMfQoWYcSW@|M9r)z@S>`6tv&WOt#kw% zEBTgqZ!6^!M^qqMiN1@2t+e%QVa>Zl)}obKF5q?%RD^ab@N*eQU!MN4To%Nfg6L62(W6C<#EK=v$j`*iQ{u z+gYqG5Y?jZRx8aq8kK@XWua0Bkf?3M5fuoDqVM9MM7@88ux34x9YmtG3MxWdqCRAV zDKN@tk3=yV5+!e2=@h08>x75a^k{|soH*GG9Qe?I5Imyqt>3>+m-;oLnn_KMOR1P6 zDiD03@8+{D+82;jEmu8`+*So16Q@i%V~V(cgJ%QKDf#)e$Pb?#`H`?KKN7a(N2O8n zqtYn(QE8O?Fq|Ymd=&YS0OW_hWnAOP&pH;X3j}ZIyLC*nKI$Rz^A4(Y0QspUj;KKJ ziN1@2@^c5Uz%0F$SQ7Fhhc#QDw5ci7>bpX%^nqF#0JSm=YUN?5l|rZ#{wdzeP%HIN zDm0=%>0z*48LLK@=x1*d5q zXJJu7n*%EuVG5M!1PAcJgbUI8jpk2?)1ur)xc z>_4KCu-)S%Z1*^oM)f$AM)f$AM)f#`lX@HDCJ&wLLX}r_p?q{*OK=e5JZo{Wp z&w(~*>?csCvzua)tcMun_`9I0BfQ@DC5+5G> z4(9^)mROqP*SB!-YPnQTAgV{-tsa%Z2T*rV1{+wI{j9x6b(B&r{R3cWT=&!pjPHXtt`axIR5!v3e-t=?D{Oj(YTd3 zyYdvyt~>`Tr5%p&KVI&CtaEwCrUg(b_;1c8{5PjsihU5r$asLvFi9K!yBbib1J6#y zLaeW1r{ee(n%0EY>-{iRD&XFRJ7T4#jfUHj=S0(-)b_CY)$tYbQ8iBsI5gviff=0L(ZIM`j58Rpwr05Xb>BGNc z2lO8?fWaQKzJV`|UxI%QYQO_l_@w}WD1g4VfWfMO^H6~GEOJY$U#ByzNklasAW~CJ3Zeor=+O64 z@CFQhRPjX+V)4UFRd~-pbv_tDSu1s@xAbEpa2 zvJ20k2>-k$0bu$E0zz4!`aJ}(l^`?;1Wok4G@Y(!I+--pAcwV_sMLQQcjkZm<|G<1 z)0)i$Hwxa_f>$8$()Z&18>Y3W>n5PL3KJ*;x17iD&Km>OJrQtF2W~k@kj@gM0)dpi z7wLS3bS9DR#<*j}0OYQp0RHaP793en4peW(GnV{`Q5OiIpzprtn6kj47zqGvUsLI}ffu+(5WOxQpS2!3~EigS!H5G~772 ziExwQroufB6?7CF)?FIA!(qp#@$XPK-QaLjbkkbLl6jbxD~tBhUZQ9(B<-(*NV|ES zLomTr+*%E-0{SNi{Q`lEz86`lLe>l~Rw< zC?<~zgoM#|liT+5?Z~0*=lRHFkLm%Wvp%?bs(U@WDL@ z_ZeK5KWN%*N$yI7>Apkyhac0l-Ef1E&xEt?0j}^)Y&kDMKt{hSLuZ9|&I)0~8%k15 zfiS1(drAG3BK263>TEd&ZoLSIl1IFA@yrqL493&k;fQw<9 zZ{z21O>i-|ui?Ih`yTEmxH$efyf@SiFQ&&Pw6b;{Q}qZ`M1Hd{vXqC!r>nB8N2uz#jJk9QQJuc5NPOo(cG@kR1*#DSL=Czgue3!svi+Fy@^H_h<2y%MN_2E z^e37bUJUwp!O&AM2m}WDUJUINhM(YBoEs)+;GMF9p}SxZ2n_VS7}lL29C?WtzScY# z^iT1O&qM@+KwzNn#c+$la3e81m5c$SM~z^}7YqV{fxZ{R0EOXfV2DjiR3V$gMid%k;mjwfoM4TZgP9r_~3YF*mw(>>|vt}tHf3{-ar@eN&(qIT-grK z_7>t@Y1BpLTIiR*!aedwP5bysP0Rd~rk(jTl7&~WriJ?~L}0$1i;}_qWPLFL7@#i# zFKBAUQqkfo(`+G~(4MhmF+yiVot^_I_)La^CS&L2ho54acEE}+AP|a6I{YnrBF)@w z3WHB5;s#tm-{c1&QK1lu*FHLTKZp%1E&vYek9?n~PY#O3AF2ami~3YEnOmPW|L#wd z-J^4$a$ud*Z-UyvY1)PnaCgCNh1xj=t_+UW%VwyN58<}LZG+nmR}Zyv3MNoL*jFZe z`A1NK)qOylP5YV=VG5M!#KaE&&+brdGKBwU2jp@D6RVGV7@zpKhtcZe9!48c$s{=W zaSt>5OfurXvsneD$dN)Ywz}@=6RcBMm3+T+1zILjw$D0D8lo9AN<%m^^}wx{Fd5E! zI{US4w#067DN1OwZ5JawmnW6CPP7!xyUvqR%~N@f^CdeY-2RG7XX8TlWb#V zpGmS0iEaDc*$Gr%1AUE;8;Gx^+}4v_7xH~VZqtNaJDJ+s4^LpSgUIc6k{czoxwVZE zra*~K;#R#=gvn6QWG-@xi50gPpWqgw6}K3TzXbsd3Qls1nSCayJ|u3n-mb9!QC*jc zu{TZ*u0D~lzYoCA!3Tbuc4AC|2}xJ{|rOhTiCHlN;Mgeg#> zllb(ZQ-;Y<&}1(1iHQ}T7@y!1qZOYRjf;)|gT$$EnfGL@$rxCZxeseH4`bb>C)Q$q zgSD79uoklgYcc;o+-F#exeA-n3$f(88=oO+_zW=vpCR4~b+XD?k9j&ywv!g0NiH0e z?O;V4TLt`2GGSs%mVXVF^WL^zm$kf1Wdll6(-5rILJ#m6aw-39FJWg9pYhHjzNE1i z@fj|*7x5*Hy@-!+(lmsq)FM6uT*QZO?JIGnA?xsnMSMaGu=L##GtDZ>1!?Q8{y0_x z6_fbi&n-v8T#`R#>5BCGy;h|Ihm%K{R_>=bDxiPoQE8u06kSCokBPa!eir%3ezTV3 zMhR`XdzBHUK#5Ms9ar}ljnzGQE9jGV35g`E6aL~=`D%WLWq-E18i?4F?1gsKfvlBm z;e)B@Rmh5eY5=q=^&}%qffAjlRGt2uT?}>s5DJ>i#m>aUsxvV@(U};nIuoPuC)9vJ z!Aa?7W}ivQ4=VklB-G_uky2-!U9#@~vsI;ga_o+9+NCW!!s94dbp-5J;8r0%(+uOS zLK3!b6_T)htB^{gZWU5#)U84)jk;Bc;iOxI_$apuNdUJB(YL-83ndq-q$^ZOPb}|N zU}BU5>*Q&ul)poD;9Vo$HR2uqh3ha_D(SdPp^8#igLhiV^ zj!*7rS%NZU(*M8w89+c^-vIPKD3`L`G`44KTb|B{Os73S4|FH@%B(-$^Bvfko5VE^% zJEt^ZHpcqM^pn^Ex8B^M5cO%t5q4)hg=O@YB0fzvvu3Z6CEnvO;kgsLN3X&v$%j?a z8&*kwSS5q;b@Qz_w7&@MHn=ExgL?yR{RrQq zr<8YmtV4N6wa)UQH3+n-p)`UusNQ@EQ+B(FL98m(4Hv4fo!OpZJ783|0zW?|&t%HP z9OG9|IrwvTbW~CFZp(k(9?1?ifGuPPj}qGYrJ50@K#5M$FN>WrOos4h>wwfROsobl z#wP|aMymmg(MD7<2~G}R%p-2dd37a848-rMW!;bVk+YkOl7oUDx;04WD=ZYDl_{`QoWzeI&y0Y zUXxq&U2f$#++uW~dQ3ZVOX}Z}TMb%GXAOt@)9asrx>*m)Wj8F8V=>VwbS65lkf9e4 zMS`K9f{k_hNW07=Da~cFgD|uN*^DTm&CsEYFa=6<5<^EgMVJf)P39s)nOHHD@d<`9 zS}~N-MpQBhPBN64eI}_^`%Ioaz^k~(rmCd6sXM%N;_!Ap-zU^vy)dAN2q{snx;vW5 z4yNt~2yuiq2l_F>6c}Z65(ft3QOYnG3YvUP4luFe0OJ!JV6@@@qp{Er7!;i305khc zl5OwVP4a_WXY&%P&m;M)OTAih;V^Qc58o%auwA&&he*9#=*VOT<3dm5!_7v3HW#`x z!W1acNnGgdlwmRyG?|NBU}D7u#wWPIXvGCa8&Sz5ILQTO_L(HRr5s?_6}C7yAa!cV zfsW+BIi7iFy>Or_5qdcgV6ua8poqmww0k4Gg33p;R3P?N=)1F7dvB!&Mq;%k ze*z30u6tcNpyhOb4>GFhKF)MvK;tt^YWedO3ESUPN!b3TN~KZXRH-!Tn<|w?eN)A7 z(l=Fnly9mefN!ekTe%lFbMxISRu_o5IeoV_Y1Raefa|R*Xjvq!dwqp*VZW~m-G^5!r8=v}QR!k|x{e+3p}sWonWOx1lzQ=n&<(&^Z--zJ#>ck_+v%ZZ5v7Cq!D zia_`#zD*o?t2~1fi_tyyKs~fQ;s5mc) zijI8aP|-e6?GvP30@ck>w*6N?5(3prxy{Duv$;Cn(Mg9YeMrNw$La!xFr0fc9;P^=0cl>f{6;x+h_keS5`+geLR{ zbe=G4*+d(yg+!BRqV7peG>vc2MEvhL_DUQg%Y+?vxr@e`F3#R)4P@f5v`XQ=Sa&H` zEjXOYH%g)eInZRon8|k0@VXFA>w)G+cx_i|JKwaZ6s&=bh;CgeIse;crS2h`7L~#{ zd5eq2tyJuKw?_Gi8qK_-Wo@!U7q)Dk_hV`eqYgvNE-GbHAWq`Yca^d|#0&s4)DUwP zB!WZC)qT<3vACyA8carERTcM2M)aM?t;QLAU4e0i&)|xTGZMDP8426tj7p=%8I?wj zGb)W5XBbWzXZR@Nj07;w(6@ed9!Qt}f$SQosb|T$KnykX-CCu@DlpDm%Z9iA1o9lb z#{Zl!k0}tGpzr4K_u3olhck@oV}NZ;85M|OnZBDc{WacK7YnSWXZcWy)f;!KxI!%ReT=F)~O<~yP;@D)YXa00JI%_sYAS_640#`4_M$SLs?#;#3DcBI2 zpNC5&kHZ#!UrjrypQfER0DK>W(QUA%opK>Yvx_zDu%Q^a%8+-Yrd|FUP5Z}{@JDOf z`m1n_$^=cj`x;Fojfa6is_~8ZM>0LDPm;XxeY@(6o*?tA1=$(~i4a({dq@ zBk$9+n;*bo=tpocdKJ!iL3}s8p=oP2Xxgtp_f1$0ZU>r zM{Y1Gvr{W`%?sm^!djy&BT}~77`8ex?78pjuK!KoKcURkxT7;}&HX=(U0rMw*%iKH z8^_6d*G?LOL*11r?uu=oK_TsKGYM;U7_j14bz|(NQnaG0{;YVY5S{^5&X}Y_DkfKX zX`8Bjpo%KGzN2P7yo$*w5V@66bng;r`6ea@Ww zbI!fz-h1wyxqnEIuFc?ElCA}r;@7nZQ-it|Wre09L|fHiJ4BReO~r>q4}d0tvlYoR z`m>+2isYkz5YI=c63a!NiWr#%UGp;~%aeXC81j{M`HG-4@{FJNdyM2PNEb-i&r?1l z?E#5{;VJB)RzvcE^e9-HiNJn`D_nfF@IjmR0#h3*@&W{6P%$(1Re4ZKDF-LV>3p)3 zrOr-Hk>Um|b%tsW)5}3ao}rAYO+{>~u&U#Yl<`@nG)_)YBxDGT_#xj5l}o|E)K&ei zU}RR{w0_9%3rv-;CfJZ~vkU)XD?9Mn6nB2E+{X;eE+7G56!HHa`nY-tVJ`z$fEl0& z%mO8#49o)y0M?qU-UP7LWOW(9T9Z|*HCbH)?g0;g$G|4=1nW>3-~oJq9|!`iKnMr} z5g-ce0rmp>fo|Y+pcjY%hk-aS0HlCpzz~gyvcBKUWVbtJ@Q*w*v;HP}k10Ah+DI;Q zc_#2)DhzD}-aE82@Y_Y_Ddd)m?nNVgjAw9){}B2MBXN>TLv9(RJj~O>My70Q*cYj3 zSc=)K8=-NVb>ej+xd`s-u@_vmLP_^-R7O#x^%(m%Dh!sQ?%NF#Bh7mJ!ypm59ypGg zn;t-2O^k4P!I01oER0=^VYFhT_wWzK?%>n~L9Ys@TE?n)g<(qPSQSo8*>8Rs$=Ha& z_KXTji=%+ix|Ec;3k^|9nL8^|3W;H6GYLwWO+~Q5dIm&8LfA>B`Vf`(`%IT3?IdQ# z7~9XzwkrooZj|H(n6jJXqCtM%?4hR^Q(mdL>^Aol(FCz}zX(IZ%&0?suGj?9Y}4m0 zv)OLBb>Y8)ZP7QMs*M#Xe6|o7`_APO#DRdUG0i3*>z~Bo2F#_S zL;X&Jk-W#{==zp!aV^^Mu~QdY#+M2SUiri)gPPgjBF>%titQh3ne2_}6*sTU z-FBsFosl8=^}L@f1ntMJo`9f=yk=|3%QF!J3mo!6UU8S|Tn(v}ihXZI!X9{ZS+kFIZD>!3tv{f9To@Q@`nG+NE?k+*`-)P*EAlP1|F;P&ZY#`qh0L^*Om2_?^dR$eZTNx^|nX zA=}8I!p^S0=^+!GoYm)iMsnU^?5Q(ut22IVd+hjx@lBpw;PPV>&`$+wXh!A%XBQgT zyRT;3KD?e49Fy=tvTP(T+W8D~JB!Ghdr@3G{bDUwC6Bmx=8>)~<5l1hvcR8GjR~C7 z@ocsqHHD+1R?Y>nM6BTpCAjsC;z#+rn8*AG(Rv>9mR|&!+i9tblj-oFl^eElp>NbG znX}pJn%U``R|5L`NwvPSM(8{#nV&n~7yG89dXiJqe0RHE`}VJn_Vk8}E4!13wzF-AS7mi$I%49PYL@z0YWqL@sY> zGdFa4OPfQ`X7)L4ijFqB$!bHJ4^Hjk>F~y1Cj4zZiHO>2>$HVS;f-4p$Gk#M`dQ5e z&e3UC=JzQtxp!*Xt;@8v`=2tGOwrM9H{~x879T>UEuhs)_x#J@Iruu1JYVs`4L#?dDszK;*Gm=Yi^#Lr*hc6 zsCp^Yr8$#U)$E>BZhpP84wZ3cMaxRIPTDM7Rt;Q$UX zT4qYUrQ~X@Q3|sQ&Fo@6+kEk_+2&tg%Ld==%Ldu>TY_-^My(M&TeUvbh!VpcRLp3o z-X3YIp=N8tnlmyLbilsh3uHk53Em)3$bs<*JUHep5*XJ&*mVI{ zyo6kI#Y-5s3w#f*N2=cr5678j8w{rek|DosiGVB+{EE&(gbKQc4{}Wnk)TNQz4lW(Y+XnRf0LH0B8uy#qOgFmt+8ctc^hPLsJ{ws1 ZTh@iWp16uB$fy%%^eR>RPaj6uzX5Ydlpp{A diff --git a/Keyboard and Spell checker/Units/pcre_fullinfo.obj b/Keyboard and Spell checker/Units/pcre_fullinfo.obj deleted file mode 100644 index 222769fd254c7f975864aa6b10e2d30c43b8b0f2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2036 zcmbVMO>7fa5T3Qy_6kAP(9i_bLnMldKym?7aOfq(F$5um8`}X1hm~WmVd;8pt)C@Q z0RXSmhJm6+Fc99GjGFnAW-2$ZU(?lMvZa$8 z9*HG)1-2&-8fm?hQIk0}$BBD5u|FUDv}2;8=hK`y*kbPJm?$m=zF_d=yqOi zk!7@%mdi33HM_EuA)7Lt4s}0MMU|b-Id@_uldL&+pnFwa%W160tKHk0shu6qRBkfO zrV4L6gzk3UA;rKRX*ah!D*E#_Wz0qADJ$qutGnIbp?0->_*A)D8wTGjM9pBTX{4ND z{P6H~CZ+S3US|?`FyDReZ%;S>;@7v3M~O#{#l`TEkqFKs`{MgV{^K1vFm@yn6_w#w z%ni^DAKm*_5M1P(h(ynSC!a)g(@Wl_yXm4UTd7xZRy8V3m2{@C)Fc)tt$kx<=9H4v zwL(G75M9Lz7uNi5v16w@n|;c602?9~V`ltMKE;fGDI@fEJR$CD%xKODxvC=H9 zdhn{*Y&K3KsY^mGGCJ_sEww!qohDh9PtgcnJInECK%lez>;)p95jw5bz7^3H(n0UjkErH6(5R z`l}c2ny>L2+}5aAlN&$bR9PsA!Mg3Txa$WPtb3NjqQE3;zgVtIwkue#`RpuWMThsH?FIv(F?oJyBV32% z`O%MRvK_`t``wRW8T{D?C9-#bB*@q5<-Y`2H{r=I&paysEg*V5o(ANZme2R#CG@$L za^kqPH1UMKJ4kmTpq9@dJ5)EyHZzlOni<(3v2QR<@vIxeew!IEZICvuL4m2L{`T2+= zpTg1FZgcEv+U__gc>JQ5cLewVaoj^3YlFt;%XW16gC649lK0$EwkJ5c{c^c-Rw%cE ztdVHAkQF@3&kBw{;RNw*&R4v>?27qtSO^xh}eF(FkF? zH$PK5%buw~w

cDs~9ETYiUJg6Q`bnp>GG^ru)d%tiSnyP!k)?pA(>3T$gYs=(#C zmMZxf^a)WuEVyMdIDXd$faYJKWB~zI}hk zewzGIx4&XNY`4&^R-282g)V5&Cj+!XiR2wZv}$RmVGz2cMrw(Yl<2Ky^pspv!0m@O z3ayhrdcr)9HY{#Ibf3@@L~3|UJb@5W!|Uk@^&vD|kC0-s41#wZbRut!AO^bmFud<* zcpI4OSD2&jZa?qh1;Fx=uLA6ha16IS2POl0PihA9uPmmJt?*t& zBtVoBSS}KTrD+91c03=O%-Fb2EHX(pYw2Zr5jP9-fnt+7{6jny)!>P_%jA0?i_WaS z@s}h?a~Qsp_MEj>vl30?iF7Dw&sclct!A`Xi*>Wr!L>apJ#SbO`w$W$VH!jEMDfuwr}mP}OyNjxp1lhPZ-!-EVbOo7@Rq*j>gr zbN;A;n#Mm-GqD#xMEx`#PuEdn06FzDaH#r13B8p!hZNM<@nc0;<$o^HUSg76*ccEX-B z&X}CJfg0Q~LdV8wgMNhiwiS=ZCX{g8KWC9P0~B>7*esbbF<%~s&3aHjp%{Chq{M7& zie3z}8@G?p26`mHW+X9#Ay_E|Y|bWj#Mmqi*JDbJ4&;-31(A%m6L39>qYuRLne!rc zVy8Yn1Nu1&`W?d4z+jrRIC_!Btk!_8w4l)~95vbw%LVH_jvl?wQP-+r?SOTbqpw|o zmE!1+zUNfG+d0L@7vTRloDyAq11S)_>q3%KSo67YHZCnu-pWA-vGx*WW{xaPDl}ye z!fb7#8Bam&kF@4fdCW*_s!RJK$bHc-;!ByLD;v-~hEt3_%c<_2f|@Y=HlhCkja<~K diff --git a/Keyboard and Spell checker/Units/pcre_globals.obj b/Keyboard and Spell checker/Units/pcre_globals.obj deleted file mode 100644 index e7709d9dc22a71581ddf805784d5eb1d819d1fd0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1745 zcmbVM&u`LT7=Bj@!-yLj%fuTO6O$#lUn=Z2U>Z*&g2Y3UrnH4szqaISIe7EfL`^su zGh_7X|HZ-m74!K%nv!iET1cQD&-*@o-e2GQsZ1LaliT{3`9p&Rb(5kUA}Y6h&J540 zwfFXF&+3gsiXIaEz3t3@9XBX?Ky+2PoHz1Qb5g&cXaoO?UmrIM;>`kh4uHDeQN4Yl zb-6$0hFg2-Fgws<8LidnX~*?_?X_pJsby=f?F!-xL9F^mPg4_h=9_}qjF|_inIIZW zhAUMOZU)sLFVAH zeNWPbZu)eC&~jEyH?%B!v|7lJHMs0h_L&Oo@VzVV#43~Q$UBf-l{u~x1|r*&c%}|h z&y+hf!;h0?htS>h9n!riV@Y$fQPH1e$e4@tA?xT++}-SVD9IMQh!Rk=P4ru# zo0<_U0GFEZt4ipuCQPUsyl-p5P?3fknn0?A!ubPVH_ciy6+Gx!?W1bH8)X%P|;fi>53n zdeg{?Fh~PHvS65MLzgneiHXciHaF#@k1nj-e|4OL!5F}CYUgK;>5A>_8Vttqo87*d zkI_A8;vOb|)2Fk=S)MbERkNXG9w@5Z;av{CP^$8Gvy=Q|T~xc0%xkhnf%hr!sxf`r zH&9Rwks|Xh@{VsL0voC$*I`Au0a!c4^jHz;pA~_MzDltH=JUU_=k=&Ry44ColZz$iq5`^Q!_$O`|T}Ygj)GYEm~YC zl`$^O*XE=26)QcgEY!KEP^eZT_`th3e0l+)FgOuFl=&CMS%94w#O#P2hSzDhEI6u& zxh^zSrQMb#fH$ZsbjcgrII&@XsogOApWNMm5J27f-8(p}E?V8BwKQs#+5VSq{PQ2% zwojgJ=E{{KN3OS^1>5z*3U@@e>K!DVHD`3qO#eF>u{d_~$Hw!s$X2Re%25 zqzkISRO+chR8@1Z4cs{J2Ly=7fdf)F=0YV@f#AdeMI^$Vx3+ePh^2Kb*_t==eeaw1 zW_H#yJ7Bvm7$T?ezlbJ3DT~E~0HvJ(5F6GEnOF1iR9|2GheZEjDD4G!vjKkUpCkQH z+6wS?$KBWc5lhe$1t@L9HT(O%0fz2R9Y@gtBWf~{8qAFt+O)wd@skoN=9)^m;dC~4 zBylMBqbkT&Ud$hHGwh*n#}KgGm*&4PP&dNrrU;U(KK9DWcpV{ zqNGk!Zhtf5L%uT>4MWvjS-hq;WJTT(3NE+Jl=HGQ>2llB<bCz3xu@NYSEc;bJJ9V6MM*V9L*<>r#4tj~ z87pYmy-p|eqKnSHjV5S_-ua*VA;OJj&W(msr_&j<(5P_A7ms}7IXT3mUIu0g>rdz7u7=mgVG7a&v zUf_Yj*(DSVfIoTw0*!m~UMBb+ff5Ghg79@{?oluRaHjm;URcSJvxT8BKz$dbjNQzv z+1J*mSWIu^M{uE-HC1qA~p<7 z`;1mDxty%qtDR<-w?*KTXNT;?;JQ_K-HLTrR)k(K!eiM2=8gYr@MABq*hS3j;tVdz zi(jarFksVQM_tQqu_g->;*=+HWKVb2|Y$K6kM1 T_?3yow^#QcI8SqfGCJXZ=3P|j diff --git a/Keyboard and Spell checker/Units/pcre_newline.obj b/Keyboard and Spell checker/Units/pcre_newline.obj deleted file mode 100644 index 9384ca23bb987202014004cb792c08f5f90e023f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2263 zcmbVMOKcNY6ulmQMGKjbv~{H}Qqc;eNG9M=9848RY)YXBgJbiv8BOd7nQA$btoe1wv$j#0sJyY!B@cL1f9?_v{!5sx;1Gu4eAM zbI-ZwzV}Y?uxc!&NrEbkE3zv2QZU&G0Q^8!Q$#i0HQ3$VwaFLQ2$P=xl$I_Q&-Dgi zawR~yXNwLmM0T57b3ZBcSsk%ybumUsnq1n1st7kRC>nu0FhEnaWs%-^5(wXy3^R*9skB5Q`n zKlD2Dq_Vhs*-rQvQ}ph8@9wly!~a|dPGKl~aL6&ZHx$PA(DtG24jNpcZ}#tvMI6FF zG-}5O{&K^`OPq}Z_6Fc^F21=v0B2m_s@ZEC{I(X_1tu&{Mgjs6hZV{HeySH>8vC&E z^|f+t@mj|l9j3kbr%`2GZ2pSa0RFkmVT>8i_eJ9ejHE|D=>-z?7Yp{Ui--XO&6lkHTJyj!LwZAysd)&BZ#Hwo?f6(;o<7-$1g0bq)pXvX(jC*Y}TRZe;{j<+L zxIKW`pDLzj@SMX7;9XWT~^j9nL z?kngKm`=6?0aILk@$Z=R7t2&w`Bw~j@dZ}ZI>_gG=?AjInS5NU=_O7(Y>vK5V;;83 zVfHXT+}G*~SeHh)bBbpQ%+;(e4!$nm8v`&I|PO-EmA~3LU1R%D-TsHNCsA zsMe=f#z|=6CiA$$X$MS+lC)z>k($2nzbs29zFdRhY&*<<5$EQEaof{EoO^mcZUcih F_8JRH>cap4 diff --git a/Keyboard and Spell checker/Units/pcre_ord2utf8.obj b/Keyboard and Spell checker/Units/pcre_ord2utf8.obj deleted file mode 100644 index 41fb928098256bdafd62f24ba0423d6d1b5c7e16..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1642 zcmbVMOKTHR6h3)27F!!zwZ%;~f>0RS#7ELD(k7`=!8Vu&f}_J^=B6E)N4PUtC{nWt z42*&+k&58ff1$V${0DB$Lh*sCF5J{}C)25t%}f?E+`0FB^L^)j=bT;|PIV+o1cS=i zuGP+S64-M9FjF$9D(Z5kyttUT!sWAI&jWlNiPl~%6u_PW_%^#g$S1l|huZ~v8oyJ| zE)utaNfvW z3JerfLt@B+hg=SfM4+g;a$Q!G8-mresLzVX;H(H#^c{xHdy1C=D<+ichEI#v6oQtB zRND2iAtlSI((tW~EA#^vmLxSE_Ro~ojQ1s_mGS)?K$pSj$xf{NR z{A|zRRk3k49Egf;5vq%BGBbF>##u@-uzKA}_&@mH=^0};{^BAeg!;yvdc3?{*}!#W zy}ll2uVm%M?d?W2E|hAu7(VcF0^Z()NEF-^Ks<4@nn(fcCn0$lJB-59BBTX(RI@QH zSYk^h%cEOaI6D$0n93sp@caxwWO{gdBp4?>yxD>XK*RY_YdW`1I*nBB-S^4WxjsAF zJF&KkdH^2(ihXo`_Yd}FozJ~5#oni$y|DTIPjah&@Z{&@FxXD7-M@S91H7Js!RcmX PaK0HE6q`|SFgN%Ml3^9} diff --git a/Keyboard and Spell checker/Units/pcre_refcount.obj b/Keyboard and Spell checker/Units/pcre_refcount.obj deleted file mode 100644 index 90b4e445ed642bc2b9d1c3086a773ad36bbc3084..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1584 zcmbVMOKa3n82x6F$z)-jiUlh|n2jJ5V(s{tsT(^F9YN^e%s|0NNb_h@@)&NCg`1)a zWh4l$RO+T%f5GTZaOL<5+`F*Uy|^)cH^vm(O)`swn|trcIp00sJ&(^oWuy{aCc2@z zf#ZuRj28f4zUdN6akOe{X{mZmtgpa$5#alY-LIb=)L}daaBz0-TfG#hBXJwXr}3MA zak0VCf76NUH~~GUCbm|k9&xvbVpngQmhMRjkJN1UrK{qybk|X>K+`2#w<+)j1unX^ z%b9_)<*F3fNRU@DBN3=rvD}yy<>p}Ze3G&vGCL~*O=pW@>xts!%!+kF95(kdi&D1T3Ry1!$`cVd=K zHsd>xpVcyL)Awk#t4U9-WbP?@Q}rK>jvPXFvpXa^fn}xU=7XX?N0PBGvP+iHp~T(% zcPOp)93GYZ_I%@SAexS^6Gw@Qna33xXT0iS_r{$-H`DApnVt+i@mH6iBo8_p1Gcr^ z?%=q+Hdtfni)-Jxzdr1-a-{1eU)b+K0bm&Z=!e5oVTXVEG2q|-j-u$n!%yM#=hw<)L%8{6m#uw1yil2R k1!nr>R}=y4a>j=!IxHJuS1_2V@w_WkCbtAcL5K?B57n{^wEzGB diff --git a/Keyboard and Spell checker/Units/pcre_study.obj b/Keyboard and Spell checker/Units/pcre_study.obj deleted file mode 100644 index 281e710a38d31a9147f4e5e1daf1cabcfa41b92e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3787 zcmbVPZERE589w*JAB~+{0|wF-byticTDA;g)&({oV9Xd@+7N$q9ce7baln~BBKzKT zQIjdr#ck}HNUgL^T_+}ftnKz|(k7J-q{=3!A?(L!Dov$S8e|6SdQ_E`1}DnuJ?A<% zNjp&`SbFX~=e*zNJ@0$22kVHnH<$?dlak!k*AOJbc0!2lU_22C#JWW1_U+<#8=4x) z@OnZDUuJ#f#bOf~t|g?n?)7|=K@RpdoFv0_n43o*-EE{=>B19OAgwV+gL6-NYa)Ik z5r~S1!;w(3eZffk!9(u$T@5?he-sNw zOF}RZ(cIOn!rfI^O-hMHtB_o|RS1S-C#Y=Gg2y{n>~ScOh{YGpVw+ZBHWWw%PcF)? z(&es5xN}i`*Rs)0|_ldt3Ol8kkk{^YT|xQ za#*W@)mx2(qhTpYqusM`rW#j#rlOresjqh_L&)yRGvtrSk;r0lS0{@6EV+zxv2vHu zxAg3;zJ?Z~-H5G<{`SG$g4PPdF)5UY1+-vnpwM<^4#shMwUdAbS){%1D}9rr+x_cp z#NhY1e&XSsPakq&eCUAZ08byrLqBYL+S|(e54znPKwdMEKlYgzmT030;SJRhAto~+ zuN#T6!c|x@(o8IxSJ6NOU5c#nYcpBuZt_ck&PZq%F`{AOu#sAg(v38PW8HCWIoR7r z$jfU8VQMs@*5&sZ2^q%P8I~+t#hm9ELcHp~-9FW8S6xYW7lmAjL<%*nn zQ=KwkBhq&DsC9;CSZT9*lo#H%GCETmW;~n9_Hjzqlq*BP*m3;1G3Zn-PD8D19e2&c z2vJ>T$7IH)%=u;0d2Agi8P3yn?m4qE#*VwnbmGWnpl41ghlQ7}VV)WM1D=&FskNZi zZ``onz7F%H-&)*UHX;Z%n;_KHtr2VjZlh&Ci>0>KVyUUIT8O1aUw;6*O-x3E!NBo6 zPdJVPD3L{K=#Tk1tc5Vy0t{e$2e<}Y25tiDk-0|Tn>-;~fro+hz$EyGfk&Y3VL-t6 zKY0HgcncT+I)J@^BU?NVk&0Yjk?j@P=5rUuzo=A{i}qAjHi3E?)FX0@V>0b67ms7& zn8-ZILGh8>o`W zjGM_#nW-|?@;>*Gw&mpoCDU+h#>p_ks~40hChfH$HN}5oamh`myYP)K`T02w=4-Y7 z4jj&}XL&)lVbl29e1-1+(#@a_Cyb2wi}z3ve;j8WYey4@r|!A=;S+9@{7yJh``P$Wk%+dsk=*x zrmCFn_u|ww=Bs?WmhokN#hgJXOS%eG9^3!%oR&%cw1>(6-oxBn3v2)$0v-W216zT| zfd-%vcmmi1>;n!0hk>KOQ$QQw1AYp00G&WL&;!JPgon8`?qhG;d@MOLz%c}8QV-&j zs)L`R!kondp7dN_*WRpl_?6t8GHViE`Um2wY#H4L*$^-Uyat>Dt^%I}9ScAqeE<#j zNKFk27iKs*<+;>30S} zRIj8a(TOjZa&z3^57rUMrnU2P*a7mvRBBS@9TO$PU+FY8A?;AF!hbK#;Hbo-uBWgCRm521NO>Y8L8`o62p*(%kJaQ1~w!ddr2!k^}ZvrpD@f8%CnoMxMBoN-!fB-)EFgG+UbY45x; zFi+$)qb>8tdMrIePYF!Vr(J`18t4wCU8hv<{Llr0QcHV>)t338Tr;{(x@DwC>>;DB zk99%osCTe!#`%C*cr~ZoV2;5qnr~LQ&a{qtKW=-b&^W8z2}dN}ku4qWX|CXJ86nTA zAEvI!HRDDvCLnx!)LB1{VuA@LKTft`Fy2h>cG4qKJxbQRXi**WSGSIwc9A^lIFCBc zqmJ{a<2>p(k2=nyj`OJFJnHz3?LO{Sz{B2p-ow86u8)87u8+ID!^hm->tWvt`wZkv zFAWr*&2lsplf-aRjKw7}AO_>nUVQ&|iHXn&ITA>SpXR-M6F)^MH v!?9pIkq8APG2SbICU%CUZOO+(`i0XS&=g2<@kB@x@!1nk;QI#2fI;#5A4tqyldl_ti9Xp212lUHG6lwcjEi8 zn!PvCqM{&Gsw^M~gail#L@KIU@e=U@0;=|*5A8#wR#hchsVYJs!2^i57J=mc=i1&t zAd;P{J-?ZI&di)MbIzT8ybJ3Zww6{Xs;+Df*qG}9(47mkEBxAy{JwoVjt&eBVy+MP z-pY!dG~PEtZNjD<>+yZsraxMtpGD5lgN8pzW5&v;wzMXxnMeU17*IS5@0{SLE07XPEc) zcIkKd+iiw5b*tMAYc)A@Ya!FE&~b)VUQ{9F&2b+P=AEoNvjyDR^O+PmG%qw-$fGTaqk zhRP46_C>szZd%NB)@cW<-nbHasWLa-jW=h?ocHs0B4bs?&Q{X-;^-Lrqa&4(v_W=s z{B-e5DQ)G-8Enj%D8764xreRgva5ha< zFIDT?s(6j=4(c~k-@TwOmMmBL_0VZ@@o#U(Zdi5cn{xb`rYq?*&nfZkCzV=yPbLz{ zr6qdQqWa>9 z$Wb-qkr%$GajrE|4YZ>4 zT7-%n?M1VW!by&%)Fan4ksky&DXUsu#7U*Oye}}}Gg=kO8cqqHyAy0fF>6exL`yhU zLE)4mbkKC@id|1?6j0cMf(R&~@==ft+Yu-zuNsj)|Cy~E3N8vB3LF%oKz++L!53QQ z05OS4;c|VK=QU|#Qeu+Iz&9H+=9ch1p)rN28m8n$t0I(Dh$N2@Y$A7vQes`BvG0{$r1IYRifGnSQ2q~C52Le zQWK};c^({2M>L>}vWT?c5om!j-yLzmtX@{W!!4jZi?WAufO6#5L|jzmmK%i1ni6&9 zu+01l8xpvG{Wv zXTJlFkU3Q2k4};aIMn3fk)60eO%g3Kg<%JO|HdnsNapN43j^`39ggD2>TD9K!Vf=wSjz5$4;BRCB{~&*Y b_ZdkR|Du=M@Ne>Vd_ZnPXv+3UbLsyd8)R|Y diff --git a/Keyboard and Spell checker/Units/pcre_try_flipped.obj b/Keyboard and Spell checker/Units/pcre_try_flipped.obj deleted file mode 100644 index 3b718ec235d58726c98682f402b945e2c1e46d7f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1891 zcmbVMK~EDw6rQ$A+1M%-8!Si+7ZMYa3KXG`c!0JTV+f@MB(Y^vcDJx(yKT1H7!D*7 zVr(-Z;basKdhy^dFrKtx4Dm$#2M|pL+Wa)A$+C7WZ{||$jUigT(Ys;U$eqfDzEY4lXT?Vc(uh{j6k)FE)!zC(gmQB})a zXH@X#G-c=u`zZ_HP{Up4Z^)|lDqL0JMf-3I8;go&$hwwe#ROo7jx$~?Lie&x=m3b$ zzB6a2hhF;A8>mT`PRvbnvB`J>*74ElQI7t3<9AY%Gf7SuOQ${XL(iJgo0`kzMr?%; z*L1RK<`LTRBCqK&-Dop}kn6JW|J0s?iT!HBpc|NGorHWlxSrjH@1|$(UZ$yW>NV8qT8d2d0Tk4<9`PXwWwU--|z)eMp6$EWa2u;zwx9&+SK1DOccMmhXh Nn17JnMi{(Ae*queohASP diff --git a/Keyboard and Spell checker/Units/pcre_ucd.obj b/Keyboard and Spell checker/Units/pcre_ucd.obj deleted file mode 100644 index 3c199cc53a37a54b5752b60651c04a9b325c299d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 54691 zcmeHQ37AyXl|HxWg>IUrpxM_3X=rHK*G8~`Ze&eZrAUGxG%cXbk_Hkr28l6>A_k)| zsHmt})HrdC8a0VV6N!mt)wsMFA|^K51;jjJ3;JcWiFmu&wHx ztu4*F)=G-Ca~oH#oji8@+J)PjTJ~&eUc0S%8#zuR$G$rzjSKC#zGX)fdDe;NgwUSo zxS>UttFvOcNo3u%yR|JVdWO%6j$5~HCg15&@%YdcH@CKK-_e#9+muAw<_)b)TiSe+ zEO}GQ){SkxN#$L?{Q^AhZPUfP;itQ6_ol6>PIvdFP0bgiRx+mD(5jD6^5@j9=G_-= z)Axx~&g8B7K9GFYmaW^i?%qYSogwGc#L(x|wvA1@FWKoFAw0U_kI?$1A;1_T9~`+c)URL{LM^S?8u5c=qZu zp$Cd+?Q^Y}ov7J2*Fe$wRrA)YDr{KVI1k5-b5_kMq+N02{1r>jT~@e$?#h*&@CJuV z;64CV0D83GmBJz(0hDwGxV0FHPjos_0EhabP51R?bza}v+_a;0(=J?~;ZPq`MI6+_^R|x-_&^Lv? zA@nVxCAcGsaq;BT^TBDtP&~p|ww?!;t?9!=aej9SJtlOo(Av@Lf1dC)!p{)G>YT>O=zviM+-eJ@)5#6Ep(*NuL-Rt zT8u^FRw{HrIrBtU;jj|>K*zlj>qYYumFE1S=8;_dNKeOs>_-T#7CKvKJyEoyjqIw3 zBL61EMf#RdI$w!@N9eOcpCgKXc*wNhw?zJ;$Wg52KN9&%LjR1kOy*IBago*W?-%-z zP&!2@{tLn%B`WtflK+Kxq;wvXBVC5}M5~BmT&kNW#UnZOjd)~Fl*|3ET>4wy1(mev zWuTDE=^jYte?W7EJgyO-q`gX(1%>(_k{&5-N|u3s61Jb=#lD}M_8`*$k%KHRAZ3C0 zgRwW|Nq&%JW`g)npt<2TLF^}p|1{yJ312UM^&+n~a*10n`RgTah3G5FIDUorRY;r) z@hcF!0Tof2!C`6~CzxXR7#36~C$CH&E;civ2*bA1L<2ML%5h z!$m*b=q288i8oH{$BF$ou^%VLX}ZX#i+s8qm+3|?ajV3xO6;n{u1fTEqOX&@b>d$q z_I1Wi>Z_B7!#a65tdlxNNSqOd7yl9BKSJV;kUSB*f1N)NUs{P@MC$4zd^bZSPB-!E zCULq+J)Om_#8A=K$isP!$ZMqT8mW7X$j9JQ1ik5Hpz}l#Pn5KMh3_kTvGB#hPZEBT z@I!J6hIhD;GIE`WIfykK(_^Q-JtyQCdTPfakXd5686Qz^{w^FQ+Hi~l(&O^`V=S-gxO0K2S zCz|)W7=I}CfS#}t{k`xMhn}_4p(6Tglo!fz>yGj1;jugV)59UyE_nbH}UgYED zG#)Rf^>~RpTlBNVZ;|L1iF}dxEi!t^*J!BNHHuxM*ew+KLXj_&xC=$!Ao>Q;H;BGL z;x>p~X(1n`QhbF+TR(YLbB6d=O8YD2uvN;u&Jq1wp`#2HyB@;#5dX7;KTGnC7Jjth z#jY#%wFc|xil@ixcp8osyE6@y`nw1}$56>TN8-&F`F!CA3qM%;F<9&ei~elUpDlHq zE%H+7Tc!Bni_%VoMa3nZOUt^Hcdh6aiFEH#*|S&gK7IT3A24vx;2~8*hn+FJdc??@ znwn9gYtI}rcHH<0k%^NgN2W}jHob1fSuiwPi9{~S&epO` zHeLoIhTWd@ws!4~ogZ%9wQKjDk9_pvOD_G`Wgn01y?oy%uE5%H`()(G$ftN1YJZj9 zu8!;vWt}%lwgZjVTzlZU$ic|O%0bU0Bc8FT?MdUk>@4!jv051arPfG55(tHQ<9q14p;ANny zL)4NlBHw|02Tn={co`UeQgY{$<~xw@K!@l6F9S6lqLzFSIp2X>BexyN`AM9H6X0dw z%uLNZ>CYSU4yRHFZa~ITGhjGWYiBI=fHd|)V5ij zsYewsM(9`^F~;GwjuXJ%o2bE*mx0N>VPaeGU_(B<6%v|kCc)%TKJnstbyH-@Ub&a2 z))-9HRZPRL>X?Sr!3;Pnu(p{n3$4zEdfd-ORKOg(&BYsoBo)xm#y7$|9G@dRjpxGx z%`Fs}@m!?&#nzrQi(v`85AlA>dMS>_SiFf4hAzV|lDM%PyePxPf#8)J-spp<6Wgs_ zuH(67LEH-HC|H@5N>;(S_*JKKvA3%=jY1UGzy~x6aBQ#|`}ILwmOrEsg|(IYP@o_PvhfDB#hUwr^h>wrKWsvUeJlVE2cPBr+0>43+DNyuJ!j%@H@Tm;qDvVzMSGO$=ly865a1BPjR!4XC-u@kc zVDK_9GgxV)PB4~Si|HJhJ&NFyR|3hd(>MqR;d*SwLHIP{P#}06J&0COxFIbp5A+Ux zg!0!C^}XPr7a%kP0#&vmFn)S9pA2uBjeGtP_>4<(BiyKY=a^BQHwA#}r=xoVd^QfE za5H=k4&yC#97g}-L1!c9%yzGDfz07n2*NG;zGdI%?D1{j#}P;jUIu2zH@qFZxC8Eh zJK?Ct9dQe@i##31cfnn7H{8>XpswD9`R>-B{5Dv6H_FKF9{p6A^n5IW>Le|_-}3nY z6u=iShW9u+QKIlg_!1%t_j*7+Bs0{jkHvc<5zqOJ2XS9SDdqhVju<56N|=%b`#F26 zlfjj7MDi!;eE}eg`w?HZ@IYG>^7<#lSCBqv!DJyBjcr|`vDcb;_nxvwF)M-cn|x+W z)JP3AHk_ZAfkrBiOEl^zJQM&5$By1`#_wTx7#_iBkNRL_hWagnBwlOgZ7F4b7_&X1 zLHQXZuWxNb^_#qVUxO5gvyp5K(y21Bys8L%sS~yf>1G;@DHf z$1(B~xThO~q+AKp$8~0s8j!Uab7dTp{7L?`06Zl#Fn&SwX?O;`pRvGJEO9iBlw>To zWi&QE&e)D?YoqXW#M64uQHcLK#$ft1jyMl%X;0eN_y+j#O&~mL;W-@JF}?+aC_L|h zkr?XL$Kr$SZ7FAe9$wJk{8Rz+hQ8pclBFDl{COEzU?xJvkUR0;4uG*U^gCeVMeTPC zjv@W72S#G3S09THwzs8J%S)K;815-IgJfI@?O#HenwhfBmVH;MHn!gbKce{ld{<8- zI|hxvkBGv{9vF$CUVSV+u|4O1S?B#eydvN_s1mA&Q zHBXZL7!ie^gaAhfV`d=v+Y56_!^P{pxu+|sHNqA)T9Kw`i z2Xv3AIHx@0{aYO`s7!Mpeh0sU|HvRrT$}zUWCI28d%eg+;SV_or#~H~`i@soyv{h) zM&Z9Y9Gse{PIrC8vy7h&tRl7F%I z+owN|{}28@1^gBMCJWKup(BE?Y&`)4|D0_J{tR#o;M;JbQF^nzoN<9lj82L`H93A} zRHzc8NEIn#ZzwMVYYkhhVj&8wi9(4g@r5z|omKmwRF$eS)y0J}l-TH^Ik%1B$`zrj z-j}Nith$SyQ#a*@nH$lF^2645SKajiqJ0k>Gb$CKCuZoS{ILCdt4yFzMxunN#IBvj zVSJLasl>T>vvgd(uSyj>r+$jiU*L?*j7j6@nIkKsA0VTFYM>evfWaylybPQltaM8$ zl_N2U-E@e`JnRfrDiPfI$=dcGs{AneVQQEvKRja8hmuQV* zj8dbsiW)UaGEqJnk7@&t-T6%qYn2~oDjQ>zA7)k#_1kcUv1+Uur^cs&aTtLy4kK|q zj!jV~1i;KK9m>nVrgTEsz7thuFiE*FS-C-4l5p-R%3!MUgKfC3Y08i3Ds|K;2Q$x`=A5J4n5*2dwRB?HTH&sNC?zcWW2=<`<-22a9kHQN2V`PZlGV zsMYX3yb)~u`xS%q1j2J=kewkXP_K2SSocznxaIVZv>+{8Z#nKGwy=lk>znQMy2oO z27$h>YwV1kmw^^$l}^SfX~GQVc~4(!B`JN`)qua`OKB_GWJX8S(MPRs$C>DEYQAI} zhPpk&alzj%An9twFr!$O@$=}5ixlmh(Ha%iSfiW~UVn6!F9)%ZdA#mNd<$K zf!)DMmL}7T_=V@Sne9N(;u9pxY*ss(y?oHv)}4Ce?9PvtsMLGL3!L#!wA^|1ybN6I z6{pTSg*cI<7Hrf>H(7RV+*_o+PEs{`JxBaYbm$uo2U-<7MDbIwA7DVLHGk z;U`slqCHN0caAGn9zh-Wl)6eINN3BgR(_D)-R0O^s=pY`%fL;>of4R_m+n`4@#nS) z*Z9h!H`K0CGnLmT5g&U(xv2^I?f%#@^UnbeC0p~}d=RB~=7Z$zC0mC1-7uN2b$za2 zr1bv=Jfqw^p5dxCe-bhV4yXg_I=tD`k+3}R{-8RDQLe-N^@4D9MB&paHSjWUI9caI zis3Eq26cn_Ogn(`#KVogg(?a+shiYi1K^!QI{eMbkI$*pa9FuSD6GL1WxgQM!G<_z`M#o6!lRdFYJlJ#B650c-l82*UKNs@V|tRva- zGH|3Ll|;29*ZhuSeUCc5@p*N6Bhh;n>FDV!Pscx=FE0Z}@O!ndgz9V0jEVY@tUgxl*XwH*_$mPVItTCAxfF^Bl9!Do{c1FAm z+?#%IY83rx8MiVw|B;waOWqd*UdXaMP@3p!f^d3zqcFV}XMD2SF-Q`QXJ7h)cQL-H z*H!h{KaR6W)PW0OhxRh3yht}=@!RCe*CN*#0@zNY-h%+v-$6?0J4iF=APy z|KvJ%A_Vmyv(;0E%tj0!?M3yX;x{bWhj;_~XZdLCeq(cmuGuXMpVx0`BKb9$lkhU| z3UznPc} z4HMUEsrN+bzUXk=QsshO7HiF&6M>acig@a1tbP<&q69GTARjS+^|dE9Xla$(|nZSr}X zpHlVqCLVvP^^NA*wiqNl)9l$7r*J?2#x zVPru+X)h5nJufq#jzW1EIF_k$a_c(6OwHPflg|8|D7ieMYe!Ot_f>bU@#b}Wu2DF; cq@V!4pKE2Gta=lj;HUEy_0$_UPyhh`0NSw_*#H0l diff --git a/Keyboard and Spell checker/Units/pcre_valid_utf8.obj b/Keyboard and Spell checker/Units/pcre_valid_utf8.obj deleted file mode 100644 index e69460dc9e15d4202b95da96db7901ead17a1454..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1808 zcmbVM&rcIk5T2z!=s_t65%5Rs#YEGjAVn>hXn~>;OduA}#MRBRU0}_2OSW$%CIa0w zBn^wfcrXTI!qtC(GsdLq4Y`o$MU;c2ns_k8V&Xb)Tg!#RE{DF(do$mD-@KVOnR=+3 z6jYIWz{^sC)5usPBtWhK0BXBas>~~iKu<6jI3J3%LGBp9w|(N1FPb|bcNk#1erYS> z(S*s+1mtRP?|Xc@!%M$U4=&&V3@YJJPbWL5rp8r18MrFRVwx>8vE8va+a79VuPcJA zB}6tUCMobD1vaI^Ew+K2oDwLqql`Rf8;L+(w&Yr@DAxgNny3|4MA~OXprnjbY^1EX z)wW_$Rh3kQ7O%+xt;nmwLUWjEP26ey38tAXn;D-(nd!$NBB`$YzKIPx|!ONV{ek<5QpVc3i|~FIW64 zPtk-+8?&D5u4{(+R&XEOjfOwXH|bwjaijmq;7X`(2@T_8Kk@aGx_%NaOzphBtWBXq zr*Xy4xN4pq2#^N7_=9dnN+Ooge$*Gt7g)XcvmDe)PUyv7xS7RZ`mdcW1uvpKa}tAF z3XM_gXmb^hN~sVxI*#_ut

njg9PEb8g+gc*Hc#>^qaYcjxXKc5Lp6g`uf%*?{6BQ1U{Bnt(hG{&j5nSzVXOchrhoD@VNAx+XYl8@mfBe?5I z0!45oQW0kBKj_}SG7AU&5B0tn(o#3cEMDGwH#zT|n{(eiZewX|F~@lCu*eMq*+Q}c zpxq0ZX9l*^UtN_pWVM6j7Vzup$Kl7hilhb1mrrM^II+g^5t1d^H$Oe-*7?ai@RR}= z2J3QvOCPfEkeR;p-1VGD&uH}CV5C2h75!ykc@x{weaGj(O%A*ru0JXaG`!H_$Zm#w zTo_3}(@W*1tR%MtYZSAbm5{|*3Frog9IIxEmBNZ0#)2@XrQcM7)-joNlw(Uuwmo-0 z$ClzXf&=nBPnUR$ryIq#yJ)(xZ94~xNhVs8r4E&^smO`n`RSclq>|nA4wPs0T;Gi& zp6ymvQ=P&!14RR=RxBMN-v!(Vn_rKlg zUQgSh8^jI^%ru!cz2WVwX@yk1X(imG5bu5e_0B5);a?s?G_;-9TCKl3*rD}cTidSj zM}6?()$ZP~X7om*Dh+&X;KyB51f(koHSymHXf%P-I_l@ua{-^1fy%YZjhcEi5{ga* zT!~Nbp#tok{5gI`GcakK(ed~#p5377?N5AfVJ2$AtVLr*6EM9G`rr*VWmW1Zin^wB P*OU#uy|e>P_$hw@DiZfy diff --git a/Keyboard and Spell checker/Units/pcre_xclass.obj b/Keyboard and Spell checker/Units/pcre_xclass.obj deleted file mode 100644 index b86907b47ff5e883960812497a56fb719e4a8b85..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2435 zcmbVN|4$ob7=NzUZ$!p*Zn~NMLS#mhCCF%}1rqt%$r9PffX*+SmvTK=-Sx_@*D1*u zG-oGpBbqpk!7TA76aN4)YK-kPnr;b+@WYHh38PE`F^y|jL9{;a^*rh@OH0zH@B2RY ze4fwq?cN(>V9yXI@$6fi;EzOVIT+s$0FJh>B>2TZb^DPc)yHbx^)UW8z;6%OR$RX0 zhVeZBEBmIG+?FUeRC^A_tMF`}daA)n{1U};sDN(KS=-*|>z2ZUl0Q^^JSgxHpU&cI z>*(>hYU_L_L{5kXcwdMQ5#aL#crfgIwqzhHggJt2(2++=Mk3HJXyIzC7;YJ?5m_== z5m`Db0)yfp!MgQ`>q?H8mn1Q4&|;a&pymA%ch10;8FD}f_8Zu;cv*1(`);I*yrrib zkpscqrYi>m{J`!)Mq0n5b*TKAitzFqA?=;m%_Il4cc6S$As7nE5t41AK2!B2&s3+9W)NDsuNdcyrRE-XA^#7Pi;(a<94lREG!m9j(2sX7Xq4c=7b9 zzHT$y*3(0yz(+Rt%tBKp&~^Z3%fCCD9bnoD);ygz!PN_}m(}8m$^&jz_V)|CbEnE> zsJH+t@myF6M8Kf~Q5BK>gZ$AQn)+?n5Ie|=r2hc#?E|1H3*f@10ly0HNd-*-^r>sg z_iH`gGpeUjJ!@YFiuvG%vPezzZN>fsG#ELy4ko!yy`?PJzQQxiFRHiVsbN}4+L9YI zGxL(2s`*J~RL_=@qYfqR|Ge@k7GcuSvVOzFynO}tN}_t@GFdmN=y~THK8kH7(9@+h z^`^4W%*;&S0VcX~YBWc$Pq{9tv+78$X8$)tJ-@i>P=2?nv&@WJx!XK{_mSHzYFAG2 z1tFi!F}=j15~(Dzjt9=~?CrR~NvI_8Jjyi6wrilEP0{$eWY*fex(G%HOVIt#eYK#cNu+ z?xmJCy{7bDFO}}ZmBaOGuQ`3&Yf1m=rPJA7DxE{w>ZO(e#f)M{dDCkJ6)On;0MdDC APXGV_ diff --git a/Keyboard and Spell checker/Units/pcreposix.obj b/Keyboard and Spell checker/Units/pcreposix.obj deleted file mode 100644 index 4af68bd25644d8363a8f1766577ddc857e8635ab..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3402 zcmbuCZ)_7~9LIlcZ|!XqsjkF9{BtH?(8)xqIGlgRwnCOj9IPuYY}DKJIy&0Ba=nf% zIvu%;tT`5WA%>tPybv<+g(k*`@rBb7mT00ez5qjFjMTB7-uQ)7)4K917(dPr-}&o)+Nq*Md$cj2Bolt4r4Gd&%e+OLU8VQ)Mkr+Z3) zdRp2#d!B6A(bKL-iA+@PNyjJlW{%GR{Kn;rFO2m$jLrQA5N|85O#OA zMVB>2Oe}Bv9XXXXONPdV3pHMMA-sLtN`iZ9&Z2_JsCu z?BZ_QckrdI4ldHt+35mw&O;wO>~c8Co}F`YRmB;RhbKDkCb#9XoOHUIs_kBgX|hai z93cr=Ax}DmqePEkqHBtj8m9HOlB6b6I3{+MY~o5xC3jLx;Jhn|@ zP3}jhs2Y9?=nU5H@Ib;8E>#Mc=g%tz%+d1>qVYN!y+sbps0xcAH@oocLgVm%!ATVn zSbZTWM}W$TfJL}XV5dqK9(BQYm-&Zrb*VFa$n5o-LEc!p=QYolNkqwc%xA|62zKaq z7P7lJ8(f+R7Dn;N81a(6$qagpA>Pt`R;Ex?F&B($?wm7_AGluNt24iCKX7P8;x&W5Yi)HF*~XD0hr7Fbr;#O+vv!yp zSuWN+MUioJu`>*HvzHI#Cmp)W_|7ruWP@|k#|Cav(A_7$BlOy2vpqux4A4Yysbiw6 zaByP(;(@T0@s@I_%eoLV+sYeFl<}HfizauLh0E0rz{m=e)V$eNE--cEusLVvb@J+v zWm$Fs>&y{fUg&xezq#2A`psr8w=QtAyz1@={~HHUgQWqgpYCw=dOHVD zcvQNySRorM7$XJBxUwVm8fc|AzceumI-4uiz%QayR_tp1XqGr`)dM@OW|9c7+ut_mEx6 z+~(p?TYTm%4pp`a`j721y_cccjUngk10m=8Tf)xS9T@jvJdSZV?0Vk}bF&|Z9T%&@ zRdWx9oEIMpyD!d!Jr{3fb&LIez;Hd;&fLUw|*cG?)S3g73kP z;CjeG7v6PZCG1~y1x&&q^ECMC`s&zid|?nQt~{ z_GMXlWcifm|9AW^|7D+TNH7Rc3`&95!D((y6MMbARF)Bz2F`c$&a#|8ovXGXKXJoh|IhoRj1$ii? z$>}tFRQlfbh;5>YO23Ru(($M)Al{0ypsT9T7w@N-h@Yt_ZiRkX7w{K=stwz=eWG*> zsl;T>j>dAqM`R``BeA5YOGkyGDZ(C8)Dz_;NNQ9j0R>WHF?>4;v^9; + Dict: TDictionary; Implementation @@ -55,50 +54,57 @@ Procedure InitDict; Begin - Dict := TDictionary.create; - LoadDict; + Dict := TDictionary.create; + LoadDict; End; { =============================================================================== } Procedure DestroyDict; Begin - FreeAndNil(Dict); + FreeAndNil(Dict); End; { =============================================================================== } Procedure LoadDict; Var - List: TStringList; - I, P: Integer; - Path: String; - FirstPart, SecondPart: String; + List: TStringList; + I, P: Integer; + Path: String; + FirstPart, SecondPart: String; Begin - Try - Try - List := TStringList.Create; - Path := GetAvroDataDir + 'autodict.dct'; - List.LoadFromFile(Path); - - For I := 0 To List.Count - 1 Do Begin - If (LeftStr(Trim(List[I]), 1) <> '/') And (Trim(List[I]) <> '') Then Begin - P := Pos(' ', Trim(List[I])); - FirstPart := LeftStr(Trim(List[I]), P - 1); - SecondPart := MidStr(Trim(List[I]), P + 1, Length(Trim(List[I]))); - Dict.AddOrSetValue(FirstPart, SecondPart); - End; - End; - Except - On E: Exception Do Begin - Application.MessageBox(Pchar('Cannot load auto-correct dictionary!' + #10 + '' + #10 + '-> Make sure ''autodict.dct'' file is present in ' + Path + ' folder, or' + #10 + - '-> ''autodict.dct'' file is not corrupt.' + #10 + '' + #10 + 'Reinstalling Avro Keyboard may solve this problem.' + #10 + - 'You may contact OmicronLab (http://www.omicronlab.com/forum/) for free support.'), 'Avro Keyboard', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - End; - End; - Finally - FreeAndNil(List); - End; + Try + Try + List := TStringList.create; + Path := GetAvroDataDir + 'autodict.dct'; + List.LoadFromFile(Path); + + For I := 0 To List.Count - 1 Do + Begin + If (LeftStr(Trim(List[I]), 1) <> '/') And (Trim(List[I]) <> '') Then + Begin + P := Pos(' ', Trim(List[I])); + FirstPart := LeftStr(Trim(List[I]), P - 1); + SecondPart := MidStr(Trim(List[I]), P + 1, Length(Trim(List[I]))); + Dict.AddOrSetValue(FirstPart, SecondPart); + End; + End; + Except + On E: Exception Do + Begin + Application.MessageBox(Pchar('Cannot load auto-correct dictionary!' + + #10 + '' + #10 + '-> Make sure ''autodict.dct'' file is present in ' + + Path + ' folder, or' + #10 + + '-> ''autodict.dct'' file is not corrupt.' + #10 + '' + #10 + + 'Reinstalling Avro Keyboard may solve this problem.' + #10 + + 'You may contact OmicronLab (http://www.omicronlab.com/forum/) for free support.'), + 'Avro Keyboard', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); + End; + End; + Finally + FreeAndNil(List); + End; End; diff --git a/Keyboard and Spell checker/Units/uCmdLineHelper.pas b/Keyboard and Spell checker/Units/uCmdLineHelper.pas index 83efa16..db040ac 100644 --- a/Keyboard and Spell checker/Units/uCmdLineHelper.pas +++ b/Keyboard and Spell checker/Units/uCmdLineHelper.pas @@ -1,25 +1,25 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= @@ -30,157 +30,180 @@ Interface Uses windows, - sysutils; + sysutils; - - -//command line parameters + program path +// command line parameters + program path Function GetCommandLine: String; -//number of parameters +// number of parameters Function GetParamCount: Integer; -//parameter by index +// parameter by index Function GetParamStr(Index: Integer): String; Function ParamPresent(Param: String): Boolean; Implementation -{===============================================================================} +{ =============================================================================== } Function ParamPresent(Param: String): Boolean; Var - i : integer; + i: Integer; Begin - result := False; - If uCmdLineHelper.GetParamCount <= 0 Then exit; - - For i := 1 To uCmdLineHelper.GetParamCount Do Begin - If (UpperCase(uCmdLineHelper.GetParamStr(i)) = '/' + UpperCase(Param)) Or - (UpperCase(uCmdLineHelper.GetParamStr(i)) = '-' + UpperCase(Param)) Or - (UpperCase(uCmdLineHelper.GetParamStr(i)) = '--' + UpperCase(Param)) Or - (UpperCase(uCmdLineHelper.GetParamStr(i)) = UpperCase(Param)) Then Begin - - Result := True; - End; - End; + result := False; + If uCmdLineHelper.GetParamCount <= 0 Then + exit; + + For i := 1 To uCmdLineHelper.GetParamCount Do + Begin + If (UpperCase(uCmdLineHelper.GetParamStr(i)) = '/' + UpperCase(Param)) Or + (UpperCase(uCmdLineHelper.GetParamStr(i)) = '-' + UpperCase(Param)) Or + (UpperCase(uCmdLineHelper.GetParamStr(i)) = '--' + UpperCase(Param)) Or + (UpperCase(uCmdLineHelper.GetParamStr(i)) = UpperCase(Param)) Then + Begin + + result := True; + End; + End; End; -{===============================================================================} +{ =============================================================================== } Function GetCommandLine: String; Begin - result := windows.GetCommandLine; + result := windows.GetCommandLine; End; -{===============================================================================} +{ =============================================================================== } -Function GetNextParam(Var CmdLine: PChar; Buffer: PChar; Len: PInteger): Boolean; +Function GetNextParam(Var CmdLine: PChar; Buffer: PChar; Len: PInteger) + : Boolean; Var - InQuotedStr, IsOdd : Boolean; - NumSlashes, NewLen, cnt : Integer; + InQuotedStr, IsOdd: Boolean; + NumSlashes, NewLen, cnt: Integer; Begin - Result := False; - If Len <> Nil Then Len^ := 0; - If CmdLine = Nil Then Exit; - While (CmdLine^ <= ' ') And (CmdLine^ <> #0) Do - CmdLine := CharNext(CmdLine); - If CmdLine^ = #0 Then Exit; - InQuotedStr := False; - NewLen := 0; - Repeat - If CmdLine^ = '\' Then Begin - NumSlashes := 0; - Repeat - Inc(NumSlashes); - CmdLine := CharNext(CmdLine); - Until CmdLine^ <> '\'; - If CmdLine^ = '"' Then Begin - IsOdd := (NumSlashes Mod 2) <> 0; - NumSlashes := NumSlashes Div 2; - Inc(NewLen, NumSlashes); - If IsOdd Then Inc(NewLen); - If Buffer <> Nil Then Begin - For cnt := 0 To NumSlashes - 1 Do Begin - Buffer^ := '\'; - Inc(Buffer); - End; - If IsOdd Then Begin - Buffer^ := '"'; - Inc(Buffer); - End; - End; - If IsOdd Then CmdLine := CharNext(CmdLine); - End - Else Begin - Inc(NewLen, NumSlashes); - If Buffer <> Nil Then Begin - For cnt := 0 To NumSlashes - 1 Do Begin - Buffer^ := '\'; - Inc(Buffer); - End; - End; - End; - Continue; + result := False; + If Len <> Nil Then + Len^ := 0; + If CmdLine = Nil Then + exit; + While (CmdLine^ <= ' ') And (CmdLine^ <> #0) Do + CmdLine := CharNext(CmdLine); + If CmdLine^ = #0 Then + exit; + InQuotedStr := False; + NewLen := 0; + Repeat + If CmdLine^ = '\' Then + Begin + NumSlashes := 0; + Repeat + Inc(NumSlashes); + CmdLine := CharNext(CmdLine); + Until CmdLine^ <> '\'; + If CmdLine^ = '"' Then + Begin + IsOdd := (NumSlashes Mod 2) <> 0; + NumSlashes := NumSlashes Div 2; + Inc(NewLen, NumSlashes); + If IsOdd Then + Inc(NewLen); + If Buffer <> Nil Then + Begin + For cnt := 0 To NumSlashes - 1 Do + Begin + Buffer^ := '\'; + Inc(Buffer); + End; + If IsOdd Then + Begin + Buffer^ := '"'; + Inc(Buffer); End; - If CmdLine^ <> '"' Then Begin - If (CmdLine^ <= ' ') And (Not InQuotedStr) Then Break; - Inc(NewLen); - If Buffer <> Nil Then Begin - Buffer^ := CmdLine^; - Inc(Buffer); - End; - End - Else - InQuotedStr := Not InQuotedStr; + End; + If IsOdd Then CmdLine := CharNext(CmdLine); - Until CmdLine^ = #0; - If Len <> Nil Then Len^ := NewLen; - Result := True; + End + Else + Begin + Inc(NewLen, NumSlashes); + If Buffer <> Nil Then + Begin + For cnt := 0 To NumSlashes - 1 Do + Begin + Buffer^ := '\'; + Inc(Buffer); + End; + End; + End; + Continue; + End; + If CmdLine^ <> '"' Then + Begin + If (CmdLine^ <= ' ') And (Not InQuotedStr) Then + Break; + Inc(NewLen); + If Buffer <> Nil Then + Begin + Buffer^ := CmdLine^; + Inc(Buffer); + End; + End + Else + InQuotedStr := Not InQuotedStr; + CmdLine := CharNext(CmdLine); + Until CmdLine^ = #0; + If Len <> Nil Then + Len^ := NewLen; + result := True; End; -{===============================================================================} +{ =============================================================================== } Function GetParamCount: Integer; Var - CmdLine : PChar; + CmdLine: PChar; Begin - Result := 0; - CmdLine := windows.GetCommandLine; - GetNextParam(CmdLine, Nil, Nil); - While GetNextParam(CmdLine, Nil, Nil) Do - Inc(Result); + result := 0; + CmdLine := windows.GetCommandLine; + GetNextParam(CmdLine, Nil, Nil); + While GetNextParam(CmdLine, Nil, Nil) Do + Inc(result); End; -{===============================================================================} +{ =============================================================================== } Function GetParamStr(Index: Integer): String; Var - Buffer : Array[0..MAX_PATH] Of Char; - CmdLine, P : PChar; - Len : Integer; + Buffer: Array [0 .. MAX_PATH] Of Char; + CmdLine, P: PChar; + Len: Integer; Begin - Result := ''; - If Index <= 0 Then Begin - Len := GetModuleFileName(0, Buffer, MAX_PATH + 1); - SetString(Result, Buffer, Len); - End - Else Begin - CmdLine := windows.GetCommandLine; - GetNextParam(CmdLine, Nil, Nil); - Repeat - Dec(Index); - If Index = 0 Then Break; - If Not GetNextParam(CmdLine, Nil, Nil) Then Exit; - Until False; - P := CmdLine; - If GetNextParam(P, Nil, @Len) Then Begin - SetLength(Result, Len); - GetNextParam(CmdLine, PChar(Result), Nil); - End; - End; + result := ''; + If Index <= 0 Then + Begin + Len := GetModuleFileName(0, Buffer, MAX_PATH + 1); + SetString(result, Buffer, Len); + End + Else + Begin + CmdLine := windows.GetCommandLine; + GetNextParam(CmdLine, Nil, Nil); + Repeat + Dec(Index); + If Index = 0 Then + Break; + If Not GetNextParam(CmdLine, Nil, Nil) Then + exit; + Until False; + P := CmdLine; + If GetNextParam(P, Nil, @Len) Then + Begin + SetLength(result, Len); + GetNextParam(CmdLine, PChar(result), Nil); + End; + End; End; -{===============================================================================} +{ =============================================================================== } End. - diff --git a/Keyboard and Spell checker/Units/uCommandLineFunctions.pas b/Keyboard and Spell checker/Units/uCommandLineFunctions.pas index 0d304f2..223897c 100644 --- a/Keyboard and Spell checker/Units/uCommandLineFunctions.pas +++ b/Keyboard and Spell checker/Units/uCommandLineFunctions.pas @@ -1,25 +1,25 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= @@ -28,13 +28,14 @@ Unit uCommandLineFunctions; Interface + Uses - SysUtils, - strutils, - forms, - windows, - Messages; + SysUtils, + strutils, + forms, + windows, + Messages; Function HandleAllCommandLine: Boolean; Function CheckLocaleParam: Boolean; @@ -42,175 +43,194 @@ Function CheckLayoutInstallParam: Boolean; Function CheckSendCommandParam: Boolean; -Function SendCommand(cmd: String): boolean; +Function SendCommand(cmd: String): Boolean; { DONE : More functions like change keyboard, change keyboard mode } Implementation -Uses - uCmdLineHelper, - uLocale, - u_Admin, - WindowsVersion, - uFileFolderHandling, - SkinLoader, - KeyboardLayoutLoader; +Uses + uCmdLineHelper, + uLocale, + u_Admin, + WindowsVersion, + uFileFolderHandling, + SkinLoader, + KeyboardLayoutLoader; -{===============================================================================} +{ =============================================================================== } Function CheckSendCommandParam: Boolean; Begin - result := False; - If uCmdLineHelper.GetParamCount <= 0 Then exit; - - If ParamPresent('toggle') Then Begin - Result := True; - SendCommand('toggle'); - End; - - If ParamPresent('bn') Then Begin - Result := True; - SendCommand('bn'); - End; - - If ParamPresent('sys') Then Begin - Result := True; - SendCommand('sys'); - End; - - If ParamPresent('minimize') Then Begin - Result := True; - SendCommand('minimize'); - End; - - If ParamPresent('restore') Then Begin - Result := True; - SendCommand('restore'); - End; + result := False; + If uCmdLineHelper.GetParamCount <= 0 Then + exit; + + If ParamPresent('toggle') Then + Begin + result := True; + SendCommand('toggle'); + End; + + If ParamPresent('bn') Then + Begin + result := True; + SendCommand('bn'); + End; + + If ParamPresent('sys') Then + Begin + result := True; + SendCommand('sys'); + End; + + If ParamPresent('minimize') Then + Begin + result := True; + SendCommand('minimize'); + End; + + If ParamPresent('restore') Then + Begin + result := True; + SendCommand('restore'); + End; End; -{===============================================================================} +{ =============================================================================== } -Function SendCommand(cmd: String): boolean; +Function SendCommand(cmd: String): Boolean; Var - copyDataStruct : TCopyDataStruct; - receiverHandle : THandle; + copyDataStruct: TCopyDataStruct; + receiverHandle: THandle; Begin - result := false; - copyDataStruct.dwData := 0; //0=string - copyDataStruct.cbData := 1 + Length(cmd); - copyDataStruct.lpData := PChar(cmd); - - receiverHandle := FindWindow(PChar('TAvroMainForm1'), Nil); - If receiverHandle = 0 Then - Exit; + result := False; + copyDataStruct.dwData := 0; // 0=string + copyDataStruct.cbData := 1 + Length(cmd); + copyDataStruct.lpData := PChar(cmd); + receiverHandle := FindWindow(PChar('TAvroMainForm1'), Nil); + If receiverHandle = 0 Then + exit; - SendMessage(receiverHandle, WM_COPYDATA, 0, Integer(@copyDataStruct)); - Result := True; + SendMessage(receiverHandle, WM_COPYDATA, 0, Integer(@copyDataStruct)); + result := True; End; -{===============================================================================} +{ =============================================================================== } Function HandleAllCommandLine: Boolean; Begin - result := False; - If CheckLocaleParam Or - CheckSkinInstallParam Or - CheckLayoutInstallParam Or - CheckSendCommandParam Then - result := True; + result := False; + If CheckLocaleParam Or CheckSkinInstallParam Or CheckLayoutInstallParam Or + CheckSendCommandParam Then + result := True; End; -{===============================================================================} +{ =============================================================================== } Function CheckLayoutInstallParam: Boolean; Var - i : integer; - FilePath, LayoutDir : String; + i: Integer; + FilePath, LayoutDir: String; Begin - result := False; - If uCmdLineHelper.GetParamCount <= 0 Then exit; - - For i := 1 To uCmdLineHelper.GetParamCount Do Begin - If FileExists(uCmdLineHelper.GetParamStr(i)) Then Begin - If uppercase(ExtractFileExt(uCmdLineHelper.GetParamStr(i))) = '.AVROLAYOUT' Then Begin - result := True; - - //Ignore already installed skins - FilePath := ExtractFilePath(uCmdLineHelper.GetParamStr(i)); - LayoutDir := GetAvroDataDir + 'Keyboard Layouts\'; - - If (uppercase(LayoutDir) <> uppercase(FilePath)) Then Begin - InstallLayout(uCmdLineHelper.GetParamStr(i)); - End; - - End; - End; - End; - - //Refresh keyboard layout lists - // If Result = True Then - SendCommand('Refresh_Layout'); + result := False; + If uCmdLineHelper.GetParamCount <= 0 Then + exit; + + For i := 1 To uCmdLineHelper.GetParamCount Do + Begin + If FileExists(uCmdLineHelper.GetParamStr(i)) Then + Begin + If uppercase(ExtractFileExt(uCmdLineHelper.GetParamStr(i))) + = '.AVROLAYOUT' Then + Begin + result := True; + + // Ignore already installed skins + FilePath := ExtractFilePath(uCmdLineHelper.GetParamStr(i)); + LayoutDir := GetAvroDataDir + 'Keyboard Layouts\'; + + If (uppercase(LayoutDir) <> uppercase(FilePath)) Then + Begin + InstallLayout(uCmdLineHelper.GetParamStr(i)); + End; + + End; + End; + End; + + // Refresh keyboard layout lists + // If Result = True Then + SendCommand('Refresh_Layout'); End; -{===============================================================================} +{ =============================================================================== } Function CheckSkinInstallParam: Boolean; Var - i : integer; - FilePath, SkinDir : String; + i: Integer; + FilePath, SkinDir: String; Begin - result := False; - If uCmdLineHelper.GetParamCount <= 0 Then exit; - - For i := 1 To uCmdLineHelper.GetParamCount Do Begin - If FileExists(uCmdLineHelper.GetParamStr(i)) Then Begin - If uppercase(ExtractFileExt(uCmdLineHelper.GetParamStr(i))) = '.AVROSKIN' Then Begin - result := True; - - //Ignore already installed skins - FilePath := ExtractFilePath(uCmdLineHelper.GetParamStr(i)); - SkinDir := GetAvroDataDir + 'Skin\'; - - If (uppercase(SkinDir) <> uppercase(FilePath)) Then Begin - InstallSkin(uCmdLineHelper.GetParamStr(i)); - End; - - End; - End; - End; + result := False; + If uCmdLineHelper.GetParamCount <= 0 Then + exit; + + For i := 1 To uCmdLineHelper.GetParamCount Do + Begin + If FileExists(uCmdLineHelper.GetParamStr(i)) Then + Begin + If uppercase(ExtractFileExt(uCmdLineHelper.GetParamStr(i))) + = '.AVROSKIN' Then + Begin + result := True; + + // Ignore already installed skins + FilePath := ExtractFilePath(uCmdLineHelper.GetParamStr(i)); + SkinDir := GetAvroDataDir + 'Skin\'; + + If (uppercase(SkinDir) <> uppercase(FilePath)) Then + Begin + InstallSkin(uCmdLineHelper.GetParamStr(i)); + End; + + End; + End; + End; End; -{===============================================================================} +{ =============================================================================== } Function CheckLocaleParam: Boolean; Begin - result := False; - If uCmdLineHelper.GetParamCount <= 0 Then exit; - - If ParamPresent('LOCALE') Then Begin - Result := True; - uLocale.InstallLocale; - - If (ParamPresent('V') Or ParamPresent('VERBOSE')) Then Begin - If IsAssameseLocaleInstalled And IsBangladeshLocaleInstalled Then Begin - Application.MessageBox('Locale installed successfully!', - 'Avro Keyboard', MB_OK + MB_ICONASTERISK + MB_DEFBUTTON1 + MB_APPLMODAL); - End - Else Begin - Application.MessageBox('Locale installation failed!', - 'Avro Keyboard', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - End; - End; - End; + result := False; + If uCmdLineHelper.GetParamCount <= 0 Then + exit; + + If ParamPresent('LOCALE') Then + Begin + result := True; + uLocale.InstallLocale; + + If (ParamPresent('V') Or ParamPresent('VERBOSE')) Then + Begin + If IsAssameseLocaleInstalled And IsBangladeshLocaleInstalled Then + Begin + Application.MessageBox('Locale installed successfully!', + 'Avro Keyboard', MB_OK + MB_ICONASTERISK + MB_DEFBUTTON1 + + MB_APPLMODAL); + End + Else + Begin + Application.MessageBox('Locale installation failed!', 'Avro Keyboard', + MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); + End; + End; + End; End; -{===============================================================================} - +{ =============================================================================== } End. - diff --git a/Keyboard and Spell checker/Units/uDBase.pas b/Keyboard and Spell checker/Units/uDBase.pas index 919b736..e19c3bc 100644 --- a/Keyboard and Spell checker/Units/uDBase.pas +++ b/Keyboard and Spell checker/Units/uDBase.pas @@ -1,28 +1,28 @@ { - ============================================================================= - ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + ============================================================================= + ***************************************************************************** + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. - ***************************************************************************** - ============================================================================= + ***************************************************************************** + ============================================================================= } Unit uDBase; @@ -32,423 +32,450 @@ {$ELSE} {$INCLUDE ../ProjectDefines.inc} {$ENDIF} -{$I DI.inc} -{$I DISQLite3.inc} + Interface Uses - SysUtils, - Forms, - Generics.Collections, - Classes, - JclAnsiStrings, - DISQLite3Database; + SysUtils, + Generics.Collections, Classes, FireDAC.Phys.SQLite, + Data.DB, FireDAC.Stan.Def, FireDAC.Phys.SQLiteWrapper, FireDAC.Comp.Client, + FireDAC.Stan.ExprFuncs, + FireDAC.Phys.SQLiteWrapper.Stat, FireDAC.Phys.SQLiteDef, FireDAC.Stan.Intf, + FireDAC.Phys, + Forms; + + Type - LongIntArray = Array Of LongInt; - IntegerArray = LongIntArray; - HashArray = Array Of IntegerArray; + LongIntArray = Array Of LongInt; + IntegerArray = LongIntArray; + HashArray = Array Of IntegerArray; Procedure LoadWordDatabase; Procedure UnloadWordDatabase; Procedure LoadSuffix; -Procedure LoadOneDatabase(FileName: String; Var Arr: TAnsiStringList; Var HArr: HashArray); +Procedure LoadOneDatabase(FileName: String; Var Arr: TStringList; + Var HArr: HashArray); Var - FDatabase: TDISQLite3Database; - FDatabaseLoaded, FDatabaseLoading: Boolean; - - W_A: TAnsiStringList; - W_AA: TAnsiStringList; - W_I: TAnsiStringList; - W_II: TAnsiStringList; - W_U: TAnsiStringList; - W_UU: TAnsiStringList; - W_RRI: TAnsiStringList; - W_E: TAnsiStringList; - W_OI: TAnsiStringList; - W_O: TAnsiStringList; - W_OU: TAnsiStringList; - - W_B: TAnsiStringList; - W_BH: TAnsiStringList; - W_C: TAnsiStringList; - W_CH: TAnsiStringList; - W_D: TAnsiStringList; - W_Dh: TAnsiStringList; - W_Dd: TAnsiStringList; - W_Ddh: TAnsiStringList; - W_G: TAnsiStringList; - W_Gh: TAnsiStringList; - W_H: TAnsiStringList; - W_J: TAnsiStringList; - W_Jh: TAnsiStringList; - W_K: TAnsiStringList; - W_Kh: TAnsiStringList; - W_L: TAnsiStringList; - W_M: TAnsiStringList; - W_N: TAnsiStringList; - W_NGA: TAnsiStringList; - W_NYA: TAnsiStringList; - W_Nn: TAnsiStringList; - W_P: TAnsiStringList; - W_Ph: TAnsiStringList; - W_R: TAnsiStringList; - W_Rr: TAnsiStringList; - W_Rrh: TAnsiStringList; - W_S: TAnsiStringList; - W_Sh: TAnsiStringList; - W_Ss: TAnsiStringList; - W_T: TAnsiStringList; - W_Th: TAnsiStringList; - W_Tt: TAnsiStringList; - W_Tth: TAnsiStringList; - W_Y: TAnsiStringList; - W_Z: TAnsiStringList; - W_Khandatta: TAnsiStringList; - - Suffix_Spell: TStringList; - Suffix: TDictionary; - - // Hash arrays + + FDatabase: TSQLiteDatabase; + FDatabaseLoaded, FDatabaseLoading: Boolean; + FDPhysSQLiteDriverLink1: TFDPhysSQLiteDriverLink; + FDConnection1: TFDConnection; + + W_A: TStringList; + W_AA: TStringList; + W_I: TStringList; + W_II: TStringList; + W_U: TStringList; + W_UU: TStringList; + W_RRI: TStringList; + W_E: TStringList; + W_OI: TStringList; + W_O: TStringList; + W_OU: TStringList; + + W_B: TStringList; + W_BH: TStringList; + W_C: TStringList; + W_CH: TStringList; + W_D: TStringList; + W_Dh: TStringList; + W_Dd: TStringList; + W_Ddh: TStringList; + W_G: TStringList; + W_Gh: TStringList; + W_H: TStringList; + W_J: TStringList; + W_Jh: TStringList; + W_K: TStringList; + W_Kh: TStringList; + W_L: TStringList; + W_M: TStringList; + W_N: TStringList; + W_NGA: TStringList; + W_NYA: TStringList; + W_Nn: TStringList; + W_P: TStringList; + W_Ph: TStringList; + W_R: TStringList; + W_Rr: TStringList; + W_Rrh: TStringList; + W_S: TStringList; + W_Sh: TStringList; + W_Ss: TStringList; + W_T: TStringList; + W_Th: TStringList; + W_Tt: TStringList; + W_Tth: TStringList; + W_Y: TStringList; + W_Z: TStringList; + W_Khandatta: TStringList; + + Suffix_Spell: TStringList; + Suffix: TDictionary; + + // Hash arrays Var - W_Hash_A: HashArray; - W_Hash_AA: HashArray; - W_Hash_I: HashArray; - W_Hash_II: HashArray; - W_Hash_U: HashArray; - W_Hash_UU: HashArray; - W_Hash_RRI: HashArray; - W_Hash_E: HashArray; - W_Hash_OI: HashArray; - W_Hash_O: HashArray; - W_Hash_OU: HashArray; - - W_Hash_B: HashArray; - W_Hash_BH: HashArray; - W_Hash_C: HashArray; - W_Hash_CH: HashArray; - W_Hash_D: HashArray; - W_Hash_Dh: HashArray; - W_Hash_Dd: HashArray; - W_Hash_Ddh: HashArray; - W_Hash_G: HashArray; - W_Hash_Gh: HashArray; - W_Hash_H: HashArray; - W_Hash_J: HashArray; - W_Hash_Jh: HashArray; - W_Hash_K: HashArray; - W_Hash_Kh: HashArray; - W_Hash_L: HashArray; - W_Hash_M: HashArray; - W_Hash_N: HashArray; - W_Hash_NGA: HashArray; - W_Hash_NYA: HashArray; - W_Hash_Nn: HashArray; - W_Hash_P: HashArray; - W_Hash_Ph: HashArray; - W_Hash_R: HashArray; - W_Hash_Rr: HashArray; - W_Hash_Rrh: HashArray; - W_Hash_S: HashArray; - W_Hash_Sh: HashArray; - W_Hash_Ss: HashArray; - W_Hash_T: HashArray; - W_Hash_Th: HashArray; - W_Hash_Tt: HashArray; - W_Hash_Tth: HashArray; - W_Hash_Y: HashArray; - W_Hash_Z: HashArray; - W_Hash_Khandatta: HashArray; + W_Hash_A: HashArray; + W_Hash_AA: HashArray; + W_Hash_I: HashArray; + W_Hash_II: HashArray; + W_Hash_U: HashArray; + W_Hash_UU: HashArray; + W_Hash_RRI: HashArray; + W_Hash_E: HashArray; + W_Hash_OI: HashArray; + W_Hash_O: HashArray; + W_Hash_OU: HashArray; + + W_Hash_B: HashArray; + W_Hash_BH: HashArray; + W_Hash_C: HashArray; + W_Hash_CH: HashArray; + W_Hash_D: HashArray; + W_Hash_Dh: HashArray; + W_Hash_Dd: HashArray; + W_Hash_Ddh: HashArray; + W_Hash_G: HashArray; + W_Hash_Gh: HashArray; + W_Hash_H: HashArray; + W_Hash_J: HashArray; + W_Hash_Jh: HashArray; + W_Hash_K: HashArray; + W_Hash_Kh: HashArray; + W_Hash_L: HashArray; + W_Hash_M: HashArray; + W_Hash_N: HashArray; + W_Hash_NGA: HashArray; + W_Hash_NYA: HashArray; + W_Hash_Nn: HashArray; + W_Hash_P: HashArray; + W_Hash_Ph: HashArray; + W_Hash_R: HashArray; + W_Hash_Rr: HashArray; + W_Hash_Rrh: HashArray; + W_Hash_S: HashArray; + W_Hash_Sh: HashArray; + W_Hash_Ss: HashArray; + W_Hash_T: HashArray; + W_Hash_Th: HashArray; + W_Hash_Tt: HashArray; + W_Hash_Tth: HashArray; + W_Hash_Y: HashArray; + W_Hash_Z: HashArray; + W_Hash_Khandatta: HashArray; Implementation Uses - {$IFNDEF SpellChecker} - - uForm1, +{$IFNDEF SpellChecker} + uForm1, - {$ENDIF} +{$ENDIF} + StrUtils, + HashTable, - StrUtils, - HashTable, - DISQLite3Api, - uFileFolderHandling, - windows; + uFileFolderHandling, + windows; Procedure LoadSuffix; Var - FirstPart, SecondPart: String; + FirstPart, SecondPart: String; - Stmt: TDISQLite3Statement; - SelectSQL: String; + Stmt: TSQLiteStatement; + SelectSQL: String; Begin - SelectSQL := 'SELECT English, Bangla FROM Suffix;'; + SelectSQL := 'SELECT English, Bangla FROM Suffix;'; + Suffix_Spell := TStringList.Create; + Suffix_Spell.Sorted := True; + Suffix_Spell.Duplicates := dupIgnore; + Suffix := TDictionary.Create; - Suffix_Spell := TStringList.Create; - Suffix_Spell.Sorted := True; - Suffix_Spell.Duplicates := dupIgnore; - Suffix := TDictionary.Create; + Stmt := TSQLiteStatement.Create(FDatabase); + Stmt.Prepare(SelectSQL); - Stmt := FDatabase.Prepare16(SelectSQL); + Suffix_Spell.BeginUpdate; - Suffix_Spell.BeginUpdate; - While Stmt.Step = SQLITE_ROW Do Begin - FirstPart := UTF8ToString(Stmt.Column_Str(0)); // English - SecondPart := UTF8ToString(Stmt.Column_Str(1)); // Bangla + while Stmt.Fetch do + begin - Suffix_Spell.Add(SecondPart); + FirstPart := utf8encode(Stmt.Columns[0].AsString); // English + SecondPart := utf8encode(Stmt.Columns[1].AsString); // Bangla - Suffix.AddOrSetValue(FirstPart, SecondPart); - End; - Suffix_Spell.EndUpdate; + Suffix_Spell.Add(SecondPart); + Suffix.AddOrSetValue(FirstPart, SecondPart); + end; + Suffix_Spell.EndUpdate; - FreeAndNil(Stmt); + FreeAndNil(Stmt); End; Procedure UnloadWordDatabase; Begin - If (not FDatabaseLoading) and FDatabaseLoaded Then Begin - - FDatabaseLoading := True; - - W_A.Clear; - FreeAndNil(W_A); - W_AA.Clear; - FreeAndNil(W_AA); - W_I.Clear; - FreeAndNil(W_I); - W_II.Clear; - FreeAndNil(W_II); - W_U.Clear; - FreeAndNil(W_U); - W_UU.Clear; - FreeAndNil(W_UU); - W_RRI.Clear; - FreeAndNil(W_RRI); - W_E.Clear; - FreeAndNil(W_E); - W_OI.Clear; - FreeAndNil(W_OI); - W_O.Clear; - FreeAndNil(W_O); - W_OU.Clear; - FreeAndNil(W_OU); - - W_B.Clear; - FreeAndNil(W_B); - W_BH.Clear; - FreeAndNil(W_BH); - W_C.Clear; - FreeAndNil(W_C); - W_CH.Clear; - FreeAndNil(W_CH); - W_D.Clear; - FreeAndNil(W_D); - W_Dh.Clear; - FreeAndNil(W_Dh); - W_Dd.Clear; - FreeAndNil(W_Dd); - W_Ddh.Clear; - FreeAndNil(W_Ddh); - W_G.Clear; - FreeAndNil(W_G); - W_Gh.Clear; - FreeAndNil(W_Gh); - W_H.Clear; - FreeAndNil(W_H); - W_J.Clear; - FreeAndNil(W_J); - W_Jh.Clear; - FreeAndNil(W_Jh); - W_K.Clear; - FreeAndNil(W_K); - W_Kh.Clear; - FreeAndNil(W_Kh); - W_L.Clear; - FreeAndNil(W_L); - W_M.Clear; - FreeAndNil(W_M); - W_N.Clear; - FreeAndNil(W_N); - W_NGA.Clear; - FreeAndNil(W_NGA); - W_NYA.Clear; - FreeAndNil(W_NYA); - W_Nn.Clear; - FreeAndNil(W_Nn); - W_P.Clear; - FreeAndNil(W_P); - W_Ph.Clear; - FreeAndNil(W_Ph); - W_R.Clear; - FreeAndNil(W_R); - W_Rr.Clear; - FreeAndNil(W_Rr); - W_Rrh.Clear; - FreeAndNil(W_Rrh); - W_S.Clear; - FreeAndNil(W_S); - W_Sh.Clear; - FreeAndNil(W_Sh); - W_Ss.Clear; - FreeAndNil(W_Ss); - W_T.Clear; - FreeAndNil(W_T); - W_Th.Clear; - FreeAndNil(W_Th); - W_Tt.Clear; - FreeAndNil(W_Tt); - W_Tth.Clear; - FreeAndNil(W_Tth); - W_Y.Clear; - FreeAndNil(W_Y); - W_Z.Clear; - FreeAndNil(W_Z); - W_Khandatta.Clear; - FreeAndNil(W_Khandatta); - - Suffix_Spell.Clear; - FreeAndNil(Suffix_Spell); - - Suffix.Clear; - FreeAndNil(Suffix); - - - FDatabaseLoaded := False; - FDatabaseLoading := False; - End; - - {$IFNDEF SpellChecker} - - AvroMainForm1.TrimAppMemorySize; - - {$ENDIF} + If (not FDatabaseLoading) and FDatabaseLoaded Then + Begin + + FDatabaseLoading := True; + + W_A.Clear; + FreeAndNil(W_A); + W_AA.Clear; + FreeAndNil(W_AA); + W_I.Clear; + FreeAndNil(W_I); + W_II.Clear; + FreeAndNil(W_II); + W_U.Clear; + FreeAndNil(W_U); + W_UU.Clear; + FreeAndNil(W_UU); + W_RRI.Clear; + FreeAndNil(W_RRI); + W_E.Clear; + FreeAndNil(W_E); + W_OI.Clear; + FreeAndNil(W_OI); + W_O.Clear; + FreeAndNil(W_O); + W_OU.Clear; + FreeAndNil(W_OU); + + W_B.Clear; + FreeAndNil(W_B); + W_BH.Clear; + FreeAndNil(W_BH); + W_C.Clear; + FreeAndNil(W_C); + W_CH.Clear; + FreeAndNil(W_CH); + W_D.Clear; + FreeAndNil(W_D); + W_Dh.Clear; + FreeAndNil(W_Dh); + W_Dd.Clear; + FreeAndNil(W_Dd); + W_Ddh.Clear; + FreeAndNil(W_Ddh); + W_G.Clear; + FreeAndNil(W_G); + W_Gh.Clear; + FreeAndNil(W_Gh); + W_H.Clear; + FreeAndNil(W_H); + W_J.Clear; + FreeAndNil(W_J); + W_Jh.Clear; + FreeAndNil(W_Jh); + W_K.Clear; + FreeAndNil(W_K); + W_Kh.Clear; + FreeAndNil(W_Kh); + W_L.Clear; + FreeAndNil(W_L); + W_M.Clear; + FreeAndNil(W_M); + W_N.Clear; + FreeAndNil(W_N); + W_NGA.Clear; + FreeAndNil(W_NGA); + W_NYA.Clear; + FreeAndNil(W_NYA); + W_Nn.Clear; + FreeAndNil(W_Nn); + W_P.Clear; + FreeAndNil(W_P); + W_Ph.Clear; + FreeAndNil(W_Ph); + W_R.Clear; + FreeAndNil(W_R); + W_Rr.Clear; + FreeAndNil(W_Rr); + W_Rrh.Clear; + FreeAndNil(W_Rrh); + W_S.Clear; + FreeAndNil(W_S); + W_Sh.Clear; + FreeAndNil(W_Sh); + W_Ss.Clear; + FreeAndNil(W_Ss); + W_T.Clear; + FreeAndNil(W_T); + W_Th.Clear; + FreeAndNil(W_Th); + W_Tt.Clear; + FreeAndNil(W_Tt); + W_Tth.Clear; + FreeAndNil(W_Tth); + W_Y.Clear; + FreeAndNil(W_Y); + W_Z.Clear; + FreeAndNil(W_Z); + W_Khandatta.Clear; + FreeAndNil(W_Khandatta); + + Suffix_Spell.Clear; + FreeAndNil(Suffix_Spell); + + Suffix.Clear; + FreeAndNil(Suffix); + + FDatabaseLoaded := False; + FDatabaseLoading := False; + End; + +{$IFNDEF SpellChecker} + AvroMainForm1.TrimAppMemorySize; +{$ENDIF} End; Procedure LoadWordDatabase; Begin - If FDatabaseLoaded Or FDatabaseLoading Then - exit; - FDatabaseLoading := True; - - FDatabase := TDISQLite3Database.Create(Nil); - Try - Try - FDatabase.DatabaseName := GetAvroDataDir + 'Database.db3'; - FDatabase.Open; - - LoadOneDatabase('A', W_A, W_Hash_A); - LoadOneDatabase('AA', W_AA, W_Hash_AA); - LoadOneDatabase('I', W_I, W_Hash_I); - LoadOneDatabase('II', W_II, W_Hash_II); - LoadOneDatabase('U', W_U, W_Hash_U); - LoadOneDatabase('UU', W_UU, W_Hash_UU); - LoadOneDatabase('RRI', W_RRI, W_Hash_RRI); - LoadOneDatabase('E', W_E, W_Hash_E); - LoadOneDatabase('OI', W_OI, W_Hash_OI); - LoadOneDatabase('O', W_O, W_Hash_O); - LoadOneDatabase('OU', W_OU, W_Hash_OU); - - LoadOneDatabase('B', W_B, W_Hash_B); - LoadOneDatabase('BH', W_BH, W_Hash_BH); - LoadOneDatabase('C', W_C, W_Hash_C); - LoadOneDatabase('CH', W_CH, W_Hash_CH); - LoadOneDatabase('D', W_D, W_Hash_D); - LoadOneDatabase('Dd', W_Dd, W_Hash_Dd); - LoadOneDatabase('Dh', W_Dh, W_Hash_Dh); - LoadOneDatabase('Ddh', W_Ddh, W_Hash_Ddh); - LoadOneDatabase('G', W_G, W_Hash_G); - LoadOneDatabase('Gh', W_Gh, W_Hash_Gh); - LoadOneDatabase('H', W_H, W_Hash_H); - LoadOneDatabase('J', W_J, W_Hash_J); - LoadOneDatabase('Jh', W_Jh, W_Hash_Jh); - LoadOneDatabase('K', W_K, W_Hash_K); - LoadOneDatabase('Kh', W_Kh, W_Hash_Kh); - LoadOneDatabase('L', W_L, W_Hash_L); - LoadOneDatabase('M', W_M, W_Hash_M); - LoadOneDatabase('N', W_N, W_Hash_N); - LoadOneDatabase('NN', W_Nn, W_Hash_Nn); - LoadOneDatabase('NGA', W_NGA, W_Hash_NGA); - LoadOneDatabase('NYA', W_NYA, W_Hash_NYA); - LoadOneDatabase('P', W_P, W_Hash_P); - LoadOneDatabase('Ph', W_Ph, W_Hash_Ph); - LoadOneDatabase('R', W_R, W_Hash_R); - LoadOneDatabase('Rr', W_Rr, W_Hash_Rr); - LoadOneDatabase('Rrh', W_Rrh, W_Hash_Rrh); - LoadOneDatabase('S', W_S, W_Hash_S); - LoadOneDatabase('Sh', W_Sh, W_Hash_Sh); - LoadOneDatabase('Ss', W_Ss, W_Hash_Ss); - LoadOneDatabase('T', W_T, W_Hash_T); - LoadOneDatabase('TT', W_Tt, W_Hash_Tt); - LoadOneDatabase('TH', W_Th, W_Hash_Th); - LoadOneDatabase('TTH', W_Tth, W_Hash_Tth); - LoadOneDatabase('Y', W_Y, W_Hash_Y); - LoadOneDatabase('Z', W_Z, W_Hash_Z); - LoadOneDatabase('Khandatta', W_Khandatta, W_Hash_Khandatta); - - LoadSuffix; - - FDatabase.Close; - - {$IFNDEF SpellChecker} - - AvroMainForm1.TrimAppMemorySize; - - {$ENDIF} - - FDatabaseLoaded := True; - FDatabaseLoading := False; - Except - On E: Exception Do Begin - Application.MessageBox(Pchar('Cannot load Avro database!' + #10 + '' + #10 + '-> Make sure ''Database.db3'' file is present in ' + GetAvroDataDir + ' folder, or' + #10 + - '-> ''Database.db3'' file is not corrupt.' + #10 + '' + #10 + 'Reinstalling Avro Keyboard may solve this problem.' + #10 + - 'You may contact OmicronLab (http://www.omicronlab.com/forum/) for free support.'), 'Avro Keyboard', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - End; - End; - Finally - FreeAndNil(FDatabase); - End; + If FDatabaseLoaded Or FDatabaseLoading Then + exit; + FDatabaseLoading := True; + + FDPhysSQLiteDriverLink1 := TFDPhysSQLiteDriverLink.Create(nil); + FDPhysSQLiteDriverLink1.EngineLinkage := slstatic; + FDConnection1 := TFDConnection.Create(nil); + + FDConnection1.DriverName := 'SQLITE'; + + + if FileExists(GetAvroDataDir + 'Database.db3') then + begin + FDConnection1.Params.Values['Database'] := GetAvroDataDir + 'Database.db3'; + + try + FDConnection1.Open; + FDatabase := TSQLiteDatabase(FDConnection1.CliObj); + + Try + + + LoadOneDatabase('A', W_A, W_Hash_A); + LoadOneDatabase('AA', W_AA, W_Hash_AA); + LoadOneDatabase('I', W_I, W_Hash_I); + LoadOneDatabase('II', W_II, W_Hash_II); + LoadOneDatabase('U', W_U, W_Hash_U); + LoadOneDatabase('UU', W_UU, W_Hash_UU); + LoadOneDatabase('RRI', W_RRI, W_Hash_RRI); + LoadOneDatabase('E', W_E, W_Hash_E); + LoadOneDatabase('OI', W_OI, W_Hash_OI); + LoadOneDatabase('O', W_O, W_Hash_O); + LoadOneDatabase('OU', W_OU, W_Hash_OU); + + LoadOneDatabase('B', W_B, W_Hash_B); + LoadOneDatabase('BH', W_BH, W_Hash_BH); + LoadOneDatabase('C', W_C, W_Hash_C); + LoadOneDatabase('CH', W_CH, W_Hash_CH); + LoadOneDatabase('D', W_D, W_Hash_D); + LoadOneDatabase('Dd', W_Dd, W_Hash_Dd); + LoadOneDatabase('Dh', W_Dh, W_Hash_Dh); + LoadOneDatabase('Ddh', W_Ddh, W_Hash_Ddh); + LoadOneDatabase('G', W_G, W_Hash_G); + LoadOneDatabase('Gh', W_Gh, W_Hash_Gh); + LoadOneDatabase('H', W_H, W_Hash_H); + LoadOneDatabase('J', W_J, W_Hash_J); + LoadOneDatabase('Jh', W_Jh, W_Hash_Jh); + LoadOneDatabase('K', W_K, W_Hash_K); + LoadOneDatabase('Kh', W_Kh, W_Hash_Kh); + LoadOneDatabase('L', W_L, W_Hash_L); + LoadOneDatabase('M', W_M, W_Hash_M); + LoadOneDatabase('N', W_N, W_Hash_N); + LoadOneDatabase('NN', W_Nn, W_Hash_Nn); + LoadOneDatabase('NGA', W_NGA, W_Hash_NGA); + LoadOneDatabase('NYA', W_NYA, W_Hash_NYA); + LoadOneDatabase('P', W_P, W_Hash_P); + LoadOneDatabase('Ph', W_Ph, W_Hash_Ph); + LoadOneDatabase('R', W_R, W_Hash_R); + LoadOneDatabase('Rr', W_Rr, W_Hash_Rr); + LoadOneDatabase('Rrh', W_Rrh, W_Hash_Rrh); + LoadOneDatabase('S', W_S, W_Hash_S); + LoadOneDatabase('Sh', W_Sh, W_Hash_Sh); + LoadOneDatabase('Ss', W_Ss, W_Hash_Ss); + LoadOneDatabase('T', W_T, W_Hash_T); + LoadOneDatabase('TT', W_Tt, W_Hash_Tt); + LoadOneDatabase('TH', W_Th, W_Hash_Th); + LoadOneDatabase('TTH', W_Tth, W_Hash_Tth); + LoadOneDatabase('Y', W_Y, W_Hash_Y); + LoadOneDatabase('Z', W_Z, W_Hash_Z); + LoadOneDatabase('Khandatta', W_Khandatta, W_Hash_Khandatta); + + LoadSuffix; + + FDatabase.Close; + +{$IFNDEF SpellChecker} + AvroMainForm1.TrimAppMemorySize; + +{$ENDIF} + FDatabaseLoaded := True; + FDatabaseLoading := False; + Except + On E: Exception Do + Begin + Application.MessageBox(Pchar('Cannot load Avro database!' + #10 + '' + + #10 + '-> Make sure ''Database.db3'' file is present in ' + + GetAvroDataDir + ' folder, or' + #10 + + '-> ''Database.db3'' file is not corrupt.' + #10 + '' + #10 + + 'Reinstalling Avro Keyboard may solve this problem.' + #10 + + 'You may contact OmicronLab (http://www.omicronlab.com/forum/) for free support.'), + 'Avro Keyboard', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + + MB_APPLMODAL); + End; + End; + Finally + FreeAndNil(FDatabase); + End; + end; End; -Procedure LoadOneDatabase(FileName: String; Var Arr: TAnsiStringList; Var HArr: HashArray); +Procedure LoadOneDatabase(FileName: String; Var Arr: TStringList; + Var HArr: HashArray); Var - Stmt: TDISQLite3Statement; - SelectSQL: String; + Stmt: TSQLiteStatement; + SelectSQL: String; + i: Integer; Begin - SelectSQL := 'SELECT Words FROM ' + FileName + ';'; - // Inititialize Data - Arr := TAnsiStringList.Create; + SelectSQL := 'SELECT Words FROM ' + FileName + ';'; + // Inititialize Data + Arr := TStringList.Create; - Stmt := FDatabase.Prepare16(SelectSQL); - Arr.BeginUpdate; + - While Stmt.Step = SQLITE_ROW Do Begin - Arr.Add(utf8encode(Stmt.Column_Str(0))); - End; + Stmt := TSQLiteStatement.Create(FDatabase); + Stmt.Prepare('select Words from ' + FileName); + Arr.BeginUpdate; - Arr.EndUpdate; + for i := 1 to Stmt.ColumnDefsCount do + TSQLiteColumn.Create(Stmt.Columns).Index := i - 1; + Stmt.Execute; - BuildOneHashTable(Arr, HArr); + while Stmt.Fetch do + Arr.Add(utf8encode(Stmt.Columns[0].AsString)); - Stmt.Free; + Arr.EndUpdate; - {$IFNDEF SpellChecker} + BuildOneHashTable(Arr, HArr); - Application.ProcessMessages; + Stmt.Free; - {$ENDIF} +{$IFNDEF SpellChecker} + Application.ProcessMessages; +{$ENDIF} End; // ------------------------------------------------------------------------------ @@ -456,7 +483,7 @@ Initialization { Initialize the DISQLite3 library prior to using any other DISQLite3 - functionality. See also sqlite3_shutdown() below. } + functionality. See also sqlite3_shutdown() below. } sqlite3_initialize; FDatabaseLoaded := False; FDatabaseLoading := False; @@ -464,7 +491,7 @@ Finalization { Deallocate any resources that were allocated by - sqlite3_initialize() above. } + sqlite3_initialize() above. } sqlite3_shutdown; End. diff --git a/Keyboard and Spell checker/Units/uFileFolderHandling.pas b/Keyboard and Spell checker/Units/uFileFolderHandling.pas index 22a5f64..b4a4479 100644 --- a/Keyboard and Spell checker/Units/uFileFolderHandling.pas +++ b/Keyboard and Spell checker/Units/uFileFolderHandling.pas @@ -1,28 +1,28 @@ { - ============================================================================= - ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + ============================================================================= + ***************************************************************************** + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. - ***************************************************************************** - ============================================================================= + ***************************************************************************** + ============================================================================= } {$IFDEF SpellChecker} @@ -30,7 +30,6 @@ {$ELSE} {$INCLUDE ../ProjectDefines.inc} {$ENDIF} - { COMPLETE TRANSFERING! } Unit uFileFolderHandling; @@ -38,21 +37,23 @@ Interface Uses - Windows, - SysUtils, - Forms, - ShellApi, - SHFolder, - StrUtils, - Messages, - classes; + Windows, + SysUtils, + Forms, + ShellApi, + SHFolder, + StrUtils, + Messages, + classes; Function GetAvroDataDir(): String; Function GetDllFolder: String; Function GetDllFullPath: String; -Function MyCopyFile(Const SourceFile, DestinationFile: String; Overwrite: Boolean = False): Boolean; -Function MyMoveFile(Const SourceFile, DestinationFile: String; Overwrite: Boolean = False): Boolean; +Function MyCopyFile(Const SourceFile, DestinationFile: String; + Overwrite: Boolean = False): Boolean; +Function MyMoveFile(Const SourceFile, DestinationFile: String; + Overwrite: Boolean = False): Boolean; Function MyDeleteFile(Const FilePath: String): Boolean; { DONE : Check: urls are not opening } @@ -65,7 +66,8 @@ Procedure Execute_Something_With_APP_Admin(Const xFile, xApp: String); Procedure Execute_App_And_Wait_Admin(xApp: String; Params: String = ''); -Function GetFileList(Const PathWithMask: String; Var ArrList: TStringList): Integer; +Function GetFileList(Const PathWithMask: String; + Var ArrList: TStringList): Integer; Function RemoveExtension(Const FilePathName: String): String; // Special folders @@ -81,28 +83,28 @@ Implementation Const - SHGFP_TYPE_CURRENT = 0; + SHGFP_TYPE_CURRENT = 0; - { =============================================================================== } + { =============================================================================== } Function GetDllFullPath: String; Var - TheFileName: Array [0 .. MAX_PATH] Of char; + TheFileName: Array [0 .. MAX_PATH] Of char; Begin - FillChar(TheFileName, sizeof(TheFileName), #0); - GetModuleFileName(hInstance, TheFileName, sizeof(TheFileName)); - Result := TheFileName; + FillChar(TheFileName, sizeof(TheFileName), #0); + GetModuleFileName(hInstance, TheFileName, sizeof(TheFileName)); + Result := TheFileName; End; { =============================================================================== } Function GetDllFolder: String; Var - TheFileName: Array [0 .. MAX_PATH] Of char; + TheFileName: Array [0 .. MAX_PATH] Of char; Begin - FillChar(TheFileName, sizeof(TheFileName), #0); - GetModuleFileName(hInstance, TheFileName, sizeof(TheFileName)); - Result := ExtractFilePath(TheFileName); + FillChar(TheFileName, sizeof(TheFileName), #0); + GetModuleFileName(hInstance, TheFileName, sizeof(TheFileName)); + Result := ExtractFilePath(TheFileName); End; { =============================================================================== } @@ -110,213 +112,226 @@ Function GetAvroDataDir(): String; Begin - {$IFDEF PortableOn} - {$IFNDEF SpellCheckerDll} - - Result := ExtractFilePath(Application.ExeName); - - {$ELSE} - - Result := GetDllFolder; - - {$ENDIF} - {$ELSE} +{$IFDEF PortableOn} +{$IFNDEF SpellCheckerDll} + Result := ExtractFilePath(Application.ExeName); - Result := GetCommonApplicationData + 'Avro Keyboard\'; +{$ELSE} + Result := GetDllFolder; - {$ENDIF} +{$ENDIF} +{$ELSE} + Result := GetCommonApplicationData + 'Avro Keyboard\'; +{$ENDIF} End; { =============================================================================== } -Function MyCopyFile(Const SourceFile, DestinationFile: String; Overwrite: Boolean = False): Boolean; +Function MyCopyFile(Const SourceFile, DestinationFile: String; + Overwrite: Boolean = False): Boolean; Begin - Try - Overwrite := Not Overwrite; - Result := Windows.CopyFile(Pchar(SourceFile), Pchar(DestinationFile), Overwrite); - Except - On E: Exception Do - Result := False; - End; + Try + Overwrite := Not Overwrite; + Result := Windows.CopyFile(Pchar(SourceFile), Pchar(DestinationFile), + Overwrite); + Except + On E: Exception Do + Result := False; + End; End; { =============================================================================== } -Function MyMoveFile(Const SourceFile, DestinationFile: String; Overwrite: Boolean = False): Boolean; +Function MyMoveFile(Const SourceFile, DestinationFile: String; + Overwrite: Boolean = False): Boolean; Begin - Result := False; - - Try - If FileExists(DestinationFile) Then Begin - If Overwrite Then Begin - If SysUtils.DeleteFile(DestinationFile) Then - Result := Windows.MoveFile(Pchar(SourceFile), Pchar(DestinationFile)); - End; - End - Else Begin - Result := Windows.MoveFile(Pchar(SourceFile), Pchar(DestinationFile)); - End; - - Except - On E: Exception Do - Result := False; - End; + Result := False; + + Try + If FileExists(DestinationFile) Then + Begin + If Overwrite Then + Begin + If SysUtils.DeleteFile(DestinationFile) Then + Result := Windows.MoveFile(Pchar(SourceFile), Pchar(DestinationFile)); + End; + End + Else + Begin + Result := Windows.MoveFile(Pchar(SourceFile), Pchar(DestinationFile)); + End; + + Except + On E: Exception Do + Result := False; + End; End; { =============================================================================== } Function MyDeleteFile(Const FilePath: String): Boolean; Begin - Result := SysUtils.DeleteFile(FilePath); + Result := SysUtils.DeleteFile(FilePath); End; { =============================================================================== } Procedure Execute_Something(Const xFile: String); Begin - ShellExecute(Application.Handle, 'open', Pchar(xFile), Nil, Nil, SW_SHOWNORMAL); + ShellExecute(Application.Handle, 'open', Pchar(xFile), Nil, Nil, + SW_SHOWNORMAL); End; { =============================================================================== } Procedure Execute_App_And_Wait(xApp: String; Params: String = ''); - Procedure WaitFor(processHandle: THandle); - Var - Msg: TMsg; - ret: DWORD; - Begin - Repeat - ret := MsgWaitForMultipleObjects(1, { 1 handle to wait on } - processHandle, { the handle } - False, { wake on any event } - INFINITE, { wait without timeout } - QS_PAINT Or { wake on paint messages } - QS_SENDMESSAGE { or messages from other threads } - ); - If ret = WAIT_FAILED Then - Exit; { can do little here } - If ret = (WAIT_OBJECT_0 + 1) Then Begin - { Woke on a message, process paint messages only. Calling - PeekMessage gets messages send from other threads processed. } - While PeekMessage(Msg, 0, WM_PAINT, WM_PAINT, PM_REMOVE) Do - DispatchMessage(Msg); - End; - Until ret = WAIT_OBJECT_0; - End; + Procedure WaitFor(processHandle: THandle); + Var + Msg: TMsg; + ret: DWORD; + Begin + Repeat + ret := MsgWaitForMultipleObjects(1, { 1 handle to wait on } + processHandle, { the handle } + False, { wake on any event } + INFINITE, { wait without timeout } + QS_PAINT Or { wake on paint messages } + QS_SENDMESSAGE { or messages from other threads } + ); + If ret = WAIT_FAILED Then + Exit; { can do little here } + If ret = (WAIT_OBJECT_0 + 1) Then + Begin + { Woke on a message, process paint messages only. Calling + PeekMessage gets messages send from other threads processed. } + While PeekMessage(Msg, 0, WM_PAINT, WM_PAINT, PM_REMOVE) Do + DispatchMessage(Msg); + End; + Until ret = WAIT_OBJECT_0; + End; Var - exInfo: TShellExecuteInfo; - Ph: DWORD; + exInfo: TShellExecuteInfo; + Ph: DWORD; Begin - FillChar(exInfo, sizeof(exInfo), 0); - With exInfo Do Begin - cbSize := sizeof(exInfo); - fMask := SEE_MASK_NOCLOSEPROCESS Or SEE_MASK_FLAG_DDEWAIT; - Wnd := GetActiveWindow(); - exInfo.lpVerb := 'open'; - exInfo.lpParameters := Pchar(Params); - lpFile := Pchar(xApp); - nShow := SW_SHOWNORMAL; - End; - If ShellExecuteEx(@exInfo) Then - Ph := exInfo.HProcess - Else Begin - // ShowMessage(SysErrorMessage(GetLastError)); - Exit; - End; - WaitFor(exInfo.HProcess); - CloseHandle(Ph); + FillChar(exInfo, sizeof(exInfo), 0); + With exInfo Do + Begin + cbSize := sizeof(exInfo); + fMask := SEE_MASK_NOCLOSEPROCESS Or SEE_MASK_FLAG_DDEWAIT; + Wnd := GetActiveWindow(); + exInfo.lpVerb := 'open'; + exInfo.lpParameters := Pchar(Params); + lpFile := Pchar(xApp); + nShow := SW_SHOWNORMAL; + End; + If ShellExecuteEx(@exInfo) Then + Ph := exInfo.HProcess + Else + Begin + // ShowMessage(SysErrorMessage(GetLastError)); + Exit; + End; + WaitFor(exInfo.HProcess); + CloseHandle(Ph); End; { =============================================================================== } Procedure Execute_Something_With_APP(Const xFile, xApp: String); Begin - ShellExecute(Application.Handle, 'open', Pchar(xApp), Pchar(xFile), Nil, SW_SHOWNORMAL); + ShellExecute(Application.Handle, 'open', Pchar(xApp), Pchar(xFile), Nil, + SW_SHOWNORMAL); End; { =============================================================================== } Function GetMyDocumentsFolder(): String; Var - path: Array [0 .. MAX_PATH] Of char; + path: Array [0 .. MAX_PATH] Of char; Begin - If SUCCEEDED(SHGetFolderPath(0, CSIDL_PERSONAL, 0, SHGFP_TYPE_CURRENT, @path[0])) Then - Result := DirToPath(path) - Else - Result := ''; + If SUCCEEDED(SHGetFolderPath(0, CSIDL_PERSONAL, 0, SHGFP_TYPE_CURRENT, + @path[0])) Then + Result := DirToPath(path) + Else + Result := ''; End; { =============================================================================== } Function GetCommonDocumentsFolder(): String; Var - path: Array [0 .. MAX_PATH] Of char; + path: Array [0 .. MAX_PATH] Of char; Begin - If SUCCEEDED(SHGetFolderPath(0, CSIDL_COMMON_DOCUMENTS, 0, SHGFP_TYPE_CURRENT, @path[0])) Then - Result := DirToPath(path) - Else - Result := ''; + If SUCCEEDED(SHGetFolderPath(0, CSIDL_COMMON_DOCUMENTS, 0, SHGFP_TYPE_CURRENT, + @path[0])) Then + Result := DirToPath(path) + Else + Result := ''; End; { =============================================================================== } Function GetMyApplicationData(): String; Var - path: Array [0 .. MAX_PATH] Of char; + path: Array [0 .. MAX_PATH] Of char; Begin - If SUCCEEDED(SHGetFolderPath(0, CSIDL_LOCAL_APPDATA, 0, SHGFP_TYPE_CURRENT, @path[0])) Then - Result := DirToPath(path) - Else - Result := ''; + If SUCCEEDED(SHGetFolderPath(0, CSIDL_LOCAL_APPDATA, 0, SHGFP_TYPE_CURRENT, + @path[0])) Then + Result := DirToPath(path) + Else + Result := ''; End; { =============================================================================== } Function GetCommonApplicationData(): String; Var - path: Array [0 .. MAX_PATH] Of char; + path: Array [0 .. MAX_PATH] Of char; Begin - If SUCCEEDED(SHGetFolderPath(0, CSIDL_COMMON_APPDATA, 0, SHGFP_TYPE_CURRENT, @path[0])) Then - Result := DirToPath(path) - Else - Result := ''; + If SUCCEEDED(SHGetFolderPath(0, CSIDL_COMMON_APPDATA, 0, SHGFP_TYPE_CURRENT, + @path[0])) Then + Result := DirToPath(path) + Else + Result := ''; End; { =============================================================================== } Function GetProgramFiles(): String; Var - path: Array [0 .. MAX_PATH] Of char; + path: Array [0 .. MAX_PATH] Of char; Begin - If SUCCEEDED(SHGetFolderPath(0, CSIDL_PROGRAM_FILES, 0, SHGFP_TYPE_CURRENT, @path[0])) Then - Result := DirToPath(path) - Else - Result := ''; + If SUCCEEDED(SHGetFolderPath(0, CSIDL_PROGRAM_FILES, 0, SHGFP_TYPE_CURRENT, + @path[0])) Then + Result := DirToPath(path) + Else + Result := ''; End; { =============================================================================== } Function GetWindowsFolder(): String; Var - path: Array [0 .. MAX_PATH] Of char; + path: Array [0 .. MAX_PATH] Of char; Begin - If SUCCEEDED(SHGetFolderPath(0, CSIDL_WINDOWS, 0, SHGFP_TYPE_CURRENT, @path[0])) Then - Result := DirToPath(path) - Else - Result := ''; + If SUCCEEDED(SHGetFolderPath(0, CSIDL_WINDOWS, 0, SHGFP_TYPE_CURRENT, + @path[0])) Then + Result := DirToPath(path) + Else + Result := ''; End; { =============================================================================== } Function DirToPath(Const Dir: String): String; Begin - If (Dir <> '') And (Dir[Length(Dir)] <> '\') Then - Result := Dir + '\' - Else - Result := Dir; + If (Dir <> '') And (Dir[Length(Dir)] <> '\') Then + Result := Dir + '\' + Else + Result := Dir; End; { =============================================================================== } @@ -326,118 +341,127 @@ Procedure Execute_App_Admin(Const xApp: String); Var - exInfo: TShellExecuteInfo; + exInfo: TShellExecuteInfo; Begin - FillChar(exInfo, sizeof(exInfo), 0); - With exInfo Do Begin - cbSize := sizeof(exInfo); - Wnd := GetActiveWindow(); - lpVerb := 'runas'; - lpParameters := ''; - lpFile := Pchar(xApp); - nShow := SW_SHOWNORMAL; - End; - ShellExecuteEx(@exInfo); + FillChar(exInfo, sizeof(exInfo), 0); + With exInfo Do + Begin + cbSize := sizeof(exInfo); + Wnd := GetActiveWindow(); + lpVerb := 'runas'; + lpParameters := ''; + lpFile := Pchar(xApp); + nShow := SW_SHOWNORMAL; + End; + ShellExecuteEx(@exInfo); End; { =============================================================================== } Procedure Execute_Something_With_APP_Admin(Const xFile, xApp: String); Var - exInfo: TShellExecuteInfo; + exInfo: TShellExecuteInfo; Begin - FillChar(exInfo, sizeof(exInfo), 0); - With exInfo Do Begin - cbSize := sizeof(exInfo); - Wnd := GetActiveWindow(); - lpVerb := 'runas'; - lpParameters := Pchar(xFile); - lpFile := Pchar(xApp); - nShow := SW_SHOWNORMAL; - End; - ShellExecuteEx(@exInfo); + FillChar(exInfo, sizeof(exInfo), 0); + With exInfo Do + Begin + cbSize := sizeof(exInfo); + Wnd := GetActiveWindow(); + lpVerb := 'runas'; + lpParameters := Pchar(xFile); + lpFile := Pchar(xApp); + nShow := SW_SHOWNORMAL; + End; + ShellExecuteEx(@exInfo); End; { =============================================================================== } Procedure Execute_App_And_Wait_Admin(xApp: String; Params: String = ''); - Procedure WaitFor(processHandle: THandle); - Var - Msg: TMsg; - ret: DWORD; - Begin - Repeat - ret := MsgWaitForMultipleObjects(1, { 1 handle to wait on } - processHandle, { the handle } - False, { wake on any event } - INFINITE, { wait without timeout } - QS_PAINT Or { wake on paint messages } - QS_SENDMESSAGE { or messages from other threads } - ); - If ret = WAIT_FAILED Then - Exit; { can do little here } - If ret = (WAIT_OBJECT_0 + 1) Then Begin - { Woke on a message, process paint messages only. Calling - PeekMessage gets messages send from other threads processed. } - While PeekMessage(Msg, 0, WM_PAINT, WM_PAINT, PM_REMOVE) Do - DispatchMessage(Msg); - End; - Until ret = WAIT_OBJECT_0; - End; + Procedure WaitFor(processHandle: THandle); + Var + Msg: TMsg; + ret: DWORD; + Begin + Repeat + ret := MsgWaitForMultipleObjects(1, { 1 handle to wait on } + processHandle, { the handle } + False, { wake on any event } + INFINITE, { wait without timeout } + QS_PAINT Or { wake on paint messages } + QS_SENDMESSAGE { or messages from other threads } + ); + If ret = WAIT_FAILED Then + Exit; { can do little here } + If ret = (WAIT_OBJECT_0 + 1) Then + Begin + { Woke on a message, process paint messages only. Calling + PeekMessage gets messages send from other threads processed. } + While PeekMessage(Msg, 0, WM_PAINT, WM_PAINT, PM_REMOVE) Do + DispatchMessage(Msg); + End; + Until ret = WAIT_OBJECT_0; + End; Var - exInfo: TShellExecuteInfo; - Ph: DWORD; + exInfo: TShellExecuteInfo; + Ph: DWORD; Begin - FillChar(exInfo, sizeof(exInfo), 0); - With exInfo Do Begin - cbSize := sizeof(exInfo); - fMask := SEE_MASK_NOCLOSEPROCESS Or SEE_MASK_FLAG_DDEWAIT; - Wnd := GetActiveWindow(); - lpVerb := 'runas'; - lpParameters := Pchar(Params); - lpFile := Pchar(xApp); - nShow := SW_SHOWNORMAL; - End; - If ShellExecuteEx(@exInfo) Then - Ph := exInfo.HProcess - Else Begin - // ShowMessage(SysErrorMessage(GetLastError)); - Exit; - End; - WaitFor(exInfo.HProcess); - CloseHandle(Ph); + FillChar(exInfo, sizeof(exInfo), 0); + With exInfo Do + Begin + cbSize := sizeof(exInfo); + fMask := SEE_MASK_NOCLOSEPROCESS Or SEE_MASK_FLAG_DDEWAIT; + Wnd := GetActiveWindow(); + lpVerb := 'runas'; + lpParameters := Pchar(Params); + lpFile := Pchar(xApp); + nShow := SW_SHOWNORMAL; + End; + If ShellExecuteEx(@exInfo) Then + Ph := exInfo.HProcess + Else + Begin + // ShowMessage(SysErrorMessage(GetLastError)); + Exit; + End; + WaitFor(exInfo.HProcess); + CloseHandle(Ph); End; { =============================================================================== } -Function GetFileList(Const PathWithMask: String; Var ArrList: TStringList): Integer; +Function GetFileList(Const PathWithMask: String; + Var ArrList: TStringList): Integer; Var - SR: SysUtils.TSearchRec; // file search result - FileCount, Success: Integer; // success code for FindXXX routines + SR: SysUtils.TSearchRec; // file search result + FileCount, Success: Integer; // success code for FindXXX routines Begin - FileCount := 0; - - // Initialise search for matching files - Success := SysUtils.FindFirst(PathWithMask, SysUtils.faAnyFile, SR); - Try - // Loop for all files in directory - While Success = 0 Do Begin - // only add true files or directories to list - If (SR.Name <> '.') And (SR.Name <> '..') And (SR.Attr And SysUtils.faDirectory = 0) Then Begin - FileCount := FileCount + 1; - ArrList.Add(SR.Name) - End; - // get next file - Success := SysUtils.FindNext(SR); - End; - Finally - // Tidy up - Result := FileCount; - SysUtils.FindClose(SR); - End; + FileCount := 0; + + // Initialise search for matching files + Success := SysUtils.FindFirst(PathWithMask, SysUtils.faAnyFile, SR); + Try + // Loop for all files in directory + While Success = 0 Do + Begin + // only add true files or directories to list + If (SR.Name <> '.') And (SR.Name <> '..') And + (SR.Attr And SysUtils.faDirectory = 0) Then + Begin + FileCount := FileCount + 1; + ArrList.Add(SR.Name) + End; + // get next file + Success := SysUtils.FindNext(SR); + End; + Finally + // Tidy up + Result := FileCount; + SysUtils.FindClose(SR); + End; End; @@ -445,7 +469,7 @@ Function RemoveExtension(Const FilePathName: String): String; Begin - Result := ChangeFileExt(ExtractFileName(FilePathName), ''); + Result := ChangeFileExt(ExtractFileName(FilePathName), ''); End; { =============================================================================== } diff --git a/Keyboard and Spell checker/Units/uLocale.pas b/Keyboard and Spell checker/Units/uLocale.pas index ad89c69..8032bf3 100644 --- a/Keyboard and Spell checker/Units/uLocale.pas +++ b/Keyboard and Spell checker/Units/uLocale.pas @@ -1,49 +1,46 @@ { - ============================================================================= - ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + ============================================================================= + ***************************************************************************** + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. - ***************************************************************************** - ============================================================================= + ***************************************************************************** + ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - Unit uLocale; Interface Uses - Windows, - SysUtils, - Messages; + Windows, + SysUtils, + Messages; Const - LANG_EN_US: String = '00000409'; - LANG_BN_IN: String = '00000445'; - LANG_BN_BD: String = '00000845'; - LANG_Assamese: String = '0000044D'; - INPUTLANGCHANGE_SYSCHARSET: Integer = $1; - - + LANG_EN_US: String = '00000409'; + LANG_BN_IN: String = '00000445'; + LANG_BN_BD: String = '00000845'; + LANG_Assamese: String = '0000044D'; + INPUTLANGCHANGE_SYSCHARSET: Integer = $1; Procedure ChangeLocaleToBangla(Const TopWnd: HWND); Procedure ChangeLocaleToEnglish(Const TopWnd: HWND); // Required for ANSI mode @@ -56,293 +53,321 @@ Implementation Uses - clsRegistry_XMLSetting, - uRegistrySettings, - WindowsVersion; + clsRegistry_XMLSetting, + uRegistrySettings, + WindowsVersion; {$HINTS Off} - { =============================================================================== } Function IsAssameseLocaleInstalled: Boolean; Var - Reg: TMyRegistry; + Reg: TMyRegistry; Begin - Result := False; - Reg := TMyRegistry.create; - Reg.RootKey := HKEY_LOCAL_MACHINE; - - If Reg.KeyExists('SYSTEM\CurrentControlSet\Control\Keyboard Layouts\0000044D') And Reg.KeyExists('SYSTEM\ControlSet001\Control\Keyboard Layouts\0000044D') And Reg.KeyExists - ('SYSTEM\ControlSet002\Control\Keyboard Layouts\0000044D') Then - Result := True - Else - Result := False; - - Reg.Free; + Result := False; + Reg := TMyRegistry.create; + Reg.RootKey := HKEY_LOCAL_MACHINE; + + If Reg.KeyExists('SYSTEM\CurrentControlSet\Control\Keyboard Layouts\0000044D') + And Reg.KeyExists('SYSTEM\ControlSet001\Control\Keyboard Layouts\0000044D') + And Reg.KeyExists + ('SYSTEM\ControlSet002\Control\Keyboard Layouts\0000044D') Then + Result := True + Else + Result := False; + + Reg.Free; End; {$HINTS On} - { =============================================================================== } {$HINTS Off} Function IsBangladeshLocaleInstalled: Boolean; Var - Reg: TMyRegistry; + Reg: TMyRegistry; Begin - Result := False; - Reg := TMyRegistry.create; - Reg.RootKey := HKEY_LOCAL_MACHINE; - - If Reg.KeyExists('SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00000845') And Reg.KeyExists('SYSTEM\ControlSet001\Control\Keyboard Layouts\00000845') And Reg.KeyExists - ('SYSTEM\ControlSet002\Control\Keyboard Layouts\00000845') Then - Result := True - Else - Result := False; - - Reg.Free; + Result := False; + Reg := TMyRegistry.create; + Reg.RootKey := HKEY_LOCAL_MACHINE; + + If Reg.KeyExists('SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00000845') + And Reg.KeyExists('SYSTEM\ControlSet001\Control\Keyboard Layouts\00000845') + And Reg.KeyExists + ('SYSTEM\ControlSet002\Control\Keyboard Layouts\00000845') Then + Result := True + Else + Result := False; + + Reg.Free; End; {$HINTS On} - { =============================================================================== } Procedure InstallLocale; Var - Reg: TMyRegistry; - LayoutDisplayName: String; - LayoutFile: String; - LayoutText: String; + Reg: TMyRegistry; + LayoutDisplayName: String; + LayoutFile: String; + LayoutText: String; Begin - Reg := TMyRegistry.create; - Reg.RootKey := HKEY_LOCAL_MACHINE; - - // ==================================================================== - // Install Bangla BD - If Reg.OpenKey('SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00000845', True) = True Then Begin - LayoutDisplayName := Reg.ReadStringDef('Layout Display Name', 'Bangla BD'); - LayoutFile := Reg.ReadStringDef('Layout File', 'KBDUS.DLL'); - LayoutText := Reg.ReadStringDef('Layout Text', 'Bangla BD'); - - Reg.WriteString('Layout Display Name', LayoutDisplayName); - Reg.WriteString('Layout File', LayoutFile); - Reg.WriteString('Layout Text', LayoutText); - End; - Reg.CloseKey; - - Reg.RootKey := HKEY_LOCAL_MACHINE; - If Reg.OpenKey('SYSTEM\ControlSet001\Control\Keyboard Layouts\00000845', True) = True Then Begin - LayoutDisplayName := Reg.ReadStringDef('Layout Display Name', 'Bangla BD'); - LayoutFile := Reg.ReadStringDef('Layout File', 'KBDUS.DLL'); - LayoutText := Reg.ReadStringDef('Layout Text', 'Bangla BD'); - - Reg.WriteString('Layout Display Name', LayoutDisplayName); - Reg.WriteString('Layout File', LayoutFile); - Reg.WriteString('Layout Text', LayoutText); - End; - Reg.CloseKey; - - Reg.RootKey := HKEY_LOCAL_MACHINE; - If Reg.OpenKey('SYSTEM\ControlSet002\Control\Keyboard Layouts\00000845', True) = True Then Begin - LayoutDisplayName := Reg.ReadStringDef('Layout Display Name', 'Bangla BD'); - LayoutFile := Reg.ReadStringDef('Layout File', 'KBDUS.DLL'); - LayoutText := Reg.ReadStringDef('Layout Text', 'Bangla BD'); - - Reg.WriteString('Layout Display Name', LayoutDisplayName); - Reg.WriteString('Layout File', LayoutFile); - Reg.WriteString('Layout Text', LayoutText); - End; - Reg.CloseKey; - - - - // ====================================================================' + - // Install Assamese - Reg.RootKey := HKEY_LOCAL_MACHINE; - If Reg.OpenKey('SYSTEM\CurrentControlSet\Control\Keyboard Layouts\0000044D', True) = True Then Begin - LayoutDisplayName := Reg.ReadStringDef('Layout Display Name', 'Assamese'); - LayoutFile := Reg.ReadStringDef('Layout File', 'KBDUS.DLL'); - LayoutText := Reg.ReadStringDef('Layout Text', 'Assamese'); - - Reg.WriteString('Layout Display Name', LayoutDisplayName); - Reg.WriteString('Layout File', LayoutFile); - Reg.WriteString('Layout Text', LayoutText); - End; - Reg.CloseKey; - - Reg.RootKey := HKEY_LOCAL_MACHINE; - If Reg.OpenKey('SYSTEM\ControlSet001\Control\Keyboard Layouts\0000044D', True) = True Then Begin - LayoutDisplayName := Reg.ReadStringDef('Layout Display Name', 'Assamese'); - LayoutFile := Reg.ReadStringDef('Layout File', 'KBDUS.DLL'); - LayoutText := Reg.ReadStringDef('Layout Text', 'Assamese'); - - Reg.WriteString('Layout Display Name', LayoutDisplayName); - Reg.WriteString('Layout File', LayoutFile); - Reg.WriteString('Layout Text', LayoutText); - End; - Reg.CloseKey; - - Reg.RootKey := HKEY_LOCAL_MACHINE; - If Reg.OpenKey('SYSTEM\ControlSet002\Control\Keyboard Layouts\0000044D', True) = True Then Begin - LayoutDisplayName := Reg.ReadStringDef('Layout Display Name', 'Assamese'); - LayoutFile := Reg.ReadStringDef('Layout File', 'KBDUS.DLL'); - LayoutText := Reg.ReadStringDef('Layout Text', 'Assamese'); - - Reg.WriteString('Layout Display Name', LayoutDisplayName); - Reg.WriteString('Layout File', LayoutFile); - Reg.WriteString('Layout Text', LayoutText); - End; - Reg.CloseKey; - - { ==================================================================== - Install Bangla - India - Present in WinXp Sp2 or later - So, don't install on these platforms } - If (Not IsWinXPSP2Plus) Or IsWinVistaOrLater Then Begin - Reg.RootKey := HKEY_LOCAL_MACHINE; - If Reg.OpenKey('SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00000445', True) = True Then Begin - LayoutDisplayName := Reg.ReadStringDef('Layout Display Name', 'Bangla IN'); - LayoutFile := Reg.ReadStringDef('Layout File', 'KBDUS.DLL'); - LayoutText := Reg.ReadStringDef('Layout Text', 'Bangla IN'); - - Reg.WriteString('Layout Display Name', LayoutDisplayName); - Reg.WriteString('Layout File', LayoutFile); - Reg.WriteString('Layout Text', LayoutText); - End; - Reg.CloseKey; - - Reg.RootKey := HKEY_LOCAL_MACHINE; - If Reg.OpenKey('SYSTEM\ControlSet001\Control\Keyboard Layouts\00000445', True) = True Then Begin - LayoutDisplayName := Reg.ReadStringDef('Layout Display Name', 'Bangla IN'); - LayoutFile := Reg.ReadStringDef('Layout File', 'KBDUS.DLL'); - LayoutText := Reg.ReadStringDef('Layout Text', 'Bangla IN'); - - Reg.WriteString('Layout Display Name', LayoutDisplayName); - Reg.WriteString('Layout File', LayoutFile); - Reg.WriteString('Layout Text', LayoutText); - End; - Reg.CloseKey; - - Reg.RootKey := HKEY_LOCAL_MACHINE; - If Reg.OpenKey('SYSTEM\ControlSet002\Control\Keyboard Layouts\00000445', True) = True Then Begin - LayoutDisplayName := Reg.ReadStringDef('Layout Display Name', 'Bangla IN'); - LayoutFile := Reg.ReadStringDef('Layout File', 'KBDUS.DLL'); - LayoutText := Reg.ReadStringDef('Layout Text', 'Bangla IN'); - - Reg.WriteString('Layout Display Name', LayoutDisplayName); - Reg.WriteString('Layout File', LayoutFile); - Reg.WriteString('Layout Text', LayoutText); - End; - Reg.CloseKey; - End; - - - Reg.Free; + Reg := TMyRegistry.create; + Reg.RootKey := HKEY_LOCAL_MACHINE; + + // ==================================================================== + // Install Bangla BD + If Reg.OpenKey('SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00000845', + True) = True Then + Begin + LayoutDisplayName := Reg.ReadStringDef('Layout Display Name', 'Bangla BD'); + LayoutFile := Reg.ReadStringDef('Layout File', 'KBDUS.DLL'); + LayoutText := Reg.ReadStringDef('Layout Text', 'Bangla BD'); + + Reg.WriteString('Layout Display Name', LayoutDisplayName); + Reg.WriteString('Layout File', LayoutFile); + Reg.WriteString('Layout Text', LayoutText); + End; + Reg.CloseKey; + + Reg.RootKey := HKEY_LOCAL_MACHINE; + If Reg.OpenKey('SYSTEM\ControlSet001\Control\Keyboard Layouts\00000845', True) + = True Then + Begin + LayoutDisplayName := Reg.ReadStringDef('Layout Display Name', 'Bangla BD'); + LayoutFile := Reg.ReadStringDef('Layout File', 'KBDUS.DLL'); + LayoutText := Reg.ReadStringDef('Layout Text', 'Bangla BD'); + + Reg.WriteString('Layout Display Name', LayoutDisplayName); + Reg.WriteString('Layout File', LayoutFile); + Reg.WriteString('Layout Text', LayoutText); + End; + Reg.CloseKey; + + Reg.RootKey := HKEY_LOCAL_MACHINE; + If Reg.OpenKey('SYSTEM\ControlSet002\Control\Keyboard Layouts\00000845', True) + = True Then + Begin + LayoutDisplayName := Reg.ReadStringDef('Layout Display Name', 'Bangla BD'); + LayoutFile := Reg.ReadStringDef('Layout File', 'KBDUS.DLL'); + LayoutText := Reg.ReadStringDef('Layout Text', 'Bangla BD'); + + Reg.WriteString('Layout Display Name', LayoutDisplayName); + Reg.WriteString('Layout File', LayoutFile); + Reg.WriteString('Layout Text', LayoutText); + End; + Reg.CloseKey; + + // ====================================================================' + + // Install Assamese + Reg.RootKey := HKEY_LOCAL_MACHINE; + If Reg.OpenKey('SYSTEM\CurrentControlSet\Control\Keyboard Layouts\0000044D', + True) = True Then + Begin + LayoutDisplayName := Reg.ReadStringDef('Layout Display Name', 'Assamese'); + LayoutFile := Reg.ReadStringDef('Layout File', 'KBDUS.DLL'); + LayoutText := Reg.ReadStringDef('Layout Text', 'Assamese'); + + Reg.WriteString('Layout Display Name', LayoutDisplayName); + Reg.WriteString('Layout File', LayoutFile); + Reg.WriteString('Layout Text', LayoutText); + End; + Reg.CloseKey; + + Reg.RootKey := HKEY_LOCAL_MACHINE; + If Reg.OpenKey('SYSTEM\ControlSet001\Control\Keyboard Layouts\0000044D', True) + = True Then + Begin + LayoutDisplayName := Reg.ReadStringDef('Layout Display Name', 'Assamese'); + LayoutFile := Reg.ReadStringDef('Layout File', 'KBDUS.DLL'); + LayoutText := Reg.ReadStringDef('Layout Text', 'Assamese'); + + Reg.WriteString('Layout Display Name', LayoutDisplayName); + Reg.WriteString('Layout File', LayoutFile); + Reg.WriteString('Layout Text', LayoutText); + End; + Reg.CloseKey; + + Reg.RootKey := HKEY_LOCAL_MACHINE; + If Reg.OpenKey('SYSTEM\ControlSet002\Control\Keyboard Layouts\0000044D', True) + = True Then + Begin + LayoutDisplayName := Reg.ReadStringDef('Layout Display Name', 'Assamese'); + LayoutFile := Reg.ReadStringDef('Layout File', 'KBDUS.DLL'); + LayoutText := Reg.ReadStringDef('Layout Text', 'Assamese'); + + Reg.WriteString('Layout Display Name', LayoutDisplayName); + Reg.WriteString('Layout File', LayoutFile); + Reg.WriteString('Layout Text', LayoutText); + End; + Reg.CloseKey; + + { ==================================================================== + Install Bangla - India + Present in WinXp Sp2 or later + So, don't install on these platforms } + If (Not IsWinXPSP2Plus) Or IsWinVistaOrLater Then + Begin + Reg.RootKey := HKEY_LOCAL_MACHINE; + If Reg.OpenKey('SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00000445', + True) = True Then + Begin + LayoutDisplayName := Reg.ReadStringDef('Layout Display Name', + 'Bangla IN'); + LayoutFile := Reg.ReadStringDef('Layout File', 'KBDUS.DLL'); + LayoutText := Reg.ReadStringDef('Layout Text', 'Bangla IN'); + + Reg.WriteString('Layout Display Name', LayoutDisplayName); + Reg.WriteString('Layout File', LayoutFile); + Reg.WriteString('Layout Text', LayoutText); + End; + Reg.CloseKey; + + Reg.RootKey := HKEY_LOCAL_MACHINE; + If Reg.OpenKey('SYSTEM\ControlSet001\Control\Keyboard Layouts\00000445', + True) = True Then + Begin + LayoutDisplayName := Reg.ReadStringDef('Layout Display Name', + 'Bangla IN'); + LayoutFile := Reg.ReadStringDef('Layout File', 'KBDUS.DLL'); + LayoutText := Reg.ReadStringDef('Layout Text', 'Bangla IN'); + + Reg.WriteString('Layout Display Name', LayoutDisplayName); + Reg.WriteString('Layout File', LayoutFile); + Reg.WriteString('Layout Text', LayoutText); + End; + Reg.CloseKey; + + Reg.RootKey := HKEY_LOCAL_MACHINE; + If Reg.OpenKey('SYSTEM\ControlSet002\Control\Keyboard Layouts\00000445', + True) = True Then + Begin + LayoutDisplayName := Reg.ReadStringDef('Layout Display Name', + 'Bangla IN'); + LayoutFile := Reg.ReadStringDef('Layout File', 'KBDUS.DLL'); + LayoutText := Reg.ReadStringDef('Layout Text', 'Bangla IN'); + + Reg.WriteString('Layout Display Name', LayoutDisplayName); + Reg.WriteString('Layout File', LayoutFile); + Reg.WriteString('Layout Text', LayoutText); + End; + Reg.CloseKey; + End; + + Reg.Free; End; { =============================================================================== } Procedure ChangeLocaleToEnglish(Const TopWnd: HWND); // Required for ANSI mode Var - Local_ID: Integer; - ParentHandle: HWND; + Local_ID: Integer; + ParentHandle: HWND; Begin - { DONE : - Extensive test needed here: - Till Vista, KLF_ACTIVATE works ok - From Windows 7, it always makes long delay to change locale. - 'KLF_ACTIVATE OR KLF_NOTELLSHELL' failed, too - Possible workaround- using KLF_NOTELLSHELL } - Local_ID := LoadKeyboardLayout(PChar(LANG_EN_US), KLF_NOTELLSHELL); - PostMessage(TopWnd, WM_INPUTLANGCHANGEREQUEST, INPUTLANGCHANGE_SYSCHARSET, Local_ID); - PostMessage(TopWnd, WM_INPUTLANGCHANGE, 0, Local_ID); - - - { Request sent. Sometimes this request is not processed if foreground window - is a child window like message box or file open/save dialog. - In this case, we have to send the request to parent } - - // Get the parent - ParentHandle := GetParent(TopWnd); - If IsWindow(ParentHandle) Then Begin - PostMessage(ParentHandle, WM_INPUTLANGCHANGEREQUEST, INPUTLANGCHANGE_SYSCHARSET, Local_ID); - PostMessage(ParentHandle, WM_INPUTLANGCHANGE, 0, Local_ID); - End; + { DONE : + Extensive test needed here: + Till Vista, KLF_ACTIVATE works ok + From Windows 7, it always makes long delay to change locale. + 'KLF_ACTIVATE OR KLF_NOTELLSHELL' failed, too + Possible workaround- using KLF_NOTELLSHELL } + Local_ID := LoadKeyboardLayout(PChar(LANG_EN_US), KLF_NOTELLSHELL); + PostMessage(TopWnd, WM_INPUTLANGCHANGEREQUEST, INPUTLANGCHANGE_SYSCHARSET, + Local_ID); + PostMessage(TopWnd, WM_INPUTLANGCHANGE, 0, Local_ID); + + { Request sent. Sometimes this request is not processed if foreground window + is a child window like message box or file open/save dialog. + In this case, we have to send the request to parent } + + // Get the parent + ParentHandle := GetParent(TopWnd); + If IsWindow(ParentHandle) Then + Begin + PostMessage(ParentHandle, WM_INPUTLANGCHANGEREQUEST, + INPUTLANGCHANGE_SYSCHARSET, Local_ID); + PostMessage(ParentHandle, WM_INPUTLANGCHANGE, 0, Local_ID); + End; End; { =============================================================================== } Procedure ChangeLocaleToBangla(Const TopWnd: HWND); Var - Local_ID: Integer; - ParentHandle: HWND; - BanglaLocale: String; + Local_ID: Integer; + ParentHandle: HWND; + BanglaLocale: String; Begin - If PrefferedLocale = 'BANGLADESH' Then - BanglaLocale := LANG_BN_BD - Else If PrefferedLocale = 'INDIA' Then - BanglaLocale := LANG_BN_IN - Else If PrefferedLocale = 'ASSAMESE' Then - BanglaLocale := LANG_Assamese - Else - BanglaLocale := LANG_BN_IN; - - { DONE : - Extensive test needed here: - Till Vista, KLF_ACTIVATE works ok - From Windows 7, it always makes long delay to change locale. - 'KLF_ACTIVATE OR KLF_NOTELLSHELL' failed, too - Possible workaround- using KLF_NOTELLSHELL } - Local_ID := LoadKeyboardLayout(PChar(BanglaLocale), KLF_NOTELLSHELL); - PostMessage(TopWnd, WM_INPUTLANGCHANGEREQUEST, INPUTLANGCHANGE_SYSCHARSET, Local_ID); - PostMessage(TopWnd, WM_INPUTLANGCHANGE, 0, Local_ID); - - { Request sent. Sometimes this request is not processed if foreground window - is a child window like message box or file open/save dialog. - In this case, we have to send the request to parent } - - // Get the parent - ParentHandle := GetParent(TopWnd); - If IsWindow(ParentHandle) Then Begin - PostMessage(ParentHandle, WM_INPUTLANGCHANGEREQUEST, INPUTLANGCHANGE_SYSCHARSET, Local_ID); - PostMessage(ParentHandle, WM_INPUTLANGCHANGE, 0, Local_ID); - End; - - { Keyboard Locale Changed in foreign app, now set my locale to English } - LoadKeyboardLayout(PChar(LANG_EN_US), KLF_ACTIVATE); + If PrefferedLocale = 'BANGLADESH' Then + BanglaLocale := LANG_BN_BD + Else If PrefferedLocale = 'INDIA' Then + BanglaLocale := LANG_BN_IN + Else If PrefferedLocale = 'ASSAMESE' Then + BanglaLocale := LANG_Assamese + Else + BanglaLocale := LANG_BN_IN; + + { DONE : + Extensive test needed here: + Till Vista, KLF_ACTIVATE works ok + From Windows 7, it always makes long delay to change locale. + 'KLF_ACTIVATE OR KLF_NOTELLSHELL' failed, too + Possible workaround- using KLF_NOTELLSHELL } + Local_ID := LoadKeyboardLayout(PChar(BanglaLocale), KLF_NOTELLSHELL); + PostMessage(TopWnd, WM_INPUTLANGCHANGEREQUEST, INPUTLANGCHANGE_SYSCHARSET, + Local_ID); + PostMessage(TopWnd, WM_INPUTLANGCHANGE, 0, Local_ID); + + { Request sent. Sometimes this request is not processed if foreground window + is a child window like message box or file open/save dialog. + In this case, we have to send the request to parent } + + // Get the parent + ParentHandle := GetParent(TopWnd); + If IsWindow(ParentHandle) Then + Begin + PostMessage(ParentHandle, WM_INPUTLANGCHANGEREQUEST, + INPUTLANGCHANGE_SYSCHARSET, Local_ID); + PostMessage(ParentHandle, WM_INPUTLANGCHANGE, 0, Local_ID); + End; + + { Keyboard Locale Changed in foreign app, now set my locale to English } + LoadKeyboardLayout(PChar(LANG_EN_US), KLF_ACTIVATE); End; { =============================================================================== } Procedure ChangeLocalToAny(Const TargetWin: HWND; FullLocaleMsg: Cardinal); Var - ParentHandle: HWND; + ParentHandle: HWND; Begin - PostMessage(TargetWin, WM_INPUTLANGCHANGEREQUEST, INPUTLANGCHANGE_SYSCHARSET, FullLocaleMsg); - PostMessage(TargetWin, WM_INPUTLANGCHANGE, 0, FullLocaleMsg); - - { Request sent. Sometimes this request is not processed if foreground window - is a child window like message box or file open/save dialog. - In this case, we have to send the request to parent } - - // Get the parent - ParentHandle := GetParent(TargetWin); - If IsWindow(ParentHandle) Then Begin - PostMessage(ParentHandle, WM_INPUTLANGCHANGEREQUEST, INPUTLANGCHANGE_SYSCHARSET, FullLocaleMsg); - PostMessage(ParentHandle, WM_INPUTLANGCHANGE, 0, FullLocaleMsg); - End; + PostMessage(TargetWin, WM_INPUTLANGCHANGEREQUEST, INPUTLANGCHANGE_SYSCHARSET, + FullLocaleMsg); + PostMessage(TargetWin, WM_INPUTLANGCHANGE, 0, FullLocaleMsg); + + { Request sent. Sometimes this request is not processed if foreground window + is a child window like message box or file open/save dialog. + In this case, we have to send the request to parent } + + // Get the parent + ParentHandle := GetParent(TargetWin); + If IsWindow(ParentHandle) Then + Begin + PostMessage(ParentHandle, WM_INPUTLANGCHANGEREQUEST, + INPUTLANGCHANGE_SYSCHARSET, FullLocaleMsg); + PostMessage(ParentHandle, WM_INPUTLANGCHANGE, 0, FullLocaleMsg); + End; End; { =============================================================================== } Function GetForeignLocale(Const TargetWin: HWND): Cardinal; Var - TID: Integer; + TID: Integer; Begin - TID := GetWindowThreadProcessId(TargetWin, Nil); - Result := GetKeyboardLayout(TID); + TID := GetWindowThreadProcessId(TargetWin, Nil); + Result := GetKeyboardLayout(TID); End; { =============================================================================== } diff --git a/Keyboard and Spell checker/Units/uProcessHandler.pas b/Keyboard and Spell checker/Units/uProcessHandler.pas index cc40b22..1428213 100644 --- a/Keyboard and Spell checker/Units/uProcessHandler.pas +++ b/Keyboard and Spell checker/Units/uProcessHandler.pas @@ -1,65 +1,62 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= } {$INCLUDE ../ProjectDefines.inc} +{ COMPLETE TRANSFERING! } -{COMPLETE TRANSFERING!} - -//Supported values: +// Supported values: // HIGH_PRIORITY_CLASS // IDLE_PRIORITY_CLASS // NORMAL_PRIORITY_CLASS // REALTIME_PRIORITY_CLASS - Unit uProcessHandler; Interface -Uses - Windows; +Uses + Windows; Procedure Set_Process_Priority(Const xPriority: Integer); - Implementation -{===============================================================================} +{ =============================================================================== } Procedure Set_Process_Priority(Const xPriority: Integer); Begin - //Supported values: - // HIGH_PRIORITY_CLASS - // IDLE_PRIORITY_CLASS - // NORMAL_PRIORITY_CLASS - // REALTIME_PRIORITY_CLASS - SetPriorityClass(GetCurrentProcess(), xPriority); + // Supported values: + // HIGH_PRIORITY_CLASS + // IDLE_PRIORITY_CLASS + // NORMAL_PRIORITY_CLASS + // REALTIME_PRIORITY_CLASS + SetPriorityClass(GetCurrentProcess(), xPriority); End; -{===============================================================================} +{ =============================================================================== } End. diff --git a/Keyboard and Spell checker/Units/uRegExPhoneticSearch.pas b/Keyboard and Spell checker/Units/uRegExPhoneticSearch.pas index 49e44c7..0f62329 100644 --- a/Keyboard and Spell checker/Units/uRegExPhoneticSearch.pas +++ b/Keyboard and Spell checker/Units/uRegExPhoneticSearch.pas @@ -1,28 +1,28 @@ { - ============================================================================= - ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + ============================================================================= + ***************************************************************************** + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. - ***************************************************************************** - ============================================================================= + ***************************************************************************** + ============================================================================= } Unit uRegExPhoneticSearch; @@ -32,956 +32,1000 @@ Interface Uses - Classes; + Classes; -Function SearchPhonetic(SearchIn, SearchStr: String; Var wList: TStringList): Integer; +Function SearchPhonetic(SearchIn, SearchStr: String; + Var wList: TStringList): Integer; Implementation Uses - Pcre, - pcre_dll, - uDBase, - StrUtils, - SysUtils; - -Function SearchPhonetic(SearchIn, SearchStr: String; Var wList: TStringList): Integer; -Var - theRegex: IRegex; - theMatch: IMatch; - theLocale: ansistring; - RegExOpt: TRegMatchOptions; - RegExCompileOptions: TRegCompileOptions; - I: Integer; - AnsiSearchStr: ansistring; - mSearchIn: String; - - StartCounter, EndCounter: Integer; - TotalSearch: Integer; { For diagnosis purpose } -Begin - wList.Clear; - wList.Sorted := True; - wList.Duplicates := dupIgnore; - - TotalSearch := 0; - AnsiSearchStr := ansistring('^') + utf8encode(SearchStr) + ansistring('$'); - RegExOpt := []; - theLocale := 'C'; - RegExCompileOptions := DecodeRegCompileOptions(PCRE_UTF8); - theRegex := Pcre.RegexCreate(AnsiSearchStr, RegExCompileOptions, theLocale); - - mSearchIn := LeftStr(LowerCase(SearchIn), 1); - - wList.BeginUpdate; - - { ***************************************** } - { Search W_A } - If (mSearchIn = 'o') Or (mSearchIn = 'a') Then Begin - - StartCounter := 0; - EndCounter := W_A.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_A[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_A[I])); - End; - End; - End; - { ***************************************** } - - - - { ***************************************** } - { Search W_AA } - If {$IFDEF FASTSEARCH_OFF}(mSearchIn = 'r') Or {$ENDIF} - - (mSearchIn = 'i') Or (mSearchIn = 'a') Then Begin - - StartCounter := 0; - EndCounter := W_AA.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_AA[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_AA[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_I } - If (mSearchIn = 'y') - - {$IFDEF FASTSEARCH_OFF} Or (mSearchIn = 'u'){$ENDIF} - - Or (mSearchIn = 'i') Or (mSearchIn = 'e') Then Begin - - StartCounter := 0; - EndCounter := W_I.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_I[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_I[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_II } - If (mSearchIn = 'i') Or (mSearchIn = 'e') Then Begin - - StartCounter := 0; - EndCounter := W_II.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_II[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_II[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_U } - If (mSearchIn = 'u') Or (mSearchIn = 'o') Then Begin - - StartCounter := 0; - EndCounter := W_U.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_U[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_U[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_UU } - If (mSearchIn = 'u') Or (mSearchIn = 'o') Then Begin - - StartCounter := 0; - EndCounter := W_UU.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_UU[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_UU[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_RRI } - If (mSearchIn = 'r') Then Begin - - StartCounter := 0; - EndCounter := W_RRI.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_RRI[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_RRI[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_E } - If (mSearchIn = 'x'){$IFDEF FASTSEARCH_OFF} Or (mSearchIn = 's') Or (mSearchIn = 'n') Or (mSearchIn = 'm') Or (mSearchIn = 'l') Or (mSearchIn = 'h') Or (mSearchIn = 'f'){$ENDIF} - - Or (mSearchIn = 'e') Or (mSearchIn = 'a') Then Begin - - StartCounter := 0; - EndCounter := W_E.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_E[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_E[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_OI } - If (mSearchIn = 'a') Or (mSearchIn = 'o') Then Begin - - StartCounter := 0; - EndCounter := W_OI.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_OI[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_OI[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_O } - If {$IFDEF FASTSEARCH_OFF}(mSearchIn = 'y') Or {$ENDIF}(mSearchIn = 'w') Or (mSearchIn = 'o') Or (mSearchIn = 'a') Then Begin - - StartCounter := 0; - EndCounter := W_O.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_O[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_O[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_OU } - If (mSearchIn = 'o') Then Begin - - StartCounter := 0; - EndCounter := W_OU.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_OU[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_OU[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_B } - If (mSearchIn = 'b') Then Begin - - StartCounter := 0; - EndCounter := W_B.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_B[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_B[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_BH } - If (mSearchIn = 'b') Or (mSearchIn = 'v') Then Begin - - StartCounter := 0; - EndCounter := W_BH.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_BH[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_BH[I])); - End; - End; - End; - { ***************************************** } - - - - { ***************************************** } - { Search W_C } - If (mSearchIn = 'c') Then Begin - - StartCounter := 0; - EndCounter := W_C.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_C[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_C[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_CH } - If (mSearchIn = 'c') Then Begin - - StartCounter := 0; - EndCounter := W_CH.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_CH[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_CH[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_D } - If (mSearchIn = 'd') Then Begin - - StartCounter := 0; - EndCounter := W_D.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_D[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_D[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_Dh } - If (mSearchIn = 'd') Then Begin - - StartCounter := 0; - EndCounter := W_Dh.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_Dh[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_Dh[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_Dd } - If {$IFDEF FASTSEARCH_OFF}(mSearchIn = 'w') Or {$ENDIF}(mSearchIn = 'd') Then Begin - - StartCounter := 0; - EndCounter := W_Dd.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_Dd[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_Dd[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_Ddh } - If (mSearchIn = 'd') Then Begin - - StartCounter := 0; - EndCounter := W_Ddh.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_Ddh[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_Ddh[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_G } - If (mSearchIn = 'g') Then Begin - - StartCounter := 0; - EndCounter := W_G.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_G[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_G[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_Gh } - If (mSearchIn = 'g') Then Begin - - StartCounter := 0; - EndCounter := W_Gh.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_Gh[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_Gh[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_H } - If (mSearchIn = 'z') Or (mSearchIn = 'r') Or (mSearchIn = 'm') Or (mSearchIn = 'h') Then Begin - - StartCounter := 0; - EndCounter := W_H.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_H[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_H[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_J } - If (mSearchIn = 'z') Or (mSearchIn = 'j') Or (mSearchIn = 'g') Then Begin - - StartCounter := 0; - EndCounter := W_J.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_J[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_J[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_Jh } - If (mSearchIn = 'j') Or (mSearchIn = 'z') Then Begin - - StartCounter := 0; - EndCounter := W_Jh.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_Jh[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_Jh[I])); - End; - End; - End; - { ***************************************** } - - - - { ***************************************** } - { Search W_K } - If (mSearchIn = 'x') Or (mSearchIn = 'q') Or (mSearchIn = 'k') Or (mSearchIn = 'c') Then Begin - - StartCounter := 0; - EndCounter := W_K.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_K[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_K[I])); - End; - End; - End; - { ***************************************** } - - - - { ***************************************** } - { Search W_Kh } - If (mSearchIn = 'k') Then Begin - - StartCounter := 0; - EndCounter := W_Kh.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_Kh[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_Kh[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_L } - If (mSearchIn = 'l') Then Begin - - StartCounter := 0; - EndCounter := W_L.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_L[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_L[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_M } - If (mSearchIn = 'm') Then Begin - - StartCounter := 0; - EndCounter := W_M.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_M[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_M[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_N } - If (mSearchIn = 'n') Then Begin - - StartCounter := 0; - EndCounter := W_N.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_N[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_N[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_NGA } - If (mSearchIn = 'n') Then Begin - - StartCounter := 0; - EndCounter := W_NGA.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_NGA[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_NGA[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_NYA } - If (mSearchIn = 'n') Or (mSearchIn = 'a') Then Begin - - StartCounter := 0; - EndCounter := W_NYA.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_NYA[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_NYA[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_Nn } - If (mSearchIn = 'n') Then Begin - - StartCounter := 0; - EndCounter := W_Nn.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_Nn[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_Nn[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_P } - If (mSearchIn = 'p') Then Begin - - StartCounter := 0; - EndCounter := W_P.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_P[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_P[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_Ph } - If (mSearchIn = 'p') Or (mSearchIn = 'f') Then Begin - - StartCounter := 0; - EndCounter := W_Ph.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_Ph[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_Ph[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_R } - If (mSearchIn = 'r') Then Begin - - StartCounter := 0; - EndCounter := W_R.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_R[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_R[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_Rr } - If (mSearchIn = 'r') Then Begin - - StartCounter := 0; - EndCounter := W_Rr.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_Rr[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_Rr[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_Rrh } - If (mSearchIn = 'r') Then Begin - - StartCounter := 0; - EndCounter := W_Rrh.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_Rrh[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_Rrh[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_S } - If (mSearchIn = 's'){$IFDEF FASTSEARCH_OFF} Or (mSearchIn = 'c'){$ENDIF} Then Begin - - StartCounter := 0; - EndCounter := W_S.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_S[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_S[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_Sh } - If (mSearchIn = 's') Then Begin - - StartCounter := 0; - EndCounter := W_Sh.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_Sh[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_Sh[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_Ss } - If (mSearchIn = 's'){$IFDEF FASTSEARCH_OFF} Or (mSearchIn = 'x'){$ENDIF} Then Begin - - StartCounter := 0; - EndCounter := W_Ss.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_Ss[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_Ss[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_T } - If (mSearchIn = 't') Then Begin - - StartCounter := 0; - EndCounter := W_T.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_T[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_T[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_Th } - If (mSearchIn = 't') Then Begin - - StartCounter := 0; - EndCounter := W_Th.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_Th[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_Th[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_Tt } - If (mSearchIn = 't') Then Begin - - StartCounter := 0; - EndCounter := W_Tt.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_Tt[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_Tt[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_Tth } - If (mSearchIn = 't') Then Begin - - StartCounter := 0; - EndCounter := W_Tth.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_Tth[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_Tth[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_Y } - If (mSearchIn = 'u') Or (mSearchIn = 'o') Or (mSearchIn = 'i') Or (mSearchIn = 'e') Or (mSearchIn = 'a') or (mSearchIn = 'y') Then Begin - - StartCounter := 0; - EndCounter := W_Y.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_Y[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_Y[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_Z } - If (mSearchIn = 'j') Or (mSearchIn = 'z') Then Begin - - StartCounter := 0; - EndCounter := W_Z.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_Z[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_Z[I])); - End; - End; - End; - { ***************************************** } - - - { ***************************************** } - { Search W_Khandatta } - If (mSearchIn = 't') Then Begin - - StartCounter := 0; - EndCounter := W_Khandatta.Count - 1; - TotalSearch := TotalSearch + EndCounter + 1; - - - For I := StartCounter To EndCounter Do Begin - theMatch := theRegex.Match(W_Khandatta[I], RegExOpt); - If theMatch.Success Then Begin - wList.Add(UTF8ToString(W_Khandatta[I])); - End; - End; - End; - { ***************************************** } + RegularExpressions, + uDBase, + StrUtils, + SysUtils; +Function SearchPhonetic(SearchIn, SearchStr: String; + Var wList: TStringList): Integer; +Var + theRegex: TRegex; + theMatch: TMatch; - wList.EndUpdate; + I: Integer; + WideSearchStr: string; + mSearchIn: String; - Result := TotalSearch; + StartCounter, EndCounter: Integer; + TotalSearch: Integer; { For diagnosis purpose } +Begin + wList.Clear; + wList.Sorted := True; + wList.Duplicates := dupIgnore; + + TotalSearch := 0; + WideSearchStr := ('^') + (SearchStr) + ('$'); + theRegex := TRegex.Create(WideSearchStr); + + mSearchIn := LeftStr(LowerCase(SearchIn), 1); + + wList.BeginUpdate; + + { ***************************************** } + { Search W_A } + If (mSearchIn = 'o') Or (mSearchIn = 'a') Then + Begin + + StartCounter := 0; + EndCounter := W_A.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_A[I]); + If theMatch.Success Then + Begin + wList.Add((W_A[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_AA } + If {$IFDEF FASTSEARCH_OFF}(mSearchIn = 'r') Or {$ENDIF} + (mSearchIn = 'i') Or (mSearchIn = 'a') Then + Begin + + StartCounter := 0; + EndCounter := W_AA.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_AA[I]); + If theMatch.Success Then + Begin + wList.Add((W_AA[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_I } + If (mSearchIn = 'y') + +{$IFDEF FASTSEARCH_OFF} Or (mSearchIn = 'u'){$ENDIF} + Or (mSearchIn = 'i') Or (mSearchIn = 'e') Then + Begin + + StartCounter := 0; + EndCounter := W_I.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_I[I]); + If theMatch.Success Then + Begin + wList.Add((W_I[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_II } + If (mSearchIn = 'i') Or (mSearchIn = 'e') Then + Begin + + StartCounter := 0; + EndCounter := W_II.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_II[I]); + If theMatch.Success Then + Begin + wList.Add((W_II[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_U } + If (mSearchIn = 'u') Or (mSearchIn = 'o') Then + Begin + + StartCounter := 0; + EndCounter := W_U.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_U[I]); + If theMatch.Success Then + Begin + wList.Add((W_U[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_UU } + If (mSearchIn = 'u') Or (mSearchIn = 'o') Then + Begin + + StartCounter := 0; + EndCounter := W_UU.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_UU[I]); + If theMatch.Success Then + Begin + wList.Add((W_UU[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_RRI } + If (mSearchIn = 'r') Then + Begin + + StartCounter := 0; + EndCounter := W_RRI.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_RRI[I]); + If theMatch.Success Then + Begin + wList.Add((W_RRI[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_E } + If (mSearchIn = 'x'){$IFDEF FASTSEARCH_OFF} Or (mSearchIn = 's') Or + (mSearchIn = 'n') Or (mSearchIn = 'm') Or (mSearchIn = 'l') Or + (mSearchIn = 'h') Or (mSearchIn = 'f'){$ENDIF} + Or (mSearchIn = 'e') Or (mSearchIn = 'a') Then + Begin + + StartCounter := 0; + EndCounter := W_E.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_E[I]); + If theMatch.Success Then + Begin + wList.Add((W_E[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_OI } + If (mSearchIn = 'a') Or (mSearchIn = 'o') Then + Begin + + StartCounter := 0; + EndCounter := W_OI.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_OI[I]); + If theMatch.Success Then + Begin + wList.Add((W_OI[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_O } + If {$IFDEF FASTSEARCH_OFF}(mSearchIn = 'y') Or +{$ENDIF}(mSearchIn = 'w') Or (mSearchIn = 'o') Or (mSearchIn = 'a') Then + Begin + + StartCounter := 0; + EndCounter := W_O.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_O[I]); + If theMatch.Success Then + Begin + wList.Add((W_O[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_OU } + If (mSearchIn = 'o') Then + Begin + + StartCounter := 0; + EndCounter := W_OU.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_OU[I]); + If theMatch.Success Then + Begin + wList.Add((W_OU[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_B } + If (mSearchIn = 'b') Then + Begin + + StartCounter := 0; + EndCounter := W_B.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_B[I]); + If theMatch.Success Then + Begin + wList.Add((W_B[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_BH } + If (mSearchIn = 'b') Or (mSearchIn = 'v') Then + Begin + + StartCounter := 0; + EndCounter := W_BH.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_BH[I]); + If theMatch.Success Then + Begin + wList.Add((W_BH[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_C } + If (mSearchIn = 'c') Then + Begin + + StartCounter := 0; + EndCounter := W_C.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_C[I]); + If theMatch.Success Then + Begin + wList.Add((W_C[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_CH } + If (mSearchIn = 'c') Then + Begin + + StartCounter := 0; + EndCounter := W_CH.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_CH[I]); + If theMatch.Success Then + Begin + wList.Add((W_CH[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_D } + If (mSearchIn = 'd') Then + Begin + + StartCounter := 0; + EndCounter := W_D.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_D[I]); + If theMatch.Success Then + Begin + wList.Add((W_D[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_Dh } + If (mSearchIn = 'd') Then + Begin + + StartCounter := 0; + EndCounter := W_Dh.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_Dh[I]); + If theMatch.Success Then + Begin + wList.Add((W_Dh[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_Dd } + If {$IFDEF FASTSEARCH_OFF}(mSearchIn = 'w') Or +{$ENDIF}(mSearchIn = 'd') Then + Begin + + StartCounter := 0; + EndCounter := W_Dd.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_Dd[I]); + If theMatch.Success Then + Begin + wList.Add((W_Dd[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_Ddh } + If (mSearchIn = 'd') Then + Begin + + StartCounter := 0; + EndCounter := W_Ddh.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_Ddh[I]); + If theMatch.Success Then + Begin + wList.Add((W_Ddh[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_G } + If (mSearchIn = 'g') Then + Begin + + StartCounter := 0; + EndCounter := W_G.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_G[I]); + If theMatch.Success Then + Begin + wList.Add((W_G[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_Gh } + If (mSearchIn = 'g') Then + Begin + + StartCounter := 0; + EndCounter := W_Gh.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_Gh[I]); + If theMatch.Success Then + Begin + wList.Add((W_Gh[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_H } + If (mSearchIn = 'z') Or (mSearchIn = 'r') Or (mSearchIn = 'm') Or + (mSearchIn = 'h') Then + Begin + + StartCounter := 0; + EndCounter := W_H.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_H[I]); + If theMatch.Success Then + Begin + wList.Add((W_H[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_J } + If (mSearchIn = 'z') Or (mSearchIn = 'j') Or (mSearchIn = 'g') Then + Begin + + StartCounter := 0; + EndCounter := W_J.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_J[I]); + If theMatch.Success Then + Begin + wList.Add((W_J[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_Jh } + If (mSearchIn = 'j') Or (mSearchIn = 'z') Then + Begin + + StartCounter := 0; + EndCounter := W_Jh.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_Jh[I]); + If theMatch.Success Then + Begin + wList.Add((W_Jh[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_K } + If (mSearchIn = 'x') Or (mSearchIn = 'q') Or (mSearchIn = 'k') Or + (mSearchIn = 'c') Then + Begin + + StartCounter := 0; + EndCounter := W_K.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_K[I]); + If theMatch.Success Then + Begin + wList.Add((W_K[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_Kh } + If (mSearchIn = 'k') Then + Begin + + StartCounter := 0; + EndCounter := W_Kh.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_Kh[I]); + If theMatch.Success Then + Begin + wList.Add((W_Kh[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_L } + If (mSearchIn = 'l') Then + Begin + + StartCounter := 0; + EndCounter := W_L.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_L[I]); + If theMatch.Success Then + Begin + wList.Add((W_L[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_M } + If (mSearchIn = 'm') Then + Begin + + StartCounter := 0; + EndCounter := W_M.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_M[I]); + If theMatch.Success Then + Begin + wList.Add((W_M[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_N } + If (mSearchIn = 'n') Then + Begin + + StartCounter := 0; + EndCounter := W_N.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_N[I]); + If theMatch.Success Then + Begin + wList.Add((W_N[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_NGA } + If (mSearchIn = 'n') Then + Begin + + StartCounter := 0; + EndCounter := W_NGA.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_NGA[I]); + If theMatch.Success Then + Begin + wList.Add((W_NGA[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_NYA } + If (mSearchIn = 'n') Or (mSearchIn = 'a') Then + Begin + + StartCounter := 0; + EndCounter := W_NYA.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_NYA[I]); + If theMatch.Success Then + Begin + wList.Add((W_NYA[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_Nn } + If (mSearchIn = 'n') Then + Begin + + StartCounter := 0; + EndCounter := W_Nn.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_Nn[I]); + If theMatch.Success Then + Begin + wList.Add((W_Nn[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_P } + If (mSearchIn = 'p') Then + Begin + + StartCounter := 0; + EndCounter := W_P.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_P[I]); + If theMatch.Success Then + Begin + wList.Add((W_P[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_Ph } + If (mSearchIn = 'p') Or (mSearchIn = 'f') Then + Begin + + StartCounter := 0; + EndCounter := W_Ph.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_Ph[I]); + If theMatch.Success Then + Begin + wList.Add((W_Ph[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_R } + If (mSearchIn = 'r') Then + Begin + + StartCounter := 0; + EndCounter := W_R.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_R[I]); + If theMatch.Success Then + Begin + wList.Add((W_R[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_Rr } + If (mSearchIn = 'r') Then + Begin + + StartCounter := 0; + EndCounter := W_Rr.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_Rr[I]); + If theMatch.Success Then + Begin + wList.Add((W_Rr[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_Rrh } + If (mSearchIn = 'r') Then + Begin + + StartCounter := 0; + EndCounter := W_Rrh.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_Rrh[I]); + If theMatch.Success Then + Begin + wList.Add((W_Rrh[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_S } + If (mSearchIn = 's'){$IFDEF FASTSEARCH_OFF} Or (mSearchIn = 'c'){$ENDIF} Then + Begin + + StartCounter := 0; + EndCounter := W_S.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_S[I]); + If theMatch.Success Then + Begin + wList.Add((W_S[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_Sh } + If (mSearchIn = 's') Then + Begin + + StartCounter := 0; + EndCounter := W_Sh.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_Sh[I]); + If theMatch.Success Then + Begin + wList.Add((W_Sh[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_Ss } + If (mSearchIn = 's'){$IFDEF FASTSEARCH_OFF} Or (mSearchIn = 'x'){$ENDIF} Then + Begin + + StartCounter := 0; + EndCounter := W_Ss.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_Ss[I]); + If theMatch.Success Then + Begin + wList.Add((W_Ss[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_T } + If (mSearchIn = 't') Then + Begin + + StartCounter := 0; + EndCounter := W_T.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_T[I]); + If theMatch.Success Then + Begin + wList.Add((W_T[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_Th } + If (mSearchIn = 't') Then + Begin + + StartCounter := 0; + EndCounter := W_Th.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_Th[I]); + If theMatch.Success Then + Begin + wList.Add((W_Th[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_Tt } + If (mSearchIn = 't') Then + Begin + + StartCounter := 0; + EndCounter := W_Tt.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_Tt[I]); + If theMatch.Success Then + Begin + wList.Add((W_Tt[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_Tth } + If (mSearchIn = 't') Then + Begin + + StartCounter := 0; + EndCounter := W_Tth.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_Tth[I]); + If theMatch.Success Then + Begin + wList.Add((W_Tth[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_Y } + If (mSearchIn = 'u') Or (mSearchIn = 'o') Or (mSearchIn = 'i') Or + (mSearchIn = 'e') Or (mSearchIn = 'a') or (mSearchIn = 'y') Then + Begin + + StartCounter := 0; + EndCounter := W_Y.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_Y[I]); + If theMatch.Success Then + Begin + wList.Add((W_Y[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_Z } + If (mSearchIn = 'j') Or (mSearchIn = 'z') Then + Begin + + StartCounter := 0; + EndCounter := W_Z.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_Z[I]); + If theMatch.Success Then + Begin + wList.Add((W_Z[I])); + End; + End; + End; + { ***************************************** } + + { ***************************************** } + { Search W_Khandatta } + If (mSearchIn = 't') Then + Begin + + StartCounter := 0; + EndCounter := W_Khandatta.Count - 1; + TotalSearch := TotalSearch + EndCounter + 1; + + For I := StartCounter To EndCounter Do + Begin + theMatch := theRegex.Match(W_Khandatta[I]); + If theMatch.Success Then + Begin + wList.Add((W_Khandatta[I])); + End; + End; + End; + { ***************************************** } + + wList.EndUpdate; + + Result := TotalSearch; End; End. diff --git a/Keyboard and Spell checker/Units/uRegistrySettings.pas b/Keyboard and Spell checker/Units/uRegistrySettings.pas index 49cb1af..1bc54ea 100644 --- a/Keyboard and Spell checker/Units/uRegistrySettings.pas +++ b/Keyboard and Spell checker/Units/uRegistrySettings.pas @@ -1,32 +1,31 @@ { - ============================================================================= - ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + ============================================================================= + ***************************************************************************** + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. - ***************************************************************************** - ============================================================================= + ***************************************************************************** + ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - { COMPLETE TRANSFERING! } Unit uRegistrySettings; @@ -34,99 +33,88 @@ Interface Uses - Classes, - Sysutils, - clsRegistry_XMLSetting, - uWindowHandlers, - Windows, - Forms, - StrUtils; + Classes, + Sysutils, + clsRegistry_XMLSetting, + uWindowHandlers, + Windows, + Forms, + StrUtils; Const - NumberOfVisibleHints: Integer = 2; - + NumberOfVisibleHints: Integer = 2; Var - DontShowComplexLNotification: String; - DontShowStartupWizard: String; - - // General settings - StartWithWindows: String; - ShowSplash: String; - DefaultUIMode: String; - LastUIMode: String; - TopBarPosX: String; - TopBarXButton: String; - - - // Inteface Settings - TopBarTransparent: String; - TopBarTransparencyLevel: String; - InterfaceSkin: String; - TrayHintShowTimes: String; - TopHintShowTimes: String; - - // Webbuddy Options - AvroUpdateCheck: String; - AvroUpdateLastCheck: TDateTime; - - - // Hotkey settings - ModeSwitchKey: String; - ToggleOutputModeKey: String; - SpellerLauncherKey: String; - - - // Avro Mouse Settings - AvroMouseChangeModeLocale: String; - AvroMousePosX: String; - AvroMousePosY: String; - - // Avro Phonetic Settings - PhoneticAutoCorrect: String; - ShowPrevWindow: String; - PhoneticMode: String; - SaveCandidate: String; - AddToPhoneticDict: String; - TabBrowsing: String; - PipeToDot: String; - EnableJoNukta: String; - - - // Input Locale Settings - ChangeInputLocale: String; - PrefferedLocale: String; - - // Fixed Layout Settings - DefaultLayout: String; // NOT A Fixed Layout SETTING! - OldStyleReph: String; - VowelFormating: String; - NumPadBangla: String; - FullOldStyleTyping: String; - AutomaticallyFixChandra: String; - - - - - // Keyboard Layout Viewer Settings - ShowLayoutOnTop: String; - SavePosLayoutViewer: String; - LayoutViewerPosX: String; - LayoutViewerPosY: String; - LayoutViewerSize: String; - - // Global Output settings - OutputIsBijoy: String; - ShowOutputwarning: String; - - + DontShowComplexLNotification: String; + DontShowStartupWizard: String; + + // General settings + StartWithWindows: String; + ShowSplash: String; + DefaultUIMode: String; + LastUIMode: String; + TopBarPosX: String; + TopBarXButton: String; + + // Inteface Settings + TopBarTransparent: String; + TopBarTransparencyLevel: String; + InterfaceSkin: String; + TrayHintShowTimes: String; + TopHintShowTimes: String; + + // Webbuddy Options + AvroUpdateCheck: String; + AvroUpdateLastCheck: TDateTime; + + // Hotkey settings + ModeSwitchKey: String; + ToggleOutputModeKey: String; + SpellerLauncherKey: String; + + // Avro Mouse Settings + AvroMouseChangeModeLocale: String; + AvroMousePosX: String; + AvroMousePosY: String; + + // Avro Phonetic Settings + PhoneticAutoCorrect: String; + ShowPrevWindow: String; + PhoneticMode: String; + SaveCandidate: String; + AddToPhoneticDict: String; + TabBrowsing: String; + PipeToDot: String; + EnableJoNukta: String; + + // Input Locale Settings + ChangeInputLocale: String; + PrefferedLocale: String; + + // Fixed Layout Settings + DefaultLayout: String; // NOT A Fixed Layout SETTING! + OldStyleReph: String; + VowelFormating: String; + NumPadBangla: String; + FullOldStyleTyping: String; + AutomaticallyFixChandra: String; + + // Keyboard Layout Viewer Settings + ShowLayoutOnTop: String; + SavePosLayoutViewer: String; + LayoutViewerPosX: String; + LayoutViewerPosY: String; + LayoutViewerSize: String; + + // Global Output settings + OutputIsBijoy: String; + ShowOutputwarning: String; Procedure SaveUISettings; Procedure LoadSettings; Procedure ValidateSettings; Procedure SaveSettings; - Procedure LoadSettingsFromFile; Procedure SaveSettingsInXML; @@ -136,101 +124,103 @@ Implementation Uses - uForm1, - uTopBar, - WindowsVersion, - uLocale; + uForm1, + uTopBar, + WindowsVersion, + uLocale; { =============================================================================== } Procedure LoadSettingsFromFile; Var - Reg: TMyRegistry; - XML: TXMLSetting; + Reg: TMyRegistry; + XML: TXMLSetting; Begin - Reg := TMyRegistry.create; - Reg.RootKey := HKEY_CURRENT_USER; - - If Reg.OpenKey('Control Panel\Desktop', True) = True Then Begin - Reg.WriteInteger('LowLevelHooksTimeout', 5000); - End; - - Reg.Free; - - XML := TXMLSetting.create; - XML.LoadXMLData; - - DontShowComplexLNotification := UpperCase(XML.GetValue('DontShowComplexLNotification', 'NO')); - DontShowStartupWizard := UpperCase(XML.GetValue('DontShowStartupWizard', 'NO')); - - // General settings - StartWithWindows := UpperCase(XML.GetValue('StartWithWindows', 'Yes')); - DefaultUIMode := UpperCase(XML.GetValue('DefaultUIMode', 'LastUI')); - ShowSplash := UpperCase(XML.GetValue('ShowSplash', 'YES')); - LastUIMode := UpperCase(XML.GetValue('LastUIMode', 'Top Bar')); - TopBarPosX := UpperCase(XML.GetValue('TopBarPosX', '1000000')); - TopBarXButton := UpperCase(XML.GetValue('TopBarXButton', 'Show Menu')); - TopBarTransparent := UpperCase(XML.GetValue('TopBarTransparent', 'Yes')); - - // Inteface Settings - InterfaceSkin := XML.GetValue('InterfaceSkin', 'internalskin*'); - TopBarTransparencyLevel := XML.GetValue('TopBarTransparencyLevel', '80'); - TopBarTransparent := XML.GetValue('TopBarTransparent', 'YES'); - TrayHintShowTimes := XML.GetValue('TrayHintShowTimes', '0'); - TopHintShowTimes := XML.GetValue('TopHintShowTimes', '0'); - - - // Webbuddy Options - AvroUpdateCheck := UpperCase(XML.GetValue('AvroUpdateCheck', 'Yes')); - AvroUpdateLastCheck := XML.GetValue('AvroUpdateLastCheck', Now); - - - // Hotkey settings - ModeSwitchKey := UpperCase(XML.GetValue('ModeSwitchKey', 'F12')); - ToggleOutputModeKey := UpperCase(XML.GetValue('ToggleOutputModeKey', 'F12')); - SpellerLauncherKey := UpperCase(XML.GetValue('SpellerLauncherKey', 'F7')); - - // Avro Mouse Settings - AvroMouseChangeModeLocale := UpperCase(XML.GetValue('AvroMouseChangeModeLocale', 'No')); - AvroMousePosX := UpperCase(XML.GetValue('AvroMousePosX', '0')); - AvroMousePosY := UpperCase(XML.GetValue('AvroMousePosY', '0')); - - // Avro Phonetic Settings - PhoneticAutoCorrect := UpperCase(XML.GetValue('PhoneticAutoCorrect', 'Yes')); - ShowPrevWindow := UpperCase(XML.GetValue('ShowPrevWindow', 'Yes')); - PhoneticMode := UpperCase(XML.GetValue('PhoneticMode', 'CHAR')); - SaveCandidate := UpperCase(XML.GetValue('SaveCandidate', 'YES')); - AddToPhoneticDict := UpperCase(XML.GetValue('AddToPhoneticDict', 'YES')); - TabBrowsing := UpperCase(XML.GetValue('TabBrowsing', 'YES')); - PipeToDot := UpperCase(XML.GetValue('PipeToDot', 'YES')); - EnableJoNukta := UpperCase(XML.GetValue('EnableJoNukta', 'NO')); - - - // Input Locale Settings - ChangeInputLocale := UpperCase(XML.GetValue('ChangeInputLocale', 'NO')); - PrefferedLocale := UpperCase(XML.GetValue('PrefferedLocale', 'India')); - // PrefferedLocaleEnglish := XML.GetValue('PrefferedLocaleEnglish', 'Locale:00000409'); - - // Tools Settings - OldStyleReph := UpperCase(XML.GetValue('OldStyleReph', 'Yes')); - VowelFormating := UpperCase(XML.GetValue('VowelFormating', 'Yes')); - NumPadBangla := UpperCase(XML.GetValue('NumPadBangla', 'Yes')); - FullOldStyleTyping := UpperCase(XML.GetValue('FullOldStyleTyping', 'No')); - AutomaticallyFixChandra := UpperCase(XML.GetValue('AutomaticallyFixChandra', 'Yes')); - - // Keyboard Layout Viewer Settings - DefaultLayout := XML.GetValue('DefaultLayout', 'avrophonetic*'); - ShowLayoutOnTop := UpperCase(XML.GetValue('ShowLayoutOnTop', 'Yes')); - SavePosLayoutViewer := UpperCase(XML.GetValue('SavePosLayoutViewer', 'Yes')); - LayoutViewerPosX := UpperCase(XML.GetValue('LayoutViewerPosX', '0')); - LayoutViewerPosY := UpperCase(XML.GetValue('LayoutViewerPosY', '0')); - LayoutViewerSize := UpperCase(XML.GetValue('LayoutViewerSize', '60%')); - - // Global Output settings - OutputIsBijoy := UpperCase(XML.GetValue('OutputIsBijoy', 'No')); - ShowOutputwarning := UpperCase(XML.GetValue('ShowOutputwarning', 'Yes')); - - XML.Free; + Reg := TMyRegistry.create; + Reg.RootKey := HKEY_CURRENT_USER; + + If Reg.OpenKey('Control Panel\Desktop', True) = True Then + Begin + Reg.WriteInteger('LowLevelHooksTimeout', 5000); + End; + + Reg.Free; + + XML := TXMLSetting.create; + XML.LoadXMLData; + + DontShowComplexLNotification := + UpperCase(XML.GetValue('DontShowComplexLNotification', 'NO')); + DontShowStartupWizard := + UpperCase(XML.GetValue('DontShowStartupWizard', 'NO')); + + // General settings + StartWithWindows := UpperCase(XML.GetValue('StartWithWindows', 'Yes')); + DefaultUIMode := UpperCase(XML.GetValue('DefaultUIMode', 'LastUI')); + ShowSplash := UpperCase(XML.GetValue('ShowSplash', 'YES')); + LastUIMode := UpperCase(XML.GetValue('LastUIMode', 'Top Bar')); + TopBarPosX := UpperCase(XML.GetValue('TopBarPosX', '1000000')); + TopBarXButton := UpperCase(XML.GetValue('TopBarXButton', 'Show Menu')); + TopBarTransparent := UpperCase(XML.GetValue('TopBarTransparent', 'Yes')); + + // Inteface Settings + InterfaceSkin := XML.GetValue('InterfaceSkin', 'internalskin*'); + TopBarTransparencyLevel := XML.GetValue('TopBarTransparencyLevel', '80'); + TopBarTransparent := XML.GetValue('TopBarTransparent', 'YES'); + TrayHintShowTimes := XML.GetValue('TrayHintShowTimes', '0'); + TopHintShowTimes := XML.GetValue('TopHintShowTimes', '0'); + + // Webbuddy Options + AvroUpdateCheck := UpperCase(XML.GetValue('AvroUpdateCheck', 'Yes')); + AvroUpdateLastCheck := XML.GetValue('AvroUpdateLastCheck', Now); + + // Hotkey settings + ModeSwitchKey := UpperCase(XML.GetValue('ModeSwitchKey', 'F12')); + ToggleOutputModeKey := UpperCase(XML.GetValue('ToggleOutputModeKey', 'F12')); + SpellerLauncherKey := UpperCase(XML.GetValue('SpellerLauncherKey', 'F7')); + + // Avro Mouse Settings + AvroMouseChangeModeLocale := + UpperCase(XML.GetValue('AvroMouseChangeModeLocale', 'No')); + AvroMousePosX := UpperCase(XML.GetValue('AvroMousePosX', '0')); + AvroMousePosY := UpperCase(XML.GetValue('AvroMousePosY', '0')); + + // Avro Phonetic Settings + PhoneticAutoCorrect := UpperCase(XML.GetValue('PhoneticAutoCorrect', 'Yes')); + ShowPrevWindow := UpperCase(XML.GetValue('ShowPrevWindow', 'Yes')); + PhoneticMode := UpperCase(XML.GetValue('PhoneticMode', 'CHAR')); + SaveCandidate := UpperCase(XML.GetValue('SaveCandidate', 'YES')); + AddToPhoneticDict := UpperCase(XML.GetValue('AddToPhoneticDict', 'YES')); + TabBrowsing := UpperCase(XML.GetValue('TabBrowsing', 'YES')); + PipeToDot := UpperCase(XML.GetValue('PipeToDot', 'YES')); + EnableJoNukta := UpperCase(XML.GetValue('EnableJoNukta', 'NO')); + + // Input Locale Settings + ChangeInputLocale := UpperCase(XML.GetValue('ChangeInputLocale', 'NO')); + PrefferedLocale := UpperCase(XML.GetValue('PrefferedLocale', 'India')); + // PrefferedLocaleEnglish := XML.GetValue('PrefferedLocaleEnglish', 'Locale:00000409'); + + // Tools Settings + OldStyleReph := UpperCase(XML.GetValue('OldStyleReph', 'Yes')); + VowelFormating := UpperCase(XML.GetValue('VowelFormating', 'Yes')); + NumPadBangla := UpperCase(XML.GetValue('NumPadBangla', 'Yes')); + FullOldStyleTyping := UpperCase(XML.GetValue('FullOldStyleTyping', 'No')); + AutomaticallyFixChandra := + UpperCase(XML.GetValue('AutomaticallyFixChandra', 'Yes')); + + // Keyboard Layout Viewer Settings + DefaultLayout := XML.GetValue('DefaultLayout', 'avrophonetic*'); + ShowLayoutOnTop := UpperCase(XML.GetValue('ShowLayoutOnTop', 'Yes')); + SavePosLayoutViewer := UpperCase(XML.GetValue('SavePosLayoutViewer', 'Yes')); + LayoutViewerPosX := UpperCase(XML.GetValue('LayoutViewerPosX', '0')); + LayoutViewerPosY := UpperCase(XML.GetValue('LayoutViewerPosY', '0')); + LayoutViewerSize := UpperCase(XML.GetValue('LayoutViewerSize', '60%')); + + // Global Output settings + OutputIsBijoy := UpperCase(XML.GetValue('OutputIsBijoy', 'No')); + ShowOutputwarning := UpperCase(XML.GetValue('ShowOutputwarning', 'Yes')); + + XML.Free; End; @@ -238,175 +228,182 @@ Procedure SaveSettingsInXML; Var - XML: TXMLSetting; + XML: TXMLSetting; Begin - XML := TXMLSetting.create; - XML.CreateNewXMLData; - - XML.SetValue('DontShowComplexLNotification', DontShowComplexLNotification); - XML.SetValue('DontShowStartupWizard', DontShowStartupWizard); - - // General settings - XML.SetValue('StartWithWindows', StartWithWindows); - XML.SetValue('ShowSplash', ShowSplash); - XML.SetValue('DefaultUIMode', DefaultUIMode); - XML.SetValue('LastUIMode', LastUIMode); - XML.SetValue('TopBarPosX', TopBarPosX); - XML.SetValue('TopBarXButton', TopBarXButton); - XML.SetValue('TopBarTransparent', TopBarTransparent); - - - // Inteface Settings - XML.SetValue('InterfaceSkin', InterfaceSkin); - XML.SetValue('TopBarTransparencyLevel', TopBarTransparencyLevel); - XML.SetValue('TopBarTransparent', TopBarTransparent); - XML.SetValue('TrayHintShowTimes', TrayHintShowTimes); - XML.SetValue('TopHintShowTimes', TopHintShowTimes); - - - - // Webbuddy Options - XML.SetValue('AvroUpdateCheck', AvroUpdateCheck); - XML.SetValue('AvroUpdateLastCheck', AvroUpdateLastCheck); - - // Hotkey settings - XML.SetValue('ModeSwitchKey', ModeSwitchKey); - XML.SetValue('ToggleOutputModeKey', ToggleOutputModeKey); - XML.SetValue('SpellerLauncherKey', SpellerLauncherKey); - - // Avro Mouse Settings - XML.SetValue('AvroMouseChangeModeLocale', AvroMouseChangeModeLocale); - XML.SetValue('AvroMousePosX', AvroMousePosX); - XML.SetValue('AvroMousePosY', AvroMousePosY); - // XML.SetValue('AvroMouseSavePos', AvroMouseSavePos); - - // Avro Phonetic Settings - XML.SetValue('PhoneticAutoCorrect', PhoneticAutoCorrect); - XML.SetValue('ShowPrevWindow', ShowPrevWindow); - XML.SetValue('PhoneticMode', PhoneticMode); - XML.SetValue('SaveCandidate', SaveCandidate); - XML.SetValue('AddToPhoneticDict', AddToPhoneticDict); - XML.SetValue('TabBrowsing', TabBrowsing); - XML.SetValue('PipeToDot', PipeToDot); - XML.SetValue('EnableJoNukta', EnableJoNukta); - - // Input Locale Settings - XML.SetValue('ChangeInputLocale', ChangeInputLocale); - XML.SetValue('PrefferedLocale', PrefferedLocale); - - // Tools Settings - XML.SetValue('OldStyleReph', OldStyleReph); - XML.SetValue('VowelFormating', VowelFormating); - XML.SetValue('NumPadBangla', NumPadBangla); - XML.SetValue('AutomaticallyFixChandra', AutomaticallyFixChandra); - XML.SetValue('FullOldStyleTyping', FullOldStyleTyping); - - // Keyboard Layout Viewer Settings - XML.SetValue('DefaultLayout', DefaultLayout); - XML.SetValue('ShowLayoutOnTop', ShowLayoutOnTop); - XML.SetValue('SavePosLayoutViewer', SavePosLayoutViewer); - XML.SetValue('LayoutViewerPosX', LayoutViewerPosX); - XML.SetValue('LayoutViewerPosY', LayoutViewerPosY); - XML.SetValue('LayoutViewerSize', LayoutViewerSize); - - - // Global Output settings - XML.SetValue('OutputIsBijoy', OutputIsBijoy); - XML.SetValue('ShowOutputwarning', ShowOutputwarning); - - - XML.SaveXMLData; - XML.Free; - + XML := TXMLSetting.create; + XML.CreateNewXMLData; + + XML.SetValue('DontShowComplexLNotification', DontShowComplexLNotification); + XML.SetValue('DontShowStartupWizard', DontShowStartupWizard); + + // General settings + XML.SetValue('StartWithWindows', StartWithWindows); + XML.SetValue('ShowSplash', ShowSplash); + XML.SetValue('DefaultUIMode', DefaultUIMode); + XML.SetValue('LastUIMode', LastUIMode); + XML.SetValue('TopBarPosX', TopBarPosX); + XML.SetValue('TopBarXButton', TopBarXButton); + XML.SetValue('TopBarTransparent', TopBarTransparent); + + // Inteface Settings + XML.SetValue('InterfaceSkin', InterfaceSkin); + XML.SetValue('TopBarTransparencyLevel', TopBarTransparencyLevel); + XML.SetValue('TopBarTransparent', TopBarTransparent); + XML.SetValue('TrayHintShowTimes', TrayHintShowTimes); + XML.SetValue('TopHintShowTimes', TopHintShowTimes); + + // Webbuddy Options + XML.SetValue('AvroUpdateCheck', AvroUpdateCheck); + XML.SetValue('AvroUpdateLastCheck', AvroUpdateLastCheck); + + // Hotkey settings + XML.SetValue('ModeSwitchKey', ModeSwitchKey); + XML.SetValue('ToggleOutputModeKey', ToggleOutputModeKey); + XML.SetValue('SpellerLauncherKey', SpellerLauncherKey); + + // Avro Mouse Settings + XML.SetValue('AvroMouseChangeModeLocale', AvroMouseChangeModeLocale); + XML.SetValue('AvroMousePosX', AvroMousePosX); + XML.SetValue('AvroMousePosY', AvroMousePosY); + // XML.SetValue('AvroMouseSavePos', AvroMouseSavePos); + + // Avro Phonetic Settings + XML.SetValue('PhoneticAutoCorrect', PhoneticAutoCorrect); + XML.SetValue('ShowPrevWindow', ShowPrevWindow); + XML.SetValue('PhoneticMode', PhoneticMode); + XML.SetValue('SaveCandidate', SaveCandidate); + XML.SetValue('AddToPhoneticDict', AddToPhoneticDict); + XML.SetValue('TabBrowsing', TabBrowsing); + XML.SetValue('PipeToDot', PipeToDot); + XML.SetValue('EnableJoNukta', EnableJoNukta); + + // Input Locale Settings + XML.SetValue('ChangeInputLocale', ChangeInputLocale); + XML.SetValue('PrefferedLocale', PrefferedLocale); + + // Tools Settings + XML.SetValue('OldStyleReph', OldStyleReph); + XML.SetValue('VowelFormating', VowelFormating); + XML.SetValue('NumPadBangla', NumPadBangla); + XML.SetValue('AutomaticallyFixChandra', AutomaticallyFixChandra); + XML.SetValue('FullOldStyleTyping', FullOldStyleTyping); + + // Keyboard Layout Viewer Settings + XML.SetValue('DefaultLayout', DefaultLayout); + XML.SetValue('ShowLayoutOnTop', ShowLayoutOnTop); + XML.SetValue('SavePosLayoutViewer', SavePosLayoutViewer); + XML.SetValue('LayoutViewerPosX', LayoutViewerPosX); + XML.SetValue('LayoutViewerPosY', LayoutViewerPosY); + XML.SetValue('LayoutViewerSize', LayoutViewerSize); + + // Global Output settings + XML.SetValue('OutputIsBijoy', OutputIsBijoy); + XML.SetValue('ShowOutputwarning', ShowOutputwarning); + + XML.SaveXMLData; + XML.Free; End; { =============================================================================== } - Procedure LoadSettingsFromRegistry; Var - Reg: TMyRegistry; + Reg: TMyRegistry; Begin - Reg := TMyRegistry.create; - Reg.RootKey := HKEY_CURRENT_USER; - - If Reg.OpenKey('Control Panel\Desktop', True) = True Then Begin - Reg.WriteInteger('LowLevelHooksTimeout', 5000); - End; - Reg.CloseKey; - - Reg.RootKey := HKEY_CURRENT_USER; - If Reg.OpenKey('Software\OmicronLab\Avro Keyboard', True) = True Then Begin - DontShowComplexLNotification := UpperCase(Reg.ReadStringDef('DontShowComplexLNotification', 'NO')); - DontShowStartupWizard := UpperCase(Reg.ReadStringDef('DontShowStartupWizard', 'NO')); - - // General settings - StartWithWindows := UpperCase(Reg.ReadStringDef('StartWithWindows', 'Yes')); - ShowSplash := UpperCase(Reg.ReadStringDef('ShowSplash', 'Yes')); - DefaultUIMode := UpperCase(Reg.ReadStringDef('DefaultUIMode', 'LastUI')); - LastUIMode := UpperCase(Reg.ReadStringDef('LastUIMode', 'Top Bar')); - TopBarPosX := UpperCase(Reg.ReadStringDef('TopBarPosX', '1000000')); - TopBarXButton := UpperCase(Reg.ReadStringDef('TopBarXButton', 'Show Menu')); - TopBarTransparent := UpperCase(Reg.ReadStringDef('TopBarTransparent', 'Yes')); - AvroUpdateCheck := UpperCase(Reg.ReadStringDef('AvroUpdateCheck', 'Yes')); - AvroUpdateLastCheck := Reg.ReadDateDef('AvroUpdateLastCheck', Now); - - // Inteface Settings - InterfaceSkin := Reg.ReadStringDef('InterfaceSkin', 'internalskin*'); - TopBarTransparencyLevel := Reg.ReadStringDef('TopBarTransparencyLevel', '80'); - TopBarTransparent := Reg.ReadStringDef('TopBarTransparent', 'YES'); - TrayHintShowTimes := Reg.ReadStringDef('TrayHintShowTimes', '0'); - TopHintShowTimes := Reg.ReadStringDef('TopHintShowTimes', '0'); - - - // Hotkey settings - ModeSwitchKey := UpperCase(Reg.ReadStringDef('ModeSwitchKey', 'F12')); - ToggleOutputModeKey := UpperCase(Reg.ReadStringDef('ToggleOutputModeKey', 'F12')); - SpellerLauncherKey := UpperCase(Reg.ReadStringDef('SpellerLauncherKey', 'F7')); - - - // Avro Mouse Settings - AvroMouseChangeModeLocale := UpperCase(Reg.ReadStringDef('AvroMouseChangeModeLocale', 'No')); - AvroMousePosX := UpperCase(Reg.ReadStringDef('AvroMousePosX', '0')); - AvroMousePosY := UpperCase(Reg.ReadStringDef('AvroMousePosY', '0')); - - // Avro Phonetic Settings - PhoneticAutoCorrect := UpperCase(Reg.ReadStringDef('PhoneticAutoCorrect', 'Yes')); - ShowPrevWindow := UpperCase(Reg.ReadStringDef('ShowPrevWindow', 'Yes')); - PhoneticMode := UpperCase(Reg.ReadStringDef('PhoneticMode', 'CHAR')); - SaveCandidate := UpperCase(Reg.ReadStringDef('SaveCandidate', 'YES')); - AddToPhoneticDict := UpperCase(Reg.ReadStringDef('AddToPhoneticDict', 'YES')); - TabBrowsing := UpperCase(Reg.ReadStringDef('TabBrowsing', 'YES')); - PipeToDot := UpperCase(Reg.ReadStringDef('PipeToDot', 'YES')); - EnableJoNukta := UpperCase(Reg.ReadStringDef('EnableJoNukta', 'NO')); - - // Input Locale Settings - ChangeInputLocale := UpperCase(Reg.ReadStringDef('ChangeInputLocale', 'NO')); - PrefferedLocale := UpperCase(Reg.ReadStringDef('PrefferedLocale', 'India')); - - // Tools Settings - OldStyleReph := UpperCase(Reg.ReadStringDef('OldStyleReph', 'Yes')); - VowelFormating := UpperCase(Reg.ReadStringDef('VowelFormating', 'Yes')); - NumPadBangla := UpperCase(Reg.ReadStringDef('NumPadBangla', 'Yes')); - FullOldStyleTyping := UpperCase(Reg.ReadStringDef('FullOldStyleTyping', 'No')); - AutomaticallyFixChandra := UpperCase(Reg.ReadStringDef('AutomaticallyFixChandra', 'Yes')); - - // Keyboard Layout Viewer Settings - DefaultLayout := Reg.ReadStringDef('DefaultLayout', 'avrophonetic*'); - ShowLayoutOnTop := UpperCase(Reg.ReadStringDef('ShowLayoutOnTop', 'Yes')); - SavePosLayoutViewer := UpperCase(Reg.ReadStringDef('SavePosLayoutViewer', 'Yes')); - LayoutViewerPosX := UpperCase(Reg.ReadStringDef('LayoutViewerPosX', '0')); - LayoutViewerPosY := UpperCase(Reg.ReadStringDef('LayoutViewerPosY', '0')); - LayoutViewerSize := UpperCase(Reg.ReadStringDef('LayoutViewerSize', '60%')); - - // Global Output settings - OutputIsBijoy := UpperCase(Reg.ReadStringDef('OutputIsBijoy', 'No')); - ShowOutputwarning := UpperCase(Reg.ReadStringDef('ShowOutputwarning', 'Yes')); - - End; - - Reg.Free; + Reg := TMyRegistry.create; + Reg.RootKey := HKEY_CURRENT_USER; + + If Reg.OpenKey('Control Panel\Desktop', True) = True Then + Begin + Reg.WriteInteger('LowLevelHooksTimeout', 5000); + End; + Reg.CloseKey; + + Reg.RootKey := HKEY_CURRENT_USER; + If Reg.OpenKey('Software\OmicronLab\Avro Keyboard', True) = True Then + Begin + DontShowComplexLNotification := + UpperCase(Reg.ReadStringDef('DontShowComplexLNotification', 'NO')); + DontShowStartupWizard := + UpperCase(Reg.ReadStringDef('DontShowStartupWizard', 'NO')); + + // General settings + StartWithWindows := UpperCase(Reg.ReadStringDef('StartWithWindows', 'Yes')); + ShowSplash := UpperCase(Reg.ReadStringDef('ShowSplash', 'Yes')); + DefaultUIMode := UpperCase(Reg.ReadStringDef('DefaultUIMode', 'LastUI')); + LastUIMode := UpperCase(Reg.ReadStringDef('LastUIMode', 'Top Bar')); + TopBarPosX := UpperCase(Reg.ReadStringDef('TopBarPosX', '1000000')); + TopBarXButton := UpperCase(Reg.ReadStringDef('TopBarXButton', 'Show Menu')); + TopBarTransparent := + UpperCase(Reg.ReadStringDef('TopBarTransparent', 'Yes')); + AvroUpdateCheck := UpperCase(Reg.ReadStringDef('AvroUpdateCheck', 'Yes')); + AvroUpdateLastCheck := Reg.ReadDateDef('AvroUpdateLastCheck', Now); + + // Inteface Settings + InterfaceSkin := Reg.ReadStringDef('InterfaceSkin', 'internalskin*'); + TopBarTransparencyLevel := Reg.ReadStringDef + ('TopBarTransparencyLevel', '80'); + TopBarTransparent := Reg.ReadStringDef('TopBarTransparent', 'YES'); + TrayHintShowTimes := Reg.ReadStringDef('TrayHintShowTimes', '0'); + TopHintShowTimes := Reg.ReadStringDef('TopHintShowTimes', '0'); + + // Hotkey settings + ModeSwitchKey := UpperCase(Reg.ReadStringDef('ModeSwitchKey', 'F12')); + ToggleOutputModeKey := + UpperCase(Reg.ReadStringDef('ToggleOutputModeKey', 'F12')); + SpellerLauncherKey := + UpperCase(Reg.ReadStringDef('SpellerLauncherKey', 'F7')); + + // Avro Mouse Settings + AvroMouseChangeModeLocale := + UpperCase(Reg.ReadStringDef('AvroMouseChangeModeLocale', 'No')); + AvroMousePosX := UpperCase(Reg.ReadStringDef('AvroMousePosX', '0')); + AvroMousePosY := UpperCase(Reg.ReadStringDef('AvroMousePosY', '0')); + + // Avro Phonetic Settings + PhoneticAutoCorrect := + UpperCase(Reg.ReadStringDef('PhoneticAutoCorrect', 'Yes')); + ShowPrevWindow := UpperCase(Reg.ReadStringDef('ShowPrevWindow', 'Yes')); + PhoneticMode := UpperCase(Reg.ReadStringDef('PhoneticMode', 'CHAR')); + SaveCandidate := UpperCase(Reg.ReadStringDef('SaveCandidate', 'YES')); + AddToPhoneticDict := + UpperCase(Reg.ReadStringDef('AddToPhoneticDict', 'YES')); + TabBrowsing := UpperCase(Reg.ReadStringDef('TabBrowsing', 'YES')); + PipeToDot := UpperCase(Reg.ReadStringDef('PipeToDot', 'YES')); + EnableJoNukta := UpperCase(Reg.ReadStringDef('EnableJoNukta', 'NO')); + + // Input Locale Settings + ChangeInputLocale := + UpperCase(Reg.ReadStringDef('ChangeInputLocale', 'NO')); + PrefferedLocale := UpperCase(Reg.ReadStringDef('PrefferedLocale', 'India')); + + // Tools Settings + OldStyleReph := UpperCase(Reg.ReadStringDef('OldStyleReph', 'Yes')); + VowelFormating := UpperCase(Reg.ReadStringDef('VowelFormating', 'Yes')); + NumPadBangla := UpperCase(Reg.ReadStringDef('NumPadBangla', 'Yes')); + FullOldStyleTyping := + UpperCase(Reg.ReadStringDef('FullOldStyleTyping', 'No')); + AutomaticallyFixChandra := + UpperCase(Reg.ReadStringDef('AutomaticallyFixChandra', 'Yes')); + + // Keyboard Layout Viewer Settings + DefaultLayout := Reg.ReadStringDef('DefaultLayout', 'avrophonetic*'); + ShowLayoutOnTop := UpperCase(Reg.ReadStringDef('ShowLayoutOnTop', 'Yes')); + SavePosLayoutViewer := + UpperCase(Reg.ReadStringDef('SavePosLayoutViewer', 'Yes')); + LayoutViewerPosX := UpperCase(Reg.ReadStringDef('LayoutViewerPosX', '0')); + LayoutViewerPosY := UpperCase(Reg.ReadStringDef('LayoutViewerPosY', '0')); + LayoutViewerSize := UpperCase(Reg.ReadStringDef('LayoutViewerSize', '60%')); + + // Global Output settings + OutputIsBijoy := UpperCase(Reg.ReadStringDef('OutputIsBijoy', 'No')); + ShowOutputwarning := + UpperCase(Reg.ReadStringDef('ShowOutputwarning', 'Yes')); + + End; + + Reg.Free; End; @@ -414,99 +411,98 @@ Procedure SaveSettingsInRegistry; Var - Reg: TMyRegistry; + Reg: TMyRegistry; Begin - Reg := TMyRegistry.create; - Reg.RootKey := HKEY_CURRENT_USER; - - If Reg.OpenKey('Software\OmicronLab\Avro Keyboard', True) = True Then Begin - Reg.WriteString('AppPath', ExtractFileDir(Application.ExeName)); - Reg.WriteString('AppExeName', ExtractFileName(Application.ExeName)); - - - Reg.WriteString('DontShowComplexLNotification', DontShowComplexLNotification); - Reg.WriteString('DontShowStartupWizard', DontShowStartupWizard); - - - // General settings - Reg.WriteString('StartWithWindows', StartWithWindows); - Reg.WriteString('ShowSplash', ShowSplash); - Reg.WriteString('DefaultUIMode', DefaultUIMode); - Reg.WriteString('LastUIMode', LastUIMode); - Reg.WriteString('TopBarPosX', TopBarPosX); - Reg.WriteString('TopBarXButton', TopBarXButton); - Reg.WriteString('TopBarTransparent', TopBarTransparent); - - - // Inteface Settings - Reg.WriteString('InterfaceSkin', InterfaceSkin); - Reg.WriteString('TopBarTransparencyLevel', TopBarTransparencyLevel); - Reg.WriteString('TopBarTransparent', TopBarTransparent); - Reg.WriteString('TrayHintShowTimes', TrayHintShowTimes); - Reg.WriteString('TopHintShowTimes', TopHintShowTimes); - - - // Webbuddy Options - Reg.WriteString('AvroUpdateCheck', AvroUpdateCheck); - Reg.WriteDateTime('AvroUpdateLastCheck', AvroUpdateLastCheck); - - // Hotkeys settings - Reg.WriteString('ModeSwitchKey', ModeSwitchKey); - Reg.WriteString('ToggleOutputModeKey', ToggleOutputModeKey); - Reg.WriteString('SpellerLauncherKey', SpellerLauncherKey); - - // Avro Mouse Settings - Reg.WriteString('AvroMouseChangeModeLocale', AvroMouseChangeModeLocale); - Reg.WriteString('AvroMousePosX', AvroMousePosX); - Reg.WriteString('AvroMousePosY', AvroMousePosY); - - // Avro Phonetic Settings - Reg.WriteString('PhoneticAutoCorrect', PhoneticAutoCorrect); - Reg.WriteString('ShowPrevWindow', ShowPrevWindow); - Reg.WriteString('PhoneticMode', PhoneticMode); - Reg.WriteString('SaveCandidate', SaveCandidate); - Reg.WriteString('AddToPhoneticDict', AddToPhoneticDict); - Reg.WriteString('TabBrowsing', TabBrowsing); - Reg.WriteString('PipeToDot', PipeToDot); - Reg.WriteString('EnableJoNukta', EnableJoNukta); - - // Input Locale Settings - Reg.WriteString('ChangeInputLocale', ChangeInputLocale); - Reg.WriteString('PrefferedLocale', PrefferedLocale); - - - // Tools Settings - Reg.WriteString('OldStyleReph', OldStyleReph); - Reg.WriteString('VowelFormating', VowelFormating); - Reg.WriteString('NumPadBangla', NumPadBangla); - Reg.WriteString('AutomaticallyFixChandra', AutomaticallyFixChandra); - Reg.WriteString('FullOldStyleTyping', FullOldStyleTyping); - - // Keyboard Layout Viewer Settings - Reg.WriteString('DefaultLayout', DefaultLayout); - Reg.WriteString('ShowLayoutOnTop', ShowLayoutOnTop); - Reg.WriteString('SavePosLayoutViewer', SavePosLayoutViewer); - Reg.WriteString('LayoutViewerPosX', LayoutViewerPosX); - Reg.WriteString('LayoutViewerPosY', LayoutViewerPosY); - Reg.WriteString('LayoutViewerSize', LayoutViewerSize); - - // Global Output settings - Reg.WriteString('OutputIsBijoy', OutputIsBijoy); - Reg.WriteString('ShowOutputwarning', ShowOutputwarning); - - End; - - Reg.CloseKey; - Reg.RootKey := HKEY_CURRENT_USER; - - If Reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\Run', True) = True Then Begin - If StartWithWindows = 'NO' Then - Reg.DeleteValue('Avro Keyboard') - Else - Reg.WriteString('Avro Keyboard', Application.ExeName); - End; - - Reg.Free; + Reg := TMyRegistry.create; + Reg.RootKey := HKEY_CURRENT_USER; + + If Reg.OpenKey('Software\OmicronLab\Avro Keyboard', True) = True Then + Begin + Reg.WriteString('AppPath', ExtractFileDir(Application.ExeName)); + Reg.WriteString('AppExeName', ExtractFileName(Application.ExeName)); + + Reg.WriteString('DontShowComplexLNotification', + DontShowComplexLNotification); + Reg.WriteString('DontShowStartupWizard', DontShowStartupWizard); + + // General settings + Reg.WriteString('StartWithWindows', StartWithWindows); + Reg.WriteString('ShowSplash', ShowSplash); + Reg.WriteString('DefaultUIMode', DefaultUIMode); + Reg.WriteString('LastUIMode', LastUIMode); + Reg.WriteString('TopBarPosX', TopBarPosX); + Reg.WriteString('TopBarXButton', TopBarXButton); + Reg.WriteString('TopBarTransparent', TopBarTransparent); + + // Inteface Settings + Reg.WriteString('InterfaceSkin', InterfaceSkin); + Reg.WriteString('TopBarTransparencyLevel', TopBarTransparencyLevel); + Reg.WriteString('TopBarTransparent', TopBarTransparent); + Reg.WriteString('TrayHintShowTimes', TrayHintShowTimes); + Reg.WriteString('TopHintShowTimes', TopHintShowTimes); + + // Webbuddy Options + Reg.WriteString('AvroUpdateCheck', AvroUpdateCheck); + Reg.WriteDateTime('AvroUpdateLastCheck', AvroUpdateLastCheck); + + // Hotkeys settings + Reg.WriteString('ModeSwitchKey', ModeSwitchKey); + Reg.WriteString('ToggleOutputModeKey', ToggleOutputModeKey); + Reg.WriteString('SpellerLauncherKey', SpellerLauncherKey); + + // Avro Mouse Settings + Reg.WriteString('AvroMouseChangeModeLocale', AvroMouseChangeModeLocale); + Reg.WriteString('AvroMousePosX', AvroMousePosX); + Reg.WriteString('AvroMousePosY', AvroMousePosY); + + // Avro Phonetic Settings + Reg.WriteString('PhoneticAutoCorrect', PhoneticAutoCorrect); + Reg.WriteString('ShowPrevWindow', ShowPrevWindow); + Reg.WriteString('PhoneticMode', PhoneticMode); + Reg.WriteString('SaveCandidate', SaveCandidate); + Reg.WriteString('AddToPhoneticDict', AddToPhoneticDict); + Reg.WriteString('TabBrowsing', TabBrowsing); + Reg.WriteString('PipeToDot', PipeToDot); + Reg.WriteString('EnableJoNukta', EnableJoNukta); + + // Input Locale Settings + Reg.WriteString('ChangeInputLocale', ChangeInputLocale); + Reg.WriteString('PrefferedLocale', PrefferedLocale); + + // Tools Settings + Reg.WriteString('OldStyleReph', OldStyleReph); + Reg.WriteString('VowelFormating', VowelFormating); + Reg.WriteString('NumPadBangla', NumPadBangla); + Reg.WriteString('AutomaticallyFixChandra', AutomaticallyFixChandra); + Reg.WriteString('FullOldStyleTyping', FullOldStyleTyping); + + // Keyboard Layout Viewer Settings + Reg.WriteString('DefaultLayout', DefaultLayout); + Reg.WriteString('ShowLayoutOnTop', ShowLayoutOnTop); + Reg.WriteString('SavePosLayoutViewer', SavePosLayoutViewer); + Reg.WriteString('LayoutViewerPosX', LayoutViewerPosX); + Reg.WriteString('LayoutViewerPosY', LayoutViewerPosY); + Reg.WriteString('LayoutViewerSize', LayoutViewerSize); + + // Global Output settings + Reg.WriteString('OutputIsBijoy', OutputIsBijoy); + Reg.WriteString('ShowOutputwarning', ShowOutputwarning); + + End; + + Reg.CloseKey; + Reg.RootKey := HKEY_CURRENT_USER; + + If Reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\Run', True) + = True Then + Begin + If StartWithWindows = 'NO' Then + Reg.DeleteValue('Avro Keyboard') + Else + Reg.WriteString('Avro Keyboard', Application.ExeName); + End; + + Reg.Free; End; @@ -514,135 +510,153 @@ Procedure SaveUISettings; Begin - If IsFormVisible('TopBar') = True Then Begin - LastUIMode := 'TOP BAR'; - TopBarPosX := IntToStr(TopBar.Left); - End - Else Begin - LastUIMode := 'ICON'; - End; - - DefaultLayout := AvroMainForm1.GetMyCurrentLayout; - - SaveSettings; + If IsFormVisible('TopBar') = True Then + Begin + LastUIMode := 'TOP BAR'; + TopBarPosX := IntToStr(TopBar.Left); + End + Else + Begin + LastUIMode := 'ICON'; + End; + + DefaultLayout := AvroMainForm1.GetMyCurrentLayout; + + SaveSettings; End; Procedure LoadSettings; Begin - {$IFDEF PortableOn} +{$IFDEF PortableOn} + LoadSettingsFromFile; - LoadSettingsFromFile; +{$ELSE} + LoadSettingsFromRegistry; - {$ELSE} - - LoadSettingsFromRegistry; - - {$ENDIF} - - ValidateSettings; +{$ENDIF} + ValidateSettings; End; { =============================================================================== } Procedure ValidateSettings; Begin - // General settings - If Not((StartWithWindows = 'YES') Or (StartWithWindows = 'NO')) Then - StartWithWindows := 'YES'; - If Not((DefaultUIMode = 'TOP BAR') Or (DefaultUIMode = 'ICON') Or (DefaultUIMode = 'LASTUI')) Then - DefaultUIMode := 'LASTUI'; - If Not((LastUIMode = 'ICON') Or (LastUIMode = 'TOP BAR')) Then - LastUIMode := 'TOP BAR'; - If Not(StrToInt(TopBarPosX) > 0) Then - TopBarPosX := '1000000'; - If Not((TopBarXButton = 'MINIMIZE') Or (TopBarXButton = 'EXIT') Or (TopBarXButton = 'SHOW MENU')) Then - TopBarXButton := 'SHOW MENU'; - If Not((TopBarTransparent = 'YES') Or (TopBarTransparent = 'NO')) Then - TopBarTransparent := 'YES'; - - // Keyboard Mode settings - If Not((ModeSwitchKey = 'F1') Or (ModeSwitchKey = 'F2') Or (ModeSwitchKey = 'F3') Or (ModeSwitchKey = 'F4') Or (ModeSwitchKey = 'F5') Or (ModeSwitchKey = 'F6') Or (ModeSwitchKey = 'F7') Or (ModeSwitchKey = 'F8') Or (ModeSwitchKey = 'F9') Or - (ModeSwitchKey = 'F10') Or (ModeSwitchKey = 'F11') Or (ModeSwitchKey = 'F12') Or (ModeSwitchKey = 'CTRL+SPACE')) Then - ModeSwitchKey := 'F12'; - If Not((ToggleOutputModeKey = 'F1') Or (ToggleOutputModeKey = 'F2') Or (ToggleOutputModeKey = 'F3') Or (ToggleOutputModeKey = 'F4') Or (ToggleOutputModeKey = 'F5') Or (ToggleOutputModeKey = 'F6') Or (ToggleOutputModeKey = 'F7') Or - (ToggleOutputModeKey = 'F8') Or (ToggleOutputModeKey = 'F9') Or (ToggleOutputModeKey = 'F10') Or (ToggleOutputModeKey = 'F11') Or (ToggleOutputModeKey = 'F12')) Then - ToggleOutputModeKey := 'F12'; - If Not((SpellerLauncherKey = 'F1') Or (SpellerLauncherKey = 'F2') Or (SpellerLauncherKey = 'F3') Or (SpellerLauncherKey = 'F4') Or (SpellerLauncherKey = 'F5') Or (SpellerLauncherKey = 'F6') Or (SpellerLauncherKey = 'F7') Or - (SpellerLauncherKey = 'F8') Or (SpellerLauncherKey = 'F9') Or (SpellerLauncherKey = 'F10') Or (SpellerLauncherKey = 'F11') Or (SpellerLauncherKey = 'F12')) Then - SpellerLauncherKey := 'F12'; - - - // Avro Mouse Settings - If Not((AvroMouseChangeModeLocale = 'YES') Or (AvroMouseChangeModeLocale = 'NO')) Then - AvroMouseChangeModeLocale := 'YES'; - If Not(StrToInt(AvroMousePosX) > 0) Then - AvroMousePosX := '0'; - If Not(StrToInt(AvroMousePosY) > 0) Then - AvroMousePosY := '0'; - - // Avro Phonetic Settings - If Not((PhoneticAutoCorrect = 'YES') Or (PhoneticAutoCorrect = 'NO')) Then - PhoneticAutoCorrect := 'YES'; - If Not((ShowPrevWindow = 'YES') Or (ShowPrevWindow = 'NO')) Then - ShowPrevWindow := 'YES'; - If Not((TabBrowsing = 'YES') Or (TabBrowsing = 'NO')) Then - TabBrowsing := 'YES'; - If Not((PipeToDot = 'YES') Or (PipeToDot = 'NO')) Then - PipeToDot := 'YES'; - If Not((EnableJoNukta = 'YES') Or (EnableJoNukta = 'NO')) Then - EnableJoNukta := 'NO'; - - // Input Locale Settings - If Not((ChangeInputLocale = 'YES') Or (ChangeInputLocale = 'NO')) Then - ChangeInputLocale := 'NO'; - If Not((PrefferedLocale = 'BANGLADESH') Or (PrefferedLocale = 'INDIA') Or (PrefferedLocale = 'ASSAMESE')) Then - PrefferedLocale := 'INDIA'; - - // Tools Settings - If Not((OldStyleReph = 'YES') Or (OldStyleReph = 'NO')) Then - OldStyleReph := 'YES'; - If Not((VowelFormating = 'YES') Or (VowelFormating = 'NO')) Then - VowelFormating := 'YES'; - If Not((NumPadBangla = 'YES') Or (NumPadBangla = 'NO')) Then - NumPadBangla := 'YES'; - If Not((FullOldStyleTyping = 'YES') Or (FullOldStyleTyping = 'NO')) Then - FullOldStyleTyping := 'No'; - If Not((AutomaticallyFixChandra = 'YES') Or (AutomaticallyFixChandra = 'NO')) Then - AutomaticallyFixChandra := 'YES'; - - // Keyboard Layout Viewer Settings - If Not((ShowLayoutOnTop = 'YES') Or (ShowLayoutOnTop = 'NO')) Then - ShowLayoutOnTop := 'YES'; - If Not((SavePosLayoutViewer = 'YES') Or (SavePosLayoutViewer = 'NO')) Then - SavePosLayoutViewer := 'YES'; - If Not(StrToInt(LayoutViewerPosX) > 0) Then - LayoutViewerPosX := '0'; - If Not(StrToInt(LayoutViewerPosY) > 0) Then - LayoutViewerPosX := '0'; - // If Not ((StrToInt(LayoutViewerSize) > 50) And (RightStr(LayoutViewerSize, 1) = '%')) Then LayoutViewerSize := '60%'; - - - // Global Output settings - If Not((OutputIsBijoy = 'YES') Or (OutputIsBijoy = 'NO')) Then - OutputIsBijoy := 'NO'; - If Not((ShowOutputwarning = 'YES') Or (ShowOutputwarning = 'NO')) Then - ShowOutputwarning := 'YES'; - - { Done : Validate locale settings here } - If IsWinVistaOrLater = True Then Begin - If (IsBangladeshLocaleInstalled = False) Then Begin - If (PrefferedLocale = 'BANGLADESH') Then - PrefferedLocale := 'INDIA'; - End; - - If (IsAssameseLocaleInstalled = False) Then Begin - If (PrefferedLocale = 'ASSAMESE') Then Begin - PrefferedLocale := 'INDIA'; - End; - - End; - End; + // General settings + If Not((StartWithWindows = 'YES') Or (StartWithWindows = 'NO')) Then + StartWithWindows := 'YES'; + If Not((DefaultUIMode = 'TOP BAR') Or (DefaultUIMode = 'ICON') Or + (DefaultUIMode = 'LASTUI')) Then + DefaultUIMode := 'LASTUI'; + If Not((LastUIMode = 'ICON') Or (LastUIMode = 'TOP BAR')) Then + LastUIMode := 'TOP BAR'; + If Not(StrToInt(TopBarPosX) > 0) Then + TopBarPosX := '1000000'; + If Not((TopBarXButton = 'MINIMIZE') Or (TopBarXButton = 'EXIT') Or + (TopBarXButton = 'SHOW MENU')) Then + TopBarXButton := 'SHOW MENU'; + If Not((TopBarTransparent = 'YES') Or (TopBarTransparent = 'NO')) Then + TopBarTransparent := 'YES'; + + // Keyboard Mode settings + If Not((ModeSwitchKey = 'F1') Or (ModeSwitchKey = 'F2') Or + (ModeSwitchKey = 'F3') Or (ModeSwitchKey = 'F4') Or (ModeSwitchKey = 'F5') + Or (ModeSwitchKey = 'F6') Or (ModeSwitchKey = 'F7') Or + (ModeSwitchKey = 'F8') Or (ModeSwitchKey = 'F9') Or (ModeSwitchKey = 'F10') + Or (ModeSwitchKey = 'F11') Or (ModeSwitchKey = 'F12') Or + (ModeSwitchKey = 'CTRL+SPACE')) Then + ModeSwitchKey := 'F12'; + If Not((ToggleOutputModeKey = 'F1') Or (ToggleOutputModeKey = 'F2') Or + (ToggleOutputModeKey = 'F3') Or (ToggleOutputModeKey = 'F4') Or + (ToggleOutputModeKey = 'F5') Or (ToggleOutputModeKey = 'F6') Or + (ToggleOutputModeKey = 'F7') Or (ToggleOutputModeKey = 'F8') Or + (ToggleOutputModeKey = 'F9') Or (ToggleOutputModeKey = 'F10') Or + (ToggleOutputModeKey = 'F11') Or (ToggleOutputModeKey = 'F12')) Then + ToggleOutputModeKey := 'F12'; + If Not((SpellerLauncherKey = 'F1') Or (SpellerLauncherKey = 'F2') Or + (SpellerLauncherKey = 'F3') Or (SpellerLauncherKey = 'F4') Or + (SpellerLauncherKey = 'F5') Or (SpellerLauncherKey = 'F6') Or + (SpellerLauncherKey = 'F7') Or (SpellerLauncherKey = 'F8') Or + (SpellerLauncherKey = 'F9') Or (SpellerLauncherKey = 'F10') Or + (SpellerLauncherKey = 'F11') Or (SpellerLauncherKey = 'F12')) Then + SpellerLauncherKey := 'F12'; + + // Avro Mouse Settings + If Not((AvroMouseChangeModeLocale = 'YES') Or + (AvroMouseChangeModeLocale = 'NO')) Then + AvroMouseChangeModeLocale := 'YES'; + If Not(StrToInt(AvroMousePosX) > 0) Then + AvroMousePosX := '0'; + If Not(StrToInt(AvroMousePosY) > 0) Then + AvroMousePosY := '0'; + + // Avro Phonetic Settings + If Not((PhoneticAutoCorrect = 'YES') Or (PhoneticAutoCorrect = 'NO')) Then + PhoneticAutoCorrect := 'YES'; + If Not((ShowPrevWindow = 'YES') Or (ShowPrevWindow = 'NO')) Then + ShowPrevWindow := 'YES'; + If Not((TabBrowsing = 'YES') Or (TabBrowsing = 'NO')) Then + TabBrowsing := 'YES'; + If Not((PipeToDot = 'YES') Or (PipeToDot = 'NO')) Then + PipeToDot := 'YES'; + If Not((EnableJoNukta = 'YES') Or (EnableJoNukta = 'NO')) Then + EnableJoNukta := 'NO'; + + // Input Locale Settings + If Not((ChangeInputLocale = 'YES') Or (ChangeInputLocale = 'NO')) Then + ChangeInputLocale := 'NO'; + If Not((PrefferedLocale = 'BANGLADESH') Or (PrefferedLocale = 'INDIA') Or + (PrefferedLocale = 'ASSAMESE')) Then + PrefferedLocale := 'INDIA'; + + // Tools Settings + If Not((OldStyleReph = 'YES') Or (OldStyleReph = 'NO')) Then + OldStyleReph := 'YES'; + If Not((VowelFormating = 'YES') Or (VowelFormating = 'NO')) Then + VowelFormating := 'YES'; + If Not((NumPadBangla = 'YES') Or (NumPadBangla = 'NO')) Then + NumPadBangla := 'YES'; + If Not((FullOldStyleTyping = 'YES') Or (FullOldStyleTyping = 'NO')) Then + FullOldStyleTyping := 'No'; + If Not((AutomaticallyFixChandra = 'YES') Or + (AutomaticallyFixChandra = 'NO')) Then + AutomaticallyFixChandra := 'YES'; + + // Keyboard Layout Viewer Settings + If Not((ShowLayoutOnTop = 'YES') Or (ShowLayoutOnTop = 'NO')) Then + ShowLayoutOnTop := 'YES'; + If Not((SavePosLayoutViewer = 'YES') Or (SavePosLayoutViewer = 'NO')) Then + SavePosLayoutViewer := 'YES'; + If Not(StrToInt(LayoutViewerPosX) > 0) Then + LayoutViewerPosX := '0'; + If Not(StrToInt(LayoutViewerPosY) > 0) Then + LayoutViewerPosX := '0'; + // If Not ((StrToInt(LayoutViewerSize) > 50) And (RightStr(LayoutViewerSize, 1) = '%')) Then LayoutViewerSize := '60%'; + + // Global Output settings + If Not((OutputIsBijoy = 'YES') Or (OutputIsBijoy = 'NO')) Then + OutputIsBijoy := 'NO'; + If Not((ShowOutputwarning = 'YES') Or (ShowOutputwarning = 'NO')) Then + ShowOutputwarning := 'YES'; + + { Done : Validate locale settings here } + If IsWinVistaOrLater = True Then + Begin + If (IsBangladeshLocaleInstalled = False) Then + Begin + If (PrefferedLocale = 'BANGLADESH') Then + PrefferedLocale := 'INDIA'; + End; + + If (IsAssameseLocaleInstalled = False) Then + Begin + If (PrefferedLocale = 'ASSAMESE') Then + Begin + PrefferedLocale := 'INDIA'; + End; + + End; + End; End; { =============================================================================== } @@ -650,16 +664,13 @@ Procedure SaveSettings; Begin - {$IFDEF PortableOn} - - SaveSettingsInXML; - - {$ELSE} - - SaveSettingsInRegistry; +{$IFDEF PortableOn} + SaveSettingsInXML; - {$ENDIF} +{$ELSE} + SaveSettingsInRegistry; +{$ENDIF} End; { =============================================================================== } diff --git a/Keyboard and Spell checker/Units/uSimilarSort.pas b/Keyboard and Spell checker/Units/uSimilarSort.pas index 32adc01..6d2e116 100644 --- a/Keyboard and Spell checker/Units/uSimilarSort.pas +++ b/Keyboard and Spell checker/Units/uSimilarSort.pas @@ -1,25 +1,25 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= @@ -28,43 +28,41 @@ Unit uSimilarSort; Interface + Uses -Classes, - Levenshtein; + Classes, + Levenshtein; Type - SimilarRec = Record - wS: String; - Match: Integer; - End; + SimilarRec = Record + wS: String; + Match: Integer; + End; Procedure SimilarSort(SourceS: String; Var WList: TStringList); Function MyCustomSort(List: TStringList; Index1, Index2: Integer): Integer; Var - SourceCompareS : String; + SourceCompareS: String; Implementation - -Function MyCustomSort(List: TStringList; Index1, Index2: Integer): - Integer; +Function MyCustomSort(List: TStringList; Index1, Index2: Integer): Integer; Begin - If LD(SourceCompareS, List[Index1]) < LD(SourceCompareS, List[Index2]) Then - Result := -1 - Else If LD(SourceCompareS, List[Index1]) > LD(SourceCompareS, List[Index2]) Then - Result := 1 - Else - Result := 0; + If LD(SourceCompareS, List[Index1]) < LD(SourceCompareS, List[Index2]) Then + Result := -1 + Else If LD(SourceCompareS, List[Index1]) > LD(SourceCompareS, + List[Index2]) Then + Result := 1 + Else + Result := 0; End; - Procedure SimilarSort(SourceS: String; Var WList: TStringList); Begin - WList.Sorted := False; - SourceCompareS := SourceS; - Wlist.CustomSort(MyCustomSort); + WList.Sorted := False; + SourceCompareS := SourceS; + WList.CustomSort(MyCustomSort); End; End. - diff --git a/Keyboard and Spell checker/Units/uWindowHandlers.pas b/Keyboard and Spell checker/Units/uWindowHandlers.pas index 0bfec66..948d297 100644 --- a/Keyboard and Spell checker/Units/uWindowHandlers.pas +++ b/Keyboard and Spell checker/Units/uWindowHandlers.pas @@ -1,25 +1,25 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= @@ -30,20 +30,19 @@ {$ELSE} {$INCLUDE ../ProjectDefines.inc} {$ENDIF} - -{ COMPLETE!} +{ COMPLETE! } Unit uWindowHandlers; Interface -Uses - Windows, - Sysutils, - Controls, - Messages, - Forms, - Classes; +Uses + Windows, + Sysutils, + Controls, + Messages, + Forms, + Classes; Procedure TOPMOST(Const xFormHwnd: HWND); Procedure NoTOPMOST(Const xFormHwnd: HWND); @@ -51,215 +50,226 @@ Function IsFormLoaded(Const xFormName: String): Boolean; Function IsFormVisible(Const xFormName: String): Boolean; Procedure DisableCloseButton(Const xFormHwnd: HWND); -Function ForceForegroundWindow(hwnd: THandle): Boolean; +Function ForceForegroundWindow(HWND: THandle): Boolean; Procedure MakeNeverActiveWindow(Const xFormHwnd: HWND); Function IsWindowTopMost(hWindow: HWND): Boolean; Procedure SetAsMainForm(aForm: TForm); Function GetWindowCaption(hWindow: HWND): String; Function GetWindowClassName(hWindow: HWND): String; Procedure SetElevationRequiredState(aControl: TWinControl; Required: Boolean); -///////////////////////////////////////////////// -//Delphi specific -Procedure CheckCreateForm(InstanceClass: TComponentClass; Var xForm; Const xFormName: String); +/// ////////////////////////////////////////////// +// Delphi specific +Procedure CheckCreateForm(InstanceClass: TComponentClass; Var xForm; + Const xFormName: String); Const - BCM_FIRST = $1600; - BCM_SETSHIELD = BCM_FIRST + $000C; + BCM_FIRST = $1600; + BCM_SETSHIELD = BCM_FIRST + $000C; Implementation -{===============================================================================} +{ =============================================================================== } Procedure SetElevationRequiredState(aControl: TWinControl; Required: Boolean); Var - lRequired : Integer; + lRequired: Integer; Begin - lRequired := Integer(Required); - SendMessage(aControl.Handle, BCM_SETSHIELD, 0, lRequired); + lRequired := Integer(Required); + SendMessage(aControl.Handle, BCM_SETSHIELD, 0, lRequired); End; -{===============================================================================} +{ =============================================================================== } Function GetWindowClassName(hWindow: HWND): String; Var - aName : Array[0..255] Of Char; + aName: Array [0 .. 255] Of Char; Begin - GetClassName(hWindow, aName, 256); - Result := String(aName); + GetClassName(hWindow, aName, 256); + Result := String(aName); End; -{===============================================================================} +{ =============================================================================== } Function GetWindowCaption(hWindow: HWND): String; Var - Len : LongInt; - Title : String; + Len: LongInt; + Title: String; Begin - Result := ''; - Len := GetWindowTextLength(hWindow) + 1; - SetLength(Title, Len); - GetWindowText(hWindow, PChar(Title), Len); - Result := TrimRight(Title); + Result := ''; + Len := GetWindowTextLength(hWindow) + 1; + SetLength(Title, Len); + GetWindowText(hWindow, PChar(Title), Len); + Result := TrimRight(Title); End; -{===============================================================================} +{ =============================================================================== } Procedure SetAsMainForm(aForm: TForm); Var - P : Pointer; + P: Pointer; Begin - P := @Application.Mainform; - Pointer(P^) := aForm; + P := @Application.Mainform; + Pointer(P^) := aForm; End; -{===============================================================================} +{ =============================================================================== } Procedure MakeNeverActiveWindow(Const xFormHwnd: HWND); Begin - SetWindowLong(xFormHwnd, GWL_EXSTYLE, GetWindowLong(xFormHwnd, GWL_EXSTYLE) Or WS_EX_NOACTIVATE); + SetWindowLong(xFormHwnd, GWL_EXSTYLE, GetWindowLong(xFormHwnd, GWL_EXSTYLE) Or + WS_EX_NOACTIVATE); End; -{===============================================================================} +{ =============================================================================== } {$HINTS Off} -Function ForceForegroundWindow(hwnd: THandle): Boolean; +Function ForceForegroundWindow(HWND: THandle): Boolean; Const - SPI_GETFOREGROUNDLOCKTIMEOUT = $2000; - SPI_SETFOREGROUNDLOCKTIMEOUT = $2001; + SPI_GETFOREGROUNDLOCKTIMEOUT = $2000; + SPI_SETFOREGROUNDLOCKTIMEOUT = $2001; Var - ForegroundThreadID : DWORD; - ThisThreadID : DWORD; - timeout : DWORD; + ForegroundThreadID: DWORD; + ThisThreadID: DWORD; + timeout: DWORD; Begin - Result := False; - - //If IsIconic(hwnd) Then ShowWindow(hwnd, SW_RESTORE); - - If GetForegroundWindow = hwnd Then - Result := True - Else Begin - // Windows 98/2000 doesn't want to foreground a window when some other - // window has keyboard focus - - If ((Win32Platform = VER_PLATFORM_WIN32_NT) And (Win32MajorVersion > 4)) Or - ((Win32Platform = VER_PLATFORM_WIN32_WINDOWS) And - ((Win32MajorVersion > 4) Or ((Win32MajorVersion = 4) And - (Win32MinorVersion > 0)))) Then Begin - - - Result := False; - ForegroundThreadID := GetWindowThreadProcessID(GetForegroundWindow, Nil); - ThisThreadID := GetWindowThreadPRocessId(hwnd, Nil); - If AttachThreadInput(ThisThreadID, ForegroundThreadID, True) Then Begin - BringWindowToTop(hwnd); // IE 5.5 related hack - SetForegroundWindow(hwnd); - AttachThreadInput(ThisThreadID, ForegroundThreadID, False); - Result := (GetForegroundWindow = hwnd); - End; - If Not Result Then Begin - SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, @timeout, 0); - SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, TObject(0), - SPIF_SENDCHANGE); - BringWindowToTop(hwnd); // IE 5.5 related hack - SetForegroundWindow(hWnd); - SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, TObject(timeout), SPIF_SENDCHANGE); - End; - End - Else Begin - BringWindowToTop(hwnd); // IE 5.5 related hack - SetForegroundWindow(hwnd); - End; - - Result := (GetForegroundWindow = hwnd); - End; + Result := False; + + // If IsIconic(hwnd) Then ShowWindow(hwnd, SW_RESTORE); + + If GetForegroundWindow = HWND Then + Result := True + Else + Begin + // Windows 98/2000 doesn't want to foreground a window when some other + // window has keyboard focus + + If ((Win32Platform = VER_PLATFORM_WIN32_NT) And (Win32MajorVersion > 4)) Or + ((Win32Platform = VER_PLATFORM_WIN32_WINDOWS) And + ((Win32MajorVersion > 4) Or ((Win32MajorVersion = 4) And + (Win32MinorVersion > 0)))) Then + Begin + + Result := False; + ForegroundThreadID := GetWindowThreadProcessID(GetForegroundWindow, Nil); + ThisThreadID := GetWindowThreadProcessID(HWND, Nil); + If AttachThreadInput(ThisThreadID, ForegroundThreadID, True) Then + Begin + BringWindowToTop(HWND); // IE 5.5 related hack + SetForegroundWindow(HWND); + AttachThreadInput(ThisThreadID, ForegroundThreadID, False); + Result := (GetForegroundWindow = HWND); + End; + If Not Result Then + Begin + SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, @timeout, 0); + SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, TObject(0), + SPIF_SENDCHANGE); + BringWindowToTop(HWND); // IE 5.5 related hack + SetForegroundWindow(HWND); + SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, TObject(timeout), + SPIF_SENDCHANGE); + End; + End + Else + Begin + BringWindowToTop(HWND); // IE 5.5 related hack + SetForegroundWindow(HWND); + End; + + Result := (GetForegroundWindow = HWND); + End; End; {$HINTS On} -{===============================================================================} +{ =============================================================================== } {$HINTS Off} Function IsWindowTopMost(hWindow: HWND): Boolean; Begin - Result := False; - Result := (GetWindowLong(hWindow, GWL_EXSTYLE) And WS_EX_TOPMOST) <> 0 + Result := False; + Result := (GetWindowLong(hWindow, GWL_EXSTYLE) And WS_EX_TOPMOST) <> 0 End; {$HINTS On} -{===============================================================================} +{ =============================================================================== } Procedure DisableCloseButton(Const xFormHwnd: HWND); Begin - RemoveMenu(GetSystemMenu(xFormHwnd, False), SC_CLOSE, MF_BYCOMMAND); + RemoveMenu(GetSystemMenu(xFormHwnd, False), SC_CLOSE, MF_BYCOMMAND); End; -{===============================================================================} +{ =============================================================================== } Procedure TOPMOST(Const xFormHwnd: HWND); Begin - SetWindowPos(xFormHwnd, HWND_TOPMOST, 0, 0, 0, 0, - SWP_NOMOVE Or SWP_NOSIZE Or SWP_NOACTIVATE); + SetWindowPos(xFormHwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE Or + SWP_NOACTIVATE); End; -{===============================================================================} +{ =============================================================================== } Procedure NoTOPMOST(Const xFormHwnd: HWND); Begin - SetWindowPos(xFormHwnd, HWND_NOTOPMOST, 0, 0, 0, 0, - SWP_NOMOVE Or SWP_NOSIZE Or SWP_NOACTIVATE); + SetWindowPos(xFormHwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or + SWP_NOSIZE Or SWP_NOACTIVATE); End; -{===============================================================================} +{ =============================================================================== } Procedure MoveForm_Ex(Const xFormHwnd: HWND; Const Button: TMouseButton); Begin - If Button = mbLeft Then Begin - ReleaseCapture; - SendMessage(xFormHwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0); - End; + If Button = mbLeft Then + Begin + ReleaseCapture; + SendMessage(xFormHwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0); + End; End; -{===============================================================================} +{ =============================================================================== } Function IsFormLoaded(Const xFormName: String): Boolean; Var - i : Integer; + i: Integer; Begin - Result := False; - For i := Screen.FormCount - 1 Downto 0 Do - If (LowerCase(Screen.Forms[i].Name) = LowerCase(xFormName)) Then Begin - Result := True; - Break; - End; + Result := False; + For i := Screen.FormCount - 1 Downto 0 Do + If (LowerCase(Screen.Forms[i].Name) = LowerCase(xFormName)) Then + Begin + Result := True; + Break; + End; End; -{===============================================================================} +{ =============================================================================== } Function IsFormVisible(Const xFormName: String): Boolean; Var - i : Integer; + i: Integer; Begin - Result := False; - For i := Screen.FormCount - 1 Downto 0 Do - If (LowerCase(Screen.Forms[i].Name) = LowerCase(xFormName)) Then Begin - If Screen.Forms[i].Visible = True Then - Result := True; - Break; - End; + Result := False; + For i := Screen.FormCount - 1 Downto 0 Do + If (LowerCase(Screen.Forms[i].Name) = LowerCase(xFormName)) Then + Begin + If Screen.Forms[i].Visible = True Then + Result := True; + Break; + End; End; -{===============================================================================} +{ =============================================================================== } -Procedure CheckCreateForm(InstanceClass: TComponentClass; Var xForm; Const xFormName: String); +Procedure CheckCreateForm(InstanceClass: TComponentClass; Var xForm; + Const xFormName: String); Begin - If Not IsFormLoaded(xFormName) Then Begin - Application.CreateForm(InstanceClass, xForm); - - //In order to keep Avro keaboard hidden - //in taskbar - ShowWindow(application.handle, SW_HIDE); - End; + If Not IsFormLoaded(xFormName) Then + Begin + Application.CreateForm(InstanceClass, xForm); + + // In order to keep Avro keaboard hidden + // in taskbar + ShowWindow(Application.Handle, SW_HIDE); + End; End; End. - diff --git a/Keyboard and Spell checker/Units/u_Admin.pas b/Keyboard and Spell checker/Units/u_Admin.pas index a9e0bc0..e947f8d 100644 --- a/Keyboard and Spell checker/Units/u_Admin.pas +++ b/Keyboard and Spell checker/Units/u_Admin.pas @@ -1,43 +1,43 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= } {$INCLUDE ../ProjectDefines.inc} -{COMPLETE TRANSFERING!} +{ COMPLETE TRANSFERING! } Unit u_Admin; Interface -Uses Windows, - Registry; +Uses Windows, + Registry; Function IsElevated: Boolean; -//returns True if the currently logged Windows user has Administrator rights +// returns True if the currently logged Windows user has Administrator rights Function IsAdmin: Boolean; Function IsUAC: Boolean; @@ -45,146 +45,164 @@ Implementation Uses - WindowsVersion; + WindowsVersion; Const - SECURITY_NT_AUTHORITY : TSIDIdentifierAuthority = (Value: (0, 0, 0, 0, 0, 5)); + SECURITY_NT_AUTHORITY: TSIDIdentifierAuthority = (Value: (0, 0, 0, 0, 0, 5)); Const - SECURITY_BUILTIN_DOMAIN_RID = $00000020; - DOMAIN_ALIAS_RID_ADMINS = $00000220; + SECURITY_BUILTIN_DOMAIN_RID = $00000020; + DOMAIN_ALIAS_RID_ADMINS = $00000220; Const - TokenElevationType = 18; - TokenElevation = 20; - TokenElevationTypeDefault = 1; - TokenElevationTypeFull = 2; - TokenElevationTypeLimited = 3; - + TokenElevationType = 18; + TokenElevation = 20; + TokenElevationTypeDefault = 1; + TokenElevationTypeFull = 2; + TokenElevationTypeLimited = 3; Function IsUAC: Boolean; Var - Reg : TRegistry; + Reg: TRegistry; Begin - Result := False; - Reg := TRegistry.Create; - Reg.RootKey := HKEY_LOCAL_MACHINE; - reg.OpenKeyReadOnly('SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System'); - If reg.ReadInteger('EnableLUA') = 1 Then - result := True; - Reg.Free; + Result := False; + Reg := TRegistry.Create; + Reg.RootKey := HKEY_LOCAL_MACHINE; + Reg.OpenKeyReadOnly + ('SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System'); + If Reg.ReadInteger('EnableLUA') = 1 Then + Result := True; + Reg.Free; End; {$HINTS Off} Function IsElevated: Boolean; - Function IsElevatedBasic: Boolean; - Var - token : Cardinal; - ElevationType : Integer; - //Elevation : DWord; - dwSize : Cardinal; - Begin - Result := False; - - If OpenProcessToken(GetCurrentProcess, TOKEN_QUERY, token) Then Try - If GetTokenInformation(token, TTokenInformationClass(TokenElevationType), @ElevationType, SizeOf(ElevationType), dwSize) Then - {* If already elevated returns TokenElevationTypeFull. - - * If it can be elevated simply by showing the elevation request - dialog it returns TokenElevationTypeLimited. - - * If running on a non-administrator account that needs to show - the elevation dialog and enter an admin password, - it returns TokenElevationTypeDefault.} - Case ElevationType Of - TokenElevationTypeDefault: Result := False; - TokenElevationTypeFull: Result := True; - TokenElevationTypeLimited: Result := False; - Else - Result := False; - End - Else - Result := False; - - { If GetTokenInformation(token, TTokenInformationClass(TokenElevation), @Elevation, SizeOf(Elevation), dwSize) Then Begin - If Elevation = 0 Then - ShowMessage('token does NOT have elevate privs') - Else - ShowMessage('token has elevate privs'); - End - Else - Result := False; } - Finally - CloseHandle(token); - End - Else - Result := False; - End; + Function IsElevatedBasic: Boolean; + Var + token: Cardinal; + ElevationType: Integer; + // Elevation : DWord; + dwSize: Cardinal; + Begin + Result := False; + + // If OpenProcessToken(GetCurrentProcess, TOKEN_QUERY, token) Then + // Try + // If GetTokenInformation(token, + // TTokenInformationClass(TokenElevationType), @ElevationType, + // SizeOf(ElevationType), dwSize) Then + // { * If already elevated returns TokenElevationTypeFull. + // + // * If it can be elevated simply by showing the elevation request + // dialog it returns TokenElevationTypeLimited. + // + // * If running on a non-administrator account that needs to show + // the elevation dialog and enter an admin password, + // it returns TokenElevationTypeDefault. } + // Case ElevationType Of + // TokenElevationTypeDefault: + // Result := False; + // TokenElevationTypeFull: + // Result := True; + // TokenElevationTypeLimited: + // Result := False; + // Else + // Result := False; + // End + // Else + // Result := False; + // + // { If GetTokenInformation(token, TTokenInformationClass(TokenElevation), @Elevation, SizeOf(Elevation), dwSize) Then Begin + // If Elevation = 0 Then + // ShowMessage('token does NOT have elevate privs') + // Else + // ShowMessage('token has elevate privs'); + // End + // Else + // Result := False; } + // Finally + // CloseHandle(token); + // End + // Else + // Result := False; + End; Begin - If IsWinVistaOrLater Then Begin - If IsUAC Then Begin - If IsElevatedBasic Then - result := true - Else - result := False; - End - Else Begin - If IsAdmin Then - result := True - Else - result := False; - End; - End - Else Begin - If IsAdmin Then - result := True - Else - result := False; - End; + If IsWinVistaOrLater Then + Begin + If IsUAC Then + Begin + If IsElevatedBasic Then + Result := True + Else + Result := False; + End + Else + Begin + If IsAdmin Then + Result := True + Else + Result := False; + End; + End + Else + Begin + If IsAdmin Then + Result := True + Else + Result := False; + End; End; {$HINTS On} Function IsAdmin: Boolean; Var - hAccessToken : THandle; - ptgGroups : PTokenGroups; - dwInfoBufferSize : DWORD; - psidAdministrators : PSID; - g : Integer; - bSuccess : BOOL; + hAccessToken: THandle; + ptgGroups: PTokenGroups; + dwInfoBufferSize: DWORD; + psidAdministrators: PSID; + g: Integer; + bSuccess: BOOL; Begin - Result := False; - - bSuccess := OpenThreadToken(GetCurrentThread, TOKEN_QUERY, True, hAccessToken); - If Not bSuccess Then Begin - If GetLastError = ERROR_NO_TOKEN Then - bSuccess := OpenProcessToken(GetCurrentProcess, TOKEN_QUERY, hAccessToken); - End; - - - If bSuccess Then Begin - GetMem(ptgGroups, 1024); - - bSuccess := GetTokenInformation(hAccessToken, TokenGroups, ptgGroups, 1024, dwInfoBufferSize); - - CloseHandle(hAccessToken); - - If bSuccess Then Begin - AllocateAndInitializeSid(SECURITY_NT_AUTHORITY, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, psidAdministrators); - - For g := 0 To ptgGroups.GroupCount - 1 Do - If EqualSid(psidAdministrators, ptgGroups.Groups[g].Sid) Then Begin - Result := True; - Break; - End; - - FreeSid(psidAdministrators); - End; - - FreeMem(ptgGroups); - End; + Result := False; + + bSuccess := OpenThreadToken(GetCurrentThread, TOKEN_QUERY, True, + hAccessToken); + If Not bSuccess Then + Begin + If GetLastError = ERROR_NO_TOKEN Then + bSuccess := OpenProcessToken(GetCurrentProcess, TOKEN_QUERY, + hAccessToken); + End; + + If bSuccess Then + Begin + GetMem(ptgGroups, 1024); + + bSuccess := GetTokenInformation(hAccessToken, TokenGroups, ptgGroups, 1024, + dwInfoBufferSize); + + CloseHandle(hAccessToken); + + If bSuccess Then + Begin + AllocateAndInitializeSid(SECURITY_NT_AUTHORITY, 2, + SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, + psidAdministrators); + + For g := 0 To ptgGroups.GroupCount - 1 Do + If EqualSid(psidAdministrators, ptgGroups.Groups[g].Sid) Then + Begin + Result := True; + Break; + End; + + FreeSid(psidAdministrators); + End; + + FreeMem(ptgGroups); + End; End; -End. +End. diff --git a/Keyboard and Spell checker/Units/u_VirtualFontInstall.pas b/Keyboard and Spell checker/Units/u_VirtualFontInstall.pas index 2e19b08..b7cbbf8 100644 --- a/Keyboard and Spell checker/Units/u_VirtualFontInstall.pas +++ b/Keyboard and Spell checker/Units/u_VirtualFontInstall.pas @@ -1,48 +1,45 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - Unit u_VirtualFontInstall; Interface -Uses - Windows, - SysUtils, - classes, - Messages; +Uses + Windows, + SysUtils, + classes, + Messages; Procedure InstallVirtualFont(FontFilePath: String); Procedure RemoveVirtualFont(FontFilePath: String); - - -//Privately used +// Privately used Function GetTempDirectory: String; Function GetFontName(TTF_Path: String): String; Procedure CheckDeleteTempFile(fname: String); @@ -50,135 +47,144 @@ Implementation Uses - clsRegistry_XMLSetting; + clsRegistry_XMLSetting; -{===============================================================================} +{ =============================================================================== } Function GetTempDirectory: String; Var - tempFolder : Array[0..MAX_PATH] Of Char; + tempFolder: Array [0 .. MAX_PATH] Of Char; Begin - GetTempPath(MAX_PATH, @tempFolder); - result := StrPas(tempFolder); + GetTempPath(MAX_PATH, @tempFolder); + result := StrPas(tempFolder); End; -{===============================================================================} +{ =============================================================================== } Procedure CheckDeleteTempFile(fname: String); Begin - If fileexists(fname) Then - DeleteFile(fname); + If fileexists(fname) Then + DeleteFile(fname); End; -{===============================================================================} +{ =============================================================================== } Function GetFontName(TTF_Path: String): String; Var - TempName, FontName, AInfo: String; - S : TFileStream; - APos : Integer; + TempName, FontName, AInfo: String; + S: TFileStream; + APos: Integer; Begin - TempName := GetTempDirectory + 'tmpfntavro.tmp'; - CheckDeleteTempFile(TempName); - - - If CreateScalableFontResource( - 0, // Hidden - pchar(TempName), // FON file - pchar(TTF_Path), // TTF file - Nil) {// Path - not required} Then Begin - - End; - - Try - FontName := ''; - S := TFileStream.Create(TempName, fmOpenRead Or fmShareDenyWrite); - Try - // Copy resource to string - SetLength(AInfo, S.Size); - S.Read(AInfo[1], S.Size); - // Find FONTRES: - APos := Pos('FONTRES:', AInfo); - // This is followed by the font typeface name (null terminated) - If APos > 0 Then - FontName := PChar(@AInfo[APos + 8]); - Except - On e: exception Do Begin - //nothing - End; - End; - Finally - S.Free; - CheckDeleteTempFile(TempName); - End; - result := FontName; + TempName := GetTempDirectory + 'tmpfntavro.tmp'; + CheckDeleteTempFile(TempName); + + If CreateScalableFontResource(0, // Hidden + pchar(TempName), // FON file + pchar(TTF_Path), // TTF file + Nil) { // Path - not required } Then + Begin + + End; + + Try + FontName := ''; + + Try + S := TFileStream.Create(TempName, fmOpenRead Or fmShareDenyWrite); + + // Copy resource to string + SetLength(AInfo, S.Size); + S.Read(AInfo[1], S.Size); + // Find FONTRES: + APos := Pos('FONTRES:', AInfo); + // This is followed by the font typeface name (null terminated) + If APos > 0 Then + FontName := pchar(@AInfo[APos + 8]); + Except + On e: exception Do + Begin + // nothing + End; + End; + Finally + S.Free; + CheckDeleteTempFile(TempName); + End; + result := FontName; End; -{===============================================================================} +{ =============================================================================== } Procedure InstallVirtualFont(FontFilePath: String); Var - PrevDefaultFixedFont, PrevDefaultPropFont, VirtualFontName: String; - Reg : TMyRegistry; + PrevDefaultFixedFont, PrevDefaultPropFont, VirtualFontName: String; + Reg: TMyRegistry; Begin - Reg := TMyRegistry.Create; - AddFontResource(PChar(FontFilePath)); - VirtualFontName := GetFontName(FontFilePath); + Reg := TMyRegistry.Create; + AddFontResource(pchar(FontFilePath)); + VirtualFontName := GetFontName(FontFilePath); - Reg.RootKey := HKEY_CURRENT_USER; - If Reg.OpenKey('Software\Microsoft\Internet Explorer\International\Scripts\11', True) = True Then Begin - PrevDefaultFixedFont := trim(REG.ReadString('IEFixedFontName')); - PrevDefaultPropFont := trim(REG.ReadString('IEPropFontName')); + Reg.RootKey := HKEY_CURRENT_USER; + If Reg.OpenKey + ('Software\Microsoft\Internet Explorer\International\Scripts\11', True) + = True Then + Begin + PrevDefaultFixedFont := trim(Reg.ReadString('IEFixedFontName')); + PrevDefaultPropFont := trim(Reg.ReadString('IEPropFontName')); - If PrevDefaultFixedFont = '' Then PrevDefaultFixedFont := 'none'; - If PrevDefaultPropFont = '' Then PrevDefaultPropFont := 'none'; + If PrevDefaultFixedFont = '' Then + PrevDefaultFixedFont := 'none'; + If PrevDefaultPropFont = '' Then + PrevDefaultPropFont := 'none'; - If trim(REG.ReadString('IEFixedFontName_Prev')) = '' Then - reg.WriteString('IEFixedFontName_Prev', PrevDefaultFixedFont); + If trim(Reg.ReadString('IEFixedFontName_Prev')) = '' Then + Reg.WriteString('IEFixedFontName_Prev', PrevDefaultFixedFont); - If trim(REG.ReadString('IEPropFontName_Prev')) = '' Then - reg.WriteString('IEPropFontName_Prev', PrevDefaultPropFont); + If trim(Reg.ReadString('IEPropFontName_Prev')) = '' Then + Reg.WriteString('IEPropFontName_Prev', PrevDefaultPropFont); - reg.WriteString('IEFixedFontName', VirtualFontName); - reg.WriteString('IEPropFontName', VirtualFontName); + Reg.WriteString('IEFixedFontName', VirtualFontName); + Reg.WriteString('IEPropFontName', VirtualFontName); - End; + End; - SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0); - FreeAndNil(Reg); + SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0); + FreeAndNil(Reg); End; -{===============================================================================} +{ =============================================================================== } Procedure RemoveVirtualFont(FontFilePath: String); Var - PrevDefaultFixedFont, PrevDefaultPropFont: String; - Reg : TMyRegistry; + PrevDefaultFixedFont, PrevDefaultPropFont: String; + Reg: TMyRegistry; Begin - Reg := TMyRegistry.Create; - RemoveFontResource(PChar(FontFilePath)); + Reg := TMyRegistry.Create; + RemoveFontResource(pchar(FontFilePath)); - If Reg.OpenKey('Software\Microsoft\Internet Explorer\International\Scripts\11', True) = True Then Begin - PrevDefaultFixedFont := trim(REG.ReadString('IEFixedFontName_Prev')); - PrevDefaultPropFont := trim(REG.ReadString('IEPropFontName_Prev')); + If Reg.OpenKey + ('Software\Microsoft\Internet Explorer\International\Scripts\11', True) + = True Then + Begin + PrevDefaultFixedFont := trim(Reg.ReadString('IEFixedFontName_Prev')); + PrevDefaultPropFont := trim(Reg.ReadString('IEPropFontName_Prev')); - If PrevDefaultFixedFont = 'none' Then PrevDefaultFixedFont := ''; - If PrevDefaultPropFont = 'none' Then PrevDefaultPropFont := ''; + If PrevDefaultFixedFont = 'none' Then + PrevDefaultFixedFont := ''; + If PrevDefaultPropFont = 'none' Then + PrevDefaultPropFont := ''; - reg.DeleteValue('IEFixedFontName_Prev'); - reg.DeleteValue('IEPropFontName_Prev'); + Reg.DeleteValue('IEFixedFontName_Prev'); + Reg.DeleteValue('IEPropFontName_Prev'); - reg.WriteString('IEFixedFontName', PrevDefaultFixedFont); - reg.WriteString('IEPropFontName', PrevDefaultPropFont); + Reg.WriteString('IEFixedFontName', PrevDefaultFixedFont); + Reg.WriteString('IEPropFontName', PrevDefaultPropFont); - End; + End; - SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0); - FreeAndNil(Reg); + SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0); + FreeAndNil(Reg); End; - - End. - diff --git a/Keyboard and Spell checker/clean_files.bat b/Keyboard and Spell checker/clean_files.bat new file mode 100644 index 0000000..a78b328 --- /dev/null +++ b/Keyboard and Spell checker/clean_files.bat @@ -0,0 +1,10 @@ +del /s /q *.dcu +del /s /q *.dsk +del /s /q *.identcache +del /s /q *.stat +del /s /q *.local +del /s /q *.exe +del /s /q *.~* +rmdir /S /Q backup +rmdir /S /Q __history +rmdir /S /Q __recovery diff --git a/Layout Editor/Classes/clsRegistry_XMLSetting.pas b/Layout Editor/Classes/clsRegistry_XMLSetting.pas index 9964086..6c134a1 100644 --- a/Layout Editor/Classes/clsRegistry_XMLSetting.pas +++ b/Layout Editor/Classes/clsRegistry_XMLSetting.pas @@ -1,191 +1,210 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan . + The Initial Developer of the Original Code is + Mehdi Hasan Khan . - Copyright (C) OmicronLab . All Rights Reserved. + Copyright (C) OmicronLab . All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - -{COMPLETE TRANSFERING!} - +{ COMPLETE TRANSFERING! } Unit clsRegistry_XMLSetting; Interface Uses - classes, - sysutils, - StrUtils, - NativeXML, - Forms, - Registry, - uFileFolderHandling; - -//Custom Registry class + classes, + sysutils, + StrUtils, + // NativeXML, + Forms, + Registry, + XMLIntf, XMLDoc, + uFileFolderHandling; + +// Custom Registry class Type - TMyRegistry = Class(TRegistry) - Public - Function ReadStringDef(Const Name: String; DefaultVal: String = ''): String; - End; + TMyRegistry = Class(TRegistry) + Public + Function ReadStringDef(Const Name: String; DefaultVal: String = ''): String; + End; - //Skeleton of Class TXMLSetting + // Skeleton of Class TXMLSetting Type - TXMLSetting = Class - Private - XML: TNativeXml; - child: TXmlNode; - - Public - Constructor Create; //Initializer - Destructor Destroy; Override; //Destructor - - Function LoadXMLData(): Boolean; - Function GetValue(Const ValueName: UTF8String; DefaultValue: String = ''): String; - Procedure CreateNewXMLData; - Procedure SetValue(Const ValueName: UTF8String; Const ValueData: String); - Procedure SaveXMLData; + TXMLSetting = Class + Private + XML: IXMLDocument; + child: IXmlNode; - End; + Public + Constructor Create; // Initializer + Destructor Destroy; Override; // Destructor + Function LoadXMLData(): Boolean; + Function GetValue(Const ValueName: UTF8String; + DefaultValue: String = ''): String; + Procedure CreateNewXMLData; + Procedure SetValue(Const ValueName: UTF8String; Const ValueData: String); + Procedure SaveXMLData; + End; Implementation -{===============================================================================} +{ =============================================================================== } { TXMLSetting } Constructor TXMLSetting.Create; Begin - Inherited; + Inherited; - XML := TNativeXml.Create; - XML.ExternalEncoding := seUTF8; + XML := TXMLDocument.Create(nil); + XML.Active := true; + XML.Encoding := 'UTF-8'; + XML.AddChild('Settings'); End; -{===============================================================================} +{ =============================================================================== } Procedure TXMLSetting.CreateNewXMLData; Begin - Xml.Free; - XML := TNativeXml.Create; - XML.EncodingString := 'UTF-8'; - XML.ExternalEncoding := seUTF8; - XML.Root.Name := 'Settings'; + XML := nil; + XML := TXMLDocument.Create(nil); + + XML.Active := true; + XML.Encoding := 'UTF-8'; + XML.AddChild('Settings'); End; -{===============================================================================} +{ =============================================================================== } Destructor TXMLSetting.Destroy; Begin - FreeAndNil(XML); - Inherited; + XML.Active := false; + XML := nil; + Inherited; End; -{===============================================================================} +{ =============================================================================== } Function TXMLSetting.GetValue(Const ValueName: UTF8String; - DefaultValue: String): String; + DefaultValue: String): String; Begin - Try - Child := Xml.Root.FindNode(ValueName); - If Length(Trim(Child.Nodes[0].ValueAsUnicodeString)) <= 0 Then - Result := DefaultValue - Else - Result := Trim(Child.Nodes[0].ValueAsUnicodeString); - Except - On E: Exception Do - Result := DefaultValue; - End; + Try + child := XML.DocumentElement.childnodes.FindNode(ValueName); + + if assigned(child) then + begin + + If Length(Trim(child.childnodes.Nodes[0].nodevalue)) <= 0 Then + Result := DefaultValue + Else + Result := Trim(child.childnodes.Nodes[0].nodevalue); + end + else + Result := DefaultValue + Except + On E: Exception Do + Result := DefaultValue; + End; End; -{===============================================================================} +{ =============================================================================== } Function TXMLSetting.LoadXMLData(): Boolean; Begin - Try - If FileExists(ExtractFilePath(Application.ExeName) + 'Layout Editor Settings.xml') = True Then Begin - XML.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Layout Editor Settings.xml'); - Result := True; - End - Else - Result := False; - Except - On E: Exception Do - Result := False; - End; + Try + If FileExists(ExtractFilePath(Application.ExeName) + + 'Layout Editor Settings.xml') = true Then + Begin + XML.LoadFromFile(ExtractFilePath(Application.ExeName) + + 'Layout Editor Settings.xml'); + Result := true; + End + Else + Result := false; + Except + On E: Exception Do + Result := false; + End; End; -{===============================================================================} +{ =============================================================================== } Procedure TXMLSetting.SaveXMLData; Begin - XML.XmlFormat := xfReadable; - Try - Xml.SaveToFile(GetAvroDataDir + 'Layout Editor Settings.xml'); - Except - On E: Exception Do Begin - //Nothing - End; - End; + XML.XML.Text := XMLDoc.FormatXMLData(XML.XML.Text); + XML.Active := true; + Try + XML.SaveToFile(GetAvroDataDir + 'Layout Editor Settings.xml'); + Except + On E: Exception Do + Begin + // Nothing + End; + End; End; -{===============================================================================} +{ =============================================================================== } -Procedure TXMLSetting.SetValue(Const ValueName:UTF8String; const ValueData: String); +Procedure TXMLSetting.SetValue(Const ValueName: UTF8String; + const ValueData: String); Var - CdataChild : TXmlNode; + CdataChild: IXmlNode; Begin - Child := XML.Root.NodeNew(ValueName); - CdataChild := Child.NodeNew(ValueName); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := ValueData; + child := XML.DocumentElement.AddChild(ValueName); + + CdataChild := XML.CreateNode(ValueName, ntCDATA); + CdataChild.nodevalue := ValueData; + child.childnodes.Add(CdataChild); + End; -{===============================================================================} -{===============================================================================} -{===============================================================================} +{ =============================================================================== } +{ =============================================================================== } +{ =============================================================================== } { TMyRegistry } Function TMyRegistry.ReadStringDef(Const Name: String; - DefaultVal: String = ''): String; + DefaultVal: String = ''): String; Begin - Try - If ValueExists(Name) = True Then Begin - Result := ReadString(Name); - End - Else Begin - Result := DefaultVal; - End; - Except - On E: Exception Do - If Trim(Result) = '' Then - Result := DefaultVal; - End; + Try + If ValueExists(Name) = true Then + Begin + Result := ReadString(Name); + End + Else + Begin + Result := DefaultVal; + End; + Except + On E: Exception Do + If Trim(Result) = '' Then + Result := DefaultVal; + End; End; End. diff --git a/Layout Editor/Classes/uShapeInterceptor.pas b/Layout Editor/Classes/uShapeInterceptor.pas index 0528b8d..3249401 100644 --- a/Layout Editor/Classes/uShapeInterceptor.pas +++ b/Layout Editor/Classes/uShapeInterceptor.pas @@ -1,78 +1,78 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan . + The Initial Developer of the Original Code is + Mehdi Hasan Khan . - Copyright (C) OmicronLab . All Rights Reserved. + Copyright (C) OmicronLab . All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - Unit uShapeInterceptor; Interface + Uses - Windows, - SysUtils, - Classes, - Controls, - Graphics, - Dialogs, - ToolWin, - StdCtrls, - ExtCtrls; + Windows, + SysUtils, + Classes, + Controls, + Graphics, + Dialogs, + ToolWin, + StdCtrls, + ExtCtrls; Type - TShape = Class(ExtCtrls.TShape) - Private - fSelected: Boolean; - fKeyName: String; - fCaptionNormal: String; - fCaptionShift: String; - fNormal: String; - fShift: String; - fAltGr: String; - fShiftAltGr: String; - - Procedure SetSelected(Const Value: Boolean); - Procedure SetKeyName(Const Value: String); - Procedure SetCaptionNormal(Const Value: String); - Procedure SetCaptionShift(Const Value: String); - Procedure SetNormal(Const Value: String); - Procedure SetShift(Const Value: String); - Procedure SetAltGr(Const Value: String); - Procedure SetShiftAltGr(Const Value: String); - Public - - Published - Property Selected: Boolean Read fSelected Write SetSelected; - Property KeyName: String Read fKeyName Write SetKeyName; - Property CaptionNormal: String Read fCaptionNormal Write SetCaptionNormal; - Property CaptionShift: String Read fCaptionShift Write SetCaptionShift; - Property Normal: String Read fNormal Write SetNormal; - Property Shift: String Read fShift Write SetShift; - Property AltGr: String Read fAltGr Write SetAltGr; - Property ShiftAltGr: String Read fShiftAltGr Write SetShiftAltGr; - End; + TShape = Class(ExtCtrls.TShape) + Private + fSelected: Boolean; + fKeyName: String; + fCaptionNormal: String; + fCaptionShift: String; + fNormal: String; + fShift: String; + fAltGr: String; + fShiftAltGr: String; + + Procedure SetSelected(Const Value: Boolean); + Procedure SetKeyName(Const Value: String); + Procedure SetCaptionNormal(Const Value: String); + Procedure SetCaptionShift(Const Value: String); + Procedure SetNormal(Const Value: String); + Procedure SetShift(Const Value: String); + Procedure SetAltGr(Const Value: String); + Procedure SetShiftAltGr(Const Value: String); + Public + + Published + Property Selected: Boolean Read fSelected Write SetSelected; + Property KeyName: String Read fKeyName Write SetKeyName; + Property CaptionNormal: String Read fCaptionNormal Write SetCaptionNormal; + Property CaptionShift: String Read fCaptionShift Write SetCaptionShift; + Property Normal: String Read fNormal Write SetNormal; + Property Shift: String Read fShift Write SetShift; + Property AltGr: String Read fAltGr Write SetAltGr; + Property ShiftAltGr: String Read fShiftAltGr Write SetShiftAltGr; + End; Implementation @@ -80,56 +80,57 @@ Procedure TShape.SetCaptionNormal(Const Value: String); Begin - fCaptionNormal := Value; + fCaptionNormal := Value; End; Procedure TShape.SetCaptionShift(Const Value: String); Begin - fCaptionShift := Value; + fCaptionShift := Value; End; Procedure TShape.SetKeyName(Const Value: String); Begin - fKeyName := Value; + fKeyName := Value; End; Procedure TShape.SetNormal(Const Value: String); Begin - fNormal := Value; + fNormal := Value; End; Procedure TShape.SetSelected(Const Value: Boolean); Begin - fSelected := Value; - If fSelected = True Then Begin - If self.Brush.Color <> clYellow Then - self.Brush.Color := clYellow; - If self.Brush.Style <> bsFDiagonal Then - self.Brush.Style := bsFDiagonal; - End - Else Begin - If self.Brush.Color <> clYellow Then - self.Brush.Color := clYellow; - If self.Brush.Style <> bsClear Then - self.Brush.Style := bsClear; - End; + fSelected := Value; + If fSelected = True Then + Begin + If self.Brush.Color <> clYellow Then + self.Brush.Color := clYellow; + If self.Brush.Style <> bsFDiagonal Then + self.Brush.Style := bsFDiagonal; + End + Else + Begin + If self.Brush.Color <> clYellow Then + self.Brush.Color := clYellow; + If self.Brush.Style <> bsClear Then + self.Brush.Style := bsClear; + End; End; Procedure TShape.SetShift(Const Value: String); Begin - fShift := Value; + fShift := Value; End; Procedure TShape.SetAltGr(Const Value: String); Begin - fAltGr := Value; + fAltGr := Value; End; Procedure TShape.SetShiftAltGr(Const Value: String); Begin - fShiftAltGr := Value; + fShiftAltGr := Value; End; End. - diff --git a/Layout Editor/Forms/uFrmAbout.dfm b/Layout Editor/Forms/uFrmAbout.dfm index ed35b2d..989904b 100644 --- a/Layout Editor/Forms/uFrmAbout.dfm +++ b/Layout Editor/Forms/uFrmAbout.dfm @@ -432,7 +432,7 @@ object frmAbout: TfrmAbout object lblVer: TLabel Left = 79 Top = 30 - Width = 56 + Width = 55 Height = 13 Caption = 'Version : ' end diff --git a/Layout Editor/Forms/uFrmAbout.pas b/Layout Editor/Forms/uFrmAbout.pas index 7aeb686..5141653 100644 --- a/Layout Editor/Forms/uFrmAbout.pas +++ b/Layout Editor/Forms/uFrmAbout.pas @@ -1,111 +1,107 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan . + The Initial Developer of the Original Code is + Mehdi Hasan Khan . - Copyright (C) OmicronLab . All Rights Reserved. + Copyright (C) OmicronLab . All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - Unit uFrmAbout; Interface Uses - Windows, - Messages, - SysUtils, - Variants, - Classes, - Graphics, - Controls, - Forms, - Dialogs, - ExtCtrls, - StdCtrls, jpeg; + Windows, + Messages, + SysUtils, + Variants, + Classes, + Graphics, + Controls, + Forms, + Dialogs, + ExtCtrls, + StdCtrls, jpeg; Type - TfrmAbout = Class(TForm) - Label3: TLabel; - Memo1: TMemo; - lblOmicronLab: TLabel; - butClose: TButton; - Panel1: TPanel; - Image1: TImage; - Label1: TLabel; - lblVer: TLabel; + TfrmAbout = Class(TForm) + Label3: TLabel; + Memo1: TMemo; + lblOmicronLab: TLabel; + butClose: TButton; + Panel1: TPanel; + Image1: TImage; + Label1: TLabel; + lblVer: TLabel; Label8: TLabel; Label5: TLabel; - Procedure FormClose(Sender: TObject; Var Action: TCloseAction); - Procedure butCloseClick(Sender: TObject); - Procedure lblOmicronLabClick(Sender: TObject); - Procedure FormCreate(Sender: TObject); + Procedure FormClose(Sender: TObject; Var Action: TCloseAction); + Procedure butCloseClick(Sender: TObject); + Procedure lblOmicronLabClick(Sender: TObject); + Procedure FormCreate(Sender: TObject); - Private - { Private declarations } - Public - { Public declarations } - End; + Private + { Private declarations } + Public + { Public declarations } + End; Var - frmAbout : TfrmAbout; + frmAbout: TfrmAbout; Implementation {$R *.dfm} Uses - uFileFolderHandling, - clsFileVersion; - + uFileFolderHandling, + clsFileVersion; Procedure TfrmAbout.butCloseClick(Sender: TObject); Begin - Self.Close; + Self.Close; End; Procedure TfrmAbout.FormClose(Sender: TObject; Var Action: TCloseAction); Begin - Action := caFree; - frmAbout := Nil; + Action := caFree; + frmAbout := Nil; End; Procedure TfrmAbout.FormCreate(Sender: TObject); Var - FileVar : TFileVersion; + FileVar: TFileVersion; Begin - FileVar := TFileVersion.Create(); - lblVer.Caption := lblVer.Caption + ' ' + FileVar.AsString - {$IFDEF BetaVersion} + ' BETA'{$ENDIF}{$IFDEF PortableOn} + ' (Portable)'{$ENDIF}; - FileVar.Free; + FileVar := TFileVersion.Create(); + lblVer.Caption := lblVer.Caption + ' ' + FileVar.AsString +{$IFDEF BetaVersion} + ' BETA'{$ENDIF}{$IFDEF PortableOn} + + ' (Portable)'{$ENDIF}; + FileVar.Free; End; Procedure TfrmAbout.lblOmicronLabClick(Sender: TObject); Begin - Execute_Something('http://www.omicronlab.com/'); + Execute_Something('http://www.omicronlab.com/'); End; - - End. - diff --git a/Layout Editor/Forms/uFrmMain.dfm b/Layout Editor/Forms/uFrmMain.dfm index 92075a0..6aa5180 100644 --- a/Layout Editor/Forms/uFrmMain.dfm +++ b/Layout Editor/Forms/uFrmMain.dfm @@ -4041,7 +4041,7 @@ object frmMain: TfrmMain Left = 154 Top = 29 Width = 68 - Height = 35 + Height = 33 Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -16 @@ -4056,7 +4056,7 @@ object frmMain: TfrmMain Left = 154 Top = 88 Width = 68 - Height = 35 + Height = 33 Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -16 @@ -4071,7 +4071,7 @@ object frmMain: TfrmMain Left = 326 Top = 87 Width = 68 - Height = 35 + Height = 33 Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -16 @@ -4086,7 +4086,7 @@ object frmMain: TfrmMain Left = 326 Top = 29 Width = 68 - Height = 35 + Height = 33 Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -16 @@ -4107,9 +4107,9 @@ object frmMain: TfrmMain ParentBackground = False TabOrder = 4 object Label14: TLabel - Left = 18 + Left = 19 Top = 13 - Width = 302 + Width = 301 Height = 13 Alignment = taRightJustify Caption = 'You can share your layout with Avro Keyboard users' diff --git a/Layout Editor/Forms/uFrmMain.pas b/Layout Editor/Forms/uFrmMain.pas index 179360c..75763c0 100644 --- a/Layout Editor/Forms/uFrmMain.pas +++ b/Layout Editor/Forms/uFrmMain.pas @@ -1,1037 +1,1144 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan . + The Initial Developer of the Original Code is + Mehdi Hasan Khan . - Copyright (C) OmicronLab . All Rights Reserved. + Copyright (C) OmicronLab . All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - Unit uFrmMain; Interface Uses - Windows, - Messages, - SysUtils, - Variants, - Classes, - Graphics, - Controls, - Forms, - Dialogs, - ToolWin, - ComCtrls, - StdCtrls, - ExtCtrls, - GIFImg, - jpeg, - ExtDlgs, - StrUtils, - uShapeInterceptor, - nativeXML, - ImgList {Always must be the last}; + Windows, + Messages, + SysUtils, + Variants, + Classes, + Graphics, + Controls, + Forms, + Dialogs, + ToolWin, + ComCtrls, + StdCtrls, + ExtCtrls, + GIFImg, + jpeg, + ExtDlgs, + StrUtils, + uShapeInterceptor, + XMLIntf, XMLDoc, + Soap.EncdDecd, + ImgList {Always must be the last}; Type - TfrmMain = Class(TForm) - ToolBar1: TToolBar; - ToolButton5: TToolButton; - butNew: TToolButton; - butOpen: TToolButton; - butFont: TToolButton; - butHelp: TToolButton; - butAbout: TToolButton; - Panel1: TPanel; - Image1: TImage; - GroupBox1: TGroupBox; - GroupBox2: TGroupBox; - Label1: TLabel; - txtLayoutName: TEdit; - ToolButton12: TToolButton; - ToolButton13: TToolButton; - ToolButton14: TToolButton; - ToolButton15: TToolButton; - txtVersion: TEdit; - Label2: TLabel; - txtDeveloper: TEdit; - Label3: TLabel; - Label4: TLabel; - txtComment: TMemo; - txtImageAltGrShift: TEdit; - txtImageNormalShift: TEdit; - Label5: TLabel; - Label6: TLabel; - butImageAltGrShift: TButton; - butImageNormalShift: TButton; - Label8: TLabel; - txtNormal: TEdit; - txtShift: TEdit; - Label9: TLabel; - txtShiftAltGr: TEdit; - Label10: TLabel; - txtAltGr: TEdit; - Label11: TLabel; - Image3: TImage; - LabelShift: TLabel; - Shape_E: TShape; - imgNormal: TImage; - imgShift: TImage; - imgAltGr: TImage; - imgShiftAltGr: TImage; - Shape_R: TShape; - Shape_D: TShape; - Shape_S: TShape; - LabelNormal: TLabel; - Shape_F: TShape; - Shape_C: TShape; - Shape_X: TShape; - Shape_V: TShape; - Shape_G: TShape; - Shape_T: TShape; - Shape_Y: TShape; - Shape_U: TShape; - Shape_H: TShape; - Shape_B: TShape; - Shape_N: TShape; - Shape_OEM2: TShape; - Shape_PERIOD: TShape; - Shape_COMMA: TShape; - Shape_M: TShape; - Shape_Z: TShape; - Shape_J: TShape; - Shape_K: TShape; - Shape_L: TShape; - Shape_OEM1: TShape; - Shape_OEM7: TShape; - Shape_A: TShape; - Shape_OEM4: TShape; - Shape_P: TShape; - Shape_O: TShape; - Shape_I: TShape; - Shape_W: TShape; - Shape_Q: TShape; - Shape_OEM5: TShape; - Shape_OEM6: TShape; - Shape_OEM3: TShape; - Shape_1: TShape; - Shape_2: TShape; - Shape_3: TShape; - Shape_4: TShape; - Shape_5: TShape; - Shape_6: TShape; - Shape_7: TShape; - Shape_8: TShape; - Shape_9: TShape; - Shape_0: TShape; - Shape_MINUS: TShape; - Shape_PLUS: TShape; - OpenPictureDialog1: TOpenPictureDialog; - SaveDialog1: TSaveDialog; - FontDialog1: TFontDialog; - OpenDialog1: TOpenDialog; - ButSave: TToolButton; - ButSaveAs: TToolButton; - ToolButton3: TToolButton; - ToolButton4: TToolButton; - Label7: TLabel; - Panel2: TPanel; - Label14: TLabel; - Label15: TLabel; - Source: TImage; - Procedure FormCreate(Sender: TObject); - Procedure Shape_QMouseDown(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); - Procedure txtLayoutNameEnter(Sender: TObject); - Procedure txtCommentEnter(Sender: TObject); - Procedure txtNormalEnter(Sender: TObject); - Procedure butNewClick(Sender: TObject); - Procedure txtLayoutNameChange(Sender: TObject); - Procedure txtNormalChange(Sender: TObject); - Procedure txtShiftChange(Sender: TObject); - Procedure txtAltGrChange(Sender: TObject); - Procedure txtShiftAltGrChange(Sender: TObject); - Procedure butFontClick(Sender: TObject); - Procedure butHelpClick(Sender: TObject); - Procedure Label15Click(Sender: TObject); - Procedure butImageNormalShiftClick(Sender: TObject); - Procedure butImageAltGrShiftClick(Sender: TObject); - Procedure ButSaveAsClick(Sender: TObject); - Procedure ButSaveClick(Sender: TObject); - Procedure butAboutClick(Sender: TObject); - Procedure butOpenClick(Sender: TObject); - Procedure FormClose(Sender: TObject; Var Action: TCloseAction); - - - Private - { Private declarations } - fDirty: Boolean; - fSelected: TShape; - fFileName: String; - Procedure SetSelectedKey(ControlName: String); - Procedure InitializeKeys; - Procedure NewLayout; - Procedure BuildLayout; - Function NoErrorFound: Boolean; - Public - { Public declarations } - End; + TfrmMain = Class(TForm) + ToolBar1: TToolBar; + ToolButton5: TToolButton; + butNew: TToolButton; + butOpen: TToolButton; + butFont: TToolButton; + butHelp: TToolButton; + butAbout: TToolButton; + Panel1: TPanel; + Image1: TImage; + GroupBox1: TGroupBox; + GroupBox2: TGroupBox; + Label1: TLabel; + txtLayoutName: TEdit; + ToolButton12: TToolButton; + ToolButton13: TToolButton; + ToolButton14: TToolButton; + ToolButton15: TToolButton; + txtVersion: TEdit; + Label2: TLabel; + txtDeveloper: TEdit; + Label3: TLabel; + Label4: TLabel; + txtComment: TMemo; + txtImageAltGrShift: TEdit; + txtImageNormalShift: TEdit; + Label5: TLabel; + Label6: TLabel; + butImageAltGrShift: TButton; + butImageNormalShift: TButton; + Label8: TLabel; + txtNormal: TEdit; + txtShift: TEdit; + Label9: TLabel; + txtShiftAltGr: TEdit; + Label10: TLabel; + txtAltGr: TEdit; + Label11: TLabel; + Image3: TImage; + LabelShift: TLabel; + Shape_E: TShape; + imgNormal: TImage; + imgShift: TImage; + imgAltGr: TImage; + imgShiftAltGr: TImage; + Shape_R: TShape; + Shape_D: TShape; + Shape_S: TShape; + LabelNormal: TLabel; + Shape_F: TShape; + Shape_C: TShape; + Shape_X: TShape; + Shape_V: TShape; + Shape_G: TShape; + Shape_T: TShape; + Shape_Y: TShape; + Shape_U: TShape; + Shape_H: TShape; + Shape_B: TShape; + Shape_N: TShape; + Shape_OEM2: TShape; + Shape_PERIOD: TShape; + Shape_COMMA: TShape; + Shape_M: TShape; + Shape_Z: TShape; + Shape_J: TShape; + Shape_K: TShape; + Shape_L: TShape; + Shape_OEM1: TShape; + Shape_OEM7: TShape; + Shape_A: TShape; + Shape_OEM4: TShape; + Shape_P: TShape; + Shape_O: TShape; + Shape_I: TShape; + Shape_W: TShape; + Shape_Q: TShape; + Shape_OEM5: TShape; + Shape_OEM6: TShape; + Shape_OEM3: TShape; + Shape_1: TShape; + Shape_2: TShape; + Shape_3: TShape; + Shape_4: TShape; + Shape_5: TShape; + Shape_6: TShape; + Shape_7: TShape; + Shape_8: TShape; + Shape_9: TShape; + Shape_0: TShape; + Shape_MINUS: TShape; + Shape_PLUS: TShape; + OpenPictureDialog1: TOpenPictureDialog; + SaveDialog1: TSaveDialog; + FontDialog1: TFontDialog; + OpenDialog1: TOpenDialog; + ButSave: TToolButton; + ButSaveAs: TToolButton; + ToolButton3: TToolButton; + ToolButton4: TToolButton; + Label7: TLabel; + Panel2: TPanel; + Label14: TLabel; + Label15: TLabel; + Source: TImage; + Procedure FormCreate(Sender: TObject); + Procedure Shape_QMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + Procedure txtLayoutNameEnter(Sender: TObject); + Procedure txtCommentEnter(Sender: TObject); + Procedure txtNormalEnter(Sender: TObject); + Procedure butNewClick(Sender: TObject); + Procedure txtLayoutNameChange(Sender: TObject); + Procedure txtNormalChange(Sender: TObject); + Procedure txtShiftChange(Sender: TObject); + Procedure txtAltGrChange(Sender: TObject); + Procedure txtShiftAltGrChange(Sender: TObject); + Procedure butFontClick(Sender: TObject); + Procedure butHelpClick(Sender: TObject); + Procedure Label15Click(Sender: TObject); + Procedure butImageNormalShiftClick(Sender: TObject); + Procedure butImageAltGrShiftClick(Sender: TObject); + Procedure ButSaveAsClick(Sender: TObject); + Procedure ButSaveClick(Sender: TObject); + Procedure butAboutClick(Sender: TObject); + Procedure butOpenClick(Sender: TObject); + Procedure FormClose(Sender: TObject; Var Action: TCloseAction); + + Private + { Private declarations } + fDirty: Boolean; + fSelected: TShape; + fFileName: String; + Procedure SetSelectedKey(ControlName: String); + Procedure InitializeKeys; + Procedure NewLayout; + Procedure BuildLayout; + Function NoErrorFound: Boolean; + Public + { Public declarations } + End; Var - frmMain : TfrmMain; + frmMain: TfrmMain; Implementation {$R *.dfm} Uses - uFileFolderHandling, - uFrmAbout, - clsSkinLayoutConverter, - uRegistrySettings; - + uFileFolderHandling, + uFrmAbout, + clsSkinLayoutConverter, + uRegistrySettings; -{===============================================================================} +{ =============================================================================== } Procedure TfrmMain.BuildLayout; Const - b_0 : Char = #$9E6; - b_1 : Char = #$9E7; - b_2 : Char = #$9E8; - b_3 : Char = #$9E9; - b_4 : Char = #$9EA; - b_5 : Char = #$9EB; - b_6 : Char = #$9EC; - b_7 : Char = #$9ED; - b_8 : Char = #$9EE; - b_9 : Char = #$9EF; + b_0: Char = #$9E6; + b_1: Char = #$9E7; + b_2: Char = #$9E8; + b_3: Char = #$9E9; + b_4: Char = #$9EA; + b_5: Char = #$9EB; + b_6: Char = #$9EC; + b_7: Char = #$9ED; + b_8: Char = #$9EE; + b_9: Char = #$9EF; Var - XML : TNativeXml; - child : TXmlNode; - CdataChild : TXmlNode; - KeyData : TXmlNode; - I : Integer; - FStream : TFileStream; - SStream : TStringStream; + XML: IXMLDocument; + child: IXmlNode; + CdataChild: IXmlNode; + KeyData: IXmlNode; + I: Integer; + FStream: TFileStream; + SStream: TStringStream; Begin - XML := TNativeXml.Create; - XML.EncodingString := 'UTF-8'; - XML.XmlFormat := xfReadable; - XML.ExternalEncoding := seUTF8; - - XML.Root.Name := 'Layout'; - - Child := XML.Root.NodeNew('AvroKeyboardVersion'); - Child.ValueAsUnicodeString := '5'; - - Child := XML.Root.NodeNew('LayoutName'); - CdataChild := Child.NodeNew('LayoutName'); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := txtLayoutName.Text; - - Child := XML.Root.NodeNew('LayoutVersion'); - CdataChild := Child.NodeNew('LayoutVersion'); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := txtVersion.Text; - - Child := XML.Root.NodeNew('DeveloperName'); - CdataChild := Child.NodeNew('DeveloperName'); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := txtDeveloper.Text; - - Child := XML.Root.NodeNew('DeveloperComment'); - CdataChild := Child.NodeNew('DeveloperComment'); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := txtComment.Text; - - - Child := XML.Root.NodeNew('ImageNormalShift'); - Child.BinaryEncoding := xbeBase64; - If FileExists(trim(txtImageNormalShift.Text)) Then Begin - Try - Try - FStream := TFileStream.Create(txtImageNormalShift.Text, fmOpenRead, fmShareDenyWrite); - SStream := TStringStream.Create(''); - SStream.CopyFrom(FStream, FStream.Size); - Child.BinaryString := SStream.DataString; - Except - On E: Exception Do Begin - Application.MessageBox(pchar('Error occured!' + #10 + #10 + e.Message), Pchar('Layout Editor'), MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - End; - End; - Finally - FreeAndNil(FStream); - FreeAndNil(SStream); - End; - End; - - - - - Child := XML.Root.NodeNew('ImageAltGrShift'); - Child.BinaryEncoding := xbeBase64; - If FileExists(trim(txtImageAltGrShift.Text)) Then Begin - Try - Try - FStream := TFileStream.Create(txtImageAltGrShift.Text, fmOpenRead, fmShareDenyWrite); - SStream := TStringStream.Create(''); - SStream.CopyFrom(FStream, FStream.Size); - Child.BinaryString := SStream.DataString; - Except - On E: Exception Do Begin - Application.MessageBox(pchar('Error occured!' + #10 + #10 + e.Message), Pchar('Layout Editor'), MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - End; - End; - Finally - FStream.Free; - SStream.Free; - End; - End; - - - KeyData := XML.Root.NodeNew('KeyData'); - - For I := 0 To ComponentCount - 1 Do Begin - If Components[I] Is TShape Then Begin - Child := KeyData.NodeNew(UTF8String('Key_' + UpperCase((Components[i] As TShape).KeyName) + '_Normal')); - CdataChild := Child.NodeNew(UTF8String('Key_' + UpperCase((Components[i] As TShape).KeyName) + '_Normal')); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := (Components[i] As TShape).Normal; - - Child := KeyData.NodeNew(UTF8String('Key_' + UpperCase((Components[i] As TShape).KeyName) + '_Shift')); - CdataChild := Child.NodeNew(UTF8String('Key_' + UpperCase((Components[i] As TShape).KeyName) + '_Shift')); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := (Components[i] As TShape).Shift; - - Child := KeyData.NodeNew(UTF8String('Key_' + UpperCase((Components[i] As TShape).KeyName) + '_AltGr')); - CdataChild := Child.NodeNew(UTF8String('Key_' + UpperCase((Components[i] As TShape).KeyName) + '_AltGr')); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := (Components[i] As TShape).AltGr; - - Child := KeyData.NodeNew(UTF8String('Key_' + UpperCase((Components[i] As TShape).KeyName) + '_ShiftAltGr')); - CdataChild := Child.NodeNew(UTF8String('Key_' + UpperCase((Components[i] As TShape).KeyName) + '_ShiftAltGr')); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := (Components[i] As TShape).ShiftAltGr; - End; - End; - - Child := KeyData.NodeNew('Num1'); - CdataChild := Child.NodeNew('Num1'); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := b_1; - - Child := KeyData.NodeNew('Num2'); - CdataChild := Child.NodeNew('Num2'); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := b_2; - - Child := KeyData.NodeNew('Num3'); - CdataChild := Child.NodeNew('Num3'); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := b_3; - - Child := KeyData.NodeNew('Num4'); - CdataChild := Child.NodeNew('Num4'); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := b_4; - - Child := KeyData.NodeNew('Num5'); - CdataChild := Child.NodeNew('Num5'); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := b_5; - - Child := KeyData.NodeNew('Num6'); - CdataChild := Child.NodeNew('Num6'); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := b_6; - - Child := KeyData.NodeNew('Num7'); - CdataChild := Child.NodeNew('Num7'); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := b_7; - - Child := KeyData.NodeNew('Num8'); - CdataChild := Child.NodeNew('Num8'); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := b_8; - - Child := KeyData.NodeNew('Num9'); - CdataChild := Child.NodeNew('Num9'); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := b_9; - - Child := KeyData.NodeNew('Num0'); - CdataChild := Child.NodeNew('Num0'); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := b_0; - - Child := KeyData.NodeNew('NumAdd'); - CdataChild := Child.NodeNew('NumAdd'); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := '+'; - - Child := KeyData.NodeNew('NumDecimal'); - CdataChild := Child.NodeNew('NumDecimal'); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := '.'; - - Child := KeyData.NodeNew('NumDivide'); - CdataChild := Child.NodeNew('NumDivide'); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := '/'; - - Child := KeyData.NodeNew('NumMultiply'); - CdataChild := Child.NodeNew('NumMultiply'); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := '*'; - - Child := KeyData.NodeNew('NumSubtract'); - CdataChild := Child.NodeNew('NumSubtract'); - CdataChild.ElementType := xeCData; - CdataChild.ValueAsUnicodeString := '-'; - - Try - Try - Xml.SaveToFile(fFileName); - Except - On E: Exception Do Begin - Application.MessageBox(pchar('Error occured!' + #10 + #10 + e.Message), Pchar('Layout Editor'), MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - End; - End; - Finally - FreeAndNil(XML); - End; + XML := TXMLDocument.Create(nil); + XML.Active := true; + XML.Encoding := 'UTF-8'; + + XML.Addchild('Layout'); + + child := XML.DocumentElement.Addchild('AvroKeyboardVersion'); + child.nodevalue := '5'; + + child := XML.DocumentElement.Addchild('LayoutName'); + CdataChild := XML.CreateNode(txtLayoutName.Text, ntCDATA); + XML.DocumentElement.ChildNodes.nodes['LayoutName'].ChildNodes.Add(CdataChild); + + child := XML.DocumentElement.Addchild('LayoutVersion'); + CdataChild := XML.CreateNode(txtVersion.Text, ntCDATA); + XML.DocumentElement.ChildNodes.nodes['LayoutVersion'].ChildNodes.Add + (CdataChild); + + child := XML.DocumentElement.Addchild('DeveloperName'); + CdataChild := XML.CreateNode(txtDeveloper.Text, ntCDATA); + XML.DocumentElement.ChildNodes.nodes['DeveloperName'].ChildNodes.Add + (CdataChild); + + child := XML.DocumentElement.Addchild('DeveloperComment'); + CdataChild := XML.CreateNode(txtComment.Text, ntCDATA); + XML.DocumentElement.ChildNodes.nodes['DeveloperComment'].ChildNodes.Add + (CdataChild); + + child := XML.DocumentElement.Addchild('ImageNormalShift'); + // child.BinaryEncoding := xbeBase64; + If FileExists(trim(txtImageNormalShift.Text)) Then + Begin + Try + Try + FStream := TFileStream.Create(txtImageNormalShift.Text, fmOpenRead, + fmShareDenyWrite); + SStream := TStringStream.Create(''); + SStream.CopyFrom(FStream, FStream.Size); + child.nodevalue := EncodeBase64(Pchar(SStream.DataString), + Length(SStream.DataString)); + Except + On E: Exception Do + Begin + Application.MessageBox + (Pchar('Error occured!' + #10 + #10 + E.Message), + Pchar('Layout Editor'), MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + + MB_APPLMODAL); + End; + End; + Finally + FreeAndNil(FStream); + FreeAndNil(SStream); + End; + End; + + child := XML.DocumentElement.Addchild('ImageAltGrShift'); + // child.BinaryEncoding := xbeBase64; + If FileExists(trim(txtImageAltGrShift.Text)) Then + Begin + Try + Try + FStream := TFileStream.Create(txtImageAltGrShift.Text, fmOpenRead, + fmShareDenyWrite); + SStream := TStringStream.Create(''); + SStream.CopyFrom(FStream, FStream.Size); + child.nodevalue := EncodeBase64(Pchar(SStream.DataString), + Length(SStream.DataString)); + Except + On E: Exception Do + Begin + Application.MessageBox + (Pchar('Error occured!' + #10 + #10 + E.Message), + Pchar('Layout Editor'), MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + + MB_APPLMODAL); + End; + End; + Finally + FStream.Free; + SStream.Free; + End; + End; + + KeyData := XML.DocumentElement.Addchild('KeyData'); + + For I := 0 To ComponentCount - 1 Do + Begin + If Components[I] Is TShape Then + Begin + + child := KeyData.Addchild + (UTF8String('Key_' + UpperCase((Components[I] As TShape).KeyName) + + '_Normal')); + CdataChild := XML.CreateNode((Components[I] As TShape).Normal, ntCDATA); + KeyData.ChildNodes.nodes + [('Key_' + UpperCase((Components[I] As TShape).KeyName) + '_Normal') + ].ChildNodes.Add(CdataChild); + + child := KeyData.Addchild + (UTF8String('Key_' + UpperCase((Components[I] As TShape).KeyName) + + '_Shift')); + CdataChild := XML.CreateNode((Components[I] As TShape).Shift, ntCDATA); + KeyData.ChildNodes.nodes + [('Key_' + UpperCase((Components[I] As TShape).KeyName) + '_Shift') + ].ChildNodes.Add(CdataChild); + + child := KeyData.Addchild + (UTF8String('Key_' + UpperCase((Components[I] As TShape).KeyName) + + '_AltGr')); + CdataChild := XML.CreateNode((Components[I] As TShape).AltGr, ntCDATA); + KeyData.ChildNodes.nodes + [('Key_' + UpperCase((Components[I] As TShape).KeyName) + '_AltGr') + ].ChildNodes.Add(CdataChild); + + child := KeyData.Addchild + (UTF8String('Key_' + UpperCase((Components[I] As TShape).KeyName) + + '_ShiftAltGr')); + CdataChild := XML.CreateNode((Components[I] As TShape) + .ShiftAltGr, ntCDATA); + KeyData.ChildNodes.nodes + [('Key_' + UpperCase((Components[I] As TShape).KeyName) + '_ShiftAltGr') + ].ChildNodes.Add(CdataChild); + + End; + End; + + child := KeyData.Addchild('Num1'); + CdataChild := XML.CreateNode(b_1, ntCDATA); + KeyData.ChildNodes.nodes['Num1'].ChildNodes.Add(CdataChild); + + child := KeyData.Addchild('Num2'); + CdataChild := XML.CreateNode(b_2, ntCDATA); + KeyData.ChildNodes.nodes['Num2'].ChildNodes.Add(CdataChild); + + child := KeyData.Addchild('Num3'); + CdataChild := XML.CreateNode(b_3, ntCDATA); + KeyData.ChildNodes.nodes['Num3'].ChildNodes.Add(CdataChild); + + child := KeyData.Addchild('Num4'); + CdataChild := XML.CreateNode(b_4, ntCDATA); + KeyData.ChildNodes.nodes['Num4'].ChildNodes.Add(CdataChild); + + child := KeyData.Addchild('Num5'); + CdataChild := XML.CreateNode(b_5, ntCDATA); + KeyData.ChildNodes.nodes['Num5'].ChildNodes.Add(CdataChild); + + child := KeyData.Addchild('Num6'); + CdataChild := XML.CreateNode(b_6, ntCDATA); + KeyData.ChildNodes.nodes['Num6'].ChildNodes.Add(CdataChild); + + child := KeyData.Addchild('Num7'); + CdataChild := XML.CreateNode(b_7, ntCDATA); + KeyData.ChildNodes.nodes['Num7'].ChildNodes.Add(CdataChild); + + child := KeyData.Addchild('Num8'); + CdataChild := XML.CreateNode(b_8, ntCDATA); + KeyData.ChildNodes.nodes['Num8'].ChildNodes.Add(CdataChild); + + child := KeyData.Addchild('Num9'); + CdataChild := XML.CreateNode(b_9, ntCDATA); + KeyData.ChildNodes.nodes['Num9'].ChildNodes.Add(CdataChild); + + child := KeyData.Addchild('Num0'); + CdataChild := XML.CreateNode(b_0, ntCDATA); + KeyData.ChildNodes.nodes['Num0'].ChildNodes.Add(CdataChild); + + child := KeyData.Addchild('NumAdd'); + CdataChild := XML.CreateNode('+', ntCDATA); + KeyData.ChildNodes.nodes['NumAdd'].ChildNodes.Add(CdataChild); + + child := KeyData.Addchild('NumDecimal'); + CdataChild := XML.CreateNode('.', ntCDATA); + KeyData.ChildNodes.nodes['NumDecimal'].ChildNodes.Add(CdataChild); + + child := KeyData.Addchild('NumDivide'); + CdataChild := XML.CreateNode('/', ntCDATA); + KeyData.ChildNodes.nodes['NumDivide'].ChildNodes.Add(CdataChild); + + child := KeyData.Addchild('NumMultiply'); + CdataChild := XML.CreateNode('*', ntCDATA); + KeyData.ChildNodes.nodes['NumMultiply'].ChildNodes.Add(CdataChild); + + child := KeyData.Addchild('NumSubtract'); + CdataChild := XML.CreateNode('-', ntCDATA); + KeyData.ChildNodes.nodes['NumSubtract'].ChildNodes.Add(CdataChild); + + Try + Try + XML.SaveToFile(fFileName); + Except + On E: Exception Do + Begin + Application.MessageBox(Pchar('Error occured!' + #10 + #10 + E.Message), + Pchar('Layout Editor'), MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + + MB_APPLMODAL); + End; + End; + Finally + + XML.Active := false; + XML := nil; + End; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmMain.butAboutClick(Sender: TObject); Begin - Application.CreateForm(TfrmAbout, frmAbout); - - Try - frmAbout.ShowModal; - Except - On E: Exception Do Begin - //Nothing - End; - End; + Application.CreateForm(TfrmAbout, frmAbout); + + Try + frmAbout.ShowModal; + Except + On E: Exception Do + Begin + // Nothing + End; + End; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmMain.butFontClick(Sender: TObject); Begin - //Initialize - FontDialog1.Font.Name := LEFontName; - FontDialog1.Font.Size := StrToInt(LEFontSize); - - //Open dialog - If FontDialog1.Execute Then Begin - txtNormal.Font := FontDialog1.Font; - txtShift.Font := FontDialog1.Font; - txtAltGr.Font := FontDialog1.Font; - txtShiftAltGr.Font := FontDialog1.Font; - LEFontName := FontDialog1.Font.Name; - LEFontSize := IntToStr(FontDialog1.Font.Size); - End; + // Initialize + FontDialog1.Font.Name := LEFontName; + FontDialog1.Font.Size := StrToInt(LEFontSize); + + // Open dialog + If FontDialog1.Execute Then + Begin + txtNormal.Font := FontDialog1.Font; + txtShift.Font := FontDialog1.Font; + txtAltGr.Font := FontDialog1.Font; + txtShiftAltGr.Font := FontDialog1.Font; + LEFontName := FontDialog1.Font.Name; + LEFontSize := IntToStr(FontDialog1.Font.Size); + End; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmMain.butHelpClick(Sender: TObject); Begin - If FileExists(ExtractFilePath(Application.ExeName) + 'Editing Keyboard Layout.pdf') Then - Execute_Something(ExtractFilePath(Application.ExeName) + 'Editing Keyboard Layout.pdf') - Else - Execute_Something('http://www.omicronlab.com/go.php?id=' + IntToStr(35)); + If FileExists(ExtractFilePath(Application.ExeName) + + 'Editing Keyboard Layout.pdf') Then + Execute_Something(ExtractFilePath(Application.ExeName) + + 'Editing Keyboard Layout.pdf') + Else + Execute_Something('http://www.omicronlab.com/go.php?id=' + IntToStr(35)); End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmMain.butImageAltGrShiftClick(Sender: TObject); Begin - OpenPictureDialog1.FileName := ''; - Try - If OpenPictureDialog1.Execute(Self.Handle) Then - txtImageAltGrShift.Text := OpenPictureDialog1.FileName; - Except - On E: Exception Do Begin - Application.MessageBox(pchar('Error occured!' + #10 + #10 + e.Message), Pchar('Layout Editor'), MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - End; - End; + OpenPictureDialog1.FileName := ''; + Try + If OpenPictureDialog1.Execute(Self.Handle) Then + txtImageAltGrShift.Text := OpenPictureDialog1.FileName; + Except + On E: Exception Do + Begin + Application.MessageBox(Pchar('Error occured!' + #10 + #10 + E.Message), + Pchar('Layout Editor'), MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + + MB_APPLMODAL); + End; + End; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmMain.butImageNormalShiftClick(Sender: TObject); Begin - OpenPictureDialog1.FileName := ''; - Try - If OpenPictureDialog1.Execute(Self.Handle) Then - txtImageNormalShift.Text := OpenPictureDialog1.FileName; - - Except - On E: Exception Do Begin - Application.MessageBox(pchar('Error occured!' + #10 + #10 + e.Message), Pchar('Layout Editor'), MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - End; - End; + OpenPictureDialog1.FileName := ''; + Try + If OpenPictureDialog1.Execute(Self.Handle) Then + txtImageNormalShift.Text := OpenPictureDialog1.FileName; + + Except + On E: Exception Do + Begin + Application.MessageBox(Pchar('Error occured!' + #10 + #10 + E.Message), + Pchar('Layout Editor'), MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + + MB_APPLMODAL); + End; + End; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmMain.butNewClick(Sender: TObject); Begin - NewLayout; + NewLayout; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmMain.butOpenClick(Sender: TObject); Var - XML : TNativeXml; - Node : TXmlNode; - I, P : Integer; - KeyName, Layer, TrimLeftString: String; - tmpShape : TShape; - FStream : TFileStream; - SStream : TStringStream; - - m_Converter : TSkinLayoutConverter; + XML: IXMLDocument; + Node: IXmlNode; + I, P: Integer; + KeyName, Layer, TrimLeftString: String; + tmpShape: TShape; + FStream: TFileStream; + SStream: TStringStream; + + m_Converter: TSkinLayoutConverter; Begin - Opendialog1.InitialDir := LELastDir; - If Opendialog1.Execute(Self.Handle) = False Then - exit; - LELastDir := ExtractFilePath(Opendialog1.FileName); - - m_Converter := TSkinLayoutConverter.Create; - m_Converter.CheckConvertLayout(Opendialog1.FileName); - FreeAndNil(m_Converter); - - XML := TNativeXml.Create; - XML.EncodingString := 'UTF-8'; - XML.XmlFormat := xfReadable; - XML.ExternalEncoding := seUTF8; - - Try - Try - XML.LoadFromFile(Opendialog1.FileName); - - //---------------------------------------------- - //Check if the layout is a compatible one - If trim(Xml.Root.FindNode('AvroKeyboardVersion').ValueAsUnicodeString) <> '5' Then Begin - Application.MessageBox('This Keyboard Layout is not compatible with current version of Avro Keyboard.', 'Error loading keyboard layout...', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - Exit; - End; - //---------------------------------------------- - - //Load basic informations - txtLayoutName.Text := Xml.Root.FindNode('LayoutName').Nodes[0].ValueAsUnicodeString; - txtDeveloper.Text := Xml.Root.FindNode('DeveloperName').Nodes[0].ValueAsUnicodeString; - txtVersion.Text := Xml.Root.FindNode('LayoutVersion').Nodes[0].ValueAsUnicodeString; - txtComment.Text := Xml.Root.FindNode('DeveloperComment').Nodes[0].ValueAsUnicodeString; - - //Extract images - If Xml.Root.FindNode('ImageNormalShift') <> Nil Then Begin - - FStream := TFileStream.Create(GetAvroDataDir + 'tmpImage_Normal_Shift.bmp', fmCreate); - SStream := TStringStream.Create(Xml.Root.FindNode('ImageNormalShift').BinaryString); - SStream.Position := 0; - FStream.CopyFrom(SStream, SStream.Size); - txtImageNormalShift.Text := GetAvroDataDir + 'tmpImage_Normal_Shift.bmp'; - FStream.Free; - SStream.Free; - End; - - If Xml.Root.FindNode('ImageAltGrShift') <> Nil Then Begin - FStream := TFileStream.Create(GetAvroDataDir + 'tmpImage_AltGr_Shift.bmp', fmCreate); - SStream := TStringStream.Create(Xml.Root.FindNode('ImageAltGrShift').BinaryString); - SStream.Position := 0; - FStream.CopyFrom(SStream, SStream.Size); - txtImageAltGrShift.Text := GetAvroDataDir + 'tmpImage_AltGr_Shift.bmp'; - FStream.Free; - SStream.Free; - End; - - - - //Load Keys - Node := XML.Root.FindNode('KeyData'); - - For I := 0 To Node.NodeCount - 1 Do Begin - If LowerCase(LeftStr(Node.Nodes[i].Name, 3)) <> 'num' Then Begin - - // Structure: Key_OEM1_Normal - TrimLeftString := MidStr(Node.Nodes[i].Name, 5, Length(Node.Nodes[i].Name)); //OEM1_normal - P := Pos('_', TrimLeftString); - KeyName := MidStr(TrimLeftString, 1, P - 1); //OEM - Layer := LowerCase(MidStr(TrimLeftString, P + 1, Length(TrimLeftString))); //normal/Shift/AltGr/ShiftAltGr - - tmpShape := FindComponent('Shape_' + KeyName) As TShape; - - If Node.Nodes[i].NodeCount <= 0 Then Begin - //If item has no cdata - If Layer = 'normal' Then tmpShape.Normal := ''; - If Layer = 'shift' Then tmpShape.Shift := ''; - If Layer = 'altgr' Then tmpShape.AltGr := ''; - If Layer = 'shiftaltgr' Then tmpShape.ShiftAltGr := ''; - End - Else Begin - //if item has cdata - If Layer = 'normal' Then tmpShape.Normal := Node.Nodes[i].Nodes[0].ValueAsUnicodeString; - If Layer = 'shift' Then tmpShape.Shift := Node.Nodes[i].Nodes[0].ValueAsUnicodeString; - If Layer = 'altgr' Then tmpShape.AltGr := Node.Nodes[i].Nodes[0].ValueAsUnicodeString; - If Layer = 'shiftaltgr' Then tmpShape.ShiftAltGr := Node.Nodes[i].Nodes[0].ValueAsUnicodeString; - End; - End; - End; - - - Except - On E: Exception Do Begin - Application.MessageBox(pchar('Error occured!' + #10 + #10 + e.Message), Pchar('Layout Editor'), MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - NewLayout; - End; + OpenDialog1.InitialDir := LELastDir; + If OpenDialog1.Execute(Self.Handle) = false Then + exit; + LELastDir := ExtractFilePath(OpenDialog1.FileName); + + m_Converter := TSkinLayoutConverter.Create; + m_Converter.CheckConvertLayout(OpenDialog1.FileName); + FreeAndNil(m_Converter); + + XML := TXMLDocument.Create(nil); + XML.Active := true; + XML.Encoding := 'UTF-8'; + Try + Try + XML.LoadFromFile(OpenDialog1.FileName); + + // ---------------------------------------------- + // Check if the layout is a compatible one + If trim(XML.DocumentElement.ChildNodes.FindNode('AvroKeyboardVersion') + .nodevalue) <> '5' Then + Begin + Application.MessageBox + ('This Keyboard Layout is not compatible with current version of Avro Keyboard.', + 'Error loading keyboard layout...', MB_OK + MB_ICONHAND + + MB_DEFBUTTON1 + MB_APPLMODAL); + exit; + End; + // ---------------------------------------------- + + // Load basic informations + txtLayoutName.Text := XML.DocumentElement.ChildNodes.FindNode + ('LayoutName').nodevalue; + txtDeveloper.Text := XML.DocumentElement.ChildNodes.FindNode + ('DeveloperName').nodevalue; + txtVersion.Text := XML.DocumentElement.ChildNodes.FindNode + ('LayoutVersion').nodevalue; + txtComment.Text := XML.DocumentElement.ChildNodes.FindNode + ('DeveloperComment').nodevalue; + + // Extract images + If XML.DocumentElement.ChildNodes.FindNode('ImageNormalShift') <> Nil Then + Begin + + FStream := TFileStream.Create(GetAvroDataDir + + 'tmpImage_Normal_Shift.bmp', fmCreate); + SStream := TStringStream.Create + (DecodeBase64(VarToStr(XML.DocumentElement.ChildNodes.FindNode + ('ImageNormalShift').nodevalue))); + SStream.Position := 0; + FStream.CopyFrom(SStream, SStream.Size); + txtImageNormalShift.Text := GetAvroDataDir + + 'tmpImage_Normal_Shift.bmp'; + FStream.Free; + SStream.Free; + End; + + If XML.DocumentElement.ChildNodes.FindNode('ImageAltGrShift') <> Nil Then + Begin + FStream := TFileStream.Create(GetAvroDataDir + + 'tmpImage_AltGr_Shift.bmp', fmCreate); + SStream := TStringStream.Create + (DecodeBase64(VarToStr(XML.DocumentElement.ChildNodes.FindNode + ('ImageAltGrShift').nodevalue))); + SStream.Position := 0; + FStream.CopyFrom(SStream, SStream.Size); + txtImageAltGrShift.Text := GetAvroDataDir + 'tmpImage_AltGr_Shift.bmp'; + FStream.Free; + SStream.Free; + End; + + // Load Keys + Node := XML.DocumentElement.ChildNodes.FindNode('KeyData'); + + For I := 0 To Node.ChildNodes.Count - 1 Do + Begin + If LowerCase(LeftStr(Node.ChildNodes.nodes[I].Nodename, 3)) <> + 'num' Then + Begin + + // Structure: Key_OEM1_Normal + TrimLeftString := MidStr(Node.ChildNodes.nodes[I].Nodename, 5, + Length(Node.ChildNodes.nodes[I].Nodename)); // OEM1_normal + P := Pos('_', TrimLeftString); + KeyName := MidStr(TrimLeftString, 1, P - 1); // OEM + Layer := LowerCase(MidStr(TrimLeftString, P + 1, + Length(TrimLeftString))); // normal/Shift/AltGr/ShiftAltGr + + tmpShape := FindComponent('Shape_' + KeyName) As TShape; + + If Node.ChildNodes.nodes[I].ChildNodes.Count <= 0 Then + Begin + // If item has no cdata + If Layer = 'normal' Then + tmpShape.Normal := ''; + If Layer = 'shift' Then + tmpShape.Shift := ''; + If Layer = 'altgr' Then + tmpShape.AltGr := ''; + If Layer = 'shiftaltgr' Then + tmpShape.ShiftAltGr := ''; + End + Else + Begin + + // if item has cdata + If Layer = 'normal' Then + tmpShape.Normal := + VarToStr(Node.ChildNodes.nodes[I].ChildNodes.nodes[0] + .nodevalue); + If Layer = 'shift' Then + tmpShape.Shift := + VarToStr(Node.ChildNodes.nodes[I].ChildNodes.nodes[0] + .nodevalue); + If Layer = 'altgr' Then + tmpShape.AltGr := + VarToStr(Node.ChildNodes.nodes[I].ChildNodes.nodes[0] + .nodevalue); + If Layer = 'shiftaltgr' Then + tmpShape.ShiftAltGr := + VarToStr(Node.ChildNodes.nodes[I].ChildNodes.nodes[0] + .nodevalue); End; - Finally - FreeAndNil(XML); - End; - - SetSelectedKey('Shape_Q'); + End; + End; + + Except + On E: Exception Do + Begin + Application.MessageBox(Pchar('Error occured!' + #10 + #10 + E.Message), + Pchar('Layout Editor'), MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + + MB_APPLMODAL); + NewLayout; + End; + End; + Finally + + XML.Active := false; + XML := nil; + End; + + SetSelectedKey('Shape_Q'); End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmMain.ButSaveAsClick(Sender: TObject); Begin - If NoErrorFound = False Then - exit; - - Try - Savedialog1.FileName := txtLayoutName.Text + '.avrolayout'; - If Savedialog1.Execute(self.Handle) Then Begin - LELastDir := ExtractFilePath(Savedialog1.FileName); - fFileName := Savedialog1.FileName; - BuildLayout; - End; - - Except - On E: Exception Do Begin - Application.MessageBox(pchar('Error occured!' + #10 + #10 + e.Message), Pchar('Layout Editor'), MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - End; - End; + If NoErrorFound = false Then + exit; + + Try + SaveDialog1.FileName := txtLayoutName.Text + '.avrolayout'; + If SaveDialog1.Execute(Self.Handle) Then + Begin + LELastDir := ExtractFilePath(SaveDialog1.FileName); + fFileName := SaveDialog1.FileName; + BuildLayout; + End; + + Except + On E: Exception Do + Begin + Application.MessageBox(Pchar('Error occured!' + #10 + #10 + E.Message), + Pchar('Layout Editor'), MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + + MB_APPLMODAL); + End; + End; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmMain.ButSaveClick(Sender: TObject); Begin - If NoErrorFound = False Then - exit; + If NoErrorFound = false Then + exit; - If fFileName = '' Then - ButSaveAsClick(Nil) - Else - BuildLayout; + If fFileName = '' Then + ButSaveAsClick(Nil) + Else + BuildLayout; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmMain.FormClose(Sender: TObject; Var Action: TCloseAction); Begin - SaveSettings; + SaveSettings; - Action := caFree; - frmMain := Nil; + Action := caFree; + frmMain := Nil; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmMain.FormCreate(Sender: TObject); Begin - InitializeKeys; - NewLayout; - fDirty := False; - - LoadSettings; - Self.Top := StrToInt(LETop); - Self.Left := StrToInt(LELeft); - txtNormal.Font.Name := LEFontName; - txtShift.Font.Name := LEFontName; - txtAltGr.Font.Name := LEFontName; - txtShiftAltGr.Font.Name := LEFontName; - txtNormal.Font.Size := StrToInt(LEFontSize); - txtShift.Font.Size := StrToInt(LEFontSize); - txtAltGr.Font.Size := StrToInt(LEFontSize); - txtShiftAltGr.Font.Size := StrToInt(LEFontSize); + InitializeKeys; + NewLayout; + fDirty := false; + LoadSettings; + Self.Top := StrToInt(LETop); + Self.Left := StrToInt(LELeft); + txtNormal.Font.Name := LEFontName; + txtShift.Font.Name := LEFontName; + txtAltGr.Font.Name := LEFontName; + txtShiftAltGr.Font.Name := LEFontName; + txtNormal.Font.Size := StrToInt(LEFontSize); + txtShift.Font.Size := StrToInt(LEFontSize); + txtAltGr.Font.Size := StrToInt(LEFontSize); + txtShiftAltGr.Font.Size := StrToInt(LEFontSize); End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmMain.InitializeKeys; Var - I : Integer; + I: Integer; Begin - {$REGION 'Initializing stuffs'} - With Shape_OEM3 Do Begin - KeyName := UpperCase(MidStr(Name, 7, Length(Name))); - CaptionNormal := '`'; - CaptionShift := '~'; - End; - - With Shape_1 Do Begin - KeyName := UpperCase(MidStr(Name, 7, Length(Name))); - CaptionNormal := '1'; - CaptionShift := '!'; - End; - - With Shape_2 Do Begin - KeyName := UpperCase(MidStr(Name, 7, Length(Name))); - CaptionNormal := '2'; - CaptionShift := '@'; - End; - - With Shape_3 Do Begin - KeyName := UpperCase(MidStr(Name, 7, Length(Name))); - CaptionNormal := '3'; - CaptionShift := '#'; - End; - - With Shape_4 Do Begin - KeyName := UpperCase(MidStr(Name, 7, Length(Name))); - CaptionNormal := '4'; - CaptionShift := '$'; - End; - - With Shape_4 Do Begin - KeyName := UpperCase(MidStr(Name, 7, Length(Name))); - CaptionNormal := '4'; - CaptionShift := '$'; - End; - - With Shape_5 Do Begin - KeyName := UpperCase(MidStr(Name, 7, Length(Name))); - CaptionNormal := '5'; - CaptionShift := '%'; - End; - - With Shape_6 Do Begin - KeyName := UpperCase(MidStr(Name, 7, Length(Name))); - CaptionNormal := '6'; - CaptionShift := '^'; - End; - - With Shape_7 Do Begin - KeyName := UpperCase(MidStr(Name, 7, Length(Name))); - CaptionNormal := '7'; - CaptionShift := '&'; - End; - - With Shape_8 Do Begin - KeyName := UpperCase(MidStr(Name, 7, Length(Name))); - CaptionNormal := '8'; - CaptionShift := '*'; - End; - - With Shape_9 Do Begin - KeyName := UpperCase(MidStr(Name, 7, Length(Name))); - CaptionNormal := '9'; - CaptionShift := '('; - End; - - With Shape_0 Do Begin - KeyName := UpperCase(MidStr(Name, 7, Length(Name))); - CaptionNormal := '0'; - CaptionShift := ')'; - End; - - With Shape_MINUS Do Begin - KeyName := UpperCase(MidStr(Name, 7, Length(Name))); - CaptionNormal := '-'; - CaptionShift := '_'; - End; - - With Shape_PLUS Do Begin - KeyName := UpperCase(MidStr(Name, 7, Length(Name))); - CaptionNormal := '='; - CaptionShift := '+'; - End; - - With Shape_OEM4 Do Begin - KeyName := UpperCase(MidStr(Name, 7, Length(Name))); - CaptionNormal := '['; - CaptionShift := '{'; - End; - - With Shape_OEM6 Do Begin - KeyName := UpperCase(MidStr(Name, 7, Length(Name))); - CaptionNormal := ']'; - CaptionShift := '}'; - End; - - With Shape_OEM5 Do Begin - KeyName := UpperCase(MidStr(Name, 7, Length(Name))); - CaptionNormal := '\'; - CaptionShift := '|'; - End; - - With Shape_COMMA Do Begin - KeyName := UpperCase(MidStr(Name, 7, Length(Name))); - CaptionNormal := ','; - CaptionShift := '<'; - End; - - With Shape_PERIOD Do Begin - KeyName := UpperCase(MidStr(Name, 7, Length(Name))); - CaptionNormal := '.'; - CaptionShift := '>'; - End; - - With Shape_OEM2 Do Begin - KeyName := UpperCase(MidStr(Name, 7, Length(Name))); - CaptionNormal := '/'; - CaptionShift := '?'; - End; - - With Shape_OEM1 Do Begin - KeyName := UpperCase(MidStr(Name, 7, Length(Name))); - CaptionNormal := ';'; - CaptionShift := ':'; - End; - - With Shape_OEM7 Do Begin +{$REGION 'Initializing stuffs'} + With Shape_OEM3 Do + Begin + KeyName := UpperCase(MidStr(Name, 7, Length(Name))); + CaptionNormal := '`'; + CaptionShift := '~'; + End; + + With Shape_1 Do + Begin + KeyName := UpperCase(MidStr(Name, 7, Length(Name))); + CaptionNormal := '1'; + CaptionShift := '!'; + End; + + With Shape_2 Do + Begin + KeyName := UpperCase(MidStr(Name, 7, Length(Name))); + CaptionNormal := '2'; + CaptionShift := '@'; + End; + + With Shape_3 Do + Begin + KeyName := UpperCase(MidStr(Name, 7, Length(Name))); + CaptionNormal := '3'; + CaptionShift := '#'; + End; + + With Shape_4 Do + Begin + KeyName := UpperCase(MidStr(Name, 7, Length(Name))); + CaptionNormal := '4'; + CaptionShift := '$'; + End; + + With Shape_4 Do + Begin + KeyName := UpperCase(MidStr(Name, 7, Length(Name))); + CaptionNormal := '4'; + CaptionShift := '$'; + End; + + With Shape_5 Do + Begin + KeyName := UpperCase(MidStr(Name, 7, Length(Name))); + CaptionNormal := '5'; + CaptionShift := '%'; + End; + + With Shape_6 Do + Begin + KeyName := UpperCase(MidStr(Name, 7, Length(Name))); + CaptionNormal := '6'; + CaptionShift := '^'; + End; + + With Shape_7 Do + Begin + KeyName := UpperCase(MidStr(Name, 7, Length(Name))); + CaptionNormal := '7'; + CaptionShift := '&'; + End; + + With Shape_8 Do + Begin + KeyName := UpperCase(MidStr(Name, 7, Length(Name))); + CaptionNormal := '8'; + CaptionShift := '*'; + End; + + With Shape_9 Do + Begin + KeyName := UpperCase(MidStr(Name, 7, Length(Name))); + CaptionNormal := '9'; + CaptionShift := '('; + End; + + With Shape_0 Do + Begin + KeyName := UpperCase(MidStr(Name, 7, Length(Name))); + CaptionNormal := '0'; + CaptionShift := ')'; + End; + + With Shape_MINUS Do + Begin + KeyName := UpperCase(MidStr(Name, 7, Length(Name))); + CaptionNormal := '-'; + CaptionShift := '_'; + End; + + With Shape_PLUS Do + Begin + KeyName := UpperCase(MidStr(Name, 7, Length(Name))); + CaptionNormal := '='; + CaptionShift := '+'; + End; + + With Shape_OEM4 Do + Begin + KeyName := UpperCase(MidStr(Name, 7, Length(Name))); + CaptionNormal := '['; + CaptionShift := '{'; + End; + + With Shape_OEM6 Do + Begin + KeyName := UpperCase(MidStr(Name, 7, Length(Name))); + CaptionNormal := ']'; + CaptionShift := '}'; + End; + + With Shape_OEM5 Do + Begin + KeyName := UpperCase(MidStr(Name, 7, Length(Name))); + CaptionNormal := '\'; + CaptionShift := '|'; + End; + + With Shape_COMMA Do + Begin + KeyName := UpperCase(MidStr(Name, 7, Length(Name))); + CaptionNormal := ','; + CaptionShift := '<'; + End; + + With Shape_PERIOD Do + Begin + KeyName := UpperCase(MidStr(Name, 7, Length(Name))); + CaptionNormal := '.'; + CaptionShift := '>'; + End; + + With Shape_OEM2 Do + Begin + KeyName := UpperCase(MidStr(Name, 7, Length(Name))); + CaptionNormal := '/'; + CaptionShift := '?'; + End; + + With Shape_OEM1 Do + Begin + KeyName := UpperCase(MidStr(Name, 7, Length(Name))); + CaptionNormal := ';'; + CaptionShift := ':'; + End; + + With Shape_OEM7 Do + Begin + KeyName := UpperCase(MidStr(Name, 7, Length(Name))); + CaptionNormal := #39; + CaptionShift := '"'; + End; + + /// //////////// Initialize alphabet keys + For I := 0 To ComponentCount - 1 Do + Begin + If Components[I] Is TShape Then + Begin + If (Components[I] As TShape).KeyName = '' Then + Begin + With (Components[I] As TShape) Do + Begin KeyName := UpperCase(MidStr(Name, 7, Length(Name))); - CaptionNormal := #39; - CaptionShift := '"'; - End; - - /////////////// Initialize alphabet keys - For I := 0 To ComponentCount - 1 Do Begin - If Components[I] Is TShape Then Begin - If (Components[i] As TShape).KeyName = '' Then Begin - With (Components[i] As TShape) Do Begin - KeyName := UpperCase(MidStr(Name, 7, Length(Name))); - CaptionNormal := LowerCase(KeyName); - CaptionShift := UpperCase(CaptionNormal); - End; - End; - End; - End; - {$ENDREGION} - + CaptionNormal := LowerCase(KeyName); + CaptionShift := UpperCase(CaptionNormal); + End; + End; + End; + End; +{$ENDREGION} End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmMain.Label15Click(Sender: TObject); Begin - Execute_Something('http://www.omicronlab.com/go.php?id=5'); + Execute_Something('http://www.omicronlab.com/go.php?id=5'); End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmMain.NewLayout; Var - retVal : Integer; + retVal: Integer; Begin - If fDirty Then Begin - retVal := Application.MessageBox('Save changes to the current keyboard layout?', 'Layout Editor', MB_YESNOCANCEL + +MB_ICONQUESTION + MB_DEFBUTTON1 + MB_APPLMODAL); - If retVal = ID_YES Then Begin - If NoErrorFound = True Then - ButSaveClick(Nil) - Else - exit; - End - Else If retVal = ID_CANCEL Then - exit; - End; - - txtLayoutName.Text := '[My Layout]'; - txtVersion.Text := '1'; - txtDeveloper.Text := 'Your Name'; - txtComment.Text := 'Some Comments'; - txtImageNormalShift.Text := ''; - txtImageAltGrShift.Text := ''; - - txtNormal.Text := ''; - txtShift.Text := ''; - txtAltGr.Text := ''; - txtShiftAltGr.Text := ''; - - SetSelectedKey('Shape_Q'); - - fFileName := ''; - fDirty := False; + If fDirty Then + Begin + retVal := Application.MessageBox + ('Save changes to the current keyboard layout?', 'Layout Editor', + MB_YESNOCANCEL + +MB_ICONQUESTION + MB_DEFBUTTON1 + MB_APPLMODAL); + If retVal = ID_YES Then + Begin + If NoErrorFound = true Then + ButSaveClick(Nil) + Else + exit; + End + Else If retVal = ID_CANCEL Then + exit; + End; + + txtLayoutName.Text := '[My Layout]'; + txtVersion.Text := '1'; + txtDeveloper.Text := 'Your Name'; + txtComment.Text := 'Some Comments'; + txtImageNormalShift.Text := ''; + txtImageAltGrShift.Text := ''; + + txtNormal.Text := ''; + txtShift.Text := ''; + txtAltGr.Text := ''; + txtShiftAltGr.Text := ''; + + SetSelectedKey('Shape_Q'); + + fFileName := ''; + fDirty := false; End; -{===============================================================================} +{ =============================================================================== } Function TfrmMain.NoErrorFound: Boolean; Begin - result := False; - If (Trim(txtLayoutName.Text) = '') Or (Trim(txtLayoutName.Text) = '[My Layout]') Then Begin - Application.MessageBox('Please give a name to your layout first.', 'Layout Editor', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - txtLayoutName.SetFocus; - txtLayoutName.SelectAll; - exit; - End; - If trim(txtImageNormalShift.Text) = '' Then Begin - Application.MessageBox('Please add bitmap images for Layout Viewer of Avro Keyboard before building keyboard layout.', 'Layout Editor', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - exit; - End; - If trim(txtImageAltGrShift.Text) = '' Then Begin - Application.MessageBox('Please add bitmap images for Layout Viewer of Avro Keyboard before building keyboard layout.', 'Layout Editor', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - exit; - End; - result := True; + result := false; + If (trim(txtLayoutName.Text) = '') Or + (trim(txtLayoutName.Text) = '[My Layout]') Then + Begin + Application.MessageBox('Please give a name to your layout first.', + 'Layout Editor', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); + txtLayoutName.SetFocus; + txtLayoutName.SelectAll; + exit; + End; + If trim(txtImageNormalShift.Text) = '' Then + Begin + Application.MessageBox + ('Please add bitmap images for Layout Viewer of Avro Keyboard before building keyboard layout.', + 'Layout Editor', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); + exit; + End; + If trim(txtImageAltGrShift.Text) = '' Then + Begin + Application.MessageBox + ('Please add bitmap images for Layout Viewer of Avro Keyboard before building keyboard layout.', + 'Layout Editor', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); + exit; + End; + result := true; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmMain.SetSelectedKey(ControlName: String); Var - I : Integer; + I: Integer; Begin - For I := 0 To ComponentCount - 1 Do Begin - If Components[I] Is TShape Then Begin - If UpperCase((Components[i] As TShape).Name) = UpperCase(ControlName) Then Begin - (Components[i] As TShape).Selected := True; - fSelected := Components[i] As TShape; - - If (Components[i] As TShape).CaptionShift <> '&' Then - LabelShift.Caption := (Components[i] As TShape).CaptionShift - Else - LabelShift.Caption := '&&'; - - LabelNormal.Caption := (Components[i] As TShape).CaptionNormal; - - txtNormal.Text := (Components[i] As TShape).Normal; - txtShift.Text := (Components[i] As TShape).Shift; - txtAltGr.Text := (Components[i] As TShape).AltGr; - txtShiftAltGr.Text := (Components[i] As TShape).ShiftAltGr; - - End - Else - (Components[i] As TShape).Selected := False; - End; - End; + For I := 0 To ComponentCount - 1 Do + Begin + If Components[I] Is TShape Then + Begin + If UpperCase((Components[I] As TShape).Name) = UpperCase(ControlName) Then + Begin + (Components[I] As TShape).Selected := true; + fSelected := Components[I] As TShape; + + If (Components[I] As TShape).CaptionShift <> '&' Then + LabelShift.Caption := (Components[I] As TShape).CaptionShift + Else + LabelShift.Caption := '&&'; + + LabelNormal.Caption := (Components[I] As TShape).CaptionNormal; + + txtNormal.Text := (Components[I] As TShape).Normal; + txtShift.Text := (Components[I] As TShape).Shift; + txtAltGr.Text := (Components[I] As TShape).AltGr; + txtShiftAltGr.Text := (Components[I] As TShape).ShiftAltGr; + + End + Else + (Components[I] As TShape).Selected := false; + End; + End; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmMain.Shape_QMouseDown(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); + Shift: TShiftState; X, Y: Integer); Begin - SetSelectedKey((Sender As TShape).Name); + SetSelectedKey((Sender As TShape).Name); End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmMain.txtAltGrChange(Sender: TObject); Begin - fSelected.AltGr := txtAltGr.Text; - If txtAltGr.Text = '' Then - imgAltGr.Visible := True - Else - imgAltGr.Visible := False; + fSelected.AltGr := txtAltGr.Text; + If txtAltGr.Text = '' Then + imgAltGr.Visible := true + Else + imgAltGr.Visible := false; - fDirty := True; + fDirty := true; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmMain.txtCommentEnter(Sender: TObject); Begin - txtComment.SelectAll; + txtComment.SelectAll; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmMain.txtLayoutNameChange(Sender: TObject); Begin - fDirty := True; + fDirty := true; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmMain.txtLayoutNameEnter(Sender: TObject); Begin - (Sender As TEdit).SelectAll; + (Sender As TEdit).SelectAll; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmMain.txtNormalChange(Sender: TObject); Begin - fSelected.Normal := txtNormal.Text; - If txtNormal.Text = '' Then - imgNormal.Visible := True - Else - imgNormal.Visible := False; + fSelected.Normal := txtNormal.Text; + If txtNormal.Text = '' Then + imgNormal.Visible := true + Else + imgNormal.Visible := false; - fDirty := True; + fDirty := true; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmMain.txtNormalEnter(Sender: TObject); Begin - (Sender As TEdit).SelectAll; + (Sender As TEdit).SelectAll; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmMain.txtShiftAltGrChange(Sender: TObject); Begin - fSelected.ShiftAltGr := txtShiftAltGr.Text; - If txtShiftAltGr.Text = '' Then - imgShiftAltGr.Visible := True - Else - imgShiftAltGr.Visible := False; + fSelected.ShiftAltGr := txtShiftAltGr.Text; + If txtShiftAltGr.Text = '' Then + imgShiftAltGr.Visible := true + Else + imgShiftAltGr.Visible := false; - fDirty := True; + fDirty := true; End; -{===============================================================================} +{ =============================================================================== } Procedure TfrmMain.txtShiftChange(Sender: TObject); Begin - fSelected.Shift := txtShift.Text; - If txtShift.Text = '' Then - imgShift.Visible := True - Else - imgShift.Visible := False; + fSelected.Shift := txtShift.Text; + If txtShift.Text = '' Then + imgShift.Visible := true + Else + imgShift.Visible := false; - fDirty := True; + fDirty := true; End; -{===============================================================================} +{ =============================================================================== } End. - diff --git a/Layout Editor/LayoutEditor.dpr b/Layout Editor/LayoutEditor.dpr index ae02dea..a560df6 100644 --- a/Layout Editor/LayoutEditor.dpr +++ b/Layout Editor/LayoutEditor.dpr @@ -1,25 +1,25 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan . + The Initial Developer of the Original Code is + Mehdi Hasan Khan . - Copyright (C) OmicronLab . All Rights Reserved. + Copyright (C) OmicronLab . All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= @@ -29,15 +29,17 @@ program LayoutEditor; uses Forms, - uFrmMain in 'Forms\uFrmMain.pas' {frmMain}, + uFrmMain in 'Forms\uFrmMain.pas' {frmMain} , uShapeInterceptor in 'Classes\uShapeInterceptor.pas', clsRegistry_XMLSetting in 'Classes\clsRegistry_XMLSetting.pas', - uFrmAbout in 'Forms\uFrmAbout.pas' {frmAbout}, + uFrmAbout in 'Forms\uFrmAbout.pas' {frmAbout} , uRegistrySettings in 'Units\uRegistrySettings.pas', - clsSkinLayoutConverter in '..\Keyboard and Spell checker\Classes\clsSkinLayoutConverter.pas', + clsSkinLayoutConverter + in '..\Keyboard and Spell checker\Classes\clsSkinLayoutConverter.pas', clsFileVersion in '..\Keyboard and Spell checker\Classes\clsFileVersion.pas', - uFileFolderHandling in '..\Keyboard and Spell checker\Units\uFileFolderHandling.pas', - nativexml in '..\Keyboard and Spell checker\Units\nativexml.pas'; + uFileFolderHandling + in '..\Keyboard and Spell checker\Units\uFileFolderHandling.pas'; +// nativexml in '..\Keyboard and Spell checker\Units\nativexml.pas'; {$R *.res} @@ -47,4 +49,5 @@ begin Application.Title := 'Keyboard Layout Editor for Avro Keyboard'; Application.CreateForm(TfrmMain, frmMain); Application.Run; + end. diff --git a/Layout Editor/LayoutEditor.res b/Layout Editor/LayoutEditor.res index d01f0b455fc83f5fe1947f8131085fc3bf6f3b96..f70b9e125f999d45763e008670b2ec71d786784e 100644 GIT binary patch delta 1411 zcmbVM%}*0S6n`Zc(n4d6A1Q)yT16wtc3YrQnr%Y~A2xwND5)1?vfZ7wn{+?2y9FCU zAYMSA6`X@!ybu%P#e^8I9z2LA{|*l(9zE9A4@wa|$RsoG&Aj*fy*F<@UcKq~deE^) z{N4@#0sz&j2fG6`fFL+K>k1Cu4)$d;&<)Tqp=8xf--TtII@rM0&A!E&hL92LV|6)& zI=}?D*~_hg-dPZ#1UeMKhAEIiL8*fYz}(MnT@FD2F~=Psim27?d+yVohue48|MX15 z4UD^hOgiLn6hVa~OxE+3a7{&4iem;XCP+BSIInpJ;Ga1my2jvubR9K~*%lC$1dYYE zx|q3hXP;bgcn-re6AsUZwTYtv6jS*l4+?kbtrNw^r$0Ndb$0;}B&t@uZB=FOcXoQn z6SbgOQPEPDhhOaa7+2|97wWU9Xcz@W5^Y7-;x2-%xxS)kvc6)asBJ4+&T81uDjP~- zMKo!HGUm_Qwh`rdOUhGKv;wLknYyKC?SQ1Kd}=Pq4+Vo^{^4mhf81U-iRIpyr&eDYkB=hfX5Zh~tkMo8=o-_{(mErm4L^ZUhN3HK-<2O)51D zcD!IGEQ_j{LMhIE?0T=(1Jo*Nmkb*7V~F7)KkF-p*j)KK%a;dFJPM+gD~dVv8uYVw z<=gCAxtDz}Ke*UP(xOt)RBYr;RQlQDijQred|m15X~p2K=|jRJ888JZHlnByjT@6;=F$#KXU4fRg$7L* z>cUuoW;QO>m>3fi7sNl{27drM{Q+)_iGKjky)A74VFT0LIrpA(zw>?Poay)X!8ad* ztK{_M5dZ=Jo10Cz0=NT+t>uE_BZ1i3*Rk~;G*9Q&+t8$zJ|0K&`}vH+AG7^JBft%7IBHr`ICVwt=lHyzX)8~)nfy~wGV;k z=e_1)cTVWQ6ULllz`s(zJ$UWRqho;Gv+sfo3oZk;GbGf6?s#5H*MR{RfVe$bFr;3Yqmxm8VqOV diff --git a/Layout Editor/Units/uRegistrySettings.pas b/Layout Editor/Units/uRegistrySettings.pas index 0986272..ce35077 100644 --- a/Layout Editor/Units/uRegistrySettings.pas +++ b/Layout Editor/Units/uRegistrySettings.pas @@ -1,50 +1,49 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan (mhasan@omicronlab.com). + The Initial Developer of the Original Code is + Mehdi Hasan Khan (mhasan@omicronlab.com). - Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. + Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - Unit uRegistrySettings; Interface Uses - Classes, - Sysutils, - clsRegistry_XMLSetting, - Windows, - Forms, - StrUtils; + Classes, + Sysutils, + clsRegistry_XMLSetting, + Windows, + Forms, + StrUtils; Var - LETop : String; - LELeft : String; - LEFontName : String; - LEFontSize : String; - LELastDir : String; + LETop: String; + LELeft: String; + LEFontName: String; + LEFontSize: String; + LELastDir: String; Procedure LoadSettings; Procedure ValidateSettings; @@ -56,129 +55,134 @@ Procedure LoadSettingsFromRegistry; Procedure SaveSettingsInRegistry; - - Implementation Uses - uFileFolderHandling; + uFileFolderHandling; -{===============================================================================} +{ =============================================================================== } Procedure LoadSettings; Begin - {$IFDEF PortableOn} - LoadSettingsFromFile; - {$ELSE} - LoadSettingsFromRegistry; - {$ENDIF} - ValidateSettings; +{$IFDEF PortableOn} + LoadSettingsFromFile; +{$ELSE} + LoadSettingsFromRegistry; +{$ENDIF} + ValidateSettings; End; -{===============================================================================} +{ =============================================================================== } Procedure SaveSettings; Begin - {$IFDEF PortableOn} - SaveSettingsInXML; - {$ELSE} - SaveSettingsInRegistry; - {$ENDIF} +{$IFDEF PortableOn} + SaveSettingsInXML; +{$ELSE} + SaveSettingsInRegistry; +{$ENDIF} End; -{===============================================================================} +{ =============================================================================== } Procedure LoadSettingsFromRegistry; Var - Reg : TMyRegistry; + Reg: TMyRegistry; Begin - Reg := TMyRegistry.create; - Reg.RootKey := HKEY_CURRENT_USER; - - If Reg.OpenKey('Software\OmicronLab\Layout Editor', True) = True Then Begin - LETop := REG.ReadStringDef('LETop', '50'); - LELeft := REG.ReadStringDef('LELeft', '50'); - LEFontName := UpperCase(REG.ReadStringDef('LEFontName', 'Siyam Rupali')); - LEFontSize := REG.ReadStringDef('LEFontSize', '12'); - LELastDir := UpperCase(REG.ReadStringDef('LELastDir', GetAvroDataDir + 'Keyboard Layouts\')); - End; - - Reg.Free; + Reg := TMyRegistry.create; + Reg.RootKey := HKEY_CURRENT_USER; + + If Reg.OpenKey('Software\OmicronLab\Layout Editor', True) = True Then + Begin + LETop := Reg.ReadStringDef('LETop', '50'); + LELeft := Reg.ReadStringDef('LELeft', '50'); + LEFontName := UpperCase(Reg.ReadStringDef('LEFontName', 'Siyam Rupali')); + LEFontSize := Reg.ReadStringDef('LEFontSize', '12'); + LELastDir := UpperCase(Reg.ReadStringDef('LELastDir', + GetAvroDataDir + 'Keyboard Layouts\')); + End; + + Reg.Free; End; -{===============================================================================} +{ =============================================================================== } Procedure LoadSettingsFromFile; Var - XML : TXMLSetting; + XML: TXMLSetting; Begin - XML := TXMLSetting.Create; - XML.LoadXMLData; + XML := TXMLSetting.create; + XML.LoadXMLData; - LETop := XML.GetValue('LETop', '50'); - LELeft := XML.GetValue('LELeft', '50'); - LEFontName := UpperCase(XML.GetValue('LEFontName', 'Siyam Rupali')); - LEFontSize := XML.GetValue('LEFontSize', '12'); - LELastDir := UpperCase(XML.GetValue('LELastDir', GetAvroDataDir + 'Keyboard Layouts\')); + LETop := XML.GetValue('LETop', '50'); + LELeft := XML.GetValue('LELeft', '50'); + LEFontName := UpperCase(XML.GetValue('LEFontName', 'Siyam Rupali')); + LEFontSize := XML.GetValue('LEFontSize', '12'); + LELastDir := UpperCase(XML.GetValue('LELastDir', + GetAvroDataDir + 'Keyboard Layouts\')); - XML.Free; + XML.Free; End; -{===============================================================================} +{ =============================================================================== } Procedure SaveSettingsInRegistry; Var - Reg : TMyRegistry; + Reg: TMyRegistry; Begin - Reg := TMyRegistry.Create; - Reg.RootKey := HKEY_CURRENT_USER; + Reg := TMyRegistry.create; + Reg.RootKey := HKEY_CURRENT_USER; - If Reg.OpenKey('Software\OmicronLab\Layout Editor', True) = True Then Begin - REG.WriteString('AppPath', ExtractFileDir(Application.ExeName)); - REG.WriteString('AppExeName', ExtractFileName(Application.ExeName)); + If Reg.OpenKey('Software\OmicronLab\Layout Editor', True) = True Then + Begin + Reg.WriteString('AppPath', ExtractFileDir(Application.ExeName)); + Reg.WriteString('AppExeName', ExtractFileName(Application.ExeName)); - REG.WriteString('LETop', LETop); - REG.WriteString('LELeft', LELeft); - REG.WriteString('LEFontName', LEFontName); - REG.WriteString('LEFontSize', LEFontSize); - REG.WriteString('LELastDir', LELastDir); + Reg.WriteString('LETop', LETop); + Reg.WriteString('LELeft', LELeft); + Reg.WriteString('LEFontName', LEFontName); + Reg.WriteString('LEFontSize', LEFontSize); + Reg.WriteString('LELastDir', LELastDir); - End; + End; - Reg.Free; + Reg.Free; End; -{===============================================================================} +{ =============================================================================== } Procedure SaveSettingsInXML; Var - XML : TXMLSetting; + XML: TXMLSetting; Begin - XML := TXMLSetting.Create; - XML.CreateNewXMLData; - - XML.SetValue('LETop', LETop); - XML.SetValue('LELeft', LELeft); - XML.SetValue('LEFontName', LEFontName); - XML.SetValue('LEFontSize', LEFontSize); - XML.SetValue('LEFontSize', LEFontSize); - XML.SetValue('LELastDir', LELastDir); - - XML.SaveXMLData; - XML.Free; + XML := TXMLSetting.create; + XML.CreateNewXMLData; + + XML.SetValue('LETop', LETop); + XML.SetValue('LELeft', LELeft); + XML.SetValue('LEFontName', LEFontName); + XML.SetValue('LEFontSize', LEFontSize); + XML.SetValue('LEFontSize', LEFontSize); + XML.SetValue('LELastDir', LELastDir); + + XML.SaveXMLData; + XML.Free; End; -{===============================================================================} +{ =============================================================================== } Procedure ValidateSettings; Begin - If Not (DirectoryExists(LELastDir)) Then LELastDir := GetAvroDataDir + 'Keyboard Layouts\'; - If Not (StrToInt(LETop) > 0) Then LETop := '50'; - If Not (StrToInt(LELeft) > 0) Then LELeft := '50'; - If Not (StrToInt(LEFontSize) > 7) Then LETop := '10'; + If Not(DirectoryExists(LELastDir)) Then + LELastDir := GetAvroDataDir + 'Keyboard Layouts\'; + If Not(StrToInt(LETop) > 0) Then + LETop := '50'; + If Not(StrToInt(LELeft) > 0) Then + LELeft := '50'; + If Not(StrToInt(LEFontSize) > 7) Then + LETop := '10'; End; -{===============================================================================} +{ =============================================================================== } End. - diff --git a/Layout Editor/clean_files.bat b/Layout Editor/clean_files.bat new file mode 100644 index 0000000..a78b328 --- /dev/null +++ b/Layout Editor/clean_files.bat @@ -0,0 +1,10 @@ +del /s /q *.dcu +del /s /q *.dsk +del /s /q *.identcache +del /s /q *.stat +del /s /q *.local +del /s /q *.exe +del /s /q *.~* +rmdir /S /Q backup +rmdir /S /Q __history +rmdir /S /Q __recovery diff --git a/Skin Designer/SkinDesigner.dpr b/Skin Designer/SkinDesigner.dpr index 82d2e35..d5d42cd 100644 --- a/Skin Designer/SkinDesigner.dpr +++ b/Skin Designer/SkinDesigner.dpr @@ -33,7 +33,7 @@ uses ufrmAbout in 'ufrmAbout.pas' { frmAbout }, uFileFolderHandling in '..\Keyboard and Spell checker\Units\uFileFolderHandling.pas', clsFileVersion in '..\Keyboard and Spell checker\Classes\clsFileVersion.pas', - nativexml in '..\Keyboard and Spell checker\Units\nativexml.pas', + // nativexml in '..\Keyboard and Spell checker\Units\nativexml.pas', uFrameDrag in 'uFrameDrag.pas' {FrameDrag: TFrame}, uFrameImageAdd in 'uFrameImageAdd.pas' {FrameImageAdd: TFrame}; diff --git a/Skin Designer/SkinDesigner.res b/Skin Designer/SkinDesigner.res index 80cbf26377558f2ebf05cfa813aded5643259513..8bbfd1dad953c00e40eedf9d9ff8e43cd43cb402 100644 GIT binary patch delta 1509 zcmbVMOK;Oa5S{@Fqz_TVLk02J8W0kayyEc65?egGi&1E^Qd+_-S%j)cPGWkTUX*V>)&%gx&~*f|b;@_Pl< z{S&}JfCaPQkmdu(+pBo$Kpdh3-<|+t6u-HKXZ{iYa}CehTjOWoI2Ce>09}Ii!2lbw zFwv;iB%4jxoYp*fd@yM(G}60d&%pyK$f4*hrP1y>0?O6rcyW~-#Qv4U`vgwz#r_XV zdvS7{$Ws-d({r5t2WjU~Sjoo;__A2Rc}k-=5>sUiQ!~IbzHZ_WZEC zF7cSWU&Y>Ky4GB{j_|Hu-* z@OPG5+@EqCD{%dpq2HP6!0F}YVYMa;|2VDQa&;2aN1OBl_qbEwj=9((tZfJ~LU21@ zYS|l9HVs({53FFZk+V)RsUA-$ly-PXk-2q@9}Ru;+!u5kDdj>mR{s?FY8}rV3jHO+ znJpW$wEdhSzpmryBMldwuT|LZIwY&&)qPF3;AYvU8q#vHNKZm1cr&+6Y)01}tGB6ES a;3nLGDbg||C*d+_If|)|&UYIh1N;Jd+@kmZ delta 1707 zcmb_bO;6NN6ul3SC}s#6zaS<&szjriGJ|}X3`D*}lt>~fx-qHk8z^)-leU9SOk`nP z84U_nvd^c{8uxSASiup5up4 z?`6b^Xl<<$i(yBUc$BI5n5kexds*V+hZ;82hxl`Ztu!Nk_Si}t;?qa$%|68Tr);fC zTdt%MOx*@dokCNu<;wX!eLtfL^@TY9plQz`G|~L)#ApiLHmhO zKV>OHIWowl0$oMSkWe_I*x6)~hYFWQkh!bQCyCFm#@jg!pwLIj1kwU!oYE+jv6p64 z8>cJC6wsJOyGPbSJv%YmN;)O65^51}4noK?a&ve$Jju z^~7p8PZ_>1GIyQAuqE8U4hr&+^PrFu-P%3dJ=dy5C$5pfNq^Q7L&EU*wcY_f7UV5E zTguM}&$qK~x0X!m3BC1vqE$~O+B%aOkJW^YMb>y*(ODuVTu_+>MGpb%CqZvXNhz_T zwk`U?xkZ*_vGCI(Yd~0CWM_^>qGhRLxD$C}0^-kTv9O`YPNJr#$m$Wsi|o>Ys5IpZ zGw;EGo>=&<$c`iXrO28PzTvAhq{QPqZ}*y}@cnKrZ8*NrT9o2YUt-6bOJFS5X!WtdJ4Rvb|lIf1l4zsf(eD;EA^^vWqma[value][sub-elements] - xeComment, // Comment - xeCData, // literal data - xeDeclaration, // XML declaration - xeStylesheet, // Stylesheet - xeDoctype, // DOCTYPE DTD declaration - xeElement, // - xeAttList, // - xeEntity, // - xeNotation, // - xeExclam, // Any - xeQuestion, // Any - xeCharData, // Character data in a node - xeUnknown // Any - ); - - // Choose what kind of binary encoding will be used when calling - // TXmlNode BufferRead and BufferWrite. - TBinaryEncodingType = ( - xbeBinHex, { With this encoding, each byte is stored as a hexadecimal - number, e.g. 0 = 00 and 255 = FF. } - xbeBase64 { With this encoding, each group of 3 bytes are stored as 4 - characters, requiring 64 different characters.} - ); - - // Definition of different methods of string encoding. - TStringEncodingType = ( - se8Bit, // General 8 bit encoding, encoding must be determined from encoding declaration - seUCS4BE, // UCS-4 Big Endian - seUCS4LE, // UCS-4 Little Endian - seUCS4_2143, // UCS-4 unusual octet order (2143) - seUCS4_3412, // UCS-4 unusual octet order (3412) - se16BitBE, // General 16 bit Big Endian, encoding must be determined from encoding declaration - se16BitLE, // General 16 bit Little Endian, encoding must be determined from encoding declaration - seUTF8, // UTF-8 - seUTF16BE, // UTF-16 Big Endian - seUTF16LE, // UTF-16 Little Endian - seEBCDIC // EBCDIC flavour - ); - - TXmlCompareOption = ( - xcNodeName, - xcNodeType, - xcNodeValue, - xcAttribCount, - xcAttribNames, - xcAttribValues, - xcChildCount, - xcChildNames, - xcChildValues, - xcRecursive - ); - - TXmlCompareOptions = set of TXmlCompareOption; - -const - - xcAll: TXmlCompareOptions = [xcNodeName, xcNodeType, xcNodeValue, xcAttribCount, - xcAttribNames, xcAttribValues, xcChildCount, xcChildNames, xcChildValues, - xcRecursive]; - -var - - // XML Defaults - - cDefaultEncodingString: string = 'windows-1252'; - cDefaultExternalEncoding: TStringEncodingType = se8bit; - cDefaultVersionString: string = '1.0'; - cDefaultXmlFormat: TXmlFormatType = xfCompact; - cDefaultWriteOnDefault: boolean = True; - cDefaultBinaryEncoding: TBinaryEncodingType = xbeBase64; - cDefaultUtf8Encoded: boolean = False; - cDefaultIndentString: string = ' '; - cDefaultDropCommentsOnParse: boolean = False; - cDefaultUseFullNodes: boolean = False; - cDefaultSortAttributes: boolean = False; - cDefaultFloatAllowScientific: boolean = True; - cDefaultFloatSignificantDigits: integer = 6; - -type - - TXmlNode = class; - TNativeXml = class; - TsdCodecStream = class; - - // An event that is based on the TXmlNode object Node. - TXmlNodeEvent = procedure(Sender: TObject; Node: TXmlNode) of object; - - // An event that is used to indicate load or save progress. - TXmlProgressEvent = procedure(Sender: TObject; Size: integer) of object; - - // This event is used in the TNativeXml.OnNodeCompare event, and should - // return -1 if Node1 < Node2, 0 if Node1 = Node2 and 1 if Node1 > Node2. - TXmlNodeCompareEvent = function(Sender: TObject; Node1, Node2: TXmlNode; Info: TPointer): integer of object; - - // Pass a function of this kind to TXmlNode.SortChildNodes. The function should - // return -1 if Node1 < Node2, 0 if Node1 = Node2 and 1 if Node1 > Node2. - TXMLNodeCompareFunction = function(Node1, Node2: TXmlNode; Info: TPointer): integer; - - // The TXmlNode represents an element in the XML file. Each TNativeXml holds - // one Root element. Under ths root element, sub-elements can be nested (there - // is no limit on how deep). Property ElementType defines what kind of element - // this node is. - TXmlNode = class(TPersistent) - private - FAttributes: TStringList; // List with attributes - FDocument: TNativeXml; // Pointer to parent XmlDocument - FElementType: TXmlElementType; // The type of element - FName: string; // The element name - FNodes: TList; // These are the child elements - FParent: TXmlNode; // Pointer to parent element - FTag: integer; // A value the developer can use - FValue: string; // The *escaped* value - function AbortParsing: boolean; - function GetValueAsString: string; - procedure SetAttributeName(Index: integer; const Value: string); - procedure SetAttributeValue(Index: integer; const Value: string); - procedure SetValueAsString(const AValue: string); - function GetIndent: string; - function GetLineFeed: string; - function GetTreeDepth: integer; - function GetAttributeCount: integer; - function GetAttributePair(Index: integer): string; - function GetAttributeName(Index: integer): string; - function GetAttributeValue(Index: integer): string; - function GetWriteOnDefault: boolean; - function GetBinaryEncoding: TBinaryEncodingType; - function GetCascadedName: string; - function QualifyAsDirectNode: boolean; - procedure SetName(const Value: string); - function GetFullPath: string; - procedure SetBinaryEncoding(const Value: TBinaryEncodingType); - function GetBinaryString: string; - procedure SetBinaryString(const Value: string); - function UseFullNodes: boolean; - function GetValueAsWidestring: widestring; - procedure SetValueAsWidestring(const Value: widestring); - function GetAttributeByName(const AName: string): string; - procedure SetAttributeByName(const AName, Value: string); - function GetValueAsInteger: integer; - procedure SetValueAsInteger(const Value: integer); - function GetValueAsFloat: double; - procedure SetValueAsFloat(const Value: double); - function GetValueAsDateTime: TDateTime; - procedure SetValueAsDateTime(const Value: TDateTime); - function GetValueAsBool: boolean; - procedure SetValueAsBool(const Value: boolean); - function GetValueAsInt64: int64; - procedure SetValueAsInt64(const Value: int64); - procedure CheckCreateAttributesList; - function GetAttributeValueAsWidestring(Index: integer): widestring; - procedure SetAttributeValueAsWidestring(Index: integer; - const Value: widestring); - function GetAttributeValueAsInteger(Index: integer): integer; - procedure SetAttributeValueAsInteger(Index: integer; - const Value: integer); - function GetAttributeByNameWide(const AName: string): widestring; - procedure SetAttributeByNameWide(const AName: string; - const Value: widestring); - function GetTotalNodeCount: integer; - function FloatSignificantDigits: integer; - function FloatAllowScientific: boolean; - function GetAttributeValueDirect(Index: integer): string; - procedure SetAttributeValueDirect(Index: integer; const Value: string); - protected - function CompareNodeName(const NodeName: string): integer; - procedure DeleteEmptyAttributes; - function GetNodes(Index: integer): TXmlNode; virtual; - function GetNodeCount: integer; virtual; - procedure ParseTag(const AValue: string; TagStart, TagClose: integer); - procedure ReadFromStream(S: TStream); virtual; - procedure ReadFromString(const AValue: string); virtual; - procedure ResolveEntityReferences; - function UnescapeString(const AValue: string): string; virtual; - function Utf8Encoded: boolean; - function WriteInnerTag: string; virtual; - procedure WriteToStream(S: TStream); virtual; - procedure ChangeDocument(ADocument: TNativeXml); - public - // Create a new TXmlNode object. ADocument must be the TNativeXml that is - // going to hold this new node. - constructor Create(ADocument: TNativeXml); virtual; - // \Create a new TXmlNode with name AName. ADocument must be the TNativeXml - // that is going to hold this new node. - constructor CreateName(ADocument: TNativeXml; const AName: string); virtual; - // \Create a new TXmlNode with name AName and string value AValue. ADocument - // must be the TNativeXml that is going to hold this new node. - constructor CreateNameValue(ADocument: TNativeXml; const AName, AValue: string); virtual; - // \Create a new TXmlNode with XML element type AType. ADocument must be the - // TNativeXml that is going to hold this new node. - constructor CreateType(ADocument: TNativeXml; AType: TXmlElementType); virtual; - // Use Assign to assign another TXmlNode to this node. This means that all - // properties and subnodes from the Source TXmlNode are copied to the current - // node. You can also Assign a TNativeXml document to the node, in that case - // the RootNodeList property of the TNativeXml object will be copied. - procedure Assign(Source: TPersistent); override; - // Call Delete to delete this node completely from the parent node list. This - // call only succeeds if the node has a parent. It has no effect when called for - // the root node. - procedure Delete; virtual; - // \Delete all nodes that are empty (this means, which have no subnodes, no - // attributes, and no value assigned). This procedure works recursively. - procedure DeleteEmptyNodes; - // Destroy a TXmlNode object. This will free the child node list automatically. - // Never call this method directly. All TXmlNodes in the document will be - // recursively freed when TNativeXml.Free is called. - destructor Destroy; override; - {$IFDEF D4UP} - // Use this method to add an integer attribute to the node. - procedure AttributeAdd(const AName: string; AValue: integer); overload; - {$ENDIF} - // Use this method to add a string attribute with value AValue to the node. - procedure AttributeAdd(const AName, AValue: string); {$IFDEF D4UP}overload;{$ENDIF} - // Use this method to delete the attribute at Index in the list. Index must be - // equal or greater than 0, and smaller than AttributeCount. Using an index - // outside of that range has no effect. - procedure AttributeDelete(Index: integer); - // Switch position of the attributes at Index1 and Index2. - procedure AttributeExchange(Index1, Index2: integer); - // Use this method to find the index of an attribute with name AName. - function AttributeIndexByname(const AName: string): integer; - // \Clear all attributes from the current node. - procedure AttributesClear; virtual; - // Use this method to read binary data from the node into Buffer with a length of Count. - procedure BufferRead(var Buffer{$IFDEF CLR}: TBytes{$ENDIF}; Count: Integer); virtual; - // Use this method to write binary data in Buffer with a length of Count to the - // current node. The data will appear as text using either BinHex or Base64 - // method) in the final XML document. - // Notice that NativeXml does only support up to 2Gb bytes of data per file, - // so do not use this option for huge files. The binary encoding method (converting - // binary data into text) can be selected using property BinaryEncoding. - // xbeBase64 is most efficient, but slightly slower. Always use identical methods - // for reading and writing. - procedure BufferWrite(const Buffer{$IFDEF CLR}: TBytes{$ENDIF}; Count: Integer); virtual; - // Returns the length of the data in the buffer, once it would be decoded by - // method xbeBinHex or xbeBase64. If BinaryEncoding is xbeSixBits, this function - // cannot be used. The length of the unencoded data is determined from the - // length of the encoded data. For xbeBinHex this is trivial (just half the - // length), for xbeBase64 this is more difficult (must use the padding characters) - function BufferLength: integer; virtual; - // Clear all child nodes and attributes, and the name and value of the current - // XML node. However, the node is not deleted. Call Delete instead for that. - procedure Clear; virtual; - // Find the first node which has name NodeName. Contrary to the NodeByName - // function, this function will search the whole subnode tree, using the - // DepthFirst method. It is possible to search for a full path too, e.g. - // FoundNode := MyNode.FindNode('/Root/SubNode1/SubNode2/ThisNode'); - function FindNode(const NodeName: string): TXmlNode; - // Find all nodes which have name NodeName. Contrary to the NodesByName - // function, this function will search the whole subnode tree. If you use - // a TXmlNodeList for the AList parameter, you don't need to cast the list - // items to TXmlNode. - procedure FindNodes(const NodeName: string; const AList: TList); - // Use FromAnsiString to convert a normal ANSI string to a string for the node - // (name, value, attributes). If the TNativeXml property UtfEncoded is True, - // the ANSI characters are encoded into UTF8. Use this function if you work - // with special codebases (characters in the range $7F-$FF) and want to produce - // unicode or UTF8 XML documents. - function FromAnsiString(const s: string): string; - // Use FromWidestring to convert widestring to a string for the node (name, value, - // attributes). If the TNativeXml property UtfEncoded is True, all - // character codes higher than $FF are preserved. - function FromWidestring(const W: widestring): string; - // Use HasAttribute to determine if the node has an attribute with name AName. - function HasAttribute(const AName: string): boolean; virtual; - // This function returns the index of this node in the parent's node list. - // If Parent is not assigned, this function returns -1. - function IndexInParent: integer; - // This function returns True if the node has no subnodes and no attributes, - // and if the node Name and value are empty. - function IsClear: boolean; virtual; - // This function returns True if the node has no subnodes and no attributes, - // and if the node value is empty. - function IsEmpty: boolean; virtual; - function IsEqualTo(ANode: TXmlNode; Options: TXmlCompareOptions; MismatchNodes: TList {$IFDEF D4UP}= nil{$ENDIF}): boolean; - // Add the node ANode as a new subelement in the nodelist. The node will be - // added in position NodeCount (which will be returned). - function NodeAdd(ANode: TXmlNode): integer; virtual; - // This function returns a pointer to the first subnode that has an attribute with - // name AttribName and value AttribValue. If ShouldRecurse = True (default), the - // function works recursively, using the depthfirst method. - function NodeByAttributeValue(const NodeName, AttribName, AttribValue: string; - ShouldRecurse: boolean {$IFDEF D4UP}= True{$ENDIF}): TXmlNode; - // Return a pointer to the first subnode with this Elementype, or return nil - // if no subnode with that type is found. - function NodeByElementType(ElementType: TXmlElementType): TXmlNode; - // Return a pointer to the first subnode in the nodelist that has name AName. - // If no subnodes with AName are found, the function returns nil. - function NodeByName(const AName: string): TXmlNode; virtual; - // \Delete the subnode at Index. The node will also be freed, so do not free the - // node in the application. - procedure NodeDelete(Index: integer); virtual; - // Switch position of the nodes at Index1 and Index2. - procedure NodeExchange(Index1, Index2: integer); - // Extract the node ANode from the subnode list. The node will no longer appear - // in the subnodes list, so the application is responsible for freeing ANode later. - function NodeExtract(ANode: TXmlNode): TXmlNode; virtual; - // This function returns a pointer to the first node with AName. If this node - // is not found, then it creates a new node with AName and returns its pointer. - function NodeFindOrCreate(const AName: string): TXmlNode; virtual; - // Find the index of the first subnode with name AName. - function NodeIndexByName(const AName: string): integer; virtual; - // Find the index of the first subnode with name AName that appears after or on - // the index AFrom. This function can be used in a loop to retrieve all nodes - // with a certain name, without using a helper list. See also NodesByName. - function NodeIndexByNameFrom(const AName: string; AFrom: integer): integer; virtual; - // Call NodeIndexOf to get the index for ANode in the Nodes array. The first - // node in the array has index 0, the second item has index 1, and so on. If - // a node is not in the list, NodeIndexOf returns -1. - function NodeIndexOf(ANode: TXmlNode): integer; - // Insert the node ANode at location Index in the list. - procedure NodeInsert(Index: integer; ANode: TXmlNode); virtual; - // \Create a new node with AName, add it to the subnode list, and return a - // pointer to it. - function NodeNew(const AName: string): TXmlNode; virtual; - // \Create a new node with AName, and insert it into the subnode list at location - // Index, and return a pointer to it. - function NodeNewAtIndex(Index: integer; const AName: string): TXmlNode; virtual; - // Call NodeRemove to remove a specific node from the Nodes array when its index - // is unknown. The value returned is the index of the item in the Nodes array - // before it was removed. After an item is removed, all the items that follow - // it are moved up in index position and the NodeCount is reduced by one. - function NodeRemove(ANode: TxmlNode): integer; - // \Clear (and free) the complete list of subnodes. - procedure NodesClear; virtual; - // Use this procedure to retrieve all nodes that have name AName. Pointers to - // these nodes are added to the list in AList. AList must be initialized - // before calling this procedure. If you use a TXmlNodeList you don't need - // to cast the list items to TXmlNode. - procedure NodesByName(const AName: string; const AList: TList); - // Find the attribute with AName, and convert its value to a boolean. If the - // attribute is not found, or cannot be converted, the default ADefault will - // be returned. - function ReadAttributeBool(const AName: string; ADefault: boolean {$IFDEF D4UP}= False{$ENDIF}): boolean; virtual; - function ReadAttributeDateTime(const AName: string; ADefault: TDateTime {$IFDEF D4UP}= 0{$ENDIF}): TDateTime; virtual; - // Find the attribute with AName, and convert its value to an integer. If the - // attribute is not found, or cannot be converted, the default ADefault will - // be returned. - function ReadAttributeInteger(const AName: string; ADefault: integer {$IFDEF D4UP}= 0{$ENDIF}): integer; virtual; - // Find the attribute with AName, and convert its value to an int64. If the - // attribute is not found, or cannot be converted, the default ADefault will - // be returned. - function ReadAttributeInt64(const AName: string; ADefault: int64 {$IFDEF D4UP}= 0{$ENDIF}): int64; virtual; - // Find the attribute with AName, and convert its value to a float. If the - // attribute is not found, or cannot be converted, the default ADefault will - // be returned. - function ReadAttributeFloat(const AName: string; ADefault: double {$IFDEF D4UP}= 0{$ENDIF}): double; - function ReadAttributeString(const AName: string; const ADefault: string {$IFDEF D4UP}= ''{$ENDIF}): string; virtual; - // Read the subnode with AName and convert it to a boolean value. If the - // subnode is not found, or cannot be converted, the boolean ADefault will - // be returned. - function ReadBool(const AName: string; ADefault: boolean {$IFDEF D4UP}= False{$ENDIF}): boolean; virtual; - {$IFDEF USEGRAPHICS} - // Read the properties Color and Style for the TBrush object ABrush from the - // subnode with AName. - procedure ReadBrush(const AName: string; ABrush: TBrush); virtual; - // Read the subnode with AName and convert its value to TColor. If the - // subnode is not found, or cannot be converted, ADefault will be returned. - function ReadColor(const AName: string; ADefault: TColor {$IFDEF D4UP}= clBlack{$ENDIF}): TColor; virtual; - // Read the properties \Name, Color, Size and Style for the TFont object AFont - // from the subnode with AName. - procedure ReadFont(const AName: string; AFont: TFont); virtual; - // Read the properties Color, Mode, Style and Width for the TPen object APen - // from the subnode with AName. - procedure ReadPen(const AName: string; APen: TPen); virtual; - {$ENDIF} - // Read the subnode with AName and convert its value to TDateTime. If the - // subnode is not found, or cannot be converted, ADefault will be returned. - function ReadDateTime(const AName: string; ADefault: TDateTime {$IFDEF D4UP}= 0{$ENDIF}): TDateTime; virtual; - // Read the subnode with AName and convert its value to a double. If the - // subnode is not found, or cannot be converted, ADefault will be returned. - function ReadFloat(const AName: string; ADefault: double {$IFDEF D4UP}= 0.0{$ENDIF}): double; virtual; - // Read the subnode with AName and convert its value to an int64. If the - // subnode is not found, or cannot be converted, ADefault will be returned. - function ReadInt64(const AName: string; ADefault: int64 {$IFDEF D4UP}= 0{$ENDIF}): int64; virtual; - // Read the subnode with AName and convert its value to an integer. If the - // subnode is not found, or cannot be converted, ADefault will be returned. - function ReadInteger(const AName: string; ADefault: integer {$IFDEF D4UP}= 0{$ENDIF}): integer; virtual; - // Read the subnode with AName and return its string value. If the subnode is - // not found, ADefault will be returned. - function ReadString(const AName: string; const ADefault: string {$IFDEF D4UP}= ''{$ENDIF}): string; virtual; - // Read the subnode with AName and return its widestring value. If the subnode is - // not found, ADefault will be returned. - function ReadWidestring(const AName: string; const ADefault: widestring {$IFDEF D4UP}= ''{$ENDIF}): widestring; virtual; - // Sort the child nodes of this node. Provide a custom node compare function in Compare, - // or attach an event handler to the parent documents' OnNodeCompare in order to - // provide custom sorting. If no compare function is given (nil) and OnNodeCompare - // is not implemented, SortChildNodes will simply sort the nodes by name (ascending, - // case insensitive). The Info pointer parameter can be used to pass any custom - // information to the compare function. Default value for Info is nil. - procedure SortChildNodes(Compare: TXMLNodeCompareFunction {$IFDEF D4UP}= nil{$ENDIF}; Info: TPointer {$IFDEF D4UP}= nil{$ENDIF}); - // Use ToAnsiString to convert any string from the node (name, value, attributes) - // to a normal ANSI string. If the TNativeXml property UtfEncoded is True, - // you may loose characters with codes higher than $FF. To prevent this, use - // widestrings in your application and use ToWidestring instead. - function ToAnsiString(const s: string): string; - // Use ToWidestring to convert any string from the node (name, value, attributes) - // to a widestring. If the TNativeXml property UtfEncoded is True, all - // character codes higher than $FF are preserved. - function ToWidestring(const s: string): widestring; - // Convert the node's value to boolean and return the result. If this conversion - // fails, or no value is found, then the function returns ADefault. - function ValueAsBoolDef(ADefault: boolean): boolean; virtual; - // Convert the node's value to a TDateTime and return the result. If this conversion - // fails, or no value is found, then the function returns ADefault. - function ValueAsDateTimeDef(ADefault: TDateTime): TDateTime; virtual; - // Convert the node's value to a double and return the result. If this conversion - // fails, or no value is found, then the function returns ADefault. - function ValueAsFloatDef(ADefault: double): double; virtual; - // Convert the node's value to int64 and return the result. If this conversion - // fails, or no value is found, then the function returns ADefault. - function ValueAsInt64Def(ADefault: int64): int64; virtual; - // Convert the node's value to integer and return the result. If this conversion - // fails, or no value is found, then the function returns ADefault. - function ValueAsIntegerDef(ADefault: integer): integer; virtual; - // If the attribute with name AName exists, then set its value to the boolean - // AValue. If it does not exist, then create a new attribute AName with the - // boolean value converted to either "True" or "False". If ADefault = AValue, and - // WriteOnDefault = False, no attribute will be added. - procedure WriteAttributeBool(const AName: string; AValue: boolean; ADefault: boolean {$IFDEF D4UP}= False{$ENDIF}); virtual; - procedure WriteAttributeDateTime(const AName:string; AValue: TDateTime; ADefault: TDateTime {$IFDEF D4UP}= 0{$ENDIF}); virtual; - // If the attribute with name AName exists, then set its value to the integer - // AValue. If it does not exist, then create a new attribute AName with the - // integer value converted to a quoted string. If ADefault = AValue, and - // WriteOnDefault = False, no attribute will be added. - procedure WriteAttributeInteger(const AName: string; AValue: integer; ADefault: integer {$IFDEF D4UP}= 0{$ENDIF}); virtual; - procedure WriteAttributeInt64(const AName: string; const AValue: int64; ADefault: int64 {$IFDEF D4UP}= 0{$ENDIF}); virtual; - procedure WriteAttributeFloat(const AName: string; AValue: double; ADefault: double {$IFDEF D4UP} = 0{$ENDIF}); virtual; - // If the attribute with name AName exists, then set its value to the string - // AValue. If it does not exist, then create a new attribute AName with the - // value AValue. If ADefault = AValue, and WriteOnDefault = False, no attribute - // will be added. - procedure WriteAttributeString(const AName: string; const AValue: string; const ADefault: string {$IFDEF D4UP}= ''{$ENDIF}); virtual; - // Add or replace the subnode with AName and set its value to represent the boolean - // AValue. If AValue = ADefault, and WriteOnDefault = False, no subnode will be added. - procedure WriteBool(const AName: string; AValue: boolean; ADefault: boolean {$IFDEF D4UP}= False{$ENDIF}); virtual; - {$IFDEF USEGRAPHICS} - // Write properties Color and Style of the TBrush object ABrush to the subnode - // with AName. If AName does not exist, it will be created. - procedure WriteBrush(const AName: string; ABrush: TBrush); virtual; - // Add or replace the subnode with AName and set its value to represent the TColor - // AValue. If AValue = ADefault, and WriteOnDefault = False, no subnode will be added. - procedure WriteColor(const AName: string; AValue: TColor; ADefault: TColor {$IFDEF D4UP}= clBlack{$ENDIF}); virtual; - // Write properties \Name, Color, Size and Style of the TFont object AFont to - // the subnode with AName. If AName does not exist, it will be created. - procedure WriteFont(const AName: string; AFont: TFont); virtual; - // Write properties Color, Mode, Style and Width of the TPen object APen to - // the subnode with AName. If AName does not exist, it will be created. - procedure WritePen(const AName: string; APen: TPen); virtual; - {$ENDIF} - // Add or replace the subnode with AName and set its value to represent the TDateTime - // AValue. If AValue = ADefault, and WriteOnDefault = False, no subnode will be added. - // The XML format used is compliant with W3C's specification of date and time. - procedure WriteDateTime(const AName: string; AValue: TDateTime; ADefault: TDateTime {$IFDEF D4UP}= 0{$ENDIF}); virtual; - // Add or replace the subnode with AName and set its value to represent the double - // AValue. If AValue = ADefault, and WriteOnDefault = False, no subnode will be added. - procedure WriteFloat(const AName: string; AValue: double; ADefault: double {$IFDEF D4UP}= 0.0{$ENDIF}); virtual; - // Add or replace the subnode with AName and set its value to represent the hexadecimal representation of - // AValue. If AValue = ADefault, and WriteOnDefault = False, no subnode will be added. - procedure WriteHex(const AName: string; AValue: integer; Digits: integer; ADefault: integer {$IFDEF D4UP}= 0{$ENDIF}); virtual; - // Add or replace the subnode with AName and set its value to represent the int64 - // AValue. If AValue = ADefault, and WriteOnDefault = False, no subnode will be added. - procedure WriteInt64(const AName: string; AValue: int64; ADefault: int64 {$IFDEF D4UP}= 0{$ENDIF}); virtual; - // Add or replace the subnode with AName and set its value to represent the integer - // AValue. If AValue = ADefault, and WriteOnDefault = False, no subnode will be added. - procedure WriteInteger(const AName: string; AValue: integer; ADefault: integer {$IFDEF D4UP}= 0{$ENDIF}); virtual; - // Add or replace the subnode with AName and set its value to represent the string - // AValue. If AValue = ADefault, and WriteOnDefault = False, no subnode will be added. - procedure WriteString(const AName, AValue: string; const ADefault: string {$IFDEF D4UP}= ''{$ENDIF}); virtual; - // Call WriteToString to save the XML node to a string. This method can be used to store - // individual nodes instead of the complete XML document. - function WriteToString: string; virtual; - // Add or replace the subnode with AName and set its value to represent the widestring - // AValue. If AValue = ADefault, and WriteOnDefault = False, no subnode will be added. - procedure WriteWidestring(const AName: string; const AValue: widestring; const ADefault: widestring {$IFDEF D4UP}= ''{$ENDIF}); virtual; - // AttributeByName returns the attribute value for the attribute that has name AName. - // Set AttributeByName to add an attribute to the attribute list, or replace an - // existing one. - property AttributeByName[const AName: string]: string read GetAttributeByName write - SetAttributeByName; - // AttributeByNameWide returns the attribute value for the attribute that has name AName - // as widestring. Set AttributeByNameWide to add an attribute to the attribute list, or replace an - // existing one. - property AttributeByNameWide[const AName: string]: widestring read GetAttributeByNameWide write - SetAttributeByNameWide; - // Returns the number of attributes in the current node. - property AttributeCount: integer read GetAttributeCount; - // Read this property to get the name of the attribute at Index. Note that Index - // is zero-based: Index goes from 0 to AttributeCount - 1 - property AttributeName[Index: integer]: string read GetAttributeName write SetAttributeName; - // Read this property to get the Attribute \Name and Value pair at index Index. - // This is a string with \Name and Value separated by a TAB character (#9). - property AttributePair[Index: integer]: string read GetAttributePair; - // Read this property to get the string value of the attribute at index Index. - // Write to it to set the string value. - property AttributeValue[Index: integer]: string read GetAttributeValue write SetAttributeValue; - // Read this property to get the widestring value of the attribute at index Index. - // Write to it to set the widestring value. - property AttributeValueAsWidestring[Index: integer]: widestring read GetAttributeValueAsWidestring write SetAttributeValueAsWidestring; - // Read this property to get the integer value of the attribute at index Index. - // If the value cannot be converted, 0 will be returned. Write to it to set the integer value. - property AttributeValueAsInteger[Index: integer]: integer read GetAttributeValueAsInteger write SetAttributeValueAsInteger; - // Set or get the raw attribute value, thus circumventing the escape function. Make sure that - // the value you set does not contain the & and quote characters, or the produced - // XML will be invalid. - property AttributeValueDirect[Index: integer]: string read GetAttributeValueDirect write SetAttributeValueDirect; - // BinaryEncoding reflects the same value as the BinaryEncoding setting of the parent - // Document. - property BinaryEncoding: TBinaryEncodingType read GetBinaryEncoding write SetBinaryEncoding; - // Use BinaryString to add/extract binary data in an easy way to/from the node. Internally the - // data gets stored as Base64-encoded data. Do not use this method for normal textual - // information, it is better to use ValueAsString in that case (adds less overhead). - property BinaryString: string read GetBinaryString write SetBinaryString; - // This property returns the name and index and all predecessors with underscores - // to separate, in order to get a unique reference that can be used in filenames. - property CascadedName: string read GetCascadedName; - // Pointer to parent NativeXml document, or Nil if none. - property Document: TNativeXml read FDocument write FDocument; - // ElementType contains the type of element that this node holds. - property ElementType: TXmlElementType read FElementType write FElementType; - // Fullpath will return the complete path of the node from the root, e.g. - // /Root/SubNode1/SubNode2/ThisNode - property FullPath: string read GetFullPath; - // Read Name to get the name of the element, and write Name to set the name. - // This is the full name and may include a namespace. (Namespace:Name) - property Name: string read FName write SetName; - // Parent points to the parent node of the current XML node. - property Parent: TXmlNode read FParent write FParent; - // NodeCount is the number of child nodes that this node holds. In order to - // loop through all child nodes, use a construct like this: - // - // with MyNode do - // for i := 0 to NodeCount - 1 do - // with Nodes[i] do - // ..processing here - // - property NodeCount: integer read GetNodeCount; - // Use Nodes to access the child nodes of the current XML node by index. Note - // that the list is zero-based, so Index is valid from 0 to NodeCount - 1. - property Nodes[Index: integer]: TXmlNode read GetNodes; default; - // Tag is an integer value the developer can use in any way. Tag does not get - // saved to the XML. Tag is often used to point to a GUI element (and is then - // cast to a pointer). - property Tag: integer read FTag write FTag; - // TotalNodeCount represents the total number of child nodes, and child nodes - // of child nodes etcetera of this particular node. Use the following to get - // the total number of nodes in the XML document: - // - // Total := MyDoc.RootNodes.TotalNodeCount; - // - property TotalNodeCount: integer read GetTotalNodeCount; - // Read TreeDepth to find out many nested levels there are for the current XML - // node. Root has a TreeDepth of zero. - property TreeDepth: integer read GetTreeDepth; - // ValueAsBool returns the node's value as boolean, or raises an - // exception if the value cannot be converted to boolean. Set ValueAsBool - // to convert a boolean to a string in the node's value field. See also - // function ValueAsBoolDef. - property ValueAsBool: boolean read GetValueAsBool write SetValueAsBool; - // ValueAsDateTime returns the node's value as TDateTime, or raises an - // exception if the value cannot be converted to TDateTime. Set ValueAsDateTime - // to convert a TDateTime to a string in the node's value field. See also - // function ValueAsDateTimeDef. - property ValueAsDateTime: TDateTime read GetValueAsDateTime write SetValueAsDateTime; - // ValueAsIn64 returns the node's value as int64, or raises an - // exception if the value cannot be converted to int64. Set ValueAsInt64 - // to convert an int64 to a string in the node's value field. See also - // function ValueAsInt64Def. - property ValueAsInt64: int64 read GetValueAsInt64 write SetValueAsInt64; - // ValueAsInteger returns the node's value as integer, or raises an - // exception if the value cannot be converted to integer. Set ValueAsInteger - // to convert an integer to a string in the node's value field. See also - // function ValueAsIntegerDef. - property ValueAsInteger: integer read GetValueAsInteger write SetValueAsInteger; - // ValueAsFloat returns the node's value as float, or raises an - // exception if the value cannot be converted to float. Set ValueAsFloat - // to convert a float to a string in the node's value field. See also - // function ValueAsFloatDef. - property ValueAsFloat: double read GetValueAsFloat write SetValueAsFloat; - // ValueAsString returns the unescaped version of ValueDirect. All neccesary - // characters in ValueDirect must be escaped (e.g. "&" becomes "&") but - // ValueAsString returns them in original format. Always use ValueAsString to - // set the text value of a node, to make sure all neccesary charaters are - // escaped. - property ValueAsString: string read GetValueAsString write SetValueAsString; - // ValueAsWidestring returns the unescaped version of ValueDirect as a widestring. - // Always use ValueAsWidestring to set the text value of a node, to make sure all - // neccesary charaters are escaped. Character codes bigger than $FF are preserved - // if the document is set to Utf8Encoded. - property ValueAsWidestring: widestring read GetValueAsWidestring write SetValueAsWidestring; - // ValueDirect is the exact text value as was parsed from the stream. If multiple - // text elements are encountered, they are added to ValueDirect with a CR to - // separate them. - property ValueDirect: string read FValue write FValue; - // WriteOnDefault reflects the same value as the WriteOnDefault setting of the parent - // Document. - property WriteOnDefault: boolean read GetWriteOnDefault; - end; - - // TXmlNodeList is a utility TList descendant that can be used to work with selection - // lists. An example: - // - // procedure FindAllZips(ANode: TXmlNode); - // var - // i: integer; - // AList: TXmlNodeList; - // begin - // AList := TXmlNodeList.Create; - // try - // // Get a list of all nodes named 'ZIP' - // ANode.NodesByName('ZIP', AList); - // for i := 0 to AList.Count - 1 do - // // Write the value of the node to output. Since AList[i] will be - // // of type TXmlNode, we can directly access the Value property. - // WriteLn(AList[i].Value); - // finally - // AList.Free; - // end; - // end; - // - TXmlNodeList = class(TList) - private - function GetItems(Index: Integer): TXmlNode; - procedure SetItems(Index: Integer; const Value: TXmlNode); - public - // Return the first node in the list that has an attribute with AName, AValue - function ByAttribute(const AName, AValue: string): TXmlNode; - property Items[Index: Integer]: TXmlNode read GetItems write SetItems; default; - end; - - // TNativeXml is the XML document holder. Create a TNativeXml and then use - // methods LoadFromFile, LoadFromStream or ReadFromString to load an XML document - // into memory. Or start from scratch and use Root.NodeNew to add nodes and - // eventually SaveToFile and SaveToStream to save the results as an XML document. - // Use property Xmlformat = xfReadable to ensure that indented (readable) output - // is produced. - TNativeXml = class(TPersistent) - private - FAbortParsing: boolean; // Signal to abort the parsing process - FBinaryEncoding: TBinaryEncodingType; // xbeBinHex or xbeBase64 - FCodecStream: TsdCodecStream; // Temporary stream used to read encoded files - FDropCommentsOnParse: boolean; // If true, comments are dropped (deleted) when parsing - FExternalEncoding: TStringEncodingType; - FFloatAllowScientific: boolean; - FFloatSignificantDigits: integer; - FParserWarnings: boolean; // Show parser warnings for non-critical errors - FRootNodes: TXmlNode; // Root nodes in the document (which contains one normal element that is the root) - FIndentString: string; // The indent string used to indent content (default is two spaces) - FUseFullNodes: boolean; // If true, nodes are never written in short notation. - FUtf8Encoded: boolean; // If true, all internal strings are UTF-8 encoded - FWriteOnDefault: boolean; // Set this option to "False" to only write values <> default value (default = true) - FXmlFormat: TXmlFormatType; // xfReadable, xfCompact - FSortAttributes: boolean; // If true, sort the String List that holds the parsed attributes. - FOnNodeCompare: TXmlNodeCompareEvent; // Compare two nodes - FOnNodeNew: TXmlNodeEvent; // Called after a node is added - FOnNodeLoaded: TXmlNodeEvent; // Called after a node is loaded completely - FOnProgress: TXmlProgressEvent; // Called after a node is loaded/saved, with the current position in the file - FOnUnicodeLoss: TNotifyEvent; // This event is called when there is a warning for unicode conversion loss when reading unicode - procedure DoNodeNew(Node: TXmlNode); - procedure DoNodeLoaded(Node: TXmlNode); - procedure DoUnicodeLoss(Sender: TObject); - function GetCommentString: string; - procedure SetCommentString(const Value: string); - function GetEntityByName(AName: string): string; - function GetRoot: TXmlNode; - function GetEncodingString: string; - procedure SetEncodingString(const Value: string); - function GetVersionString: string; - procedure SetVersionString(const Value: string); - function GetStyleSheetNode: TXmlNode; - protected - procedure CopyFrom(Source: TNativeXml); virtual; - procedure DoProgress(Size: integer); - function LineFeed: string; virtual; - procedure ParseDTD(ANode: TXmlNode; S: TStream); virtual; - procedure ReadFromStream(S: TStream); virtual; - procedure WriteToStream(S: TStream); virtual; - procedure SetDefaults; virtual; - public - // Create a new NativeXml document which can then be used to read or write XML files. - // A document that is created with Create must later be freed using Free. - // Example: - // - // var - // ADoc: TNativeXml; - // begin - // ADoc := TNativeXml.Create; - // try - // ADoc.LoadFromFile('c:\\temp\\myxml.xml'); - // {do something with the document here} - // finally - // ADoc.Free; - // end; - // end; - // - constructor Create; virtual; - // Use CreateName to Create a new Xml document that will automatically - // contain a root element with name ARootName. - constructor CreateName(const ARootName: string); virtual; - // Destroy will free all data in the TNativeXml object. This includes the - // root node and all subnodes under it. Do not call Destroy directly, call - // Free instead. - destructor Destroy; override; - // When calling Assign with a Source object that is a TNativeXml, will cause - // it to copy all data from Source. - procedure Assign(Source: TPersistent); override; - // Call Clear to remove all data from the object, and restore all defaults. - procedure Clear; virtual; - // Function IsEmpty returns true if the root is clear, or in other words, the - // root contains no value, no name, no subnodes and no attributes. - function IsEmpty: boolean; virtual; - // Load an XML document from the TStream object in Stream. The LoadFromStream - // procedure will raise an exception of type EFilerError when it encounters - // non-wellformed XML. This method can be used with any TStream descendant. - // See also LoadFromFile and ReadFromString. - procedure LoadFromStream(Stream: TStream); virtual; - // Call procedure LoadFromFile to load an XML document from the filename - // specified. See Create for an example. The LoadFromFile procedure will raise - // an exception of type EFilerError when it encounters non-wellformed XML. - procedure LoadFromFile(const FileName: string); virtual; - // Call procedure ReadFromString to load an XML document from the string AValue. - // The ReadFromString procedure will raise an exception of type EFilerError - // when it encounters non-wellformed XML. - procedure ReadFromString(const AValue: string); virtual; - // Call ResolveEntityReferences after the document has been loaded to resolve - // any present entity references (&Entity;). When an entity is found in the - // DTD, it will replace the entity reference. Whenever an entity contains - // XML markup, it will be parsed and become part of the document tree. Since - // calling ResolveEntityReferences is adding quite some extra overhead, it - // is not done automatically. If you want to do the entity replacement, a good - // moment to call ResolveEntityReferences is right after LoadFromFile. - procedure ResolveEntityReferences; - // Call SaveToStream to save the XML document to the Stream. Stream - // can be any TStream descendant. Set XmlFormat to xfReadable if you want - // the stream to contain indentations to make the XML more human-readable. This - // is not the default and also not compliant with the XML specification. See - // SaveToFile for information on how to save in special encoding. - procedure SaveToStream(Stream: TStream); virtual; - // Call SaveToFile to save the XML document to a file with FileName. If the - // filename exists, it will be overwritten without warning. If the file cannot - // be created, a standard I/O exception will be generated. Set XmlFormat to - // xfReadable if you want the file to contain indentations to make the XML - // more human-readable. This is not the default and also not compliant with - // the XML specification.

- // Saving to special encoding types can be achieved by setting two properties - // before saving: - // * ExternalEncoding - // * EncodingString - // ExternalEncoding can be se8bit (for plain ascii), seUtf8 (UTF-8), seUtf16LE - // (for unicode) or seUtf16BE (unicode big endian).

Do not forget to also - // set the EncodingString (e.g. "UTF-8" or "UTF-16") which matches with your - // ExternalEncoding. - procedure SaveToFile(const FileName: string); virtual; - // Call WriteToString to save the XML document to a string. Set XmlFormat to - // xfReadable if you want the string to contain indentations to make the XML - // more human-readable. This is not the default and also not compliant with - // the XML specification. - function WriteToString: string; virtual; - // Set AbortParsing to True if you use the OnNodeNew and OnNodeLoaded events in - // a SAX-like manner, and you want to abort the parsing process halfway. Example: - // - // procedure MyForm.NativeXmlNodeLoaded(Sender: TObject; Node: TXmlNode); - // begin - // if (Node.Name = 'LastNode') and (Sender is TNativeXml) then - // TNativeXml(Sender).AbortParsing := True; - // end; - // - property AbortParsing: boolean read FAbortParsing write FAbortParsing; - // Choose what kind of binary encoding will be used when calling TXmlNode.BufferRead - // and TXmlNode.BufferWrite. Default value is xbeBase64. - property BinaryEncoding: TBinaryEncodingType read FBinaryEncoding write FBinaryEncoding; - // A comment string above the root element \'; FStyle: xeComment), - (FStart: ''; FStyle: xeExclam), - (FStart: ''; FStyle: xeQuestion), - (FStart: '<'; FClose: '>'; FStyle: xeNormal) ); - // direct tags are derived from Normal tags by checking for the /> - - // These constant are used when generating hexchars from buffer data - cHexChar: array[0..15] of char = '0123456789ABCDEF'; - cHexCharLoCase: array[0..15] of char = '0123456789abcdef'; - - // These characters are used when generating BASE64 chars from buffer data - cBase64Char: array[0..63] of char = - 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - cBase64PadChar: char = '='; - - // The amount of bytes to allocate with each increase of the value buffer - cNodeValueBuf = 2048; - - // byte order marks for strings - // Unicode text files should contain $FFFE as first character to identify such a file clearly. Depending on the system - // where the file was created on this appears either in big endian or little endian style. - - const cBomInfoCount = 15; - const cBomInfo: array[0..cBomInfoCount - 1] of TBomInfo = - ( (BOM: ($00,$00,$FE,$FF); Len: 4; Enc: seUCS4BE; HasBOM: true), - (BOM: ($FF,$FE,$00,$00); Len: 4; Enc: seUCS4LE; HasBOM: true), - (BOM: ($00,$00,$FF,$FE); Len: 4; Enc: seUCS4_2143; HasBOM: true), - (BOM: ($FE,$FF,$00,$00); Len: 4; Enc: seUCS4_3412; HasBOM: true), - (BOM: ($FE,$FF,$00,$00); Len: 2; Enc: seUTF16BE; HasBOM: true), - (BOM: ($FF,$FE,$00,$00); Len: 2; Enc: seUTF16LE; HasBOM: true), - (BOM: ($EF,$BB,$BF,$00); Len: 3; Enc: seUTF8; HasBOM: true), - (BOM: ($00,$00,$00,$3C); Len: 4; Enc: seUCS4BE; HasBOM: false), - (BOM: ($3C,$00,$00,$00); Len: 4; Enc: seUCS4LE; HasBOM: false), - (BOM: ($00,$00,$3C,$00); Len: 4; Enc: seUCS4_2143; HasBOM: false), - (BOM: ($00,$3C,$00,$00); Len: 4; Enc: seUCS4_3412; HasBOM: false), - (BOM: ($00,$3C,$00,$3F); Len: 4; Enc: seUTF16BE; HasBOM: false), - (BOM: ($3C,$00,$3F,$00); Len: 4; Enc: seUTF16LE; HasBOM: false), - (BOM: ($3C,$3F,$78,$6D); Len: 4; Enc: se8Bit; HasBOM: false), - (BOM: ($4C,$6F,$A7,$94); Len: 4; Enc: seEBCDIC; HasBOM: false) - ); - -// .NET compatible stub for TBytes (array of byte) type -{$IFNDEF CLR} -type - TBytes = TBigByteArray; -{$ENDIF} - -// Delphi 3 and below stubs -{$IFNDEF D4UP} -function StringReplace(const S, OldPattern, NewPattern: string; - Flags: TReplaceFlags): string; -var - SearchStr, Patt, NewStr: string; - Offset: Integer; -begin - if rfIgnoreCase in Flags then - begin - SearchStr := UpperCase(S); - Patt := UpperCase(OldPattern); - end else - begin - SearchStr := S; - Patt := OldPattern; - end; - NewStr := S; - Result := ''; - while SearchStr <> '' do - begin - Offset := Pos(Patt, SearchStr); - if Offset = 0 then - begin - Result := Result + NewStr; - Break; - end; - Result := Result + Copy(NewStr, 1, Offset - 1) + NewPattern; - NewStr := Copy(NewStr, Offset + Length(OldPattern), MaxInt); - if not (rfReplaceAll in Flags) then - begin - Result := Result + NewStr; - Break; - end; - SearchStr := Copy(SearchStr, Offset + Length(Patt), MaxInt); - end; -end; - -function StrToInt64Def(const AValue: string; ADefault: int64): int64; -begin - Result := StrToIntDef(AValue, ADefault); -end; - -function StrToInt64(const AValue: string): int64; -begin - Result := StrToInt(AValue); -end; -{$ENDIF} - -// Delphi 4 stubs -{$IFNDEF D5UP} -function AnsiPos(const Substr, S: string): Integer; -begin - Result := Pos(Substr, S); -end; - -function AnsiQuotedStr(const S: string; Quote: Char): string; -var - P, Src, Dest: PChar; - AddCount: Integer; -begin - AddCount := 0; - P := StrScan(PChar(S), Quote); - while P <> nil do - begin - Inc(P); - Inc(AddCount); - P := StrScan(P, Quote); - end; - if AddCount = 0 then - begin - Result := Quote + S + Quote; - Exit; - end; - SetLength(Result, Length(S) + AddCount + 2); - Dest := Pointer(Result); - Dest^ := Quote; - Inc(Dest); - Src := Pointer(S); - P := StrScan(Src, Quote); - repeat - Inc(P); - Move(Src^, Dest^, P - Src); - Inc(Dest, P - Src); - Dest^ := Quote; - Inc(Dest); - Src := P; - P := StrScan(Src, Quote); - until P = nil; - P := StrEnd(Src); - Move(Src^, Dest^, P - Src); - Inc(Dest, P - Src); - Dest^ := Quote; -end; - -function AnsiExtractQuotedStr(var Src: PChar; Quote: Char): string; -var - P, Dest: PChar; - DropCount: Integer; -begin - Result := ''; - if (Src = nil) or (Src^ <> Quote) then - Exit; - Inc(Src); - DropCount := 1; - P := Src; - Src := StrScan(Src, Quote); - while Src <> nil do - begin - Inc(Src); - if Src^ <> Quote then - Break; - Inc(Src); - Inc(DropCount); - Src := StrScan(Src, Quote); - end; - if Src = nil then - Src := StrEnd(P); - if ((Src - P) <= 1) then - Exit; - if DropCount = 1 then - SetString(Result, P, Src - P - 1) - else - begin - SetLength(Result, Src - P - DropCount); - Dest := PChar(Result); - Src := StrScan(P, Quote); - while Src <> nil do - begin - Inc(Src); - if Src^ <> Quote then - Break; - Move(P^, Dest^, Src - P); - Inc(Dest, Src - P); - Inc(Src); - P := Src; - Src := StrScan(Src, Quote); - end; - if Src = nil then - Src := StrEnd(P); - Move(P^, Dest^, Src - P - 1); - end; -end; - -procedure FreeAndNil(var Obj); -var - P: TObject; -begin - P := TObject(Obj); - TObject(Obj) := nil; - P.Free; -end; -{$ENDIF} - -// .NET-compatible TStream.Write - -function StreamWrite(Stream: TStream; const Buffer{$IFDEF CLR}: TBytes{$ENDIF}; Offset, Count: Longint): Longint; -begin -{$IFDEF CLR} - Result := Stream.Write(Buffer, Offset, Count); -{$ELSE} - Result := Stream.Write(TBytes(Buffer)[Offset], Count); -{$ENDIF} -end; - -{$IFNDEF CLR} -// Delphi's implementation of TStringStream is severely flawed, it does a SetLength -// on each write, which slows down everything to a crawl. This implementation over- -// comes this issue. -type - TsdStringStream = class(TMemoryStream) - public - constructor Create(const S: string); - function DataString: string; - end; - -constructor TsdStringStream.Create(const S: string); -begin - inherited Create; - SetSize(length(S)); - if Size > 0 then - begin - Write(S[1], Size); - Position := 0; - end; -end; - -function TsdStringStream.DataString: string; -begin - SetLength(Result, Size); - if Size > 0 then - begin - Position := 0; - Read(Result[1], length(Result)); - end; -end; -{$ELSE} -// In .NET we use the standard TStringStream -type - TsdStringStream = TStringStream; -{$ENDIF} - -// Utility functions - -function Min(A, B: integer): integer; -begin - if A < B then - Result := A - else - Result := B; -end; - -function Max(A, B: integer): integer; -begin - if A > B then - Result := A - else - Result := B; -end; - -function EscapeString(const AValue: string): string; -var - i: integer; -begin - Result := AValue; - for i := 0 to cEscapeCount - 1 do - Result := StringReplace(Result, cEscapes[i], cReplaces[i], [rfReplaceAll]); -end; - -function UnEscapeStringUTF8(const AValue: string): string; -var - SearchStr, Reference, Replace: string; - i, Offset, Code: Integer; - W: word; -begin - SearchStr := AValue; - Result := ''; - while SearchStr <> '' do - begin - // find '&' - Offset := AnsiPos('&', SearchStr); - if Offset = 0 then - begin - // Nothing found - Result := Result + SearchStr; - Break; - end; - Result := Result + Copy(SearchStr, 1, Offset - 1); - SearchStr := Copy(SearchStr, Offset, MaxInt); - // find next ';' - Offset := AnsiPos(';', SearchStr); - if Offset = 0 then - begin - // Error: encountered a '&' but not a ';'.. we will ignore, just return - // the unmodified value - Result := Result + SearchStr; - Break; - end; - // Reference - Reference := copy(SearchStr, 1, Offset); - SearchStr := Copy(SearchStr, Offset + 1, MaxInt); - Replace := Reference; - // See if it is a character reference - if copy(Reference, 1, 2) = '&#' then - begin - Reference := copy(Reference, 3, length(Reference) - 3); - if length(Reference) > 0 then - begin - if lowercase(Reference[1]) = 'x' then - // Hex notation - Reference[1] := '$'; - Code := StrToIntDef(Reference, -1); - if (Code >= 0) and (Code < $FFFF) then - begin - W := Code; - {$IFDEF D5UP} - Replace := sdUnicodeToUtf8(WideChar(W)); - {$ELSE} - Replace := char(W and $FF); - {$ENDIF} - end; - end; - end else - begin - // Look up default escapes - for i := 0 to cEscapeCount - 1 do - if Reference = cReplaces[i] then - begin - // Replace - Replace := cEscapes[i]; - Break; - end; - end; - // New result - Result := Result + Replace; - end; -end; - -function UnEscapeStringANSI(const AValue: string): string; -var - SearchStr, Reference, Replace: string; - i, Offset, Code: Integer; - B: byte; -begin - SearchStr := AValue; - Result := ''; - while SearchStr <> '' do - begin - // find '&' - Offset := AnsiPos('&', SearchStr); - if Offset = 0 then - begin - // Nothing found - Result := Result + SearchStr; - Break; - end; - Result := Result + Copy(SearchStr, 1, Offset - 1); - SearchStr := Copy(SearchStr, Offset, MaxInt); - // find next ';' - Offset := AnsiPos(';', SearchStr); - if Offset = 0 then - begin - // Error: encountered a '&' but not a ';'.. we will ignore, just return - // the unmodified value - Result := Result + SearchStr; - Break; - end; - // Reference - Reference := copy(SearchStr, 1, Offset); - SearchStr := Copy(SearchStr, Offset + 1, MaxInt); - Replace := Reference; - // See if it is a character reference - if copy(Reference, 1, 2) = '&#' then - begin - Reference := copy(Reference, 3, length(Reference) - 3); - if length(Reference) > 0 then - begin - if lowercase(Reference[1]) = 'x' then - // Hex notation - Reference[1] := '$'; - Code := StrToIntDef(Reference, -1); - if (Code >= 0) and (Code < $FF) then - begin - B := Code; - Replace := char(B); - end; - end; - end else - begin - // Look up default escapes - for i := 0 to cEscapeCount - 1 do - if Reference = cReplaces[i] then - begin - // Replace - Replace := cEscapes[i]; - Break; - end; - end; - // New result - Result := Result + Replace; - end; -end; - -function QuoteString(const AValue: string): string; -var - AQuoteChar: char; -begin - AQuoteChar := '"'; - if Pos('"', AValue) > 0 then - AQuoteChar := ''''; -{$IFDEF CLR} - Result := QuotedStr(AValue, AQuoteChar); -{$ELSE} - Result := AnsiQuotedStr(AValue, AQuoteChar); -{$ENDIF} -end; - -function UnQuoteString(const AValue: string): string; -{$IFNDEF CLR} -var - P: PChar; -{$ENDIF} -begin - if Length(AValue) < 2 then - begin - Result := AValue; - exit; - end; - if AValue[1] in cQuoteChars then - begin - {$IFDEF CLR} - Result := DequotedStr(AValue, AValue[1]); - {$ELSE} - P := PChar(AValue); - Result := AnsiExtractQuotedStr(P, AValue[1]); - {$ENDIF} - end else - Result := AValue; -end; - -function AddControlChars(const AValue: string; const Chars: string; Interval: integer): string; -// Insert Chars in AValue at each Interval chars -var - i, j, ALength: integer; - // local - procedure InsertControlChars; - var - k: integer; - begin - for k := 1 to Length(Chars) do - begin - Result[j] := Chars[k]; - inc(j); - end; - end; -// main -begin - if (Length(Chars) = 0) or (Interval <= 0) then - begin - Result := AValue; - exit; - end; - - // Calculate length based on original length and total extra length for control chars - ALength := Length(AValue) + ((Length(AValue) - 1) div Interval + 3) * Length(Chars); - SetLength(Result, ALength); - - // Copy and insert - j := 1; - for i := 1 to Length(AValue) do - begin - if (i mod Interval) = 1 then - // Insert control chars - InsertControlChars; - Result[j] := AValue[i]; - inc(j); - end; - InsertControlChars; - - // Adjust length - dec(j); - if ALength > j then - SetLength(Result, j); -end; - -function RemoveControlChars(const AValue: string): string; -// Remove control characters from string in AValue -var - i, j: integer; -begin - Setlength(Result, Length(AValue)); - i := 1; - j := 1; - while i <= Length(AValue) do - if AValue[i] in cControlChars then - inc(i) - else - begin - Result[j] := AValue[i]; - inc(i); - inc(j); - end; - // Adjust length - if i <> j then - SetLength(Result, j - 1); -end; - -function FindString(const SubString: string; const S: string; Start, Close: integer; var APos: integer): boolean; -// Check if the Substring matches the string S in any position in interval Start to Close - 1 -// and returns found positon in APos. Result = True if anything is found. -// Note: this funtion is case-insensitive -var - CharIndex: integer; -begin - Result := False; - APos := 0; - for CharIndex := Start to Close - Length(SubString) do - if MatchString(SubString, S, CharIndex) then - begin - APos := CharIndex; - Result := True; - exit; - end; -end; - -function MatchString(const SubString: string; const S: string; Start: integer): boolean; -// Check if the Substring matches the string S at position Start. -// Note: this funtion is case-insensitive -var - CharIndex: integer; -begin - Result := False; - // Check range just in case - if (Length(S) - Start + 1) < Length(Substring) then - exit; - - CharIndex := 0; - while CharIndex < Length(SubString) do - if Upcase(SubString[CharIndex + 1]) = Upcase(S[Start + CharIndex]) then - inc(CharIndex) - else - exit; - // All chars were the same, so we succeeded - Result := True; -end; - -procedure ParseAttributes(const AValue: string; Start, Close: integer; Attributes: TStrings); -// Convert the attributes string AValue in [Start, Close - 1] to the attributes stringlist -var - i: integer; - InQuotes: boolean; - AQuoteChar: char; -begin - InQuotes := False; - AQuoteChar := '"'; - if not assigned(Attributes) then - exit; - if not TrimPos(AValue, Start, Close) then - exit; - - // Clear first - Attributes.Clear; - - // Loop through characters - for i := Start to Close - 1 do - begin - - // In quotes? - if InQuotes then - begin - if AValue[i] = AQuoteChar then - InQuotes := False; - end else - begin - if AValue[i] in cQuoteChars then - begin - InQuotes := True; - AQuoteChar := AValue[i]; - end; - end; - - // Add attribute strings on each controlchar break - if not InQuotes then - if AValue[i] in cControlChars then - begin - if i > Start then - Attributes.Add(copy(AValue, Start, i - Start)); - Start := i + 1; - end; - end; - // Add last attribute string - if Start < Close then - Attributes.Add(copy(AValue, Start, Close - Start)); - - // First-char "=" signs should append to previous - for i := Attributes.Count - 1 downto 1 do - if Attributes[i][1] = '=' then - begin - Attributes[i - 1] := Attributes[i - 1] + Attributes[i]; - Attributes.Delete(i); - end; - - // First-char quotes should append to previous - for i := Attributes.Count - 1 downto 1 do - if (Attributes[i][1] in cQuoteChars) and (Pos('=', Attributes[i - 1]) > 0) then - begin - Attributes[i - 1] := Attributes[i - 1] + Attributes[i]; - Attributes.Delete(i); - end; -end; - -function TrimPos(const AValue: string; var Start, Close: integer): boolean; -// Trim the string in AValue in [Start, Close - 1] by adjusting Start and Close variables -begin - // Checks - Start := Max(1, Start); - Close := Min(Length(AValue) + 1, Close); - if Close <= Start then - begin - Result := False; - exit; - end; - - // Trim left - while - (Start < Close) and - (AValue[Start] in cControlChars) do - inc(Start); - - // Trim right - while - (Start < Close) and - (AValue[Close - 1] in cControlChars) do - dec(Close); - - // Do we have a string left? - Result := Close > Start; -end; - -procedure WriteStringToStream(S: TStream; const AString: string); -begin - if Length(AString) > 0 then - begin - {$IFDEF CLR} - S.Write(BytesOf(AString), Length(AString)); - {$ELSE} - S.Write(AString[1], Length(AString)); - {$ENDIF} - end; -end; - -function ReadOpenTag(AReader: TsdSurplusReader): integer; -// Try to read the type of open tag from S -var - AIndex, i: integer; - Found: boolean; - Ch: char; - Candidates: array[0..cTagCount - 1] of boolean; - Surplus: string; -begin - Surplus := ''; - Result := cTagCount - 1; - for i := 0 to cTagCount - 1 do Candidates[i] := True; - AIndex := 1; - repeat - Found := False; - inc(AIndex); - if AReader.ReadChar(Ch) = 0 then - exit; - Surplus := Surplus + Ch; - for i := cTagCount - 1 downto 0 do - if Candidates[i] and (length(cTags[i].FStart) >= AIndex) then - begin - if cTags[i].FStart[AIndex] = Ch then - begin - Found := True; - if length(cTags[i].FStart) = AIndex then - Result := i; - end else - Candidates[i] := False; - end; - until Found = False; - // The surplus string that we already read (everything after the tag) - AReader.Surplus := copy(Surplus, length(cTags[Result].FStart), length(Surplus)); -end; - -function ReadStringFromStreamUntil(AReader: TsdSurplusReader; const ASearch: string; - var AValue: string; SkipQuotes: boolean): boolean; -var - AIndex, ValueIndex, SearchIndex: integer; - LastSearchChar, Ch: char; - InQuotes: boolean; - QuoteChar: Char; - SB: TsdStringBuilder; -begin - Result := False; - InQuotes := False; - - // Get last searchstring character - AIndex := length(ASearch); - if AIndex = 0 then exit; - LastSearchChar := ASearch[AIndex]; - - SB := TsdStringBuilder.Create; - try - QuoteChar := #0; - - repeat - // Add characters to the value to be returned - if AReader.ReadChar(Ch) = 0 then - exit; - SB.AddChar(Ch); - - // Do we skip quotes? - if SkipQuotes then - begin - if InQuotes then - begin - if (Ch = QuoteChar) then - InQuotes := false; - end else - begin - if Ch in cQuoteChars then - begin - InQuotes := true; - QuoteChar := Ch; - end; - end; - end; - - // In quotes? If so, we don't check the end condition - if not InQuotes then - begin - // Is the last char the same as the last char of the search string? - if Ch = LastSearchChar then - begin - - // Check to see if the whole search string is present - ValueIndex := SB.Length - 1; - SearchIndex := length(ASearch) - 1; - if ValueIndex < SearchIndex then continue; - - Result := True; - while (SearchIndex > 0)and Result do - begin - Result := SB[ValueIndex] = ASearch[SearchIndex]; - dec(ValueIndex); - dec(SearchIndex); - end; - end; - end; - until Result; - - // Use only the part before the search string - AValue := SB.StringCopy(1, SB.Length - length(ASearch)); - finally - SB.Free; - end; -end; - -function ReadStringFromStreamWithQuotes(S: TStream; const Terminator: string; - var AValue: string): boolean; -var - Ch, QuoteChar: char; - InQuotes: boolean; - SB: TsdStringBuilder; -begin - SB := TsdStringBuilder.Create; - try - QuoteChar := #0; - Result := False; - InQuotes := False; - repeat - if S.Read(Ch, 1) = 0 then exit; - if not InQuotes then - begin - if (Ch = '"') or (Ch = '''') then - begin - InQuotes := True; - QuoteChar := Ch; - end; - end else - begin - if Ch = QuoteChar then - InQuotes := False; - end; - if not InQuotes and (Ch = Terminator) then - break; - SB.AddChar(Ch); - until False; - AValue := SB.Value; - Result := True; - finally - SB.Free; - end; -end; - -function sdDateTimeFromString(const ADate: string): TDateTime; -// Convert the string ADate to a TDateTime according to the W3C date/time specification -// as found here: http://www.w3.org/TR/NOTE-datetime -var - AYear, AMonth, ADay, AHour, AMin, ASec, AMSec: word; -begin - AYear := StrToInt(copy(ADate, 1, 4)); - AMonth := StrToInt(copy(ADate, 6, 2)); - ADay := StrToInt(copy(ADate, 9, 2)); - if Length(ADate) > 16 then - begin - AHour := StrToInt(copy(ADate, 12, 2)); - AMin := StrToInt(copy(ADate, 15, 2)); - ASec := StrToIntDef(copy(ADate, 18, 2), 0); // They might be omitted, so default to 0 - AMSec := StrToIntDef(copy(ADate, 21, 3), 0); // They might be omitted, so default to 0 - end else - begin - AHour := 0; - AMin := 0; - ASec := 0; - AMSec := 0; - end; - Result := - EncodeDate(AYear, AMonth, ADay) + - EncodeTime(AHour, AMin, ASec, AMSec); -end; - -function sdDateTimeFromStringDefault(const ADate: string; ADefault: TDateTime): TDateTime; -// Convert the string ADate to a TDateTime according to the W3C date/time specification -// as found here: http://www.w3.org/TR/NOTE-datetime -// If there is a conversion error, the default value ADefault is returned. -begin - try - Result := sdDateTimeFromString(ADate); - except - Result := ADefault; - end; -end; - -function sdDateTimeToString(ADate: TDateTime): string; -// Convert the TDateTime ADate to a string according to the W3C date/time specification -// as found here: http://www.w3.org/TR/NOTE-datetime -var - AYear, AMonth, ADay, AHour, AMin, ASec, AMSec: word; -begin - DecodeDate(ADate, AYear, AMonth, ADay); - DecodeTime(ADate, AHour, AMin, ASec, AMSec); - if frac(ADate) = 0 then - Result := Format('%.4d-%.2d-%.2d', [AYear, AMonth, ADay]) - else - Result := Format('%.4d-%.2d-%.2dT%.2d:%.2d:%.2d.%.3dZ', - [AYear, AMonth, ADay, AHour, AMin, ASec, AMSec]); -end; - -function sdWriteNumber(Value: double; SignificantDigits: integer; AllowScientific: boolean): string; -const - Limits: array[1..9] of integer = - (10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000); -var - Limit, Limitd, PointPos, IntVal, ScPower: integer; - Body: string; -begin - if (SignificantDigits < 1) or (SignificantDigits > 9) then - raise Exception.Create(sxeSignificantDigitsOutOfRange); - - // Zero - if Value = 0 then - begin - Result := '0'; - exit; - end; - - // Sign - if Value < 0 then - begin - Result := '-'; - Value := -Value; - end else - Result := ''; - - // Determine point position - Limit := Limits[SignificantDigits]; - Limitd := Limit div 10; - PointPos := SignificantDigits; - while Value < Limitd do - begin - Value := Value * 10; - dec(PointPos); - end; - while Value >= Limit do - begin - Value := Value * 0.1; - inc(PointPos); - end; - - // Round - IntVal := round(Value); - - // Exceptional case which happens when the value rounds up to the limit - if Intval = Limit then - begin - IntVal := IntVal div 10; - inc(PointPos); - end; - - // Strip off any zeros, these reduce significance count - while (IntVal mod 10 = 0) and (PointPos < SignificantDigits) do - begin - dec(SignificantDigits); - IntVal := IntVal div 10; - end; - - // Check for scientific notation - ScPower := 0; - if AllowScientific and ((PointPos < -1) or (PointPos > SignificantDigits + 2)) then - begin - ScPower := PointPos - 1; - dec(PointPos, ScPower); - end; - - // Body - Body := IntToStr(IntVal); - while PointPos > SignificantDigits do - begin - Body := Body + '0'; - inc(SignificantDigits); - end; - while PointPos < 0 do - begin - Body := '0' + Body; - inc(PointPos); - end; - if PointPos = 0 then - Body := '.' + Body - else - if PointPos < SignificantDigits then - Body := copy(Body, 1, PointPos) + '.' + copy(Body, PointPos + 1, SignificantDigits); - - // Final result - if ScPower = 0 then - Result := Result + Body - else - Result := Result + Body + 'E' + IntToStr(ScPower); -end; - -{$IFDEF CLR} - -function sdUnicodeToUtf8(const W: widestring): string; -begin - Result := Encoding.UTF8.GetBytes(W); -end; - -function sdUtf8ToUnicode(const S: string): widestring; -begin - Result := Encoding.UTF8.GetString(BytesOf(S)); -end; - -function EncodeBase64Buf(const Buffer: TBytes; Count: Integer): string; -begin - Result := Convert.ToBase64String(Buffer, 0, Count); -end; - -function EncodeBase64(const Source: string): string; -begin - Result := Convert.ToBase64String(BytesOf(Source)); -end; - -procedure DecodeBase64Buf(const Source: string; var Buffer: TBytes; Count: Integer); -var - ADecoded: TBytes; -begin - ADecoded := Convert.FromBase64String(Source); - if Count > Length(ADecoded) then - raise EFilerError.Create(sxeMissingDataInBinaryStream); - SetLength(ADecoded, Count); - Buffer := ADecoded; -end; - -function DecodeBase64(const Source: string): string; -begin - Result := AnsiString(Convert.FromBase64String(Source)); -end; - -{$ELSE} - -function PtrUnicodeToUtf8(Dest: PChar; MaxDestBytes: Cardinal; Source: PWideChar; SourceChars: Cardinal): Cardinal; -var - i, count: Cardinal; - c: Cardinal; -begin - Result := 0; - if not assigned(Source) or not assigned(Dest) then - exit; - - count := 0; - i := 0; - - while (i < SourceChars) and (count < MaxDestBytes) do - begin - c := Cardinal(Source[i]); - Inc(i); - if c <= $7F then - begin - Dest[count] := Char(c); - Inc(count); - end else - if c > $7FF then - begin - if count + 3 > MaxDestBytes then - break; - Dest[count] := Char($E0 or (c shr 12)); - Dest[count+1] := Char($80 or ((c shr 6) and $3F)); - Dest[count+2] := Char($80 or (c and $3F)); - Inc(count,3); - end else - begin // $7F < Source[i] <= $7FF - if count + 2 > MaxDestBytes then - break; - Dest[count] := Char($C0 or (c shr 6)); - Dest[count+1] := Char($80 or (c and $3F)); - Inc(count,2); - end; - end; - if count >= MaxDestBytes then - count := MaxDestBytes-1; - Dest[count] := #0; - Result := count + 1; // convert zero based index to byte count -end; - -function PtrUtf8ToUnicode(Dest: PWideChar; MaxDestChars: Cardinal; Source: PChar; - SourceBytes: Cardinal): Cardinal; -var - i, count: Cardinal; - c: Byte; - wc: Cardinal; -begin - if not assigned(Dest) or not assigned(Source) then - begin - Result := 0; - Exit; - end; - Result := Cardinal(-1); - count := 0; - i := 0; - while (i < SourceBytes) and (count < MaxDestChars) do - begin - wc := Cardinal(Source[i]); - Inc(i); - if (wc and $80) <> 0 then - begin - if i >= SourceBytes then - // incomplete multibyte char - Exit; - wc := wc and $3F; - if (wc and $20) <> 0 then - begin - c := Byte(Source[i]); - Inc(i); - if (c and $C0) <> $80 then - // malformed trail byte or out of range char - Exit; - if i >= SourceBytes then - // incomplete multibyte char - Exit; - wc := (wc shl 6) or (c and $3F); - end; - c := Byte(Source[i]); - Inc(i); - if (c and $C0) <> $80 then - // malformed trail byte - Exit; - Dest[count] := WideChar((wc shl 6) or (c and $3F)); - end else - Dest[count] := WideChar(wc); - Inc(count); - end; - - if count >= MaxDestChars then - count := MaxDestChars-1; - - Dest[count] := #0; - Result := count + 1; -end; - -function sdUnicodeToUtf8(const W: widestring): string; -var - L: integer; - Temp: string; -begin - Result := ''; - if W = '' then Exit; - SetLength(Temp, Length(W) * 3); // SetLength includes space for null terminator - - L := PtrUnicodeToUtf8(PChar(Temp), Length(Temp) + 1, PWideChar(W), Length(W)); - if L > 0 then - SetLength(Temp, L - 1) - else - Temp := ''; - Result := Temp; -end; - -function sdUtf8ToUnicode(const S: string): widestring; -var - L: Integer; - Temp: WideString; -begin - Result := ''; - if S = '' then Exit; - SetLength(Temp, Length(S)); - - L := PtrUtf8ToUnicode(PWideChar(Temp), Length(Temp)+1, PChar(S), Length(S)); - if L > 0 then - SetLength(Temp, L-1) - else - Temp := ''; - Result := Temp; -end; - -function EncodeBase64Buf(const Buffer; Count: Integer): string; -var - i, j: integer; - ACore: integer; - ALong: cardinal; - S: PByte; -begin - // Make sure ASize is always a multiple of 3, and this multiple - // gets saved as 4 characters - ACore := (Count + 2) div 3; - - // Set the length of the string that stores encoded characters - SetLength(Result, ACore * 4); - S := @Buffer; - // Do the loop ACore times - for i := 0 to ACore - 1 do - begin - ALong := 0; - for j := 0 to 2 do - begin - ALong := ALong shl 8 + S^; - inc(S); - end; - for j := 0 to 3 do - begin - Result[i * 4 + 4 - j] := cBase64Char[ALong and $3F]; - ALong := ALong shr 6; - end; - end; - // For comformity to Base64, we must pad the data instead of zero out - // if the size is not an exact multiple of 3 - case ACore * 3 - Count of - 0:;// nothing to do - 1: // pad one byte - Result[ACore * 4] := cBase64PadChar; - 2: // pad two bytes - begin - Result[ACore * 4 ] := cBase64PadChar; - Result[ACore * 4 - 1] := cBase64PadChar; - end; - end;//case -end; - -function EncodeBase64(const Source: string): string; -// Encode binary data in Source as BASE64. The function returns the BASE64 encoded -// data as string, without any linebreaks. -begin - if length(Source) > 0 then - Result := EncodeBase64Buf(Source[1], length(Source)) - else - Result := ''; -end; - -procedure DecodeBase64Buf(var Source: string; var Buffer; Count: Integer); -var - i, j: integer; - BufPos, Core: integer; - LongVal: cardinal; - D: PByte; - Map: array[Char] of byte; -begin - // Core * 4 is the number of chars to read - check length - Core := Length(Source) div 4; - if Count > Core * 3 then - raise EFilerError.Create(sxeMissingDataInBinaryStream); - - // Prepare map - for i := 0 to 63 do - Map[cBase64Char[i]] := i; - D := @Buffer; - - // Check for final padding, and replace with "zeros". There can be - // at max two pad chars ('=') - BufPos := length(Source); - if (BufPos > 0) and (Source[BufPos] = cBase64PadChar) then - begin - Source[BufPos] := cBase64Char[0]; - dec(BufPos); - if (BufPos > 0) and (Source[BufPos] = cBase64PadChar) then - Source[BufPos] := cBase64Char[0]; - end; - - // Do this Core times - for i := 0 to Core - 1 do - begin - LongVal := 0; - // Unroll the characters - for j := 0 to 3 do - LongVal := LongVal shl 6 + Map[Source[i * 4 + j + 1]]; - // and unroll the bytes - for j := 2 downto 0 do - begin - // Check overshoot - if integer(D) - integer(@Buffer) >= Count then - exit; - D^ := LongVal shr (j * 8) and $FF; - inc(D); - end; - end; -end; - -function DecodeBase64(const Source: string): string; -// Decode BASE64 data in Source into binary data. The function returns the binary -// data as string. Use a TStringStream to convert this data to a stream. -var - BufData: string; - BufSize, BufPos: integer; -begin - BufData := RemoveControlChars(Source); - - // Determine length of data - BufSize := length(BufData) div 4; - if BufSize * 4 <> length(BufData) then - raise EFilerError.Create(sxeErrorCalcStreamLength); - BufSize := BufSize * 3; - // Check padding chars - BufPos := length(BufData); - if (BufPos > 0) and (BufData[BufPos] = cBase64PadChar) then - begin - dec(BufPos); - dec(BufSize); - if (BufPos > 0) and (BufData[BufPos] = cBase64PadChar) then - dec(BufSize); - end; - Setlength(Result, BufSize); - - // Decode - if BufSize > 0 then - DecodeBase64Buf(BufData, Result[1], BufSize); -end; - -{$ENDIF} - -function sdAnsiToUtf8(const S: string): string; -begin - Result := sdUnicodeToUtf8(S); -end; - -function sdUtf8ToAnsi(const S: string): string; -begin - Result := sdUtf8ToUnicode(S); -end; - -function EncodeBinHexBuf(const Source; Count: Integer): string; -// Encode binary data in Source as BINHEX. The function returns the BINHEX encoded -// data as string, without any linebreaks. -var -{$IFDEF CLR} - Text: TBytes; -{$ELSE} - Text: string; -{$ENDIF} -begin - SetLength(Text, Count * 2); -{$IFDEF CLR} - BinToHex(TBytes(Source), 0, Text, 0, Count); -{$ELSE} -{$IFDEF D4UP} - BinToHex(PChar(@Source), PChar(Text), Count); -{$ELSE} - raise Exception.Create(sxeUnsupportedEncoding); -{$ENDIF} -{$ENDIF} - Result := Text; -end; - -function EncodeBinHex(const Source: string): string; -// Encode binary data in Source as BINHEX. The function returns the BINHEX encoded -// data as string, without any linebreaks. -var -{$IFDEF CLR} - Text: TBytes; -{$ELSE} - Text: string; -{$ENDIF} -begin - SetLength(Text, Length(Source) * 2); -{$IFDEF CLR} - BinToHex(BytesOf(Source), 0, Text, 0, Length(Source)); -{$ELSE} -{$IFDEF D4UP} - BinToHex(PChar(Source), PChar(Text), Length(Source)); -{$ELSE} - raise Exception.Create(sxeUnsupportedEncoding); -{$ENDIF} -{$ENDIF} - Result := Text; -end; - -procedure DecodeBinHexBuf(const Source: string; var Buffer{$IFDEF CLR}: TBytes{$ENDIF}; Count: Integer); -// Decode BINHEX data in Source into binary data. -begin - if Length(Source) div 2 < Count then - raise EFilerError.Create(sxeMissingDataInBinaryStream); - -{$IFDEF CLR} - HexToBin(BytesOf(Source), 0, Buffer, 0, Count); -{$ELSE} -{$IFDEF D4UP} - HexToBin(PChar(Source), PChar(@Buffer), Count); -{$ELSE} - raise Exception.Create(sxeUnsupportedEncoding); -{$ENDIF} -{$ENDIF} -end; - -function DecodeBinHex(const Source: string): string; -// Decode BINHEX data in Source into binary data. The function returns the binary -// data as string. Use a TStringStream to convert this data to a stream. -var - AData: string; - ASize: integer; -{$IFDEF CLR} - Buffer: TBytes; -{$ELSE} - Buffer: string; -{$ENDIF} -begin - AData := RemoveControlChars(Source); - - // Determine length of data - ASize := length(AData) div 2; - if ASize * 2 <> length(AData) then - raise EFilerError.Create(sxeErrorCalcStreamLength); - - SetLength(Buffer, ASize); -{$IFDEF CLR} - HexToBin(BytesOf(AData), 0, Buffer, 0, ASize); -{$ELSE} -{$IFDEF D4UP} - HexToBin(PChar(AData), PChar(Buffer), ASize); -{$ELSE} - raise Exception.Create(sxeUnsupportedEncoding); -{$ENDIF} -{$ENDIF} - Result := Buffer; -end; - -function sdStringToBool(const AValue: string): boolean; -var - Ch: Char; -begin - if Length(AValue) > 0 then - begin - Ch := UpCase(AValue[1]); - if Ch in ['T', 'Y'] then - begin - Result := True; - exit; - end; - if Ch in ['F', 'N'] then - begin - Result := False; - exit; - end; - end; - raise Exception.Create(sxeCannotConverToBool); -end; - -function sdStringFromBool(ABool: boolean): string; -const - cBoolValues: array[boolean] of string = ('False', 'True'); -begin - Result := cBoolValues[ABool]; -end; - -{ TXmlNode } - -function TXmlNode.AbortParsing: boolean; -begin - Result := assigned(Document) and Document.AbortParsing; -end; - -procedure TXmlNode.Assign(Source: TPersistent); -var - i: integer; - Node: TXmlNode; -begin - if Source is TXmlNode then - begin - // Clear first - Clear; - - // Properties - FElementType := TXmlNode(Source).FElementType; - FName := TXmlNode(Source).FName; - FTag := TXmlNode(Source).FTag; - FValue := TXmlNode(Source).FValue; - - // Attributes - if assigned(TXmlNode(Source).FAttributes) then - begin - CheckCreateAttributesList; - FAttributes.Assign(TXmlNode(Source).FAttributes); - end; - - // Nodes - for i := 0 to TXmlNode(Source).NodeCount - 1 do - begin - Node := NodeNew(''); - Node.Assign(TXmlNode(Source).Nodes[i]); - end; - end else - if Source is TNativeXml then - begin - Assign(TNativeXml(Source).FRootNodes); - end else - inherited; -end; - -procedure TXmlNode.AttributeAdd(const AName, AValue: string); -var - Attr: string; -begin - Attr := Format('%s=%s', [AName, QuoteString(EscapeString(AValue))]); - CheckCreateAttributesList; - FAttributes.Add(Attr); -end; - -{$IFDEF D4UP} -procedure TXmlNode.AttributeAdd(const AName: string; AValue: integer); -begin - AttributeAdd(AName, IntToStr(AValue)); -end; -{$ENDIF} - -procedure TXmlNode.AttributeDelete(Index: integer); -begin - if (Index >= 0) and (Index < AttributeCount) then - FAttributes.Delete(Index); -end; - -procedure TXmlNode.AttributeExchange(Index1, Index2: integer); -var - Temp: string; -begin - if (Index1 <> Index2) and - (Index1 >= 0) and (Index1 < FAttributes.Count) and - (Index2 >= 0) and (Index2 < FAttributes.Count) then - begin - Temp := FAttributes[Index1]; - FAttributes[Index1] := FAttributes[Index2]; - FAttributes[Index2] := Temp; - end; -end; - -function TXmlNode.AttributeIndexByname(const AName: string): integer; -// Return the index of the attribute with name AName, or -1 if not found -var - i: integer; -begin - Result := -1; - for i := 0 to AttributeCount - 1 do - if AnsiCompareText(AttributeName[i], AName) = 0 then - begin - Result := i; - exit; - end; -end; - -procedure TXmlNode.AttributesClear; -begin - FreeAndNil(FAttributes); -end; - -function TXmlNode.BufferLength: integer; -var - BufData: string; - BufPos: integer; -begin - BufData := RemoveControlChars(FValue); - case BinaryEncoding of - xbeBinHex: - begin - Result := length(BufData) div 2; - if Result * 2 <> length(BufData) then - raise EFilerError.Create(sxeErrorCalcStreamLength); - end; - xbeBase64: - begin - Result := length(BufData) div 4; - if Result * 4 <> length(BufData) then - raise EFilerError.Create(sxeErrorCalcStreamLength); - Result := Result * 3; - // Check padding chars - BufPos := length(BufData); - if (BufPos > 0) and (BufData[BufPos] = cBase64PadChar) then - begin - dec(BufPos); - dec(Result); - if (BufPos > 0) and (BufData[BufPos] = cBase64PadChar) then - dec(Result); - end; - end; - else - Result := 0; // avoid compiler warning - end; -end; - -procedure TXmlNode.BufferRead(var Buffer{$IFDEF CLR}: TBytes{$ENDIF}; Count: Integer); -// Read data from XML binhex to the buffer -var - BufData: string; -begin - BufData := RemoveControlChars(FValue); - case BinaryEncoding of - xbeBinHex: - DecodeBinHexBuf(BufData, Buffer, Count); - xbeBase64: - DecodeBase64Buf(BufData, Buffer, Count); - end; -end; - -procedure TXmlNode.BufferWrite(const Buffer{$IFDEF CLR}: TBytes{$ENDIF}; Count: Integer); -// Write data from the buffer to XML in binhex format -var - BufData: string; -begin - if Count > 0 then - case BinaryEncoding of - xbeBinHex: - BufData := EncodeBinHexBuf(Buffer, Count); - xbeBase64: - BufData := EncodeBase64Buf(Buffer, Count); - end; - - // For comformity with Base64, we must add linebreaks each 76 characters - FValue := AddControlChars(BufData, GetLineFeed + GetIndent, 76); -end; - -procedure TXmlNode.ChangeDocument(ADocument: TNativeXml); -var - i: integer; -begin - FDocument := ADocument; - for i := 0 to NodeCount - 1 do - Nodes[i].ChangeDocument(ADocument); -end; - -procedure TXmlNode.CheckCreateAttributesList; -begin - if not assigned(FAttributes) then - begin - FAttributes := TStringList.Create; - if assigned(FDocument) then - FAttributes.Sorted := FDocument.SortAttributes; - end; -end; - -procedure TXmlNode.Clear; -begin - // Name + value - FName := ''; - FValue := ''; - // Clear attributes and nodes - AttributesClear; - NodesClear; -end; - -function TXmlNode.CompareNodeName(const NodeName: string): integer; -begin - // Compare with FullPath or local name based on NodeName's first character - if length(NodeName) > 0 then - if NodeName[1] = '/' then - begin - // FullPath - Result := AnsiCompareText(FullPath, NodeName); - exit; - end; - // local name - Result := AnsiCompareText(Name, NodeName); -end; - -constructor TXmlNode.Create(ADocument: TNativeXml); -begin - inherited Create; - FDocument := ADocument; -end; - -constructor TXmlNode.CreateName(ADocument: TNativeXml; - const AName: string); -begin - Create(ADocument); - Name := AName; -end; - -constructor TXmlNode.CreateNameValue(ADocument: TNativeXml; const AName, - AValue: string); -begin - Create(ADocument); - Name := AName; - ValueAsString := AValue; -end; - -constructor TXmlNode.CreateType(ADocument: TNativeXml; - AType: TXmlElementType); -begin - Create(ADocument); - FElementType := AType; -end; - -procedure TXmlNode.Delete; -begin - if assigned(Parent) then - Parent.NodeRemove(Self); -end; - -procedure TXmlNode.DeleteEmptyAttributes; -var - i: integer; - V: string; -begin - for i := AttributeCount - 1 downto 0 do - begin - V := AttributeValue[i]; - if length(V) = 0 then - FAttributes.Delete(i); - end; -end; - -procedure TXmlNode.DeleteEmptyNodes; -var - i: integer; - Node: TXmlNode; -begin - for i := NodeCount - 1 downto 0 do - begin - Node := Nodes[i]; - // Recursive call - Node.DeleteEmptyNodes; - // Check if we should delete child node - if Node.IsEmpty then - NodeDelete(i); - end; -end; - -destructor TXmlNode.Destroy; -begin - NodesClear; - AttributesClear; - inherited; -end; - -function TXmlNode.FindNode(const NodeName: string): TXmlNode; -// Find the first node which has name NodeName. Contrary to the NodeByName -// function, this function will search the whole subnode tree, using the -// DepthFirst method. -var - i: integer; -begin - Result := nil; - // Loop through all subnodes - for i := 0 to NodeCount - 1 do - begin - Result := Nodes[i]; - // If the subnode has name NodeName then we have a result, exit - if Result.CompareNodeName(NodeName) = 0 then - exit; - // If not, we will search the subtree of this node - Result := Result.FindNode(NodeName); - if assigned(Result) then - exit; - end; -end; - -procedure TXmlNode.FindNodes(const NodeName: string; const AList: TList); - // local - procedure FindNodesRecursive(ANode: TXmlNode; AList: TList); - var - i: integer; - begin - with ANode do - for i := 0 to NodeCount - 1 do - begin - if Nodes[i].CompareNodeName(NodeName) = 0 then - AList.Add(Nodes[i]); - FindNodesRecursive(Nodes[i], AList); - end; - end; -// main -begin - AList.Clear; - FindNodesRecursive(Self, AList); -end; - -function TXmlNode.FloatAllowScientific: boolean; -begin - if assigned(Document) then - Result := Document.FloatAllowScientific - else - Result := cDefaultFloatAllowScientific; -end; - -function TXmlNode.FloatSignificantDigits: integer; -begin - if assigned(Document) then - Result := Document.FloatSignificantDigits - else - Result := cDefaultFloatSignificantDigits; -end; - -function TXmlNode.FromAnsiString(const s: string): string; -begin - if Utf8Encoded then - Result := sdAnsiToUtf8(s) - else - Result := s; -end; - -function TXmlNode.FromWidestring(const W: widestring): string; -begin - if Utf8Encoded then - Result := sdUnicodeToUtf8(W) - else - Result := W; -end; - -function TXmlNode.GetAttributeByName(const AName: string): string; -begin - if assigned(FAttributes) then - Result := UnEscapeString(UnQuoteString(FAttributes.Values[AName])) - else - Result := ''; -end; - -function TXmlNode.GetAttributeByNameWide(const AName: string): widestring; -begin - Result := ToWidestring(GetAttributeByName(AName)); -end; - -function TXmlNode.GetAttributeCount: integer; -begin - if assigned(FAttributes) then - Result := FAttributes.Count - else - Result := 0; -end; - -function TXmlNode.GetAttributeName(Index: integer): string; -begin - if (Index >= 0) and (Index < AttributeCount) then - Result := FAttributes.Names[Index]; -end; - -function TXmlNode.GetAttributePair(Index: integer): string; -begin - if (Index >= 0) and (Index < AttributeCount) then - Result := FAttributes[Index]; -end; - -function TXmlNode.GetAttributeValue(Index: integer): string; -var - P: integer; - S: string; -begin - Result := ''; - if (Index >= 0) and (Index < AttributeCount) then - begin - S := FAttributes[Index]; - P := AnsiPos('=', S); - if P > 0 then - Result := UnEscapeString(UnQuoteString(Copy(S, P + 1, MaxInt))); - end; -end; - -function TXmlNode.GetAttributeValueAsInteger(Index: integer): integer; -begin - Result := StrToIntDef(GetAttributeValue(Index), 0); -end; - -function TXmlNode.GetAttributeValueAsWidestring(Index: integer): widestring; -begin - Result := ToWidestring(GetAttributeValue(Index)); -end; - -function TXmlNode.GetAttributeValueDirect(Index: integer): string; -var - P: integer; - S: string; -begin - Result := ''; - if (Index >= 0) and (Index < AttributeCount) then - begin - S := FAttributes[Index]; - P := AnsiPos('=', S); - if P > 0 then - Result := UnQuoteString(Copy(S, P + 1, MaxInt)); - end; -end; - -function TXmlNode.GetBinaryEncoding: TBinaryEncodingType; -begin - Result := xbeBinHex; - if assigned(Document) then - Result := Document.BinaryEncoding; -end; - -function TXmlNode.GetBinaryString: string; -// Get the binary contents of this node as Base64 and return it as a string -var - OldEncoding: TBinaryEncodingType; -{$IFDEF CLR} - Buffer: TBytes; -{$ENDIF} -begin - // Set to base64 - OldEncoding := BinaryEncoding; - try - BinaryEncoding := xbeBase64; - {$IFDEF CLR} - SetLength(Buffer, BufferLength); - if length(Buffer) > 0 then - BufferRead(Buffer, length(Buffer)); - Result := Buffer; - {$ELSE} - SetLength(Result, BufferLength); - if length(Result) > 0 then - BufferRead(Result[1], length(Result)); - {$ENDIF} - finally - BinaryEncoding := OldEncoding; - end; -end; - -function TXmlNode.GetCascadedName: string; -// Return the name+index and all predecessors with underscores to separate, in -// order to get a unique reference that can be used in filenames -var - LName: string; -begin - LName := Format('%s%.4d', [Name, StrToIntDef(AttributeByName['Index'], 0)]); - if assigned(Parent) then - Result := Format('%s_%s', [Parent.CascadedName, LName]) - else - Result := LName; -end; - -function TXmlNode.GetFullPath: string; -// GetFullpath will return the complete path of the node from the root, e.g. -// /Root/SubNode1/SubNode2/ThisNode -begin - Result := '/' + Name; - if Treedepth > 0 then - // Recursive call - Result := Parent.GetFullPath + Result; -end; - -function TXmlNode.GetIndent: string; -var - i: integer; -begin - if assigned(Document) then - begin - case Document.XmlFormat of - xfCompact: Result := ''; - xfReadable: - for i := 0 to TreeDepth - 1 do - Result := Result + Document.IndentString; - end; //case - end else - Result := '' -end; - -function TXmlNode.GetLineFeed: string; -begin - if assigned(Document) then - begin - case Document.XmlFormat of - xfCompact: Result := ''; - xfReadable: Result := #13#10; - else - Result := #10; - end; //case - end else - Result := ''; -end; - -function TXmlNode.GetNodeCount: integer; -begin - if Assigned(FNodes) then - Result := FNodes.Count - else - Result := 0; -end; - -function TXmlNode.GetNodes(Index: integer): TXmlNode; -begin - if (Index >= 0) and (Index < NodeCount) then - Result := TXmlNode(FNodes[Index]) - else - Result := nil; -end; - -function TXmlNode.GetTotalNodeCount: integer; -var - i: integer; -begin - Result := NodeCount; - for i := 0 to NodeCount - 1 do - inc(Result, Nodes[i].TotalNodeCount); -end; - -function TXmlNode.GetTreeDepth: integer; -begin - Result := -1; - if assigned(Parent) then - Result := Parent.TreeDepth + 1; -end; - -function TXmlNode.GetValueAsBool: boolean; -begin - Result := sdStringToBool(FValue); -end; - -function TXmlNode.GetValueAsDateTime: TDateTime; -begin - Result := sdDateTimeFromString(ValueAsString); -end; - -function TXmlNode.GetValueAsFloat: double; -var - Code: integer; -begin - val(StringReplace(FValue, ',', '.', []), Result, Code); - if Code > 0 then - raise Exception.Create(sxeCannotConvertToFloat); -end; - -function TXmlNode.GetValueAsInt64: int64; -begin - Result := StrToInt64(FValue); -end; - -function TXmlNode.GetValueAsInteger: integer; -begin - Result := StrToInt(FValue); -end; - -function TXmlNode.GetValueAsString: string; -begin - Result := UnEscapeString(FValue); -end; - -function TXmlNode.GetValueAsWidestring: widestring; -begin - Result := ToWidestring(ValueAsString); -end; - -function TXmlNode.GetWriteOnDefault: boolean; -begin - Result := True; - if assigned(Document) then - Result := Document.WriteOnDefault; -end; - -function TXmlNode.HasAttribute(const AName: string): boolean; -var - i: integer; -begin - Result := False; - for i := 0 to AttributeCount - 1 do - if AnsiCompareText(AName, AttributeName[i]) = 0 then - begin - Result := True; - exit; - end; -end; - -function TXmlNode.IndexInParent: integer; -// Retrieve our index in the parent's nodelist -var - i: integer; -begin - Result := -1; - if assigned(Parent) then - for i := 0 to Parent.NodeCount - 1 do - if Self = Parent.Nodes[i] then - begin - Result := i; - exit; - end; -end; - -function TXmlNode.IsClear: boolean; -begin - Result := (Length(FName) = 0) and IsEmpty; -end; - -function TXmlNode.IsEmpty: boolean; -begin - Result := (Length(FValue) = 0) and (NodeCount = 0) and (AttributeCount = 0); -end; - -function TXmlNode.IsEqualTo(ANode: TXmlNode; Options: TXmlCompareOptions; - MismatchNodes: TList): boolean; -var - i, Index: integer; - NodeResult, ChildResult: boolean; -begin - // Start with a negative result - Result := False; - NodeResult := False; - if not assigned(ANode) then - exit; - - // Assume childs equals other node's childs - ChildResult := True; - - // child node names and values - this comes first to assure the lists are filled - if (xcChildNames in Options) or (xcChildValues in Options) or (xcRecursive in Options) then - for i := 0 to NodeCount - 1 do - begin - // Do child name check - Index := ANode.NodeIndexByName(Nodes[i].Name); - // Do we have the childnode in the other? - if Index < 0 then - begin - // No we dont have it - if xcChildNames in Options then - begin - if assigned(MismatchNodes) then MismatchNodes.Add(Nodes[i]); - ChildResult := False; - end; - end else - begin - // Do child value check - if xcChildValues in Options then - if AnsiCompareText(Nodes[i].ValueAsString, ANode.Nodes[Index].ValueAsString) <> 0 then - begin - if assigned(MismatchNodes) then - MismatchNodes.Add(Nodes[i]); - ChildResult := False; - end; - // Do recursive check - if xcRecursive in Options then - if not Nodes[i].IsEqualTo(ANode.Nodes[Index], Options, MismatchNodes) then - ChildResult := False; - end; - end; - - try - // We assume there are differences - NodeResult := False; - - // Node name, type and value - if xcNodeName in Options then - if AnsiCompareText(Name, ANode.Name) <> 0 then - exit; - - if xcNodeType in Options then - if ElementType <> ANode.ElementType then - exit; - - if xcNodeValue in Options then - if AnsiCompareText(ValueAsString, ANode.ValueAsString) <> 0 then - exit; - - // attribute count - if xcAttribCount in Options then - if AttributeCount <> ANode.AttributeCount then - exit; - - // attribute names and values - if (xcAttribNames in Options) or (xcAttribValues in Options) then - for i := 0 to AttributeCount - 1 do - begin - Index := ANode.AttributeIndexByName(AttributeName[i]); - if Index < 0 then - if xcAttribNames in Options then - exit - else - continue; - if xcAttribValues in Options then - if AnsiCompareText(AttributeValue[i], ANode.AttributeValue[Index]) <> 0 then - exit; - end; - - // child node count - if xcChildCount in Options then - if NodeCount <> ANode.NodeCount then - exit; - - // If we arrive here, it means no differences were found, return True - NodeResult := True; - - finally - - Result := ChildResult and NodeResult; - if (not NodeResult) and assigned(MismatchNodes) then - MismatchNodes.Insert(0, Self); - - end; -end; - -function TXmlNode.NodeAdd(ANode: TXmlNode): integer; -begin - if assigned(ANode) then - begin - ANode.Parent := Self; - ANode.ChangeDocument(Document); - if not assigned(FNodes) then - FNodes := TList.Create; - Result := FNodes.Add(ANode); - end else - Result := -1; -end; - -function TXmlNode.NodeByAttributeValue(const NodeName, AttribName, AttribValue: string; - ShouldRecurse: boolean): TXmlNode; -// This function returns a pointer to the first subnode that has an attribute with -// name AttribName and value AttribValue. -var - i: integer; - Node: TXmlNode; -begin - Result := nil; - // Find all nodes that are potential results - for i := 0 to NodeCount - 1 do - begin - Node := Nodes[i]; - if (AnsiCompareText(Node.Name, NodeName) = 0) and - Node.HasAttribute(AttribName) and - (AnsiCompareText(Node.AttributeByName[AttribName], AttribValue) = 0) then - begin - Result := Node; - exit; - end; - // Recursive call - if ShouldRecurse then - Result := Node.NodeByAttributeValue(NodeName, AttribName, AttribValue, True); - if assigned(Result) then - exit; - end; -end; - -function TXmlNode.NodeByElementType(ElementType: TXmlElementType): TXmlNode; -var - i: integer; -begin - Result := nil; - for i := 0 to NodeCount - 1 do - if Nodes[i].ElementType = ElementType then - begin - Result := Nodes[i]; - exit; - end; -end; - -function TXmlNode.NodeByName(const AName: string): TXmlNode; -var - i: integer; -begin - Result := nil; - for i := 0 to NodeCount - 1 do - if AnsiCompareText(Nodes[i].Name, AName) = 0 then - begin - Result := Nodes[i]; - exit; - end; -end; - -procedure TXmlNode.NodeDelete(Index: integer); -begin - if (Index >= 0) and (Index < NodeCount) then - begin - TXmlNode(FNodes[Index]).Free; - FNodes.Delete(Index); - end; -end; - -procedure TXmlNode.NodeExchange(Index1, Index2: integer); -begin - if (Index1 >= 0) and (Index1 < Nodecount) and - (Index2 >= 0) and (Index2 < Nodecount) then - FNodes.Exchange(Index1, Index2); -end; - -function TXmlNode.NodeExtract(ANode: TXmlNode): TXmlNode; -var - Index: integer; -begin - // Compatibility with Delphi4 - Result := nil; - if assigned(FNodes) then - begin - Index := FNodes.IndexOf(ANode); - if Index >= 0 then begin - Result := ANode; - FNodes.Delete(Index); - end; - end; -end; - -function TXmlNode.NodeFindOrCreate(const AName: string): TXmlNode; -// Find the node with AName, and if not found, add new one -begin - Result := NodeByName(AName); - if not assigned(Result) then - Result := NodeNew(AName); -end; - -function TXmlNode.NodeIndexByName(const AName: string): integer; -begin - Result := 0; - while Result < NodeCount do - begin - if AnsiCompareText(Nodes[Result].Name, AName) = 0 then - exit; - inc(Result); - end; - if Result = NodeCount then - Result := -1; -end; - -function TXmlNode.NodeIndexByNameFrom(const AName: string; AFrom: integer): integer; -begin - Result := AFrom; - while Result < NodeCount do - begin - if AnsiCompareText(Nodes[Result].Name, AName) = 0 then - exit; - inc(Result); - end; - if Result = NodeCount then - Result := -1; -end; - -function TXmlNode.NodeIndexOf(ANode: TXmlNode): integer; -begin - if assigned(ANode) and assigned(FNodes) then - Result := FNodes.IndexOf(ANode) - else - Result := -1; -end; - -procedure TXmlNode.NodeInsert(Index: integer; ANode: TXmlNode); -// Insert the node ANode at location Index in the list. -begin - if not assigned(ANode) then - exit; - if (Index >=0) and (Index <= NodeCount) then - begin - if not assigned(FNodes) then - FNodes := TList.Create; - ANode.Parent := Self; - FNodes.Insert(Index, ANode); - end; -end; - -function TXmlNode.NodeNew(const AName: string): TXmlNode; -// Add a new child node and return its pointer -begin - Result := Nodes[NodeAdd(TXmlNode.CreateName(Document, AName))]; -end; - -function TXmlNode.NodeNewAtIndex(Index: integer; const AName: string): TXmlNode; -// Create a new node with AName, and insert it into the subnode list at location -// Index, and return a pointer to it. -begin - if (Index >= 0) and (Index <= NodeCount) then - begin - Result := TXmlNode.CreateName(Document, AName); - NodeInsert(Index, Result); - end else - Result := nil; -end; - -function TXmlNode.NodeRemove(ANode: TxmlNode): integer; -begin - Result := NodeIndexOf(ANode); - if Result >= 0 then - NodeDelete(Result); -end; - -procedure TXmlNode.NodesByName(const AName: string; const AList: TList); -// Fill AList with nodes that have name AName -var - i: integer; -begin - if not assigned(AList) then - exit; - AList.Clear; - for i := 0 to NodeCount - 1 do - if AnsiCompareText(Nodes[i].Name, AName) = 0 then - AList.Add(Nodes[i]); -end; - -procedure TXmlNode.NodesClear; -var - i: integer; -begin - for i := 0 to NodeCount - 1 do - TXmlNode(FNodes[i]).Free; - FreeAndNil(FNodes); -end; - -procedure TXmlNode.ParseTag(const AValue: string; TagStart, TagClose: integer); -var - LItems: TStringList; -begin - // Create a list to hold string items - LItems := TStringList.Create; - try - ParseAttributes(AValue, TagStart, TagClose, LItems); - - // Determine name, attributes or value for each element type - case ElementType of - xeDeclaration: - FName := 'xml'; - xeStyleSheet: - begin - FName := 'xml-stylesheet'; - // We also set this as the value for use in "StyleSheetString" - ValueDirect := trim(copy(AValue, TagStart, TagClose - TagStart)); - end; - else - // First item is the name - is it there? - if LItems.Count = 0 then - raise EFilerError.Create(sxeMissingElementName); - - // Set the name - using the element instead of property for speed - FName := LItems[0]; - LItems.Delete(0); - end;//case - - // Any attributes? - if LItems.Count > 0 then - begin - CheckCreateAttributesList; - FAttributes.Assign(LItems); - end; - - finally - LItems.Free; - end; -end; - -function TXmlNode.QualifyAsDirectNode: boolean; -// If this node qualifies as a direct node when writing, we return True. -// A direct node may have attributes, but no value or subnodes. Furhtermore, -// the root node will never be displayed as a direct node. -begin - Result := - (Length(FValue) = 0) and - (NodeCount = 0) and - (ElementType = xeNormal) and - not UseFullNodes and - (TreeDepth > 0); -end; - -function TXmlNode.ReadAttributeBool(const AName: string; ADefault: boolean): boolean; -var - V: string; -begin - V := AttributeByName[AName]; - try - Result := sdStringToBool(V); - except - Result := ADefault; - end; -end; - -function TXmlNode.ReadAttributeDateTime(const AName: string; - ADefault: TDateTime): TDateTime; -var - V: string; -begin - V := AttributeByName[AName]; - try - Result := sdDateTimeFromStringDefault(V, ADefault); - except - Result := ADefault; - end; -end; - -function TXmlNode.ReadAttributeFloat(const AName: string; ADefault: double): double; -var - V: string; - Code: integer; -begin - V := AttributeByName[AName]; - val(StringReplace(V, ',', '.', []), Result, Code); - if Code > 0 then - Result := ADefault; -end; - -function TXmlNode.ReadAttributeInteger(const AName: string; ADefault: integer): integer; -begin - Result := StrToIntDef(AttributeByName[AName], ADefault); -end; - -function TXmlNode.ReadAttributeInt64(const AName: string; ADefault: int64): int64; -begin - Result := StrToInt64Def(AttributeByName[AName], ADefault); -end; - -function TXmlNode.ReadAttributeString(const AName: string; const ADefault: string): string; -begin - Result := AttributeByName[AName]; - if length(Result) = 0 then - Result := ADefault; -end; - -function TXmlNode.ReadBool(const AName: string; ADefault: boolean): boolean; -var - Index: integer; -begin - Result := ADefault; - Index := NodeIndexByName(AName); - if Index >= 0 then - Result := Nodes[Index].ValueAsBoolDef(ADefault); -end; - -{$IFDEF USEGRAPHICS} -procedure TXmlNode.ReadBrush(const AName: string; ABrush: TBrush); -var - Child: TXmlNode; -begin - Child := NodeByName(AName); - if assigned(Child) then with Child do - begin - // Read values - ABrush.Color := ReadColor('Color', clWhite); - ABrush.Style := TBrushStyle(ReadInteger('Style', integer(bsSolid))); - end else - begin - // Defaults - ABrush.Bitmap := nil; - ABrush.Color := clWhite; - ABrush.Style := bsSolid; - end; -end; - -function TXmlNode.ReadColor(const AName: string; ADefault: TColor): TColor; -var - Index: integer; -begin - Result := ADefault; - Index := NodeIndexByName(AName); - if Index >= 0 then - Result := StrToInt(Nodes[Index].ValueAsString); -end; -{$ENDIF} - -function TXmlNode.ReadDateTime(const AName: string; ADefault: TDateTime): TDateTime; -// Date MUST always be written in this format: -// YYYY-MM-DD (if just date) or -// YYYY-MM-DDThh:mm:ss.sssZ (if date and time. The Z stands for universal time -// zone. Since Delphi's TDateTime does not give us a clue about the timezone, -// this is the easiest solution) -// This format SHOULD NOT be changed, to avoid all kinds of -// conversion errors in future. -// This format is compatible with the W3C date/time specification as found here: -// http://www.w3.org/TR/NOTE-datetime -begin - Result := sdDateTimeFromStringDefault(ReadString(AName, ''), ADefault); -end; - -function TXmlNode.ReadFloat(const AName: string; ADefault: double): double; -var - Index: integer; -begin - Result := ADefault; - Index := NodeIndexByName(AName); - if Index >= 0 then - Result := Nodes[Index].ValueAsFloatDef(ADefault); -end; - -{$IFDEF USEGRAPHICS} -procedure TXmlNode.ReadFont(const AName: string; AFont: TFont); -var - Child: TXmlNode; -begin - Child := NodeByName(AName); - AFont.Style := []; - if assigned(Child) then with Child do - begin - // Read values - AFont.Name := ReadString('Name', 'Arial'); - AFont.Color := ReadColor('Color', clBlack); - AFont.Size := ReadInteger('Size', 14); - if ReadBool('Bold', False) then AFont.Style := AFont.Style + [fsBold]; - if ReadBool('Italic', False) then AFont.Style := AFont.Style + [fsItalic]; - if ReadBool('Underline', False) then AFont.Style := AFont.Style + [fsUnderline]; - if ReadBool('Strikeout', False) then AFont.Style := AFont.Style + [fsStrikeout]; - end else - begin - // Defaults - AFont.Name := 'Arial'; - AFont.Color := clBlack; - AFont.Size := 14; - end; -end; -{$ENDIF} - -procedure TXmlNode.ReadFromStream(S: TStream); -// Read the node from the starting "<" until the closing ">" from the stream in S. -// This procedure also calls OnNodeNew and OnNodeLoaded events -var - Ch: Char; - i: integer; - TagIndex: integer; - V: string; - Len: integer; - Node: TXmlNode; - NodeValue: string; - ValuePos, ValueLen: integer; - ClosePos: integer; - HasCR: boolean; - HasSubtags: boolean; - Words: TStringList; - IsDirect: boolean; - Reader: TsdSurplusReader; - // local - procedure AddCharDataNode; - var - V: string; - Node: TXmlNode; - begin - // Add all text up till now as xeCharData - if ValuePos > 0 then - begin - V := copy(NodeValue, 1, ValuePos); - if length(trim(V)) > 0 then - begin - Node := TXmlNode.CreateType(Document, xeCharData); - Node.ValueDirect := V; - NodeAdd(Node); - end; - ValuePos := 0; - end; - end; -// Main -begin - // Check if we aborted parsing - if AbortParsing then - exit; - // Clear this node first - Clear; - // Initial reserve textual value: just 80 characters which is OK for most short values - ValuePos := 0; - ValueLen := 80; - SetLength(NodeValue, ValueLen); - HasCR := False; - HasSubTags := False; - Reader := TsdSurplusReader.Create(S); - try - // Trailing blanks/controls chars? - if not Reader.ReadCharSkipBlanks(Ch) then - exit; - - // What is it? - if Ch = '<' then - begin - // A tag - which one? - TagIndex := ReadOpenTag(Reader); - if TagIndex >= 0 then - begin - try - ElementType := cTags[TagIndex].FStyle; - case ElementType of - xeNormal, xeDeclaration, xeStyleSheet: - begin - // These tags we will process - ReadStringFromStreamUntil(Reader, cTags[TagIndex].FClose, V, True); - Len := length(V); - - // Is it a direct tag? - IsDirect := False; - if (ElementType = xeNormal) and (Len > 0) then - if V[Len] = '/' then - begin - dec(Len); - IsDirect := True; - end; - ParseTag(V, 1, Len + 1); - - // Here we know our name so good place to call OnNodeNew event - if assigned(Document) then - begin - Document.DoNodeNew(Self); - if AbortParsing then - exit; - end; - - // Now the tag can be a direct close - in that case we're finished - if IsDirect or (ElementType in [xeDeclaration, xeStyleSheet]) then - exit; - - // Process rest of tag - repeat - - // Read character from stream - if S.Read(Ch, 1) <> 1 then - raise EFilerError.CreateFmt(sxeMissingCloseTag, [Name]); - - // Is there a subtag? - if Ch = '<' then - begin - if not Reader.ReadCharSkipBlanks(Ch) then - raise EFilerError.CreateFmt(sxeMissingDataAfterGreaterThan, [Name]); - if Ch = '/' then - begin - - // This seems our closing tag - if not ReadStringFromStreamUntil(Reader, '>', V, True) then - raise EFilerError.CreateFmt(sxeMissingLessThanInCloseTag, [Name]); - if AnsiCompareText(trim(V), Name) <> 0 then - raise EFilerError.CreateFmt(sxeIncorrectCloseTag, [Name]); - V := ''; - break; - - end else - begin - - // Add all text up till now as xeCharData - AddCharDataNode; - - // Reset the HasCR flag if we add node, we only want to detect - // the CR after last subnode - HasCR := False; - - // This is a subtag... so create it and let it process - HasSubTags := True; - S.Seek(-2, soCurrent); - Node := TXmlNode.Create(Document); - NodeAdd(Node); - Node.ReadFromStream(S); - - // Check for dropping comments - if assigned(Document) and Document.DropCommentsOnParse and - (Node.ElementType = xeComment) then - NodeDelete(NodeIndexOf(Node)); - - end; - end else - begin - - // If we detect a CR we will set the flag. This will signal the fact - // that this XML file was saved with xfReadable - if Ch = #13 then - HasCR := True; - - // Add the character to the node value buffer. - inc(ValuePos); - if ValuePos > ValueLen then - begin - inc(ValueLen, cNodeValueBuf); - SetLength(NodeValue, ValueLen); - end; - NodeValue[ValuePos] := Ch; - - end; - until False or AbortParsing; - - // Add all text up till now as xeText - AddCharDataNode; - - // Check CharData nodes, remove trailing CRLF + indentation if we - // were in xfReadable mode - if HasSubtags and HasCR then - begin - for i := 0 to NodeCount - 1 do - if Nodes[i].ElementType = xeCharData then - begin - ClosePos := length(Nodes[i].FValue); - while (ClosePos > 0) and (Nodes[i].FValue[ClosePos] in [#10, #13, ' ']) do - dec(ClosePos); - Nodes[i].FValue := copy(Nodes[i].FValue, 1, ClosePos); - end; - end; - - // If the first node is xeCharData we use it as ValueDirect - if NodeCount > 0 then - if Nodes[0].ElementType = xeCharData then - begin - ValueDirect := Nodes[0].ValueDirect; - NodeDelete(0); - end; - - end; - xeDocType: - begin - Name := 'DTD'; - if assigned(Document) then - begin - Document.DoNodeNew(Self); - if AbortParsing then - exit; - end; - // Parse DTD - if assigned(Document) then - Document.ParseDTD(Self, S); - end; - xeElement, xeAttList, xeEntity, xeNotation: - begin - // DTD elements - ReadStringFromStreamWithQuotes(S, cTags[TagIndex].FClose, V); - Len := length(V); - Words := TStringList.Create; - try - ParseAttributes(V, 1, Len + 1, Words); - if Words.Count > 0 then - begin - Name := Words[0]; - Words.Delete(0); - end; - ValueDirect := trim(Words.Text); - finally - Words.Free; - end; - if assigned(Document) then - begin - Document.DoNodeNew(Self); - if AbortParsing then - exit; - end; - end; - else - case ElementType of - xeComment: Name := 'Comment'; - xeCData: Name := 'CData'; - xeExclam: Name := 'Special'; - xeQuestion: Name := 'Special'; - else - Name := 'Unknown'; - end; //case - - // Here we know our name so good place to call OnNodeNew - if assigned(Document) then - begin - Document.DoNodeNew(Self); - if AbortParsing then - exit; - end; - - // In these cases just get all data up till the closing tag - ReadStringFromStreamUntil(Reader, cTags[TagIndex].FClose, V, False); - ValueDirect := V; - end;//case - finally - // Call the OnNodeLoaded and OnProgress events - if assigned(Document) and not AbortParsing then - begin - Document.DoProgress(S.Position); - Document.DoNodeLoaded(Self); - end; - end; - end; - end; - finally - Reader.Free; - end; -end; - -procedure TXmlNode.ReadFromString(const AValue: string); -var - S: TStream; -begin - S := TsdStringStream.Create(AValue); - try - ReadFromStream(S); - finally - S.Free; - end; -end; - -function TXmlNode.ReadInt64(const AName: string; ADefault: int64): int64; -var - Index: integer; -begin - Result := ADefault; - Index := NodeIndexByName(AName); - if Index >= 0 then - Result := Nodes[Index].ValueAsInt64Def(ADefault); -end; - -function TXmlNode.ReadInteger(const AName: string; ADefault: integer): integer; -var - Index: integer; -begin - Result := ADefault; - Index := NodeIndexByName(AName); - if Index >= 0 then - Result := Nodes[Index].ValueAsIntegerDef(ADefault); -end; - -{$IFDEF USEGRAPHICS} -procedure TXmlNode.ReadPen(const AName: string; APen: TPen); -var - Child: TXmlNode; -begin - Child := NodeByName(AName); - if assigned(Child) then with Child do - begin - // Read values - APen.Color := ReadColor('Color', clBlack); - APen.Mode := TPenMode(ReadInteger('Mode', integer(pmCopy))); - APen.Style := TPenStyle(ReadInteger('Style', integer(psSolid))); - APen.Width := ReadInteger('Width', 1); - end else - begin - // Defaults - APen.Color := clBlack; - APen.Mode := pmCopy; - APen.Style := psSolid; - APen.Width := 1; - end; -end; -{$ENDIF} - -function TXmlNode.ReadString(const AName: string; const ADefault: string): string; -var - Index: integer; -begin - Result := ADefault; - Index := NodeIndexByName(AName); - if Index >= 0 then - Result := Nodes[Index].ValueAsString; -end; - -function TXmlNode.ReadWidestring(const AName: string; const ADefault: widestring): widestring; -begin - Result := ToWidestring(ReadString(AName, FromWidestring(ADefault))); -end; - -procedure TXmlNode.ResolveEntityReferences; -// Replace any entity references by the entities, and parse the new content if any - // local - function SplitReference(const AValue: string; var Text1, Text2: string): string; - var - P: integer; - begin - Result := ''; - P := Pos('&', AValue); - Text1 := ''; - Text2 := AValue; - if P = 0 then - exit; - Text1 := copy(AValue, 1, P - 1); - Text2 := copy(AValue, P + 1, length(AValue)); - P := Pos(';', Text2); - if P = 0 then - exit; - Result := copy(Text2, 1, P - 1); - Text2 := copy(Text2, P + 1, length(Text2)); - end; - // local - function ReplaceEntityReferenceByNodes(ARoot: TXmlNode; const AValue: string; var InsertPos: integer; var Text1, Text2: string): boolean; - var - Reference: string; - Entity: string; - Node: TXmlNode; - S: TStream; - begin - Result := False; - Reference := SplitReference(AValue, Text1, Text2); - if (length(Reference) = 0) or not assigned(Document) then - exit; - - // Lookup entity references - Entity := Document.EntityByName[Reference]; - - // Does the entity contain markup? - if (length(Entity) > 0) and (Pos('<', Entity) > 0) then - begin - S := TsdStringStream.Create(Entity); - try - while S.Position < S.Size do - begin - Node := TXmlNode.Create(Document); - Node.ReadFromStream(S); - if Node.IsEmpty then - Node.Free - else - begin - ARoot.NodeInsert(InsertPos, Node); - inc(InsertPos); - Result := True; - end; - end; - finally - S.Free; - end; - end; - end; -// main -var - i: integer; - InsertPos: integer; - Text1, Text2: string; - Node: TXmlNode; - V, Reference, Replace, Entity, First, Last: string; -begin - if length(FValue) > 0 then - begin - // Different behaviour for xeNormal and xeCharData - if ElementType = xeNormal then - begin - InsertPos := 0; - if ReplaceEntityReferenceByNodes(Self, FValue, InsertPos, Text1, Text2) then - begin - FValue := Text1; - if length(trim(Text2)) > 0 then - begin - Node := TXmlNode.CreateType(Document, xeCharData); - Node.ValueDirect := Text2; - NodeInsert(InsertPos, Node); - end; - end; - end else if (ElementType = xeCharData) and assigned(Parent) then - begin - InsertPos := Parent.NodeIndexOf(Self); - if ReplaceEntityReferenceByNodes(Parent, FValue, InsertPos, Text1, Text2) then - begin - FValue := Text1; - if length(trim(FValue)) = 0 then - FValue := ''; - if length(trim(Text2)) > 0 then - begin - Node := TXmlNode.CreateType(Document, xeCharData); - Node.ValueDirect := Text2; - Parent.NodeInsert(InsertPos, Node); - end; - end; - end; - end; - - // Do attributes - for i := 0 to AttributeCount - 1 do - begin - Last := AttributeValue[i]; - V := ''; - repeat - Reference := SplitReference(Last, First, Last); - Replace := ''; - if length(Reference) > 0 then - begin - Entity := Document.EntityByName[Reference]; - if length(Entity) > 0 then - Replace := Entity - else - Replace := '&' + Reference + ';'; - end; - V := V + First + Replace; - until length(Reference) = 0; - V := V + Last; - AttributeValue[i] := V; - end; - - // Do childnodes too - i := 0; - while i < NodeCount do - begin - Nodes[i].ResolveEntityReferences; - inc(i); - end; - - // Check for empty CharData nodes - for i := NodeCount - 1 downto 0 do - if (Nodes[i].ElementType = xeCharData) and (length(Nodes[i].ValueDirect) = 0) then - NodeDelete(i); -end; - -procedure TXmlNode.SetAttributeByName(const AName, Value: string); -begin - CheckCreateAttributesList; - FAttributes.Values[AName] := QuoteString(EscapeString(Value)); -end; - -procedure TXmlNode.SetAttributeByNameWide(const AName: string; const Value: widestring); -begin - SetAttributeByName(AName, FromWidestring(Value)); -end; - -procedure TXmlNode.SetAttributeName(Index: integer; const Value: string); -var - S: string; - P: integer; -begin - if (Index >= 0) and (Index < AttributeCount) then - begin - S := FAttributes[Index]; - P := AnsiPos('=', S); - if P > 0 then - FAttributes[Index] := Format('%s=%s', [Value, Copy(S, P + 1, MaxInt)]); - end; -end; - -procedure TXmlNode.SetAttributeValue(Index: integer; const Value: string); -begin - if (Index >= 0) and (Index < AttributeCount) then - FAttributes[Index] := Format('%s=%s', [AttributeName[Index], - QuoteString(EscapeString(Value))]); -end; - -procedure TXmlNode.SetAttributeValueAsInteger(Index: integer; const Value: integer); -begin - SetAttributeValue(Index, IntToStr(Value)); -end; - -procedure TXmlNode.SetAttributeValueAsWidestring(Index: integer; - const Value: widestring); -begin - SetAttributeValue(Index, FromWidestring(Value)); -end; - -procedure TXmlNode.SetAttributeValueDirect(Index: integer; - const Value: string); -begin - if (Index >= 0) and (Index < AttributeCount) then - FAttributes[Index] := Format('%s=%s', [AttributeName[Index], - QuoteString(Value)]); -end; - -procedure TXmlNode.SetBinaryEncoding(const Value: TBinaryEncodingType); -begin - if assigned(Document) then - Document.BinaryEncoding := Value; -end; - -procedure TXmlNode.SetBinaryString(const Value: string); -var - OldEncoding: TBinaryEncodingType; -begin - // Set to base64 - OldEncoding := BinaryEncoding; - try - BinaryEncoding := xbeBase64; - if length(Value) = 0 then - begin - ValueAsString := ''; - exit; - end; - // fill the buffer - {$IFDEF CLR} - BufferWrite(BytesOf(Value), length(Value)); - {$ELSE} - BufferWrite(Value[1], length(Value)); - {$ENDIF} - finally - BinaryEncoding := OldEncoding; - end; -end; - -procedure TXmlNode.SetName(const Value: string); -var - i: integer; -begin - if FName <> Value then - begin - // Check if the name abides the rules. We will be very forgiving here and - // just accept any name that at least does not contain control characters - for i := 1 to length(Value) do - if Value[i] in cControlChars then - raise Exception.Create(Format(sxeIllegalCharInNodeName, [Value])); - FName := Value; - end; -end; - -procedure TXmlNode.SetValueAsBool(const Value: boolean); -begin - FValue := sdStringFromBool(Value); -end; - -procedure TXmlNode.SetValueAsDateTime(const Value: TDateTime); -begin - ValueAsString := sdDateTimeToString(Value); -end; - -procedure TXmlNode.SetValueAsFloat(const Value: double); -begin - FValue := sdWriteNumber(Value, FloatSignificantDigits, FloatAllowScientific); -end; - -procedure TXmlNode.SetValueAsInt64(const Value: int64); -begin - FValue := IntToStr(Value); -end; - -procedure TXmlNode.SetValueAsInteger(const Value: integer); -begin - FValue := IntToStr(Value); -end; - -procedure TXmlNode.SetValueAsString(const AValue: string); -begin - FValue := EscapeString(AValue); -end; - -procedure TXmlNode.SetValueAsWidestring(const Value: widestring); -begin - ValueAsString := FromWidestring(Value); -end; - -procedure TXmlNode.SortChildNodes(Compare: TXMLNodeCompareFunction; - Info: TPointer); -// Sort the child nodes using the quicksort algorithm - //local - function DoNodeCompare(Node1, Node2: TXmlNode): integer; - begin - if assigned(Compare) then - Result := Compare(Node1, Node2, Info) - else - if assigned(Document) and assigned(Document.OnNodeCompare) then - Result := Document.OnNodeCompare(Document, Node1, Node2, Info) - else - Result := AnsiCompareText(Node1.Name, Node2.Name); - end; - // local - procedure QuickSort(iLo, iHi: Integer); - var - Lo, Hi, Mid: longint; - begin - Lo := iLo; - Hi := iHi; - Mid:= (Lo + Hi) div 2; - repeat - while DoNodeCompare(Nodes[Lo], Nodes[Mid]) < 0 do - Inc(Lo); - while DoNodeCompare(Nodes[Hi], Nodes[Mid]) > 0 do - Dec(Hi); - if Lo <= Hi then - begin - // Swap pointers; - NodeExchange(Lo, Hi); - if Mid = Lo then - Mid := Hi - else - if Mid = Hi then - Mid := Lo; - Inc(Lo); - Dec(Hi); - end; - until Lo > Hi; - if Hi > iLo then QuickSort(iLo, Hi); - if Lo < iHi then QuickSort(Lo, iHi); - end; -// main -begin - if NodeCount > 1 then - QuickSort(0, NodeCount - 1); -end; - -function TXmlNode.ToAnsiString(const s: string): string; -begin - if Utf8Encoded then - Result := sdUtf8ToAnsi(s) - else - Result := s; -end; - -function TXmlNode.ToWidestring(const s: string): widestring; -begin - if Utf8Encoded then - Result := sdUtf8ToUnicode(s) - else - Result := s; -end; - -function TXmlNode.UnescapeString(const AValue: string): string; -begin - if Utf8Encoded then - Result := UnescapeStringUTF8(AValue) - else - Result := UnescapeStringAnsi(AValue); -end; - -function TXmlNode.UseFullNodes: boolean; -begin - Result := False; - if assigned(Document) then - Result := Document.UseFullNodes; -end; - -function TXmlNode.Utf8Encoded: boolean; -begin - Result := False; - if assigned(Document) then - Result := Document.Utf8Encoded; -end; - -function TXmlNode.ValueAsBoolDef(ADefault: boolean): boolean; -var - Ch: Char; -begin - Result := ADefault; - if Length(FValue) = 0 then - exit; - Ch := UpCase(FValue[1]); - if Ch in ['T', 'Y'] then - begin - Result := True; - exit; - end; - if Ch in ['F', 'N'] then - begin - Result := False; - exit; - end; -end; - -function TXmlNode.ValueAsDateTimeDef(ADefault: TDateTime): TDateTime; -begin - Result := sdDateTimeFromStringDefault(ValueAsString, ADefault); -end; - -function TXmlNode.ValueAsFloatDef(ADefault: double): double; -var - Code: integer; -begin - try - val(StringReplace(FValue, ',', '.', []), Result, Code); - if Code > 0 then - Result := ADefault; - except - Result := ADefault; - end; -end; - -function TXmlNode.ValueAsInt64Def(ADefault: int64): int64; -begin - Result := StrToInt64Def(FValue, ADefault); -end; - -function TXmlNode.ValueAsIntegerDef(ADefault: integer): integer; -begin - Result := StrToIntDef(FValue, ADefault); -end; - -procedure TXmlNode.WriteAttributeBool(const AName: string; AValue: boolean; - ADefault: boolean); -var - Index: integer; -begin - if WriteOnDefault or (AValue <> ADefault) then - begin - Index := AttributeIndexByName(AName); - if Index >= 0 then - AttributeValue[Index] := sdStringFromBool(AValue) - else - AttributeAdd(AName, sdStringFromBool(AValue)); - end; -end; - -procedure TXmlNode.WriteAttributeDateTime(const AName: string; AValue, - ADefault: TDateTime); -var - Index: integer; -begin - if WriteOnDefault or (AValue <> ADefault) then - begin - Index := AttributeIndexByName(AName); - if Index >= 0 then - AttributeValue[Index] := sdDateTimeToString(AValue) - else - AttributeAdd(AName, sdDateTimeToString(AValue)); - end; -end; - -procedure TXmlNode.WriteAttributeFloat(const AName: string; AValue, ADefault: double); -var - Index: integer; - S: string; -begin - if WriteOnDefault or (AValue <> ADefault) then - begin - Index := AttributeIndexByName(AName); - S := sdWriteNumber(AValue, FloatSignificantDigits, FloatAllowScientific); - if Index >= 0 then - AttributeValue[Index] := S - else - AttributeAdd(AName, S); - end; -end; - -procedure TXmlNode.WriteAttributeInteger(const AName: string; AValue: integer; ADefault: integer); -var - Index: integer; -begin - if WriteOnDefault or (AValue <> ADefault) then - begin - Index := AttributeIndexByName(AName); - if Index >= 0 then - AttributeValue[Index] := IntToStr(AValue) - else - AttributeAdd(AName, IntToStr(AValue)); - end; -end; - -procedure TXmlNode.WriteAttributeInt64(const AName: string; const AValue: int64; ADefault: int64); -var - Index: integer; -begin - if WriteOnDefault or (AValue <> ADefault) then - begin - Index := AttributeIndexByName(AName); - if Index >= 0 then - AttributeValue[Index] := IntToStr(AValue) - else - AttributeAdd(AName, IntToStr(AValue)); - end; -end; - -procedure TXmlNode.WriteAttributeString(const AName, AValue, ADefault: string); -var - Index: integer; -begin - if WriteOnDefault or (AValue <> ADefault) then - begin - Index := AttributeIndexByName(AName); - if Index >= 0 then - AttributeValue[Index] := AValue - else - AttributeAdd(AName, AValue); - end; -end; - -procedure TXmlNode.WriteBool(const AName: string; AValue: boolean; ADefault: boolean); -const - cBoolValues: array[boolean] of string = ('False', 'True'); -begin - if WriteOnDefault or (AValue <> ADefault) then - with NodeFindOrCreate(AName) do - ValueAsString := cBoolValues[AValue]; -end; - -{$IFDEF USEGRAPHICS} -procedure TXmlNode.WriteBrush(const AName: string; ABrush: TBrush); -begin - with NodeFindOrCreate(AName) do - begin - WriteColor('Color', ABrush.Color, clBlack); - WriteInteger('Style', integer(ABrush.Style), 0); - end; -end; - -procedure TXmlNode.WriteColor(const AName: string; AValue, ADefault: TColor); -begin - if WriteOnDefault or (AValue <> ADefault) then - WriteHex(AName, ColorToRGB(AValue), 8, 0); -end; -{$ENDIF} - -procedure TXmlNode.WriteDateTime(const AName: string; AValue, ADefault: TDateTime); -// Date MUST always be written in this format: -// YYYY-MM-DD (if just date) or -// YYYY-MM-DDThh:mm:ss.sssZ (if date and time. The Z stands for universal time -// zone. Since Delphi's TDateTime does not give us a clue about the timezone, -// this is the easiest solution) -// This format SHOULD NOT be changed, to avoid all kinds of -// conversion errors in future. -// This format is compatible with the W3C date/time specification as found here: -// http://www.w3.org/TR/NOTE-datetime -begin - if WriteOnDefault or (AValue <> ADefault) then - WriteString(AName, sdDateTimeToString(AValue), ''); -end; - -procedure TXmlNode.WriteFloat(const AName: string; AValue: double; ADefault: double); -begin - if WriteOnDefault or (AValue <> ADefault) then - with NodeFindOrCreate(AName) do - ValueAsString := sdWriteNumber(AValue, FloatSignificantDigits, FloatAllowScientific); -end; - -{$IFDEF USEGRAPHICS} -procedure TXmlNode.WriteFont(const AName: string; AFont: TFont); -begin - with NodeFindOrCreate(AName) do - begin - WriteString('Name', AFont.Name, 'Arial'); - WriteColor('Color', AFont.Color, clBlack); - WriteInteger('Size', AFont.Size, 14); - WriteBool('Bold', fsBold in AFont.Style, False); - WriteBool('Italic', fsItalic in AFont.Style, False); - WriteBool('Underline', fsUnderline in AFont.Style, False); - WriteBool('Strikeout', fsStrikeout in AFont.Style, False); - end; -end; -{$ENDIF} - -procedure TXmlNode.WriteHex(const AName: string; AValue, Digits: integer; ADefault: integer); -begin - if WriteOnDefault or (AValue <> ADefault) then - with NodeFindOrCreate(AName) do - ValueAsString := '$' + IntToHex(AValue, Digits); -end; - -function TXmlNode.WriteInnerTag: string; -// Write the inner part of the tag, the one that contains the attributes -var - i: integer; -begin - Result := ''; - // Attributes - for i := 0 to AttributeCount - 1 do - // Here we used to prevent empty attributes, but in fact, empty attributes - // should be allowed because sometimes they're required - Result := Result + ' ' + AttributePair[i]; - // End of tag - direct nodes get an extra "/" - if QualifyAsDirectNode then - Result := Result + '/'; -end; - -procedure TXmlNode.WriteInt64(const AName: string; AValue, ADefault: int64); -begin - if WriteOnDefault or (AValue <> ADefault) then - with NodeFindOrCreate(AName) do - ValueAsString := IntToStr(AValue); -end; - -procedure TXmlNode.WriteInteger(const AName: string; AValue: integer; ADefault: integer); -begin - if WriteOnDefault or (AValue <> ADefault) then - with NodeFindOrCreate(AName) do - ValueAsString := IntToStr(AValue); -end; - -{$IFDEF USEGRAPHICS} -procedure TXmlNode.WritePen(const AName: string; APen: TPen); -begin - with NodeFindOrCreate(AName) do - begin - WriteColor('Color', APen.Color, clBlack); - WriteInteger('Mode', integer(APen.Mode), 0); - WriteInteger('Style', integer(APen.Style), 0); - WriteInteger('Width', APen.Width, 0); - end; -end; -{$ENDIF} - -procedure TXmlNode.WriteString(const AName, AValue: string; const ADefault: string); -begin - if WriteOnDefault or (AValue <> ADefault) then - with NodeFindOrCreate(AName) do - ValueAsString := AValue; -end; - -procedure TXmlNode.WriteToStream(S: TStream); -var - i: integer; - Indent: string; - LFeed: string; - Line: string; - ThisNode, NextNode: TXmlNode; - AddLineFeed: boolean; -begin - Indent := GetIndent; - LFeed := GetLineFeed; - - // Write indent - Line := Indent; - - // Write the node - distinguish node type - case ElementType of - xeDeclaration: // XML declaration - begin - // Explicitly delete empty attributes in the declaration, - // this is usually the encoding and we do not want encoding="" - // to show up - DeleteEmptyAttributes; - Line := Indent + Format('', [WriteInnerTag]); - end; - xeStylesheet: // Stylesheet - Line := Indent + Format('', [WriteInnerTag]); - xeDoctype: - begin - if NodeCount = 0 then - Line := Indent + Format('', [Name, ValueDirect]) - else - begin - Line := Indent + Format(''; - end; - end; - xeElement: - Line := Indent + Format('', [Name, ValueDirect]); - xeAttList: - Line := Indent + Format('', [Name, ValueDirect]); - xeEntity: - Line := Indent + Format('', [Name, ValueDirect]); - xeNotation: - Line := Indent + Format('', [Name, ValueDirect]); - xeComment: // Comment - Line := Indent + Format('', [ValueDirect]); - xeCData: // literal data - Line := Indent + Format('', [ValueDirect]); - xeExclam: // Any - Line := Indent + Format('', [ValueDirect]); - xeQuestion: // Any - Line := Indent + Format('', [ValueDirect]); - xeCharData: - Line := FValue; - xeUnknown: // Any - Line := Indent + Format('<%s>', [ValueDirect]); - xeNormal: // normal nodes (xeNormal) - begin - // Write tag - Line := Line + Format('<%s%s>', [FName, WriteInnerTag]); - - // Write value (if any) - Line := Line + FValue; - if (NodeCount > 0) then - // ..and a linefeed - Line := Line + LFeed; - - WriteStringToStream(S, Line); - - // Write child elements - for i := 0 to NodeCount - 1 do - begin - ThisNode := Nodes[i]; - NextNode := Nodes[i + 1]; - ThisNode.WriteToStream(S); - AddLineFeed := True; - if ThisNode.ElementType = xeCharData then - AddLineFeed := False; - if assigned(NextNode) then - if NextNode.ElementType = xeCharData then - AddLineFeed := False; - if AddLineFeed then - WriteStringToStream(S, LFeed); - end; - - // Write end tag - Line := ''; - if not QualifyAsDirectNode then - begin - if NodeCount > 0 then - Line := Indent; - Line := Line + Format('', [FName]); - end; - end; - else - raise EFilerError.Create(sxeIllegalElementType); - end;//case - WriteStringToStream(S, Line); - - // Call the onprogress - if assigned(Document) then - Document.DoProgress(S.Position); -end; - -function TXmlNode.WriteToString: string; -var - S: TsdStringStream; -begin - // We will simply call WriteToStream and collect the result as string using - // a string stream - S := TsdStringStream.Create(''); - try - WriteToStream(S); - Result := S.DataString; - finally - S.Free; - end; -end; - -procedure TXmlNode.WriteWidestring(const AName: string; - const AValue: widestring; const ADefault: widestring); -begin - WriteString(AName, FromWidestring(AValue), ADefault); -end; - -{ TXmlNodeList } - -function TXmlNodeList.ByAttribute(const AName, AValue: string): TXmlNode; -var - i: integer; -begin - for i := 0 to Count - 1 do - if AnsiCompareText(Items[i].AttributeByName[AName], AValue) = 0 then - begin - Result := Items[i]; - exit; - end; - Result := nil; -end; - -function TXmlNodeList.GetItems(Index: Integer): TXmlNode; -begin - Result := TXmlNode(Get(Index)); -end; - -procedure TXmlNodeList.SetItems(Index: Integer; const Value: TXmlNode); -begin - Put(Index, TPointer(Value)); -end; - -{ TNativeXml } - -procedure TNativeXml.Assign(Source: TPersistent); - // local - procedure SetDocumentRecursively(ANode: TXmlNode; ADocument: TNativeXml); - var - i: integer; - begin - ANode.Document := ADocument; - for i := 0 to ANode.NodeCount - 1 do - SetDocumentRecursively(ANode.Nodes[i], ADocument); - end; -// main -begin - if Source is TNativeXml then - begin - // Copy private members - FBinaryEncoding := TNativeXml(Source).FBinaryEncoding; - FDropCommentsOnParse := TNativeXml(Source).FDropCommentsOnParse; - FExternalEncoding := TNativeXml(Source).FExternalEncoding; - FParserWarnings := TNativeXml(Source).FParserWarnings; - FIndentString := TNativeXml(Source).FIndentString; - FUseFullNodes := TNativeXml(Source).FUseFullNodes; - FUtf8Encoded := TNativeXml(Source).FUtf8Encoded; - FWriteOnDefault := TNativeXml(Source).FWriteOnDefault; - FXmlFormat := TNativeXml(Source).FXmlFormat; - FSortAttributes := TNativeXml(Source).FSortAttributes; - // Assign root - FRootNodes.Assign(TNativeXml(Source).FRootNodes); - // Set Document property recursively - SetDocumentRecursively(FRootNodes, Self); - end else - if Source is TXmlNode then - begin - // Assign this node to the FRootNodes property - FRootNodes.Assign(Source); - // Set Document property recursively - SetDocumentRecursively(FRootNodes, Self); - end else - inherited; -end; - -procedure TNativeXml.Clear; -var - Node: TXmlNode; -begin - // Reset defaults - SetDefaults; - // Clear root - FRootNodes.Clear; - // Build default items in RootNodes - // - first the declaration - Node := TXmlNode.CreateType(Self, xeDeclaration); - Node.Name := 'xml'; - Node.AttributeAdd('version', cDefaultVersionString); - Node.AttributeAdd('encoding', cDefaultEncodingString); - FRootNodes.NodeAdd(Node); - // - then the root node - FRootNodes.NodeNew(''); -end; - -procedure TNativeXml.CopyFrom(Source: TNativeXml); -begin - if not assigned(Source) then - exit; - Assign(Source); -end; - -constructor TNativeXml.Create; -begin - inherited Create; - FRootNodes := TXmlNode.Create(Self); - Clear; -end; - -constructor TNativeXml.CreateName(const ARootName: string); -begin - Create; - Root.Name := ARootName; -end; - -destructor TNativeXml.Destroy; -begin - FreeAndNil(FRootNodes); - inherited; -end; - -procedure TNativeXml.DoNodeLoaded(Node: TXmlNode); -begin - if assigned(FOnNodeLoaded) then - FOnNodeLoaded(Self, Node); -end; - -procedure TNativeXml.DoNodeNew(Node: TXmlNode); -begin - if assigned(FOnNodeNew) then - FOnNodeNew(Self, Node); -end; - -procedure TNativeXml.DoProgress(Size: integer); -begin - if assigned(FOnProgress) then - FOnProgress(Self, Size); -end; - -procedure TNativeXml.DoUnicodeLoss(Sender: TObject); -begin - if assigned(FOnUnicodeLoss) then - FOnUnicodeLoss(Self); -end; - -function TNativeXml.GetCommentString: string; -// Get the first comment node, and return its value -var - Node: TXmlNode; -begin - Result := ''; - Node := FRootNodes.NodeByElementType(xeComment); - if assigned(Node) then - Result := Node.ValueAsString; -end; - -function TNativeXml.GetEncodingString: string; -begin - Result := ''; - if FRootNodes.NodeCount > 0 then - if FRootNodes[0].ElementType = xeDeclaration then - Result := FRootNodes[0].AttributeByName['encoding']; -end; - -function TNativeXml.GetEntityByName(AName: string): string; -var - i, j: integer; -begin - Result := ''; - for i := 0 to FRootNodes.NodeCount - 1 do - if FRootNodes[i].ElementType = xeDoctype then with FRootNodes[i] do - begin - for j := 0 to NodeCount - 1 do - if (Nodes[j].ElementType = xeEntity) and (Nodes[j].Name = AName) then - begin - Result := UnQuoteString(Trim(Nodes[j].ValueDirect)); - exit; - end; - end; -end; - -function TNativeXml.GetRoot: TXmlNode; -begin - Result := FRootNodes.NodeByElementType(xeNormal); -end; - -function TNativeXml.GetStyleSheetNode: TXmlNode; -begin - Result := FRootNodes.NodeByElementType(xeStylesheet); - if not assigned(Result) then - begin - // Add a stylesheet node as second one if none present - Result := TXmlNode.CreateType(Self, xeStyleSheet); - FRootNodes.NodeInsert(1, Result); - end; -end; - -function TNativeXml.GetVersionString: string; -begin - Result := ''; - if FRootNodes.NodeCount > 0 then - if FRootNodes[0].ElementType = xeDeclaration then - Result := FRootNodes[0].AttributeByName['version']; -end; - -function TNativeXml.IsEmpty: boolean; -var - R: TXmlNode; -begin - Result := True; - R := GetRoot; - if assigned(R) then - Result := R.IsClear; -end; - -function TNativeXml.LineFeed: string; -begin - case XmlFormat of - xfReadable: - Result := #13#10; - xfCompact: - Result := #10; - else - Result := #10; - end;//case -end; - -procedure TNativeXml.LoadFromFile(const FileName: string); -var - S: TStream; -begin - S := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite); - try - LoadFromStream(S); - finally - S.Free; - end; -end; - -procedure TNativeXml.LoadFromStream(Stream: TStream); -var - B: TsdBufferedReadStream; -begin - // Create buffer filter. Since we read from the original stream a buffer at a - // time, this speeds up the reading process for disk-based files. - B := TsdBufferedReadStream.Create(Stream, False); - try - // We will create a conversion stream as intermediate - if Utf8Encoded then - FCodecStream := TsdUtf8Stream.Create(B) - else - FCodecStream := TsdAnsiStream.Create(B); - try - // Connect events - FCodecStream.OnUnicodeLoss := DoUnicodeLoss; - // Read from stream - ReadFromStream(FCodecStream); - // Set our external encoding - FExternalEncoding := FCodecStream.Encoding; - // Set internal encoding - if (ExternalEncoding = seUtf8) or (AnsiCompareText(EncodingString,'UTF-8') = 0) then - FUtf8Encoded := True; - finally - FreeAndNil(FCodecStream); - end; - finally - B.Free; - end; -end; - -procedure TNativeXml.ParseDTD(ANode: TXmlNode; S: TStream); -// DTD parsing is quite different from normal node parsing so it is brought -// under in the main NativeXml object - // local - procedure ParseMarkupDeclarations; - var - Ch: char; - begin - repeat - ANode.NodeNew('').ReadFromStream(S); - // Read character, exit if none available - repeat - if S.Read(Ch, 1) = 0 then - exit; - // Read until end markup declaration or end - until not (Ch in cControlChars); - if Ch = ']' then - break; - S.Seek(-1, soCurrent); - until False; - end; -// main -var - Prework: string; - Ch: char; - Words: TStringList; -begin - // Get the name and external ID - Prework := ''; - repeat - // Read character, exit if none available - if S.Read(Ch, 1) = 0 then - exit; - // Read until markup declaration or end - if Ch in ['[', '>'] then - break; - Prework := Prework + Ch; - until False; - Words := TStringList.Create; - try - ParseAttributes(Prework, 1, length(Prework) + 1, Words); - // First word is name - if Words.Count > 0 then - begin - ANode.Name := Words[0]; - Words.Delete(0); - // Put the rest in the valuedirect - ANode.ValueDirect := Trim(StringReplace(Words.Text, #13#10, ' ', [rfReplaceAll])); - end; - finally - Words.Free; - end; - - if Ch = '[' then - begin - - // Parse any !ENTITY nodes and such - ParseMarkupDeclarations; - - // read final tag - repeat - if S.Read(Ch, 1) = 0 then - exit; - if Ch = '>' then - break; - until False; - - end; -end; - -procedure TNativeXml.ReadFromStream(S: TStream); -var - i: integer; - Node: TXmlNode; - Enc: string; - NormalCount, DeclarationCount, - DoctypeCount, CDataCount: integer; - NormalPos, DoctypePos: integer; -begin - FAbortParsing := False; - with FRootNodes do - begin - // Clear the old root nodes - we do not reset the defaults - Clear; - DoProgress(0); - repeat - Node := NodeNew(''); - Node.ReadFromStream(S); - if AbortParsing then - exit; - - // XML declaration - if Node.ElementType = xeDeclaration then - begin - if Node.HasAttribute('encoding') then - Enc := Node.AttributeByName['encoding']; - // Check encoding - if assigned(FCodecStream) and (Enc = 'UTF-8') then - FCodecStream.Encoding := seUTF8; - end; - // Skip clear nodes - if Node.IsClear then - NodeDelete(NodeCount - 1); - until S.Position >= S.Size; - DoProgress(S.Size); - - // Do some checks - NormalCount := 0; - DeclarationCount := 0; - DoctypeCount := 0; - CDataCount := 0; - NormalPos := -1; - DoctypePos := -1; - for i := 0 to NodeCount - 1 do - begin - // Count normal elements - there may be only one - case Nodes[i].ElementType of - xeNormal: - begin - inc(NormalCount); - NormalPos := i; - end; - xeDeclaration: inc(DeclarationCount); - xeDoctype: - begin - inc(DoctypeCount); - DoctypePos := i; - end; - xeCData: inc(CDataCount); - end;//case - end; - - // We *must* have a root node - if NormalCount = 0 then - raise EFilerError.Create(sxeNoRootElement); - - // Do some validation if we allow parser warnings - if FParserWarnings then - begin - - // Check for more than one root node - if NormalCount > 1 then - raise EFilerError.Create(sxeMoreThanOneRootElement); - - // Check for more than one xml declaration - if DeclarationCount > 1 then - raise EFilerError.Create(sxeMoreThanOneDeclaration); - - // Declaration must be first element if present - if DeclarationCount = 1 then - if Nodes[0].ElementType <> xeDeclaration then - raise EFilerError.Create(sxeDeclarationMustBeFirstElem); - - // Check for more than one DTD - if DoctypeCount > 1 then - raise EFilerError.Create(sxeMoreThanOneDoctype); - - // Check if DTD is after root, this is not allowed - if (DoctypeCount = 1) and (DoctypePos > NormalPos) then - raise EFilerError.Create(sxeDoctypeAfterRootElement); - - // No CDATA in root allowed - if CDataCount > 0 then - raise EFilerError.Create(sxeCDataInRoot); - end; - end;//with -end; - -procedure TNativeXml.ReadFromString(const AValue: string); -var - S: TStream; -begin - S := TsdStringStream.Create(AValue); - try - ReadFromStream(S); - finally - S.Free; - end; -end; - -procedure TNativeXml.ResolveEntityReferences; -begin - if assigned(Root) then - Root.ResolveEntityReferences; -end; - -procedure TNativeXml.SaveToFile(const FileName: string); -var - S: TStream; -begin - S := TFileStream.Create(FileName, fmCreate); - try - SaveToStream(S); - finally - S.Free; - end; -end; - -procedure TNativeXml.SaveToStream(Stream: TStream); -var - B: TsdBufferedWriteStream; -begin - // Create buffer filter. Since we write a buffer at a time to the destination - // stream, this speeds up the writing process for disk-based files. - B := TsdBufferedWriteStream.Create(Stream, False); - try - // Create conversion stream - if Utf8Encoded then - FCodecStream := TsdUtf8Stream.Create(B) - else - FCodecStream := TsdAnsiStream.Create(B); - try - // Set External encoding - FCodecStream.Encoding := FExternalEncoding; - WriteToStream(FCodecStream); - finally - FreeAndNil(FCodecStream); - end; - finally - B.Free; - end; -end; - -procedure TNativeXml.SetCommentString(const Value: string); -// Find first comment node and set it's value, otherwise add new comment node -// right below the xml declaration -var - Node: TXmlNode; -begin - Node := FRootNodes.NodeByElementType(xeComment); - if not assigned(Node) and (length(Value) > 0) then - begin - Node := TXmlNode.CreateType(Self, xeComment); - FRootNodes.NodeInsert(1, Node); - end; - if assigned(Node) then - Node.ValueAsString := Value; -end; - -procedure TNativeXml.SetDefaults; -begin - // Defaults - FExternalEncoding := cDefaultExternalEncoding; - FXmlFormat := cDefaultXmlFormat; - FWriteOnDefault := cDefaultWriteOnDefault; - FBinaryEncoding := cDefaultBinaryEncoding; - FUtf8Encoded := cDefaultUtf8Encoded; - FIndentString := cDefaultIndentString; - FDropCommentsOnParse := cDefaultDropCommentsOnParse; - FUseFullNodes := cDefaultUseFullNodes; - FSortAttributes := cDefaultSortAttributes; - FFloatAllowScientific := cDefaultFloatAllowScientific; - FFloatSignificantDigits := cDefaultFloatSignificantDigits; - FOnNodeNew := nil; - FOnNodeLoaded := nil; -end; - -procedure TNativeXml.SetEncodingString(const Value: string); -var - Node: TXmlNode; -begin - if Value = GetEncodingString then - exit; - Node := FRootNodes[0]; - if not assigned(Node) or (Node.ElementType <> xeDeclaration) then - begin - Node := TXmlNode.CreateType(Self, xeDeclaration); - FRootNodes.NodeInsert(0, Node); - end; - if assigned(Node) then - Node.AttributeByName['encoding'] := Value; -end; - -procedure TNativeXml.SetVersionString(const Value: string); -var - Node: TXmlNode; -begin - if Value = GetVersionString then - exit; - Node := FRootNodes[0]; - if not assigned(Node) or (Node.ElementType <> xeDeclaration) then - begin - if length(Value) > 0 then - begin - Node := TXmlNode.CreateType(Self, xeDeclaration); - FRootNodes.NodeInsert(0, Node); - end; - end; - if assigned(Node) then - Node.AttributeByName['version'] := Value; -end; - -procedure TNativeXml.WriteToStream(S: TStream); -var - i: integer; -begin - if not assigned(Root) and FParserWarnings then - raise EFilerError.Create(sxeRootElementNotDefined); - - DoProgress(0); - - // write the root nodes - for i := 0 to FRootNodes.NodeCount - 1 do - begin - FRootNodes[i].WriteToStream(S); - WriteStringToStream(S, LineFeed); - end; - - DoProgress(S.Size); -end; - -function TNativeXml.WriteToString: string; -var - S: TsdStringStream; -begin - S := TsdStringStream.Create(''); - try - WriteToStream(S); - Result := S.DataString; - finally - S.Free; - end; -end; - -{ TsdCodecStream } - -constructor TsdCodecStream.Create(AStream: TStream); -begin - inherited Create; - FStream := AStream; -end; - -function TsdCodecStream.InternalRead(var Buffer{$IFDEF CLR}: array of Byte{$ENDIF}; Offset, Count: Longint): Longint; -// Read from FStream and pass back data -var - i, j: integer; - BOM: array[0..3] of byte; - BytesRead: integer; - Found: boolean; -begin - Result := 0; - if FMode = umUnknown then - begin - FMode := umRead; - // Check FStream - if not assigned(FStream) then - raise EStreamError.Create(sxeCodecStreamNotAssigned); - - // Determine encoding - FEncoding := se8Bit; - BytesRead := FStream.Read(BOM, 4); - for i := 0 to cBomInfoCount - 1 do - begin - Found := True; - for j := 0 to Min(BytesRead, cBomInfo[i].Len) - 1 do - begin - if BOM[j] <> cBomInfo[i].BOM[j] then - begin - Found := False; - break; - end; - end; - if Found then - break; - end; - if Found then - begin - FEncoding := cBomInfo[i].Enc; - FWriteBom := cBomInfo[i].HasBOM; - end else - begin - // Unknown.. default to this - FEncoding := se8Bit; - FWriteBom := False; - end; - - // Some encodings are not supported (yet) - if FEncoding in [seUCS4BE, seUCS4_2143, seUCS4_3412, seEBCDIC] then - raise EStreamError.Create(sxeUnsupportedEncoding); - - // Correct stream to start position - if FWriteBom then - FStream.Seek(cBomInfo[i].Len - BytesRead, soCurrent) - else - FStream.Seek(-BytesRead, soCurrent); - - // Check if we must swap byte order - if FEncoding in [se16BitBE, seUTF16BE] then - FSwapByteOrder := True; - - end; - - // Check mode - if FMode <> umRead then - raise EStreamError.Create(sxeCannotReadCodecForWriting); - - // Check count - if Count <> 1 then - raise EStreamError.Create(sxeCannotReadMultipeChar); - - // Now finally read - TBytes(Buffer)[Offset] := ReadByte; - if TBytes(Buffer)[Offset] <> 0 then Result := 1; -end; - -{$IFDEF CLR} - -function TsdCodecStream.Read(var Buffer: array of Byte; Offset, Count: Longint): Longint; -begin - Result := InternalRead(Buffer, Offset, Count); -end; - -{$ELSE} - -function TsdCodecStream.Read(var Buffer; Count: Longint): Longint; -begin - Result := InternalRead(Buffer, 0, Count); -end; - -{$ENDIF} - -function TsdCodecStream.ReadByte: byte; -begin - // default does nothing - Result := 0; -end; - -function TsdCodecStream.InternalSeek(Offset: Longint; Origin: TSeekOrigin): Longint; -begin - Result := 0; - if FMode = umUnknown then - raise EStreamError.Create(sxeCannotSeekBeforeReadWrite); - - if Origin = soCurrent then - begin - if Offset = 0 then - begin - // Position - Result := FStream.Position; - exit; - end; - if (FMode = umRead) and ((Offset = -1) or (Offset = -2)) then - begin - FBuffer := ''; - case Offset of - -1: FStream.Seek(FPosMin1, soBeginning); - -2: FStream.Seek(FPosMin2, soBeginning); - end;//case - exit; - end; - end; - if (Origin = soEnd) and (Offset = 0) then - begin - // Size - Result := FStream.Size; - exit; - end; - // Ignore set position from beginning (used in Size command) - if Origin = soBeginning then - exit; - // Arriving here means we cannot do it - raise EStreamError.Create(sxeCannotPerformSeek); -end; - -{$IFDEF CLR} - -function TsdCodecStream.Seek(const Offset: Int64; Origin: TSeekOrigin): Int64; -begin - Result := InternalSeek(Offset, Origin); -end; - -{$ELSE} - -function TsdCodecStream.Seek(Offset: Longint; Origin: Word): Longint; -begin - Result := InternalSeek(Offset, TSeekOrigin(Origin)); -end; - -{$ENDIF} - -procedure TsdCodecStream.StorePrevPositions; -begin - FPosMin2 := FPosMin1; - FPosMin1 := FStream.Position; -end; - -function TsdCodecStream.InternalWrite(const Buffer{$IFDEF CLR}: array of Byte{$ENDIF}; Offset, Count: Longint): Longint; -var - i: integer; -begin - if FMode = umUnknown then - begin - FMode := umWrite; - - // Some encodings are not supported (yet) - if FEncoding in [seUCS4BE, seUCS4_2143, seUCS4_3412, seEBCDIC] then - raise EStreamError.Create(sxeUnsupportedEncoding); - - // Find correct encoding info - for i := 0 to cBomInfoCount - 1 do - if cBomInfo[i].Enc = FEncoding then - begin - FWriteBom := cBomInfo[i].HasBOM; - break; - end; - - // Write BOM - if FWriteBom then - FStream.WriteBuffer(cBomInfo[i].BOM, cBomInfo[i].Len); - - // Check if we must swap byte order - if FEncoding in [se16BitBE, seUTF16BE] then - FSwapByteOrder := True; - end; - - if FMode <> umWrite then - raise EStreamError.Create(sxeCannotWriteCodecForReading); - WriteBuf(Buffer, Offset, Count); - Result := Count; -end; - -{$IFDEF CLR} - -function TsdCodecStream.Write(const Buffer: array of Byte; Offset, Count: Longint): Longint; -begin - Result := InternalWrite(Buffer, Offset, Count); -end; - -{$ELSE} - -function TsdCodecStream.Write(const Buffer; Count: Longint): Longint; -begin - Result := InternalWrite(Byte(Buffer), 0, Count); -end; - -{$ENDIF} - -procedure TsdCodecStream.WriteBuf(const Buffer{$IFDEF CLR}: TBytes{$ENDIF}; Offset, Count: longint); -var - i: integer; -begin - // Default just writes out bytes one by one. We override this in descendants - // to provide faster writes for some modes - for i := 0 to Count - 1 do - {$IFDEF CLR} - WriteByte(Buffer[Offset + i]); - {$ELSE} - WriteByte(TBytes(Buffer)[Offset + i]); - {$ENDIF} -end; - -procedure TsdCodecStream.WriteByte(const B: byte); -begin -// default does nothing -end; - -{$IFDEF CLR} - -procedure TsdCodecStream.SetSize(NewSize: Int64); -begin -// default does nothing -end; - -{$ENDIF} - -{ TsdAnsiStream } - -function TsdAnsiStream.ReadByte: byte; -var - B: byte; - W: word; -begin - StorePrevPositions; - - case FEncoding of - se8Bit, seUTF8: - begin - // Just a flat read of one byte. UTF8 is not converted back, when UTF8 - // encoding is detected, the document will set Utf8Encoded to True. - B := 0; - FStream.Read(B, 1); - Result := B; - end; - se16BitBE,se16BitLE,seUTF16BE,seUTF16LE: - begin - // Read two bytes - W := 0; - FStream.Read(W, 2); - // Swap byte order - if FSwapByteOrder then - W := swap(W); - // Unicode warning loss - if ((W and $FF00) > 0) and not FWarningUnicodeLoss then - begin - FWarningUnicodeLoss := True; - if assigned(FOnUnicodeLoss) then - FOnUnicodeLoss(Self); - // We cannot display unicode range characters - Result := ord('?'); - end else - Result := W and $FF; - end; - else - raise EStreamError.Create(sxeUnsupportedEncoding); - end;//case -end; - -procedure TsdAnsiStream.WriteBuf(const Buffer{$IFDEF CLR}: TBytes{$ENDIF}; Offset, Count: longint); -begin - case FEncoding of - se8Bit: - begin - // one on one - if StreamWrite(FStream, Buffer, Offset, Count) <> Count then - raise EStreamError.Create(sxeCannotWriteToOutputStream); - end; - else - inherited; - end;//case -end; - -procedure TsdAnsiStream.WriteByte(const B: byte); -var - SA, SU: string; - W: word; -begin - case FEncoding of - se8Bit: - begin - // Just a flat write of one byte - FStream.Write(B, 1); - end; - seUTF8: - begin - // Convert Ansi to UTF8 - SA := char(B); - SU := sdAnsiToUTF8(SA); - // write out - if FStream.Write(SU[1], length(SU)) = 0 then - raise EStreamError.Create(sxeCannotWriteToOutputStream); - end; - se16BitBE,se16BitLE,seUTF16BE,seUTF16LE: - begin - // Convert Ansi to Unicode - W := B; - // Swap byte order - if FSwapByteOrder then - W := swap(W); - // write out - if FStream.Write(W, 2) = 0 then - raise EStreamError.Create(sxeCannotWriteToOutputStream); - end; - else - raise EStreamError.Create(sxeUnsupportedEncoding); - end;//case -end; - -{ TsdUtf8Stream } - -function TsdUtf8Stream.ReadByte: byte; -var - B, B1, B2, B3: byte; - W: word; - SA: string; -begin - Result := 0; - - // New character? - if (Length(FBuffer) = 0) or (FBufferPos > length(FBuffer)) then - begin - StorePrevPositions; - FBufferPos := 1; - // Read another char and put in buffer - case FEncoding of - se8Bit: - begin - // read one byte - B := 0; - FStream.Read(B, 1); - SA := char(B); - // Convert to UTF8 - FBuffer := sdAnsiToUtf8(SA); - end; - seUTF8: - begin - // Read one, two or three bytes in the buffer - B1 := 0; - FStream.Read(B1, 1); - FBuffer := char(B1); - if (B1 and $80) > 0 then - begin - if (B1 and $20) <> 0 then - begin - B2 := 0; - FStream.Read(B2, 1); - FBuffer := FBuffer + char(B2); - end; - B3 := 0; - FStream.Read(B3, 1); - FBuffer := FBuffer + char(B3); - end; - end; - se16BitBE,se16BitLE,seUTF16BE,seUTF16LE: - begin - // Read two bytes - W := 0; - FStream.Read(W, 2); - // Swap byte order - if FSwapByteOrder then - W := swap(W); - // Convert to UTF8 in buffer - {$IFDEF D5UP} - FBuffer := sdUnicodeToUtf8(widechar(W)); - {$ELSE} - FBuffer := sdUnicodeToUtf8(char(W and $FF)); - {$ENDIF} - end; - else - raise EStreamError.Create(sxeUnsupportedEncoding); - end;//case - end; - - // Now we have the buffer, so read - if (FBufferPos > 0) and (FBufferPos <= length(FBuffer)) then - Result := byte(FBuffer[FBufferPos]); - inc(FBufferPos); -end; - -procedure TsdUtf8Stream.WriteBuf(const Buffer{$IFDEF CLR}: TBytes{$ENDIF}; Offset, Count: longint); -begin - case FEncoding of - seUtf8: - begin - // one on one - if StreamWrite(FStream, Buffer, Offset, Count) <> Count then - raise EStreamError.Create(sxeCannotWriteToOutputStream); - end - else - inherited; - end;//case -end; - -procedure TsdUtf8Stream.WriteByte(const B: byte); -var - SA: string; - SW: widestring; - MustWrite: boolean; -begin - case FEncoding of - se8Bit,se16BitBE,se16BitLE,seUTF16BE,seUTF16LE: - begin - MustWrite := True; - case Length(FBuffer) of - 0: - begin - FBuffer := char(B); - if (B and $80) <> 0 then - MustWrite := False; - end; - 1: - begin - FBuffer := FBuffer + char(B); - if (byte(FBuffer[1]) and $20) <> 0 then - MustWrite := False; - end; - 2: FBuffer := FBuffer + char(B); - end; - if MustWrite then - begin - if FEncoding = se8Bit then - begin - // Convert to ansi - SA := sdUtf8ToAnsi(FBuffer); - // write out - if length(SA) = 1 then - if FStream.Write(SA[1], 1) <> 1 then - raise EStreamError.Create(sxeCannotWriteToOutputStream); - end else - begin - // Convert to unicode - SW := sdUtf8ToUnicode(FBuffer); - // write out - if length(SW) = 1 then - if FStream.Write(SW[1], 2) <> 2 then - raise EStreamError.Create(sxeCannotWriteToOutputStream); - end; - FBuffer := ''; - end; - end; - seUTF8: - begin - // Just a flat write of one byte - if FStream.Write(B, 1) <> 1 then - raise EStreamError.Create(sxeCannotWriteToOutputStream); - end; - else - raise EStreamError.Create(sxeUnsupportedEncoding); - end;//case -end; - -{$IFDEF CLR} -{ TsdBufferedStream } - -constructor TsdBufferedStream.Create(AStream: TStream; Owned: Boolean = False); -begin - inherited Create; - FStream := AStream; - FOwned := Owned; -end; - -destructor TsdBufferedStream.Destroy; -begin - if FOwned then FreeAndNil(FStream); - inherited Destroy; -end; - -function TsdBufferedStream.Read(var Buffer: array of Byte; Offset, Count: Longint): Longint; -begin - Result := FStream.Read(Buffer, Offset, Count); -end; - -function TsdBufferedStream.Write(const Buffer: array of Byte; Offset, Count: Longint): Longint; -begin - Result := FStream.Write(Buffer, Offset, Count); -end; - -function TsdBufferedStream.Seek(const Offset: Int64; Origin: TSeekOrigin): Int64; -begin - Result := FStream.Seek(Offset, Origin); -end; - -procedure TsdBufferedStream.SetSize(NewSize: Int64); -begin - FStream.Size := NewSize; -end; - -{$ELSE} - -{ TsdBufferedReadStream } - -const - cMaxBufferSize = $10000; // 65536 bytes in the buffer - -procedure TsdBufferedReadStream.CheckPosition; -var - NewPage: integer; - FStartPos: longint; -begin - // Page and buffer position - NewPage := FPosition div cMaxBufferSize; - FBufPos := FPosition mod cMaxBufferSize; - - // Read new page if required - if (NewPage <> FPage) then - begin - // New page and buffer - FPage := NewPage; - - // Start position in stream - FStartPos := FPage * cMaxBufferSize; - FBufSize := Min(cMaxBufferSize, FStream.Size - FStartPos); - - FStream.Seek(FStartPos, soBeginning); - if FBufSize > 0 then - FStream.Read(FBuffer^, FBufSize); - end; - FMustCheck := False; -end; - -constructor TsdBufferedReadStream.Create(AStream: TStream; Owned: boolean); -begin - inherited Create; - FStream := AStream; - FOwned := Owned; - FMustCheck := True; - FPage := -1; // Set to invalid number to force an update on first read - ReallocMem(FBuffer, cMaxBufferSize); -end; - -destructor TsdBufferedReadStream.Destroy; -begin - if FOwned then FreeAndNil(FStream); - ReallocMem(FBuffer, 0); - inherited; -end; - -function TsdBufferedReadStream.Read(var Buffer; Count: longint): Longint; -var - Packet: PByte; - PacketCount: integer; -begin - // Set the right page - if FMustCheck then - CheckPosition; - - // Special case - read one byte, most often - if (Count = 1) and (FBufPos < FBufSize - 1) then - begin - byte(Buffer) := FBuffer^[FBufPos]; - inc(FBufPos); - inc(FPosition); - Result := 1; - exit; - end; - - // general case - Packet := @Buffer; - Result := 0; - while Count > 0 do - begin - PacketCount := min(FBufSize - FBufPos, Count); - if PacketCount <= 0 then - exit; - Move(FBuffer^[FBufPos], Packet^, PacketCount); - dec(Count, PacketCount); - inc(Packet, PacketCount); - inc(Result, PacketCount); - inc(FPosition, PacketCount); - inc(FBufPos, PacketCount); - if FBufPos >= FBufSize then - CheckPosition; - end; -end; - -function TsdBufferedReadStream.Seek(Offset: longint; Origin: Word): Longint; -begin - case Origin of - soFromBeginning: - FPosition := Offset; - soFromCurrent: - begin - // no need to check in this case - it is the GetPosition command - if Offset = 0 then - begin - Result := FPosition; - exit; - end; - FPosition := FPosition + Offset; - end; - soFromEnd: - FPosition := FStream.Size + Offset; - end;//case - Result := FPosition; - FMustCheck := True; -end; - -function TsdBufferedReadStream.Write(const Buffer; Count: longint): Longint; -begin - raise EStreamError.Create(sxeCannotWriteCodecForReading); -end; - -{ TsdBufferedWriteStream } - -constructor TsdBufferedWriteStream.Create(AStream: TStream; Owned: boolean); -begin - inherited Create; - FStream := AStream; - FOwned := Owned; - ReallocMem(FBuffer, cMaxBufferSize); -end; - -destructor TsdBufferedWriteStream.Destroy; -begin - Flush; - if FOwned then - FreeAndNil(FStream); - ReallocMem(FBuffer, 0); - inherited; -end; - -procedure TsdBufferedWriteStream.Flush; -begin - // Write the buffer to the stream - if FBufPos > 0 then - begin - FStream.Write(FBuffer^, FBufPos); - FBufPos := 0; - end; -end; - -function TsdBufferedWriteStream.Read(var Buffer; Count: longint): Longint; -begin - raise EStreamError.Create(sxeCannotReadCodecForWriting); -end; - -function TsdBufferedWriteStream.Seek(Offset: longint; Origin: Word): Longint; -begin - case Origin of - soFromBeginning: - if Offset = FPosition then - begin - Result := FPosition; - exit; - end; - soFromCurrent: - begin - // GetPosition command - if Offset = 0 then - begin - Result := FPosition; - exit; - end; - end; - soFromEnd: - if Offset = 0 then - begin - Result := FPosition; - exit; - end; - end;//case - raise EStreamError.Create(sxeCannotPerformSeek); -end; - -function TsdBufferedWriteStream.Write(const Buffer; Count: longint): Longint; -var - Packet: PByte; - PacketCount: integer; -begin - // Special case - read less bytes than would fill buffersize - if (FBufPos + Count < cMaxBufferSize) then - begin - Move(Buffer, FBuffer^[FBufPos], Count); - inc(FBufPos, Count); - inc(FPosition, Count); - Result := Count; - exit; - end; - - // general case that wraps buffer - Packet := @Buffer; - Result := 0; - while Count > 0 do - begin - PacketCount := min(cMaxBufferSize - FBufPos, Count); - if PacketCount <= 0 then - exit; - Move(Packet^, FBuffer^[FBufPos], PacketCount); - dec(Count, PacketCount); - inc(Result, PacketCount); - inc(FPosition, PacketCount); - inc(Packet, PacketCount); - inc(FBufPos, PacketCount); - if FBufPos = cMaxBufferSize then - Flush; - end; -end; -{$ENDIF} - -{ TsdSurplusReader } - -constructor TsdSurplusReader.Create(AStream: TStream); -begin - inherited Create; - FStream := AStream; -end; - -function TsdSurplusReader.ReadChar(var Ch: char): integer; -begin - if length(FSurplus) > 0 then - begin - Ch := FSurplus[1]; - FSurplus := copy(FSurplus, 2, length(FSurplus) - 1); - Result := 1; - end else - Result := FStream.Read(Ch, 1); -end; - -function TsdSurplusReader.ReadCharSkipBlanks(var Ch: char): boolean; -begin - Result := False; - repeat - // Read character, exit if none available - if ReadChar(Ch) = 0 then - exit; - // Skip if in controlchars - if not (Ch in cControlchars) then - break; - until False; - Result := True; -end; - -{ TsdStringBuilder } - -procedure TsdStringBuilder.AddChar(Ch: Char); -begin - inc(FCurrentIdx); - Reallocate(FCurrentIdx); - FData[FCurrentIdx] := Ch; -end; - -procedure TsdStringBuilder.AddString(var S: string); -var - {$IFDEF CLR} - i: integer; - {$ENDIF} - Count: integer; -begin - {$IFDEF CLR} - Count := S.Length; - {$ELSE} - Count := System.length(S); - {$ENDIF} - if Count = 0 then - exit; - Reallocate(FCurrentIdx + Count); - {$IFDEF CLR} - for i := 1 to S.Length do - FData[FCurrentIdx + i] := S[i]; - {$ELSE} - Move(S[1], FData[FCurrentIdx + 1], Count); - {$ENDIF} - inc(FCurrentIdx, Count); -end; - -procedure TsdStringBuilder.Clear; -begin - FCurrentIdx := 0; -end; - -function TsdStringBuilder.StringCopy(AFirst, ALength: integer): string; -begin - if ALength > FCurrentIdx - AFirst + 1 then - ALength := FCurrentIdx - AFirst + 1; - Result := Copy(FData, AFirst, ALength); -end; - -constructor TsdStringBuilder.Create; -begin - inherited Create; - SetLength(FData, 64); -end; - -function TsdStringBuilder.GetData(Index: integer): Char; -begin - Result := FData[Index]; -end; - -procedure TsdStringBuilder.Reallocate(RequiredLength: integer); -begin - {$IFDEF CLR} - while FData.Length < RequiredLength do - SetLength(FData, FData.Length * 2); - {$ELSE} - while System.Length(FData) < RequiredLength do - SetLength(FData, System.Length(FData) * 2); - {$ENDIF} -end; - -function TsdStringBuilder.Value: string; -begin - Result := Copy(FData, 1, FCurrentIdx); -end; - -initialization - - {$IFDEF TRIALXML} - ShowMessage( - 'This is the unregistered version of NativeXml.pas'#13#13 + - 'Please visit http://www.simdesign.nl/xml.html to buy the'#13 + - 'registered version for Eur 29.95 (source included).'); - {$ENDIF} - -end. diff --git a/Skin Designer/ufrmSkinCreator.pas b/Skin Designer/ufrmSkinCreator.pas index 3246119..5dbd434 100644 --- a/Skin Designer/ufrmSkinCreator.pas +++ b/Skin Designer/ufrmSkinCreator.pas @@ -1,526 +1,591 @@ { - ============================================================================= - ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + ============================================================================= + ***************************************************************************** + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan . + The Initial Developer of the Original Code is + Mehdi Hasan Khan . - Copyright (C) OmicronLab . All Rights Reserved. + Copyright (C) OmicronLab . All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. - ***************************************************************************** - ============================================================================= + ***************************************************************************** + ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - Unit ufrmSkinCreator; Interface Uses - Windows, - Messages, - SysUtils, - Variants, - Classes, - Graphics, - Controls, - Forms, - Dialogs, - StdCtrls, - uFrameImageAdd, - uFrameDrag, - ExtCtrls, - GIFImg; + Windows, + Messages, + SysUtils, + Variants, + Classes, + Graphics, + Controls, + Forms, + Dialogs, + StdCtrls, + uFrameImageAdd, + uFrameDrag, + xmlDoc, XMLIntf, + Soap.EncdDecd, + ExtCtrls, + GIFImg; Type - TfrmSkinCreator = Class(TForm) - Panel1: TPanel; - Label1: TLabel; - GroupBox1: TGroupBox; - Label3: TLabel; - Label4: TLabel; - EditSkinName: TEdit; - Label5: TLabel; - EditSkinVer: TEdit; - Label6: TLabel; - EditDesignerName: TEdit; - Label7: TLabel; - EditComment: TMemo; - Label8: TLabel; - CheckAvroIcon: TCheckBox; - CheckKM: TCheckBox; - CheckKL: TCheckBox; - CheckLayoutViewer: TCheckBox; - CheckMouse: TCheckBox; - CheckTools: TCheckBox; - CheckWeb: TCheckBox; - CheckHelp: TCheckBox; - CheckExit: TCheckBox; - ButtonHelp: TButton; - ButtonAbout: TButton; - ButtonPrev: TButton; - ButtonNext: TButton; - ButtonExit: TButton; - GroupBox2: TGroupBox; - ScrollBoxImageAdd: TScrollBox; - FrameImageAdd1: TFrameImageAdd; - GroupBox3: TGroupBox; - FrameDrag1: TFrameDrag; - GroupBox4: TGroupBox; - ButtonSaveSkin: TButton; - Label9: TLabel; - Label10: TLabel; - Panel2: TPanel; - Label11: TLabel; - LabelShareLink: TLabel; - Panel3: TPanel; - Image1: TImage; - Label13: TLabel; - Label14: TLabel; - Label2: TLabel; - SaveDialog1: TSaveDialog; - Procedure FormCreate(Sender: TObject); - Procedure ButtonNextClick(Sender: TObject); - Procedure ButtonPrevClick(Sender: TObject); - Procedure ButtonSaveSkinClick(Sender: TObject); - Procedure ButtonHelpClick(Sender: TObject); - Procedure LabelShareLinkClick(Sender: TObject); - Procedure ButtonAboutClick(Sender: TObject); - Procedure ButtonExitClick(Sender: TObject); - Private - { Private declarations } - Index: Integer; - Function ValidateNext(Val: Integer): Boolean; - Function Validate_1To2_Page: Boolean; - Function Validate_2To3_Page: Boolean; - Function Validate_3To4_Page: Boolean; - Public - { Public declarations } - End; + TfrmSkinCreator = Class(TForm) + Panel1: TPanel; + Label1: TLabel; + GroupBox1: TGroupBox; + Label3: TLabel; + Label4: TLabel; + EditSkinName: TEdit; + Label5: TLabel; + EditSkinVer: TEdit; + Label6: TLabel; + EditDesignerName: TEdit; + Label7: TLabel; + EditComment: TMemo; + Label8: TLabel; + CheckAvroIcon: TCheckBox; + CheckKM: TCheckBox; + CheckKL: TCheckBox; + CheckLayoutViewer: TCheckBox; + CheckMouse: TCheckBox; + CheckTools: TCheckBox; + CheckWeb: TCheckBox; + CheckHelp: TCheckBox; + CheckExit: TCheckBox; + ButtonHelp: TButton; + ButtonAbout: TButton; + ButtonPrev: TButton; + ButtonNext: TButton; + ButtonExit: TButton; + GroupBox2: TGroupBox; + ScrollBoxImageAdd: TScrollBox; + FrameImageAdd1: TFrameImageAdd; + GroupBox3: TGroupBox; + FrameDrag1: TFrameDrag; + GroupBox4: TGroupBox; + ButtonSaveSkin: TButton; + Label9: TLabel; + Label10: TLabel; + Panel2: TPanel; + Label11: TLabel; + LabelShareLink: TLabel; + Panel3: TPanel; + Image1: TImage; + Label13: TLabel; + Label14: TLabel; + Label2: TLabel; + SaveDialog1: TSaveDialog; + Procedure FormCreate(Sender: TObject); + Procedure ButtonNextClick(Sender: TObject); + Procedure ButtonPrevClick(Sender: TObject); + Procedure ButtonSaveSkinClick(Sender: TObject); + Procedure ButtonHelpClick(Sender: TObject); + Procedure LabelShareLinkClick(Sender: TObject); + Procedure ButtonAboutClick(Sender: TObject); + Procedure ButtonExitClick(Sender: TObject); + Private + { Private declarations } + Index: Integer; + Function ValidateNext(Val: Integer): Boolean; + Function Validate_1To2_Page: Boolean; + Function Validate_2To3_Page: Boolean; + Function Validate_3To4_Page: Boolean; + Public + { Public declarations } + End; Var - frmSkinCreator: TfrmSkinCreator; + frmSkinCreator: TfrmSkinCreator; Implementation {$R *.dfm} Uses - ufrmAbout, - NativeXml, - uFileFolderHandling; + ufrmAbout, + + uFileFolderHandling; Procedure TfrmSkinCreator.ButtonAboutClick(Sender: TObject); Begin - Application.CreateForm(TfrmAbout, frmAbout); - frmAbout.ShowModal; + Application.CreateForm(TfrmAbout, frmAbout); + frmAbout.ShowModal; End; Procedure TfrmSkinCreator.ButtonExitClick(Sender: TObject); Begin - If Application.MessageBox('Exit Skin Designer?', 'Skin Designer', MB_YESNO + MB_ICONQUESTION + MB_DEFBUTTON2 + MB_APPLMODAL) = ID_YES Then - Self.Close; + If Application.MessageBox('Exit Skin Designer?', 'Skin Designer', + MB_YESNO + MB_ICONQUESTION + MB_DEFBUTTON2 + MB_APPLMODAL) = ID_YES Then + Self.Close; End; Procedure TfrmSkinCreator.ButtonHelpClick(Sender: TObject); Begin - { TODO : Write help and make this button Visible! } + { TODO : Write help and make this button Visible! } End; Procedure TfrmSkinCreator.ButtonNextClick(Sender: TObject); Begin - If ValidateNext(Index + 1) = False Then - System.Exit; - Inc(Index); + If ValidateNext(Index + 1) = False Then + System.Exit; + Inc(Index); - If Index = 4 Then - ButtonNext.Enabled := False - Else - ButtonNext.Enabled := True; + If Index = 4 Then + ButtonNext.Enabled := False + Else + ButtonNext.Enabled := True; - If Index = 1 Then - ButtonPrev.Enabled := False - Else - ButtonPrev.Enabled := True; + If Index = 1 Then + ButtonPrev.Enabled := False + Else + ButtonPrev.Enabled := True; -(FindComponent('GroupBox' + IntToStr(Index)) As TGroupBox) - .BringToFront; + (FindComponent('GroupBox' + IntToStr(Index)) As TGroupBox).BringToFront; End; Procedure TfrmSkinCreator.ButtonPrevClick(Sender: TObject); Begin - If Index <= 1 Then - System.Exit; + If Index <= 1 Then + System.Exit; - Dec(Index); + Dec(Index); - If Index = 4 Then - ButtonNext.Enabled := False - Else - ButtonNext.Enabled := True; + If Index = 4 Then + ButtonNext.Enabled := False + Else + ButtonNext.Enabled := True; - If Index = 1 Then - ButtonPrev.Enabled := False - Else - ButtonPrev.Enabled := True; + If Index = 1 Then + ButtonPrev.Enabled := False + Else + ButtonPrev.Enabled := True; -(FindComponent('GroupBox' + IntToStr(Index)) As TGroupBox) - .BringToFront; + (FindComponent('GroupBox' + IntToStr(Index)) As TGroupBox).BringToFront; End; Procedure TfrmSkinCreator.ButtonSaveSkinClick(Sender: TObject); /// ///////////////////////////////////// - Procedure NewCDataNode(Var mXML: TNativeXML; NodeName: UTF8String; NodeData: String); - Var - mChild: TXmlNode; - mCDataChild: TXmlNode; - Begin - mChild := mXML.Root.NodeNew(NodeName); - mCDataChild := mChild.NodeNew(NodeName); - mCDataChild.ElementType := xeCData; - mCDataChild.ValueAsUnicodeString := NodeData; - End; + Procedure NewCDataNode(Var mXML: IXMLDocument; NodeName: UTF8String; + NodeData: String); + Var + mChild: IXMLNode; + mCDataChild: IXMLNode; + Begin + mChild := mXML.DocumentElement.AddChild(NodeName); + mCDataChild := mXML.CreateNode(NodeData, ntCDATA); + mXML.DocumentElement.ChildNodes.nodes[NodeName].ChildNodes.Add(mCDataChild); + + End; /// ///////////////////////////////////// - Procedure NewNode(Var mXML: TNativeXML; NodeName: UTF8String; NodeData: String); - Var - mChild: TXmlNode; - Begin - mChild := mXML.Root.NodeNew(NodeName); - mChild.ValueAsUnicodeString := NodeData; - End; + Procedure NewNode(Var mXML: IXMLDocument; NodeName: UTF8String; + NodeData: String); + Var + mChild: IXMLNode; + Begin + mChild := mXML.DocumentElement.AddChild(NodeName); + mChild.NodeValue := NodeData; + End; /// ///////////////////////////////////// - Function ImageToXml(Var mXML: TNativeXML; NodeName: UTF8String; ImagePath: String): Boolean; - Var - FStream: TFileStream; - SStream: TStringStream; - mChild: TXmlNode; - // mCDataChild : TXmlNode; - - ErrorOccured: Boolean; - Begin - ErrorOccured := False; - ImagePath := Trim(ImagePath); - - mChild := mXML.Root.NodeNew(NodeName); - // mCDataChild := mChild.NodeNew(NodeName); - // mCDataChild.ElementType := xeCData; - mChild.BinaryEncoding := xbeBase64; - Try - Try - If ImagePath <> '' Then Begin - SStream := TStringStream.Create(''); - FStream := TFileStream.Create(ImagePath, fmOpenRead, fmShareDenyWrite); - SStream.CopyFrom(FStream, FStream.Size); - mChild.BinaryString := RawByteString(SStream.DataString); - End - Else - mChild.BinaryString := ''; - - Except - On E: Exception Do Begin - ErrorOccured := True; - End; - End; - Finally - If ImagePath <> '' Then Begin - SStream.Free; - FStream.Free; - End; - - If ErrorOccured Then - Result := False - Else - Result := True; - End; - End; + Function ImageToXml(Var mXML: IXMLDocument; NodeName: UTF8String; + ImagePath: String): Boolean; + Var + FStream: TFileStream; + SStream: TStringStream; + mChild: IXMLNode; + // mCDataChild : IXMLNode; + + ErrorOccured: Boolean; + Begin + ErrorOccured := False; + ImagePath := Trim(ImagePath); + + mChild := mXML.DocumentElement.AddChild(NodeName); + // mCDataChild := mChild.NodeNew(NodeName); + // mCDataChild.ElementType := xeCData; + // mChild.BinaryEncoding := xbeBase64; + Try + Try + If ImagePath <> '' Then + Begin + SStream := TStringStream.Create(''); + FStream := TFileStream.Create(ImagePath, fmOpenRead, + fmShareDenyWrite); + SStream.CopyFrom(FStream, FStream.Size); + // mChild.BinaryString := RawByteString(SStream.DataString); + mChild.NodeValue := EncodeBase64(Pchar(SStream.DataString), + Length(SStream.DataString)); + End + Else + // mChild.BinaryString := ''; + mChild.NodeValue := ''; + Except + On E: Exception Do + Begin + ErrorOccured := True; + End; + End; + Finally + If ImagePath <> '' Then + Begin + SStream.Free; + FStream.Free; + End; + + If ErrorOccured Then + Result := False + Else + Result := True; + End; + End; /// ///////////////////////////////////// - Function MyBoolToStr(b: Boolean): String; - Begin - If b Then - Result := '1' - Else - Result := '0'; + Function MyBoolToStr(b: Boolean): String; + Begin + If b Then + Result := '1' + Else + Result := '0'; - End; + End; /// ///////////////////////////////////// Var - XML: TNativeXML; - child: TXmlNode; + XML: IXMLDocument; + child: IXMLNode; Begin - Try - Try - XML := TNativeXML.Create; - XML.EncodingString := 'UTF-8'; - XML.XmlFormat := xfReadable; - XML.ExternalEncoding := seUTF8; - - XML.Root.Name := 'Skin'; - - // Avro version - child := XML.Root.NodeNew('AvroKeyboardVersion'); - child.ValueAsUnicodeString := '5'; - - // Skin info - NewCDataNode(XML, 'SkinName', EditSkinName.Text); - NewCDataNode(XML, 'SkinVersion', EditSkinVer.Text); - NewCDataNode(XML, 'DesignerName', EditDesignerName.Text); - NewCDataNode(XML, 'DesignerComment', EditComment.Text); - - // Preview Image - If Not ImageToXml(XML, 'Preview', FrameImageAdd1.Preview.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.Preview.Text); - - // Button info - NewNode(XML, 'AvroIconAdded', MyBoolToStr(CheckAvroIcon.Checked)); - NewNode(XML, 'KeyboardModeAdded', MyBoolToStr(CheckKM.Checked)); - NewNode(XML, 'KeyboardLayoutAdded', MyBoolToStr(CheckKL.Checked)); - NewNode(XML, 'LayoutViewerAdded', MyBoolToStr(CheckLayoutViewer.Checked)); - NewNode(XML, 'AvroMouseAdded', MyBoolToStr(CheckMouse.Checked)); - NewNode(XML, 'ToolsAdded', MyBoolToStr(CheckTools.Checked)); - NewNode(XML, 'WebAdded', MyBoolToStr(CheckWeb.Checked)); - NewNode(XML, 'HelpAdded', MyBoolToStr(CheckHelp.Checked)); - NewNode(XML, 'ExitAdded', MyBoolToStr(CheckExit.Checked)); - - // Main Image - If Not ImageToXml(XML, 'TopBarMain', FrameImageAdd1.ImagePath_TopBar.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.ImagePath_TopBar.Text); - NewNode(XML, 'TopBarHeight', IntToStr(FrameDrag1.Background.Height)); - NewNode(XML, 'TopBarWidth', IntToStr(FrameDrag1.Background.Width)); - - // Avro icon - If Not ImageToXml(XML, 'AvroIconNormal', FrameImageAdd1.AvroIcon.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.AvroIcon.Text); - If Not ImageToXml(XML, 'AvroIconOver', FrameImageAdd1.AvroIconOver.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.AvroIconOver.Text); - If Not ImageToXml(XML, 'AvroIconDown', FrameImageAdd1.AvroIconDown.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.AvroIconDown.Text); - NewNode(XML, 'AvroIconHeight', IntToStr(FrameDrag1.AvroIcon.Height)); - NewNode(XML, 'AvroIconWidth', IntToStr(FrameDrag1.AvroIcon.Width)); - NewNode(XML, 'AvroIconLeft', IntToStr(FrameDrag1.AvroIcon.Left)); - NewNode(XML, 'AvroIconTop', IntToStr(FrameDrag1.AvroIcon.Top)); - - - // Keyboard Mode - If Not ImageToXml(XML, 'KeyboardModeEnglishNormal', FrameImageAdd1.KMSys.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.KMSys.Text); - If Not ImageToXml(XML, 'KeyboardModeEnglishOver', FrameImageAdd1.KMSysOver.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.KMSysOver.Text); - If Not ImageToXml(XML, 'KeyboardModeEnglishDown', FrameImageAdd1.KMSysDown.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.KMSysDown.Text); - If Not ImageToXml(XML, 'KeyboardModeBanglaNormal', FrameImageAdd1.KMBangla.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.KMBangla.Text); - If Not ImageToXml(XML, 'KeyboardModeBanglaOver', FrameImageAdd1.KMBanglaOver.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.KMBanglaOver.Text); - If Not ImageToXml(XML, 'KeyboardModeBanglaDown', FrameImageAdd1.KMBanglaDown.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.KMBanglaDown.Text); - NewNode(XML, 'KeyboardModeHeight', IntToStr(FrameDrag1.KM.Height)); - NewNode(XML, 'KeyboardModeWidth', IntToStr(FrameDrag1.KM.Width)); - NewNode(XML, 'KeyboardModeLeft', IntToStr(FrameDrag1.KM.Left)); - NewNode(XML, 'KeyboardModeTop', IntToStr(FrameDrag1.KM.Top)); - - // Keyboard Layout - If Not ImageToXml(XML, 'KeyboardLayoutNormal', FrameImageAdd1.KL.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.KL.Text); - If Not ImageToXml(XML, 'KeyboardLayoutOver', FrameImageAdd1.KLOver.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.KLOver.Text); - If Not ImageToXml(XML, 'KeyboardLayoutDown', FrameImageAdd1.KLDown.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.KLDown.Text); - NewNode(XML, 'KeyboardLayoutHeight', IntToStr(FrameDrag1.KL.Height)); - NewNode(XML, 'KeyboardLayoutWidth', IntToStr(FrameDrag1.KL.Width)); - NewNode(XML, 'KeyboardLayoutLeft', IntToStr(FrameDrag1.KL.Left)); - NewNode(XML, 'KeyboardLayoutTop', IntToStr(FrameDrag1.KL.Top)); - - - // LayoutViewer - If Not ImageToXml(XML, 'LayoutViewerNormal', FrameImageAdd1.LayoutV.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.LayoutV.Text); - If Not ImageToXml(XML, 'LayoutViewerOver', FrameImageAdd1.LayoutVOver.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.LayoutVOver.Text); - If Not ImageToXml(XML, 'LayoutViewerDown', FrameImageAdd1.LayoutVDown.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.LayoutVDown.Text); - NewNode(XML, 'LayoutViewerHeight', IntToStr(FrameDrag1.LayoutV.Height)); - NewNode(XML, 'LayoutViewerWidth', IntToStr(FrameDrag1.LayoutV.Width)); - NewNode(XML, 'LayoutViewerLeft', IntToStr(FrameDrag1.LayoutV.Left)); - NewNode(XML, 'LayoutViewerTop', IntToStr(FrameDrag1.LayoutV.Top)); - - - // AvroMouse - If Not ImageToXml(XML, 'AvroMouseNormal', FrameImageAdd1.AvroMouse.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.AvroMouse.Text); - If Not ImageToXml(XML, 'AvroMouseOver', FrameImageAdd1.AvroMouseOver.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.AvroMouseOver.Text); - If Not ImageToXml(XML, 'AvroMouseDown', FrameImageAdd1.AvroMouseDown.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.AvroMouseDown.Text); - NewNode(XML, 'AvroMouseHeight', IntToStr(FrameDrag1.AvroMouse.Height)); - NewNode(XML, 'AvroMouseWidth', IntToStr(FrameDrag1.AvroMouse.Width)); - NewNode(XML, 'AvroMouseLeft', IntToStr(FrameDrag1.AvroMouse.Left)); - NewNode(XML, 'AvroMouseTop', IntToStr(FrameDrag1.AvroMouse.Top)); - - - // Tools - If Not ImageToXml(XML, 'ToolsNormal', FrameImageAdd1.Tools.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.Tools.Text); - If Not ImageToXml(XML, 'ToolsOver', FrameImageAdd1.ToolsOver.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.ToolsOver.Text); - If Not ImageToXml(XML, 'ToolsDown', FrameImageAdd1.ToolsDown.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.ToolsDown.Text); - NewNode(XML, 'ToolsHeight', IntToStr(FrameDrag1.Tools.Height)); - NewNode(XML, 'ToolsWidth', IntToStr(FrameDrag1.Tools.Width)); - NewNode(XML, 'ToolsLeft', IntToStr(FrameDrag1.Tools.Left)); - NewNode(XML, 'ToolsTop', IntToStr(FrameDrag1.Tools.Top)); - - // Web - If Not ImageToXml(XML, 'WebNormal', FrameImageAdd1.Web.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.Web.Text); - If Not ImageToXml(XML, 'WebOver', FrameImageAdd1.WebOver.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.WebOver.Text); - If Not ImageToXml(XML, 'WebDown', FrameImageAdd1.WebDown.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.WebDown.Text); - NewNode(XML, 'WebHeight', IntToStr(FrameDrag1.Web.Height)); - NewNode(XML, 'WebWidth', IntToStr(FrameDrag1.Web.Width)); - NewNode(XML, 'WebLeft', IntToStr(FrameDrag1.Web.Left)); - NewNode(XML, 'WebTop', IntToStr(FrameDrag1.Web.Top)); - - // Help - If Not ImageToXml(XML, 'HelpNormal', FrameImageAdd1.Help.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.Help.Text); - If Not ImageToXml(XML, 'HelpOver', FrameImageAdd1.HelpOver.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.HelpOver.Text); - If Not ImageToXml(XML, 'HelpDown', FrameImageAdd1.HelpDown.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.HelpDown.Text); - NewNode(XML, 'HelpHeight', IntToStr(FrameDrag1.Help.Height)); - NewNode(XML, 'HelpWidth', IntToStr(FrameDrag1.Help.Width)); - NewNode(XML, 'HelpLeft', IntToStr(FrameDrag1.Help.Left)); - NewNode(XML, 'HelpTop', IntToStr(FrameDrag1.Help.Top)); - - // Exit - If Not ImageToXml(XML, 'ExitNormal', FrameImageAdd1.Exit.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.Exit.Text); - If Not ImageToXml(XML, 'ExitOver', FrameImageAdd1.ExitOver.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.ExitOver.Text); - If Not ImageToXml(XML, 'ExitDown', FrameImageAdd1.ExitDown.Text) Then - Raise Exception.Create('Unable to convert image to skin!' + #10 + FrameImageAdd1.ExitDown.Text); - NewNode(XML, 'ExitHeight', IntToStr(FrameDrag1.Exit.Height)); - NewNode(XML, 'ExitWidth', IntToStr(FrameDrag1.Exit.Width)); - NewNode(XML, 'ExitLeft', IntToStr(FrameDrag1.Exit.Left)); - NewNode(XML, 'ExitTop', IntToStr(FrameDrag1.Exit.Top)); - - SaveDialog1.FileName := EditSkinName.Text + '.avroskin'; - If SaveDialog1.Execute(Self.Handle) Then Begin - XML.SaveToFile(SaveDialog1.FileName); - End; - { TODO : Save path in registry } - - - Except - On E: Exception Do Begin - Application.MessageBox(pchar('Error occured!' + #10 + #10 + E.Message), pchar('Skin Designer'), MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL); - End; - End; - Finally - FreeAndNil(XML); - End; - + Try + Try + XML := TXMLDocument.Create(nil); + XML.Active := True; + XML.Encoding := 'UTF-8'; + + XML.AddChild('Skin'); + + // Avro version + child := XML.DocumentElement.AddChild('AvroKeyboardVersion'); + child.NodeValue := '5'; + + // Skin info + NewCDataNode(XML, 'SkinName', EditSkinName.Text); + NewCDataNode(XML, 'SkinVersion', EditSkinVer.Text); + NewCDataNode(XML, 'DesignerName', EditDesignerName.Text); + NewCDataNode(XML, 'DesignerComment', EditComment.Text); + + // Preview Image + If Not ImageToXml(XML, 'Preview', FrameImageAdd1.Preview.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.Preview.Text); + + // Button info + NewNode(XML, 'AvroIconAdded', MyBoolToStr(CheckAvroIcon.Checked)); + NewNode(XML, 'KeyboardModeAdded', MyBoolToStr(CheckKM.Checked)); + NewNode(XML, 'KeyboardLayoutAdded', MyBoolToStr(CheckKL.Checked)); + NewNode(XML, 'LayoutViewerAdded', MyBoolToStr(CheckLayoutViewer.Checked)); + NewNode(XML, 'AvroMouseAdded', MyBoolToStr(CheckMouse.Checked)); + NewNode(XML, 'ToolsAdded', MyBoolToStr(CheckTools.Checked)); + NewNode(XML, 'WebAdded', MyBoolToStr(CheckWeb.Checked)); + NewNode(XML, 'HelpAdded', MyBoolToStr(CheckHelp.Checked)); + NewNode(XML, 'ExitAdded', MyBoolToStr(CheckExit.Checked)); + + // Main Image + If Not ImageToXml(XML, 'TopBarMain', + FrameImageAdd1.ImagePath_TopBar.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.ImagePath_TopBar.Text); + NewNode(XML, 'TopBarHeight', IntToStr(FrameDrag1.Background.Height)); + NewNode(XML, 'TopBarWidth', IntToStr(FrameDrag1.Background.Width)); + + // Avro icon + If Not ImageToXml(XML, 'AvroIconNormal', + FrameImageAdd1.AvroIcon.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.AvroIcon.Text); + If Not ImageToXml(XML, 'AvroIconOver', + FrameImageAdd1.AvroIconOver.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.AvroIconOver.Text); + If Not ImageToXml(XML, 'AvroIconDown', + FrameImageAdd1.AvroIconDown.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.AvroIconDown.Text); + NewNode(XML, 'AvroIconHeight', IntToStr(FrameDrag1.AvroIcon.Height)); + NewNode(XML, 'AvroIconWidth', IntToStr(FrameDrag1.AvroIcon.Width)); + NewNode(XML, 'AvroIconLeft', IntToStr(FrameDrag1.AvroIcon.Left)); + NewNode(XML, 'AvroIconTop', IntToStr(FrameDrag1.AvroIcon.Top)); + + // Keyboard Mode + If Not ImageToXml(XML, 'KeyboardModeEnglishNormal', + FrameImageAdd1.KMSys.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.KMSys.Text); + If Not ImageToXml(XML, 'KeyboardModeEnglishOver', + FrameImageAdd1.KMSysOver.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.KMSysOver.Text); + If Not ImageToXml(XML, 'KeyboardModeEnglishDown', + FrameImageAdd1.KMSysDown.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.KMSysDown.Text); + If Not ImageToXml(XML, 'KeyboardModeBanglaNormal', + FrameImageAdd1.KMBangla.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.KMBangla.Text); + If Not ImageToXml(XML, 'KeyboardModeBanglaOver', + FrameImageAdd1.KMBanglaOver.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.KMBanglaOver.Text); + If Not ImageToXml(XML, 'KeyboardModeBanglaDown', + FrameImageAdd1.KMBanglaDown.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.KMBanglaDown.Text); + NewNode(XML, 'KeyboardModeHeight', IntToStr(FrameDrag1.KM.Height)); + NewNode(XML, 'KeyboardModeWidth', IntToStr(FrameDrag1.KM.Width)); + NewNode(XML, 'KeyboardModeLeft', IntToStr(FrameDrag1.KM.Left)); + NewNode(XML, 'KeyboardModeTop', IntToStr(FrameDrag1.KM.Top)); + + // Keyboard Layout + If Not ImageToXml(XML, 'KeyboardLayoutNormal', + FrameImageAdd1.KL.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.KL.Text); + If Not ImageToXml(XML, 'KeyboardLayoutOver', + FrameImageAdd1.KLOver.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.KLOver.Text); + If Not ImageToXml(XML, 'KeyboardLayoutDown', + FrameImageAdd1.KLDown.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.KLDown.Text); + NewNode(XML, 'KeyboardLayoutHeight', IntToStr(FrameDrag1.KL.Height)); + NewNode(XML, 'KeyboardLayoutWidth', IntToStr(FrameDrag1.KL.Width)); + NewNode(XML, 'KeyboardLayoutLeft', IntToStr(FrameDrag1.KL.Left)); + NewNode(XML, 'KeyboardLayoutTop', IntToStr(FrameDrag1.KL.Top)); + + // LayoutViewer + If Not ImageToXml(XML, 'LayoutViewerNormal', + FrameImageAdd1.LayoutV.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.LayoutV.Text); + If Not ImageToXml(XML, 'LayoutViewerOver', + FrameImageAdd1.LayoutVOver.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.LayoutVOver.Text); + If Not ImageToXml(XML, 'LayoutViewerDown', + FrameImageAdd1.LayoutVDown.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.LayoutVDown.Text); + NewNode(XML, 'LayoutViewerHeight', IntToStr(FrameDrag1.LayoutV.Height)); + NewNode(XML, 'LayoutViewerWidth', IntToStr(FrameDrag1.LayoutV.Width)); + NewNode(XML, 'LayoutViewerLeft', IntToStr(FrameDrag1.LayoutV.Left)); + NewNode(XML, 'LayoutViewerTop', IntToStr(FrameDrag1.LayoutV.Top)); + + // AvroMouse + If Not ImageToXml(XML, 'AvroMouseNormal', + FrameImageAdd1.AvroMouse.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.AvroMouse.Text); + If Not ImageToXml(XML, 'AvroMouseOver', + FrameImageAdd1.AvroMouseOver.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.AvroMouseOver.Text); + If Not ImageToXml(XML, 'AvroMouseDown', + FrameImageAdd1.AvroMouseDown.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.AvroMouseDown.Text); + NewNode(XML, 'AvroMouseHeight', IntToStr(FrameDrag1.AvroMouse.Height)); + NewNode(XML, 'AvroMouseWidth', IntToStr(FrameDrag1.AvroMouse.Width)); + NewNode(XML, 'AvroMouseLeft', IntToStr(FrameDrag1.AvroMouse.Left)); + NewNode(XML, 'AvroMouseTop', IntToStr(FrameDrag1.AvroMouse.Top)); + + // Tools + If Not ImageToXml(XML, 'ToolsNormal', FrameImageAdd1.Tools.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.Tools.Text); + If Not ImageToXml(XML, 'ToolsOver', FrameImageAdd1.ToolsOver.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.ToolsOver.Text); + If Not ImageToXml(XML, 'ToolsDown', FrameImageAdd1.ToolsDown.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.ToolsDown.Text); + NewNode(XML, 'ToolsHeight', IntToStr(FrameDrag1.Tools.Height)); + NewNode(XML, 'ToolsWidth', IntToStr(FrameDrag1.Tools.Width)); + NewNode(XML, 'ToolsLeft', IntToStr(FrameDrag1.Tools.Left)); + NewNode(XML, 'ToolsTop', IntToStr(FrameDrag1.Tools.Top)); + + // Web + If Not ImageToXml(XML, 'WebNormal', FrameImageAdd1.Web.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.Web.Text); + If Not ImageToXml(XML, 'WebOver', FrameImageAdd1.WebOver.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.WebOver.Text); + If Not ImageToXml(XML, 'WebDown', FrameImageAdd1.WebDown.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.WebDown.Text); + NewNode(XML, 'WebHeight', IntToStr(FrameDrag1.Web.Height)); + NewNode(XML, 'WebWidth', IntToStr(FrameDrag1.Web.Width)); + NewNode(XML, 'WebLeft', IntToStr(FrameDrag1.Web.Left)); + NewNode(XML, 'WebTop', IntToStr(FrameDrag1.Web.Top)); + + // Help + If Not ImageToXml(XML, 'HelpNormal', FrameImageAdd1.Help.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.Help.Text); + If Not ImageToXml(XML, 'HelpOver', FrameImageAdd1.HelpOver.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.HelpOver.Text); + If Not ImageToXml(XML, 'HelpDown', FrameImageAdd1.HelpDown.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.HelpDown.Text); + NewNode(XML, 'HelpHeight', IntToStr(FrameDrag1.Help.Height)); + NewNode(XML, 'HelpWidth', IntToStr(FrameDrag1.Help.Width)); + NewNode(XML, 'HelpLeft', IntToStr(FrameDrag1.Help.Left)); + NewNode(XML, 'HelpTop', IntToStr(FrameDrag1.Help.Top)); + + // Exit + If Not ImageToXml(XML, 'ExitNormal', FrameImageAdd1.Exit.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.Exit.Text); + If Not ImageToXml(XML, 'ExitOver', FrameImageAdd1.ExitOver.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.ExitOver.Text); + If Not ImageToXml(XML, 'ExitDown', FrameImageAdd1.ExitDown.Text) Then + Raise Exception.Create('Unable to convert image to skin!' + #10 + + FrameImageAdd1.ExitDown.Text); + NewNode(XML, 'ExitHeight', IntToStr(FrameDrag1.Exit.Height)); + NewNode(XML, 'ExitWidth', IntToStr(FrameDrag1.Exit.Width)); + NewNode(XML, 'ExitLeft', IntToStr(FrameDrag1.Exit.Left)); + NewNode(XML, 'ExitTop', IntToStr(FrameDrag1.Exit.Top)); + + SaveDialog1.FileName := EditSkinName.Text + '.avroskin'; + If SaveDialog1.Execute(Self.Handle) Then + Begin + XML.SaveToFile(SaveDialog1.FileName); + End; + { TODO : Save path in registry } + + Except + On E: Exception Do + Begin + Application.MessageBox(Pchar('Error occured!' + #10 + #10 + E.Message), + Pchar('Skin Designer'), MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + + MB_APPLMODAL); + End; + End; + Finally + XML.Active := False; + XML := nil; + End; End; Procedure TfrmSkinCreator.FormCreate(Sender: TObject); Begin - With FrameImageAdd1 Do Begin - Initialize; - Top := 0; - Left := 0; - End; - - With FrameDrag1 Do Begin - Initialize; - End; - - Index := 1; - GroupBox1.BringToFront; - Self.Show; - Application.ProcessMessages; - EditSkinName.SetFocus; + With FrameImageAdd1 Do + Begin + Initialize; + Top := 0; + Left := 0; + End; + + With FrameDrag1 Do + Begin + Initialize; + End; + + Index := 1; + GroupBox1.BringToFront; + Self.Show; + Application.ProcessMessages; + EditSkinName.SetFocus; End; Procedure TfrmSkinCreator.LabelShareLinkClick(Sender: TObject); Begin - Execute_Something('http://www.omicronlab.com/go.php?id=7'); + Execute_Something('http://www.omicronlab.com/go.php?id=7'); End; Function TfrmSkinCreator.ValidateNext(Val: Integer): Boolean; Begin - Result := False; - Case Index Of - 1: - Result := Validate_1To2_Page; + Result := False; + Case Index Of + 1: + Result := Validate_1To2_Page; - 2: - Result := Validate_2To3_Page; + 2: + Result := Validate_2To3_Page; - 3: - Result := Validate_3To4_Page; - End; + 3: + Result := Validate_3To4_Page; + End; End; Function TfrmSkinCreator.Validate_1To2_Page: Boolean; Begin - Result := False; - - // Validate - If Trim(EditSkinName.Text) = '' Then Begin - Application.MessageBox('Please enter Skin Name', 'Skin Designer', MB_OK + MB_ICONEXCLAMATION + MB_DEFBUTTON1 + MB_APPLMODAL); - EditSkinName.SetFocus; - System.Exit; - End; - - // Cosmetics - FrameImageAdd1.SetVisibleControls(CheckKL.Checked, CheckLayoutViewer.Checked, CheckMouse.Checked, CheckTools.Checked, CheckWeb.Checked, CheckHelp.Checked); - Result := True; + Result := False; + + // Validate + If Trim(EditSkinName.Text) = '' Then + Begin + Application.MessageBox('Please enter Skin Name', 'Skin Designer', + MB_OK + MB_ICONEXCLAMATION + MB_DEFBUTTON1 + MB_APPLMODAL); + EditSkinName.SetFocus; + System.Exit; + End; + + // Cosmetics + FrameImageAdd1.SetVisibleControls(CheckKL.Checked, CheckLayoutViewer.Checked, + CheckMouse.Checked, CheckTools.Checked, CheckWeb.Checked, + CheckHelp.Checked); + Result := True; End; Function TfrmSkinCreator.Validate_2To3_Page: Boolean; Begin - Result := False; - - // Validate - If FrameImageAdd1.Validate = False Then - System.Exit; + Result := False; + // Validate + If FrameImageAdd1.Validate = False Then + System.Exit; - // Load Images - With FrameImageAdd1 Do - FrameDrag1.SetImages(ImagePath_TopBar.Text, AvroIcon.Text, KMSys.Text, KL.Text, LayoutV.Text, AvroMouse.Text, Tools.Text, Web.Text, Help.Text, Exit.Text); + // Load Images + With FrameImageAdd1 Do + FrameDrag1.SetImages(ImagePath_TopBar.Text, AvroIcon.Text, KMSys.Text, + KL.Text, LayoutV.Text, AvroMouse.Text, Tools.Text, Web.Text, Help.Text, + Exit.Text); - Result := True; + Result := True; End; Function TfrmSkinCreator.Validate_3To4_Page: Boolean; Begin - Result := FrameDrag1.Validate; + Result := FrameDrag1.Validate; End; End. diff --git a/Unicode to ascii converter/Unicode_to_Bijoy.dpr b/Unicode to ascii converter/Unicode_to_Bijoy.dpr index d872a9d..20b09c2 100644 --- a/Unicode to ascii converter/Unicode_to_Bijoy.dpr +++ b/Unicode to ascii converter/Unicode_to_Bijoy.dpr @@ -1,25 +1,25 @@ { ============================================================================= ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan . + The Initial Developer of the Original Code is + Mehdi Hasan Khan . - Copyright (C) OmicronLab . All Rights Reserved. + Copyright (C) OmicronLab . All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. ***************************************************************************** ============================================================================= @@ -29,10 +29,11 @@ program Unicode_to_Bijoy; uses Forms, - Unit1 in 'Unit1.pas' {Form1}, + Unit1 in 'Unit1.pas' {Form1} , clsUnicodeToBijoy2000 in 'clsUnicodeToBijoy2000.pas', BanglaChars in '..\Keyboard and Spell checker\Units\BanglaChars.pas', - uFileFolderHandling in '..\Keyboard and Spell checker\Units\uFileFolderHandling.pas'; + uFileFolderHandling + in '..\Keyboard and Spell checker\Units\uFileFolderHandling.pas'; {$R *.res} @@ -42,4 +43,5 @@ begin Application.Title := 'Avro Unicode to Bijoy Converter'; Application.CreateForm(TForm1, Form1); Application.Run; + end. diff --git a/Unicode to ascii converter/Unit1.pas b/Unicode to ascii converter/Unit1.pas index adfd92f..33d9c19 100644 --- a/Unicode to ascii converter/Unit1.pas +++ b/Unicode to ascii converter/Unit1.pas @@ -1,135 +1,133 @@ { - ============================================================================= - ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + ============================================================================= + ***************************************************************************** + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan . + The Initial Developer of the Original Code is + Mehdi Hasan Khan . - Copyright (C) OmicronLab . All Rights Reserved. + Copyright (C) OmicronLab . All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. - ***************************************************************************** - ============================================================================= + ***************************************************************************** + ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - Unit Unit1; Interface Uses - Windows, - Messages, - SysUtils, - Variants, - Classes, - Graphics, - Controls, - Forms, - Dialogs, - StdCtrls, - clsUnicodeToBijoy2000, - ComCtrls; + Windows, + Messages, + SysUtils, + Variants, + Classes, + Graphics, + Controls, + Forms, + Dialogs, + StdCtrls, + clsUnicodeToBijoy2000, + ComCtrls; Type - TForm1 = Class(TForm) - MEMO1: TMemo; - MEMO2: TMemo; - Label1: TLabel; - Button1: TButton; - Progress: TProgressBar; - Label8: TLabel; - Label_OmicronLab: TLabel; - Label4: TLabel; - Procedure FormCreate(Sender: TObject); - Procedure FormClose(Sender: TObject; Var Action: TCloseAction); - Procedure Button1Click(Sender: TObject); - Procedure Label_OmicronLabClick(Sender: TObject); - Private - { Private declarations } - FUniToBijoy: TUnicodeToBijoy2000; - Public - { Public declarations } - End; + TForm1 = Class(TForm) + MEMO1: TMemo; + MEMO2: TMemo; + Label1: TLabel; + Button1: TButton; + Progress: TProgressBar; + Label8: TLabel; + Label_OmicronLab: TLabel; + Label4: TLabel; + Procedure FormCreate(Sender: TObject); + Procedure FormClose(Sender: TObject; Var Action: TCloseAction); + Procedure Button1Click(Sender: TObject); + Procedure Label_OmicronLabClick(Sender: TObject); + Private + { Private declarations } + FUniToBijoy: TUnicodeToBijoy2000; + Public + { Public declarations } + End; Var - Form1: TForm1; + Form1: TForm1; Implementation {$R *.dfm} Uses - uFileFolderHandling; + uFileFolderHandling; { =============================================================================== } Procedure TForm1.Button1Click(Sender: TObject); Var - i, TotalLines: integer; + i, TotalLines: integer; Begin - MEMO1.Enabled := False; - MEMO2.Enabled := False; - Button1.Enabled := False; - Progress.Visible := True; - Progress.Position := 0; - MEMO2.Clear; - application.ProcessMessages; - - TotalLines := MEMO1.Lines.Count; - MEMO2.Lines.BeginUpdate; - For i := 0 To TotalLines - 1 Do Begin - MEMO2.Lines.Add(FUniToBijoy.Convert(MEMO1.Lines[i])); - - Progress.Position := ((i + 1) * 100) Div (TotalLines + 1); - - application.ProcessMessages; - End; - MEMO2.Lines.EndUpdate; - - Progress.Visible := False; - MEMO1.Enabled := True; - MEMO2.Enabled := True; - Button1.Enabled := True; + MEMO1.Enabled := False; + MEMO2.Enabled := False; + Button1.Enabled := False; + Progress.Visible := True; + Progress.Position := 0; + MEMO2.Clear; + application.ProcessMessages; + + TotalLines := MEMO1.Lines.Count; + MEMO2.Lines.BeginUpdate; + For i := 0 To TotalLines - 1 Do + Begin + MEMO2.Lines.Add(FUniToBijoy.Convert(MEMO1.Lines[i])); + + Progress.Position := ((i + 1) * 100) Div (TotalLines + 1); + + application.ProcessMessages; + End; + MEMO2.Lines.EndUpdate; + + Progress.Visible := False; + MEMO1.Enabled := True; + MEMO2.Enabled := True; + Button1.Enabled := True; End; - { =============================================================================== } - Procedure TForm1.FormClose(Sender: TObject; Var Action: TCloseAction); Begin - FUniToBijoy.Free; - Action := caFree; - Form1 := Nil; + FUniToBijoy.Free; + Action := caFree; + Form1 := Nil; End; { =============================================================================== } Procedure TForm1.FormCreate(Sender: TObject); Begin - FUniToBijoy := TUnicodeToBijoy2000.Create; + FUniToBijoy := TUnicodeToBijoy2000.Create; End; { =============================================================================== } Procedure TForm1.Label_OmicronLabClick(Sender: TObject); Begin - Execute_Something('http://www.omicronlab.com'); + Execute_Something('http://www.omicronlab.com'); End; { =============================================================================== } diff --git a/Unicode to ascii converter/clean_files.bat b/Unicode to ascii converter/clean_files.bat new file mode 100644 index 0000000..a78b328 --- /dev/null +++ b/Unicode to ascii converter/clean_files.bat @@ -0,0 +1,10 @@ +del /s /q *.dcu +del /s /q *.dsk +del /s /q *.identcache +del /s /q *.stat +del /s /q *.local +del /s /q *.exe +del /s /q *.~* +rmdir /S /Q backup +rmdir /S /Q __history +rmdir /S /Q __recovery diff --git a/Unicode to ascii converter/clsUnicodeToBijoy2000.pas b/Unicode to ascii converter/clsUnicodeToBijoy2000.pas index 90e2891..5f10815 100644 --- a/Unicode to ascii converter/clsUnicodeToBijoy2000.pas +++ b/Unicode to ascii converter/clsUnicodeToBijoy2000.pas @@ -1,375 +1,387 @@ { - ============================================================================= - ***************************************************************************** - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + ============================================================================= + ***************************************************************************** + The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. - The Original Code is Avro Keyboard 5. + The Original Code is Avro Keyboard 5. - The Initial Developer of the Original Code is - Mehdi Hasan Khan . + The Initial Developer of the Original Code is + Mehdi Hasan Khan . - Copyright (C) OmicronLab . All Rights Reserved. + Copyright (C) OmicronLab . All Rights Reserved. - Contributor(s): ______________________________________. + Contributor(s): ______________________________________. - ***************************************************************************** - ============================================================================= + ***************************************************************************** + ============================================================================= } {$INCLUDE ../ProjectDefines.inc} - Unit clsUnicodeToBijoy2000; Interface Type - TUnicodeToBijoy2000 = Class - Private - fUniText: String; - fConvertedText: String; - Procedure ReArrangeKars; - Procedure ReArrangeReph; - Procedure ReplaceFullForms; - Procedure ReplaceKarsVowels; - Procedure ConvertRFola_ZFola_Hasanta; - Procedure FirstHalfForms; - Procedure SecondHalfForms; - Procedure Consonants; - Procedure FinalTouch; - Procedure DeNormalize; - - // Utility Functions - Function BaseLineRightCharacter(Const wC: String): Boolean; - Function WideStuffString(Source: String; Start, Len: Integer; SubString: String): String; - Public - Function Convert(Const UniText: String): String; - End; + TUnicodeToBijoy2000 = Class + Private + fUniText: String; + fConvertedText: String; + Procedure ReArrangeKars; + Procedure ReArrangeReph; + Procedure ReplaceFullForms; + Procedure ReplaceKarsVowels; + Procedure ConvertRFola_ZFola_Hasanta; + Procedure FirstHalfForms; + Procedure SecondHalfForms; + Procedure Consonants; + Procedure FinalTouch; + Procedure DeNormalize; + + // Utility Functions + Function BaseLineRightCharacter(Const wC: String): Boolean; + Function WideStuffString(Source: String; Start, Len: Integer; + SubString: String): String; + Public + Function Convert(Const UniText: String): String; + End; Implementation Uses - Strutils, - BanglaChars; + Strutils, + BanglaChars; { Bijoy2000 Font Map Constants } Const - { Numbers } - A_0: Char = #$30; - A_1: Char = #$31; - A_2: Char = #$32; - A_3: Char = #$33; - A_4: Char = #$34; - A_5: Char = #$35; - A_6: Char = #$36; - A_7: Char = #$37; - A_8: Char = #$38; - A_9: Char = #$39; - - { Vowels and Kars } - A_A: Char = #$41; - A_AA: String = #$41#$76; - A_AAKar: Char = #$76; - A_I: Char = #$42; - A_IKar: Char = #$77; - A_II: Char = #$43; - A_IIKar: Char = #$78; - A_U: Char = #$44; - A_UKar2: Char = #$79; - A_UKar1: Char = #$7A; - A_UKar3: Char = #$2013; - A_UKar4: Char = #$201C; - A_UU: Char = #$45; - A_UUKar2: Char = #$7E; - A_UUKar1: Char = #$201A; - A_UUKar3: Char = #$192; - A_RRI: Char = #$46; - A_RRIKar1: Char = #$201E; - A_RRIKar2: Char = #$2026; - A_E: Char = #$47; - A_EKar1: Char = #$2020; - A_EKar2: Char = #$2021; - A_OI: Char = #$48; - A_OIKar1: Char = #$2C6; - A_OIKar2: Char = #$2030; - A_O: Char = #$49; - A_OU: Char = #$4A; - A_OUKar: Char = #$160; - - { Symbols } - A_Taka: Char = #$24; - A_Dari: Char = #$7C; - A_DoubleDanda: Char = #$5C; - A_Hasanta: Char = #$26; - A_StartDoubleQuote: Char = #$D2; - A_EndDoubleQuote: Char = #$D3; - - { Consonants } - A_K: Char = #$4B; - A_Kh: Char = #$4C; - A_G: Char = #$4D; - A_Gh: Char = #$4E; - A_NGA: Char = #$4F; - A_C: Char = #$50; - A_Ch: Char = #$51; - A_J: Char = #$52; - A_Jh: Char = #$53; - A_NYA: Char = #$54; - A_Tt: Char = #$55; - A_Tth: Char = #$56; - A_Dd: Char = #$57; - A_Ddh: Char = #$58; - A_Nn: Char = #$59; - A_T: Char = #$5A; - A_Th: Char = #$5F; - A_D: Char = #$60; - A_Dh: Char = #$61; - A_N: Char = #$62; - A_P: Char = #$63; - A_Ph: Char = #$64; - A_B: Char = #$65; - A_Bh: Char = #$66; - A_M: Char = #$67; - A_Z: Char = #$68; - A_R: Char = #$69; - A_L: Char = #$6A; - A_Sh: Char = #$6B; - A_SS: Char = #$6C; - A_S: Char = #$6D; - A_H: Char = #$6E; - A_RR: Char = #$6F; - A_RRH: Char = #$70; - A_Y: Char = #$71; - A_Khandata: Char = #$72; - A_Anushar: Char = #$73; - A_Bisharga: Char = #$74; - A_Chandra: Char = #$75; - - { Full Forms } - A_K_K: Char = #$B0; - A_K_Tt: Char = #$B1; - A_K_Ss_M: Char = #$B2; - A_K_T: Char = #$B3; - A_K_M: Char = #$B4; - A_K_R: Char = #$B5; - A_K_Ss: Char = #$B6; - A_K_S: Char = #$B7; - A_G_Ukar: Char = #$B8; - A_G_G: Char = #$B9; - A_G_D: Char = #$BA; - A_G_Dh: Char = #$BB; - A_NGA_K: Char = #$BC; - A_NGA_G: Char = #$BD; - A_J_J: Char = #$BE; - A_J_Jh: Char = #$C0; - A_J_NYA: Char = #$C1; - A_NYA_C: Char = #$C2; - A_NYA_CH: Char = #$C3; - A_NYA_J: Char = #$C4; - A_NYA_Jh: Char = #$C5; - A_Tt_Tt: Char = #$C6; - A_Dd_Dd: Char = #$C7; - A_Nn_Tt: Char = #$C8; - A_Nn_Tth: Char = #$C9; - A_NN_Dd: Char = #$CA; - A_T_T: Char = #$CB; - A_T_Th: Char = #$CC; - A_T_M: Char = #$CD; - A_T_R: Char = #$CE; - A_D_D: Char = #$CF; - A_D_Dh: Char = #$D7; - A_D_B: Char = #$D8; - A_D_M: Char = #$D9; - A_N_Tth: Char = #$DA; - A_N_Dd: Char = #$DB; - A_N_Dh: Char = #$DC; - A_N_S: Char = #$DD; - A_P_Tt: Char = #$DE; - A_P_T: Char = #$DF; - A_P_P: Char = #$E0; - A_P_S: Char = #$E1; - A_B_J: Char = #$E2; - A_B_D: Char = #$E3; - A_B_Dh: Char = #$E4; - A_Bh_R: Char = #$E5; - A_M_N: Char = #$E6; - A_M_Ph: Char = #$E7; - A_L_K: Char = #$E9; - A_L_G: Char = #$EA; - A_L_Tt: Char = #$EB; - A_L_Dd: Char = #$EC; - A_L_P: Char = #$ED; - A_L_Ph: Char = #$EE; - A_Sh_UKar: Char = #$EF; - A_Sh_C: Char = #$F0; - A_Sh_Ch: Char = #$F1; - A_Ss_Nn: Char = #$F2; - A_Ss_Tt: Char = #$F3; - A_Ss_Tth: Char = #$F4; - A_Ss_Ph: Char = #$F5; - A_S_Kh: Char = #$F6; - A_S_Tt: Char = #$F7; - A_S_N: Char = #$F8; - A_S_Ph: Char = #$F9; - A_H_UKar: Char = #$FB; - A_H_RRIKar: Char = #$FC; - A_H_N: Char = #$FD; - A_H_M: Char = #$FE; - A_Rr_G: Char = #$FF; - - { First Half forms } - A_Reph: Char = #$A9; - A_M_1H: Char = #$A4; - A_Ss_1H: Char = #$AE; - A_S_1H_1: Char = #$AF; - A_N_1H_1: Char = #$161; - A_S_1H_2: Char = #$2C9; // -----------Not used - A_D_1H_1: Char = #$2DC; - A_C_1H: Char = #$201D; - A_NGA_1H: Char = #$2022; - A_N_1H_2: Char = #$203A; - A_D_1H_2: Char = #$2122; - - { Second Half forms } - A_B_2H_1: Char = #$5E; // - A_B_2H_2: Char = #$A1; // - A_BH_2H: Char = #$A2; // - A_BH_R_2H: Char = #$A3; // - A_M_2H_1: Char = #$A5; // - A_B_2H_3: Char = #$A6; // - A_M_2H_2: Char = #$A7; // - A_ZFola: Char = #$A8; // - A_RFola_1: Char = #$AA; // - A_RFola_2: Char = #$AB; // - A_L_2H_1: Char = #$AC; // - A_L_2H_2: Char = #$AD; // - A_T_R_2H: Char = #$BF; // - A_RFola_3: Char = #$D6; // - A_Nn_2H_1: Char = #$E8; - A_K_R_2H: Char = #$152; // - A_Nn_2H_2: Char = #$153; - A_B_2H_4: Char = #$178; // - A_T_2H: Char = #$2014; // - A_T_UKar_2H: Char = #$2018; // - A_Th_2H: Char = #$2019; // - A_K_2H: Char = #$2039; // - A_L_2H_3: Char = #$2212; // ------Not used - - { TUnicodeToBijoy2000 } - { =============================================================================== } + { Numbers } + A_0: Char = #$30; + A_1: Char = #$31; + A_2: Char = #$32; + A_3: Char = #$33; + A_4: Char = #$34; + A_5: Char = #$35; + A_6: Char = #$36; + A_7: Char = #$37; + A_8: Char = #$38; + A_9: Char = #$39; + + { Vowels and Kars } + A_A: Char = #$41; + A_AA: String = #$41#$76; + A_AAKar: Char = #$76; + A_I: Char = #$42; + A_IKar: Char = #$77; + A_II: Char = #$43; + A_IIKar: Char = #$78; + A_U: Char = #$44; + A_UKar2: Char = #$79; + A_UKar1: Char = #$7A; + A_UKar3: Char = #$2013; + A_UKar4: Char = #$201C; + A_UU: Char = #$45; + A_UUKar2: Char = #$7E; + A_UUKar1: Char = #$201A; + A_UUKar3: Char = #$192; + A_RRI: Char = #$46; + A_RRIKar1: Char = #$201E; + A_RRIKar2: Char = #$2026; + A_E: Char = #$47; + A_EKar1: Char = #$2020; + A_EKar2: Char = #$2021; + A_OI: Char = #$48; + A_OIKar1: Char = #$2C6; + A_OIKar2: Char = #$2030; + A_O: Char = #$49; + A_OU: Char = #$4A; + A_OUKar: Char = #$160; + + { Symbols } + A_Taka: Char = #$24; + A_Dari: Char = #$7C; + A_DoubleDanda: Char = #$5C; + A_Hasanta: Char = #$26; + A_StartDoubleQuote: Char = #$D2; + A_EndDoubleQuote: Char = #$D3; + + { Consonants } + A_K: Char = #$4B; + A_Kh: Char = #$4C; + A_G: Char = #$4D; + A_Gh: Char = #$4E; + A_NGA: Char = #$4F; + A_C: Char = #$50; + A_Ch: Char = #$51; + A_J: Char = #$52; + A_Jh: Char = #$53; + A_NYA: Char = #$54; + A_Tt: Char = #$55; + A_Tth: Char = #$56; + A_Dd: Char = #$57; + A_Ddh: Char = #$58; + A_Nn: Char = #$59; + A_T: Char = #$5A; + A_Th: Char = #$5F; + A_D: Char = #$60; + A_Dh: Char = #$61; + A_N: Char = #$62; + A_P: Char = #$63; + A_Ph: Char = #$64; + A_B: Char = #$65; + A_Bh: Char = #$66; + A_M: Char = #$67; + A_Z: Char = #$68; + A_R: Char = #$69; + A_L: Char = #$6A; + A_Sh: Char = #$6B; + A_SS: Char = #$6C; + A_S: Char = #$6D; + A_H: Char = #$6E; + A_RR: Char = #$6F; + A_RRH: Char = #$70; + A_Y: Char = #$71; + A_Khandata: Char = #$72; + A_Anushar: Char = #$73; + A_Bisharga: Char = #$74; + A_Chandra: Char = #$75; + + { Full Forms } + A_K_K: Char = #$B0; + A_K_Tt: Char = #$B1; + A_K_Ss_M: Char = #$B2; + A_K_T: Char = #$B3; + A_K_M: Char = #$B4; + A_K_R: Char = #$B5; + A_K_Ss: Char = #$B6; + A_K_S: Char = #$B7; + A_G_Ukar: Char = #$B8; + A_G_G: Char = #$B9; + A_G_D: Char = #$BA; + A_G_Dh: Char = #$BB; + A_NGA_K: Char = #$BC; + A_NGA_G: Char = #$BD; + A_J_J: Char = #$BE; + A_J_Jh: Char = #$C0; + A_J_NYA: Char = #$C1; + A_NYA_C: Char = #$C2; + A_NYA_CH: Char = #$C3; + A_NYA_J: Char = #$C4; + A_NYA_Jh: Char = #$C5; + A_Tt_Tt: Char = #$C6; + A_Dd_Dd: Char = #$C7; + A_Nn_Tt: Char = #$C8; + A_Nn_Tth: Char = #$C9; + A_NN_Dd: Char = #$CA; + A_T_T: Char = #$CB; + A_T_Th: Char = #$CC; + A_T_M: Char = #$CD; + A_T_R: Char = #$CE; + A_D_D: Char = #$CF; + A_D_Dh: Char = #$D7; + A_D_B: Char = #$D8; + A_D_M: Char = #$D9; + A_N_Tth: Char = #$DA; + A_N_Dd: Char = #$DB; + A_N_Dh: Char = #$DC; + A_N_S: Char = #$DD; + A_P_Tt: Char = #$DE; + A_P_T: Char = #$DF; + A_P_P: Char = #$E0; + A_P_S: Char = #$E1; + A_B_J: Char = #$E2; + A_B_D: Char = #$E3; + A_B_Dh: Char = #$E4; + A_Bh_R: Char = #$E5; + A_M_N: Char = #$E6; + A_M_Ph: Char = #$E7; + A_L_K: Char = #$E9; + A_L_G: Char = #$EA; + A_L_Tt: Char = #$EB; + A_L_Dd: Char = #$EC; + A_L_P: Char = #$ED; + A_L_Ph: Char = #$EE; + A_Sh_UKar: Char = #$EF; + A_Sh_C: Char = #$F0; + A_Sh_Ch: Char = #$F1; + A_Ss_Nn: Char = #$F2; + A_Ss_Tt: Char = #$F3; + A_Ss_Tth: Char = #$F4; + A_Ss_Ph: Char = #$F5; + A_S_Kh: Char = #$F6; + A_S_Tt: Char = #$F7; + A_S_N: Char = #$F8; + A_S_Ph: Char = #$F9; + A_H_UKar: Char = #$FB; + A_H_RRIKar: Char = #$FC; + A_H_N: Char = #$FD; + A_H_M: Char = #$FE; + A_Rr_G: Char = #$FF; + + { First Half forms } + A_Reph: Char = #$A9; + A_M_1H: Char = #$A4; + A_Ss_1H: Char = #$AE; + A_S_1H_1: Char = #$AF; + A_N_1H_1: Char = #$161; + A_S_1H_2: Char = #$2C9; // -----------Not used + A_D_1H_1: Char = #$2DC; + A_C_1H: Char = #$201D; + A_NGA_1H: Char = #$2022; + A_N_1H_2: Char = #$203A; + A_D_1H_2: Char = #$2122; + + { Second Half forms } + A_B_2H_1: Char = #$5E; // + A_B_2H_2: Char = #$A1; // + A_BH_2H: Char = #$A2; // + A_BH_R_2H: Char = #$A3; // + A_M_2H_1: Char = #$A5; // + A_B_2H_3: Char = #$A6; // + A_M_2H_2: Char = #$A7; // + A_ZFola: Char = #$A8; // + A_RFola_1: Char = #$AA; // + A_RFola_2: Char = #$AB; // + A_L_2H_1: Char = #$AC; // + A_L_2H_2: Char = #$AD; // + A_T_R_2H: Char = #$BF; // + A_RFola_3: Char = #$D6; // + A_Nn_2H_1: Char = #$E8; + A_K_R_2H: Char = #$152; // + A_Nn_2H_2: Char = #$153; + A_B_2H_4: Char = #$178; // + A_T_2H: Char = #$2014; // + A_T_UKar_2H: Char = #$2018; // + A_Th_2H: Char = #$2019; // + A_K_2H: Char = #$2039; // + A_L_2H_3: Char = #$2212; // ------Not used + + { TUnicodeToBijoy2000 } + { =============================================================================== } Procedure TUnicodeToBijoy2000.SecondHalfForms; Var - I: Integer; - wT: String; + I: Integer; + wT: String; Begin - { A_BH_2H } - fConvertedText := ReplaceStr(fConvertedText, b_Hasanta + b_Bh, A_BH_2H); - { A_T_2H } - fConvertedText := ReplaceStr(fConvertedText, b_Hasanta + b_t, A_T_2H); - { A_Th_2H } - fConvertedText := ReplaceStr(fConvertedText, b_Hasanta + b_Th, A_Th_2H); - { A_K_2H } - fConvertedText := ReplaceStr(fConvertedText, b_Hasanta + b_K, A_K_2H); - - { A_B_2H_1, A_B_2H_2, A_B_2H_3, A_B_2H_4 } - Repeat - I := Pos(b_Hasanta + b_b, fConvertedText); - If I <= 0 Then - break; - wT := MidStr(fConvertedText, I - 1, 1); - - If ((wT = b_s) Or (wT = b_ss) Or (wT = b_m) Or (wT = b_n) Or (wT = b_d) Or (wT = A_M_1H) Or (wT = A_Ss_1H) Or (wT = A_S_1H_1) Or (wT = A_N_1H_1) Or (wT = A_D_1H_2)) Then - fConvertedText := WideStuffString(fConvertedText, I, 2, A_B_2H_1) - Else If ((wT = b_dh) Or (wT = b_b) Or (wT = b_h)) Then - fConvertedText := WideStuffString(fConvertedText, I, 2, A_B_2H_4) - Else If ((wT = b_sh) Or (wT = b_g) Or (wT = b_p)) Then - fConvertedText := WideStuffString(fConvertedText, I, 2, A_B_2H_3) - Else - fConvertedText := WideStuffString(fConvertedText, I, 2, A_B_2H_2); - Until I <= 0; - - { A_M_2H_1 and A_M_2H_2 } - Repeat - I := Pos(b_Hasanta + b_m, fConvertedText); - If I <= 0 Then - break; - wT := MidStr(fConvertedText, I - 1, 1); - If ((wT = A_M_1H) Or (wT = A_Ss_1H) Or (wT = A_C_1H) Or (wT = A_S_1H_1) Or (wT = A_D_1H_2) Or (wT = A_N_1H_1) Or (wT = A_N_1H_2)) Then - fConvertedText := WideStuffString(fConvertedText, I, 2, A_M_2H_2) - Else If wT = A_NGA_1H Then - fConvertedText := WideStuffString(fConvertedText, I, 2, A_M) - Else - fConvertedText := WideStuffString(fConvertedText, I, 2, A_M_2H_1); - Until I <= 0; - - { A_L_2H_1 and A_L_2H_2 } - Repeat - I := Pos(b_Hasanta + b_L, fConvertedText); - If I <= 0 Then - break; - wT := MidStr(fConvertedText, I - 1, 1); - If BaseLineRightCharacter(wT) Then - fConvertedText := WideStuffString(fConvertedText, I, 2, A_L_2H_2) - Else - fConvertedText := WideStuffString(fConvertedText, I, 2, A_L_2H_1); - Until I <= 0; - - { A_Nn_2H_1 } - fConvertedText := ReplaceStr(fConvertedText, b_Hasanta + b_Nn, A_Nn_2H_1); - { A_Nn_2H_2 } - fConvertedText := ReplaceStr(fConvertedText, b_Hasanta + b_n, A_Nn_2H_2); + { A_BH_2H } + fConvertedText := ReplaceStr(fConvertedText, b_Hasanta + b_Bh, A_BH_2H); + { A_T_2H } + fConvertedText := ReplaceStr(fConvertedText, b_Hasanta + b_t, A_T_2H); + { A_Th_2H } + fConvertedText := ReplaceStr(fConvertedText, b_Hasanta + b_Th, A_Th_2H); + { A_K_2H } + fConvertedText := ReplaceStr(fConvertedText, b_Hasanta + b_K, A_K_2H); + + { A_B_2H_1, A_B_2H_2, A_B_2H_3, A_B_2H_4 } + Repeat + I := Pos(b_Hasanta + b_b, fConvertedText); + If I <= 0 Then + break; + wT := MidStr(fConvertedText, I - 1, 1); + + If ((wT = b_s) Or (wT = b_ss) Or (wT = b_m) Or (wT = b_n) Or (wT = b_d) Or + (wT = A_M_1H) Or (wT = A_Ss_1H) Or (wT = A_S_1H_1) Or (wT = A_N_1H_1) Or + (wT = A_D_1H_2)) Then + fConvertedText := WideStuffString(fConvertedText, I, 2, A_B_2H_1) + Else If ((wT = b_dh) Or (wT = b_b) Or (wT = b_h)) Then + fConvertedText := WideStuffString(fConvertedText, I, 2, A_B_2H_4) + Else If ((wT = b_sh) Or (wT = b_g) Or (wT = b_p)) Then + fConvertedText := WideStuffString(fConvertedText, I, 2, A_B_2H_3) + Else + fConvertedText := WideStuffString(fConvertedText, I, 2, A_B_2H_2); + Until I <= 0; + + { A_M_2H_1 and A_M_2H_2 } + Repeat + I := Pos(b_Hasanta + b_m, fConvertedText); + If I <= 0 Then + break; + wT := MidStr(fConvertedText, I - 1, 1); + If ((wT = A_M_1H) Or (wT = A_Ss_1H) Or (wT = A_C_1H) Or (wT = A_S_1H_1) Or + (wT = A_D_1H_2) Or (wT = A_N_1H_1) Or (wT = A_N_1H_2)) Then + fConvertedText := WideStuffString(fConvertedText, I, 2, A_M_2H_2) + Else If wT = A_NGA_1H Then + fConvertedText := WideStuffString(fConvertedText, I, 2, A_M) + Else + fConvertedText := WideStuffString(fConvertedText, I, 2, A_M_2H_1); + Until I <= 0; + + { A_L_2H_1 and A_L_2H_2 } + Repeat + I := Pos(b_Hasanta + b_L, fConvertedText); + If I <= 0 Then + break; + wT := MidStr(fConvertedText, I - 1, 1); + If BaseLineRightCharacter(wT) Then + fConvertedText := WideStuffString(fConvertedText, I, 2, A_L_2H_2) + Else + fConvertedText := WideStuffString(fConvertedText, I, 2, A_L_2H_1); + Until I <= 0; + + { A_Nn_2H_1 } + fConvertedText := ReplaceStr(fConvertedText, b_Hasanta + b_Nn, A_Nn_2H_1); + { A_Nn_2H_2 } + fConvertedText := ReplaceStr(fConvertedText, b_Hasanta + b_n, A_Nn_2H_2); End; { =============================================================================== } Procedure TUnicodeToBijoy2000.FirstHalfForms; Var - I: Integer; + I: Integer; Begin - { A_M_1H } - fConvertedText := ReplaceStr(fConvertedText, b_m + b_Hasanta, A_M_1H + b_Hasanta); - { A_Ss_1H } - fConvertedText := ReplaceStr(fConvertedText, b_ss + b_Hasanta, A_Ss_1H + b_Hasanta); - { A_C_1H } - fConvertedText := ReplaceStr(fConvertedText, b_C + b_Hasanta, A_C_1H + b_Hasanta); - { A_NGA_1H } - fConvertedText := ReplaceStr(fConvertedText, b_NGA + b_Hasanta, A_NGA_1H + b_Hasanta); - { A_S_1H_1 } - fConvertedText := ReplaceStr(fConvertedText, b_s + b_Hasanta, A_S_1H_1 + b_Hasanta); - - { A_D_1H_1 and A_D_1H_2 } - Repeat - I := Pos(b_d + b_Hasanta, fConvertedText); - If I <= 0 Then - break; - If MidStr(fConvertedText, I + 2, 1) = b_g Then - fConvertedText[I] := A_D_1H_1 - Else - fConvertedText[I] := A_D_1H_2; - Until I <= 0; - - { A_N_1H_1 AND A_N_1H_2 } - Repeat - I := Pos(b_n + b_Hasanta, fConvertedText); - If I <= 0 Then - break; - If ((MidStr(fConvertedText, I + 2, 1) = b_t) Or (MidStr(fConvertedText, I + 2, 1) = b_Th) Or (MidStr(fConvertedText, I + 2, 1) = b_L) Or (MidStr(fConvertedText, I + 2, 1) = b_b) Or (MidStr(fConvertedText, I + 2, 1) = A_T_R_2H) Or - (MidStr(fConvertedText, I + 2, 1) = A_T_UKar_2H)) Then - fConvertedText[I] := A_N_1H_1 - Else If (MidStr(fConvertedText, I + 2, 1) = b_m) Or (MidStr(fConvertedText, I + 2, 1) = b_n) Then - fConvertedText[I] := A_N - Else - fConvertedText[I] := A_N_1H_2; - Until I <= 0; + { A_M_1H } + fConvertedText := ReplaceStr(fConvertedText, b_m + b_Hasanta, + A_M_1H + b_Hasanta); + { A_Ss_1H } + fConvertedText := ReplaceStr(fConvertedText, b_ss + b_Hasanta, + A_Ss_1H + b_Hasanta); + { A_C_1H } + fConvertedText := ReplaceStr(fConvertedText, b_C + b_Hasanta, + A_C_1H + b_Hasanta); + { A_NGA_1H } + fConvertedText := ReplaceStr(fConvertedText, b_NGA + b_Hasanta, + A_NGA_1H + b_Hasanta); + { A_S_1H_1 } + fConvertedText := ReplaceStr(fConvertedText, b_s + b_Hasanta, + A_S_1H_1 + b_Hasanta); + + { A_D_1H_1 and A_D_1H_2 } + Repeat + I := Pos(b_d + b_Hasanta, fConvertedText); + If I <= 0 Then + break; + If MidStr(fConvertedText, I + 2, 1) = b_g Then + fConvertedText[I] := A_D_1H_1 + Else + fConvertedText[I] := A_D_1H_2; + Until I <= 0; + + { A_N_1H_1 AND A_N_1H_2 } + Repeat + I := Pos(b_n + b_Hasanta, fConvertedText); + If I <= 0 Then + break; + If ((MidStr(fConvertedText, I + 2, 1) = b_t) Or + (MidStr(fConvertedText, I + 2, 1) = b_Th) Or + (MidStr(fConvertedText, I + 2, 1) = b_L) Or (MidStr(fConvertedText, I + 2, + 1) = b_b) Or (MidStr(fConvertedText, I + 2, 1) = A_T_R_2H) Or + (MidStr(fConvertedText, I + 2, 1) = A_T_UKar_2H)) Then + fConvertedText[I] := A_N_1H_1 + Else If (MidStr(fConvertedText, I + 2, 1) = b_m) Or + (MidStr(fConvertedText, I + 2, 1) = b_n) Then + fConvertedText[I] := A_N + Else + fConvertedText[I] := A_N_1H_2; + Until I <= 0; End; @@ -377,146 +389,165 @@ Procedure TUnicodeToBijoy2000.Consonants; Begin - fConvertedText := ReplaceStr(fConvertedText, b_K, A_K); - fConvertedText := ReplaceStr(fConvertedText, b_kh, A_Kh); - fConvertedText := ReplaceStr(fConvertedText, b_g, A_G); - fConvertedText := ReplaceStr(fConvertedText, b_gh, A_Gh); - fConvertedText := ReplaceStr(fConvertedText, b_NGA, A_NGA); - fConvertedText := ReplaceStr(fConvertedText, b_C, A_C); - fConvertedText := ReplaceStr(fConvertedText, b_ch, A_Ch); - fConvertedText := ReplaceStr(fConvertedText, b_j, A_J); - fConvertedText := ReplaceStr(fConvertedText, b_jh, A_Jh); - fConvertedText := ReplaceStr(fConvertedText, b_nya, A_NYA); - fConvertedText := ReplaceStr(fConvertedText, b_tt, A_Tt); - fConvertedText := ReplaceStr(fConvertedText, b_tth, A_Tth); - fConvertedText := ReplaceStr(fConvertedText, b_dd, A_Dd); - fConvertedText := ReplaceStr(fConvertedText, b_ddh, A_Ddh); - fConvertedText := ReplaceStr(fConvertedText, b_Nn, A_Nn); - fConvertedText := ReplaceStr(fConvertedText, b_t, A_T); - fConvertedText := ReplaceStr(fConvertedText, b_Th, A_Th); - fConvertedText := ReplaceStr(fConvertedText, b_d, A_D); - fConvertedText := ReplaceStr(fConvertedText, b_dh, A_Dh); - fConvertedText := ReplaceStr(fConvertedText, b_n, A_N); - fConvertedText := ReplaceStr(fConvertedText, b_p, A_P); - fConvertedText := ReplaceStr(fConvertedText, b_ph, A_Ph); - fConvertedText := ReplaceStr(fConvertedText, b_b, A_B); - fConvertedText := ReplaceStr(fConvertedText, b_Bh, A_Bh); - fConvertedText := ReplaceStr(fConvertedText, b_m, A_M); - fConvertedText := ReplaceStr(fConvertedText, b_z, A_Z); - fConvertedText := ReplaceStr(fConvertedText, b_r, A_R); - fConvertedText := ReplaceStr(fConvertedText, b_L, A_L); - fConvertedText := ReplaceStr(fConvertedText, b_sh, A_Sh); - fConvertedText := ReplaceStr(fConvertedText, b_ss, A_SS); - fConvertedText := ReplaceStr(fConvertedText, b_s, A_S); - fConvertedText := ReplaceStr(fConvertedText, b_h, A_H); - fConvertedText := ReplaceStr(fConvertedText, b_y, A_Y); - fConvertedText := ReplaceStr(fConvertedText, b_rr, A_RR); - fConvertedText := ReplaceStr(fConvertedText, b_rrh, A_RRH); + fConvertedText := ReplaceStr(fConvertedText, b_K, A_K); + fConvertedText := ReplaceStr(fConvertedText, b_kh, A_Kh); + fConvertedText := ReplaceStr(fConvertedText, b_g, A_G); + fConvertedText := ReplaceStr(fConvertedText, b_gh, A_Gh); + fConvertedText := ReplaceStr(fConvertedText, b_NGA, A_NGA); + fConvertedText := ReplaceStr(fConvertedText, b_C, A_C); + fConvertedText := ReplaceStr(fConvertedText, b_ch, A_Ch); + fConvertedText := ReplaceStr(fConvertedText, b_j, A_J); + fConvertedText := ReplaceStr(fConvertedText, b_jh, A_Jh); + fConvertedText := ReplaceStr(fConvertedText, b_nya, A_NYA); + fConvertedText := ReplaceStr(fConvertedText, b_tt, A_Tt); + fConvertedText := ReplaceStr(fConvertedText, b_tth, A_Tth); + fConvertedText := ReplaceStr(fConvertedText, b_dd, A_Dd); + fConvertedText := ReplaceStr(fConvertedText, b_ddh, A_Ddh); + fConvertedText := ReplaceStr(fConvertedText, b_Nn, A_Nn); + fConvertedText := ReplaceStr(fConvertedText, b_t, A_T); + fConvertedText := ReplaceStr(fConvertedText, b_Th, A_Th); + fConvertedText := ReplaceStr(fConvertedText, b_d, A_D); + fConvertedText := ReplaceStr(fConvertedText, b_dh, A_Dh); + fConvertedText := ReplaceStr(fConvertedText, b_n, A_N); + fConvertedText := ReplaceStr(fConvertedText, b_p, A_P); + fConvertedText := ReplaceStr(fConvertedText, b_ph, A_Ph); + fConvertedText := ReplaceStr(fConvertedText, b_b, A_B); + fConvertedText := ReplaceStr(fConvertedText, b_Bh, A_Bh); + fConvertedText := ReplaceStr(fConvertedText, b_m, A_M); + fConvertedText := ReplaceStr(fConvertedText, b_z, A_Z); + fConvertedText := ReplaceStr(fConvertedText, b_r, A_R); + fConvertedText := ReplaceStr(fConvertedText, b_L, A_L); + fConvertedText := ReplaceStr(fConvertedText, b_sh, A_Sh); + fConvertedText := ReplaceStr(fConvertedText, b_ss, A_SS); + fConvertedText := ReplaceStr(fConvertedText, b_s, A_S); + fConvertedText := ReplaceStr(fConvertedText, b_h, A_H); + fConvertedText := ReplaceStr(fConvertedText, b_y, A_Y); + fConvertedText := ReplaceStr(fConvertedText, b_rr, A_RR); + fConvertedText := ReplaceStr(fConvertedText, b_rrh, A_RRH); End; { =============================================================================== } Procedure TUnicodeToBijoy2000.FinalTouch; Begin - fConvertedText := ReplaceStr(fConvertedText, b_Hasanta, ''); - fConvertedText := ReplaceStr(fConvertedText, zwj, ''); - fConvertedText := ReplaceStr(fConvertedText, zwnj, ''); - // Warning: Hardcoded conversion - fConvertedText := ReplaceStr(fConvertedText, 'nè', 'nœ'); - fConvertedText := ReplaceStr(fConvertedText, 'Kœ', 'Kè'); - fConvertedText := ReplaceStr(fConvertedText, '¶y', '¶z'); - fConvertedText := ReplaceStr(fConvertedText, 'Rz', 'Ry'); - fConvertedText := ReplaceStr(fConvertedText, 'R‚', 'R~'); - fConvertedText := ReplaceStr(fConvertedText, 'R…', 'R„'); + fConvertedText := ReplaceStr(fConvertedText, b_Hasanta, ''); + fConvertedText := ReplaceStr(fConvertedText, zwj, ''); + fConvertedText := ReplaceStr(fConvertedText, zwnj, ''); + // Warning: Hardcoded conversion + fConvertedText := ReplaceStr(fConvertedText, 'nè', 'nœ'); + fConvertedText := ReplaceStr(fConvertedText, 'Kœ', 'Kè'); + fConvertedText := ReplaceStr(fConvertedText, '¶y', '¶z'); + fConvertedText := ReplaceStr(fConvertedText, 'Rz', 'Ry'); + fConvertedText := ReplaceStr(fConvertedText, 'R‚', 'R~'); + fConvertedText := ReplaceStr(fConvertedText, 'R…', 'R„'); End; Procedure TUnicodeToBijoy2000.ReplaceFullForms; Begin - { Replace Numbers } - fConvertedText := ReplaceStr(fConvertedText, b_0, A_0); - fConvertedText := ReplaceStr(fConvertedText, b_1, A_1); - fConvertedText := ReplaceStr(fConvertedText, b_2, A_2); - fConvertedText := ReplaceStr(fConvertedText, b_3, A_3); - fConvertedText := ReplaceStr(fConvertedText, b_4, A_4); - fConvertedText := ReplaceStr(fConvertedText, b_5, A_5); - fConvertedText := ReplaceStr(fConvertedText, b_6, A_6); - fConvertedText := ReplaceStr(fConvertedText, b_7, A_7); - fConvertedText := ReplaceStr(fConvertedText, b_8, A_8); - fConvertedText := ReplaceStr(fConvertedText, b_9, A_9); - - { Replace Symbols } - fConvertedText := ReplaceStr(fConvertedText, b_Taka, A_Taka); - fConvertedText := ReplaceStr(fConvertedText, b_Dari, A_Dari); - fConvertedText := ReplaceStr(fConvertedText, String(#$965), A_DoubleDanda); - - { Replace Other Full Forms } - fConvertedText := ReplaceStr(fConvertedText, b_Khandatta, A_Khandata); - fConvertedText := ReplaceStr(fConvertedText, b_Anushar, A_Anushar); - fConvertedText := ReplaceStr(fConvertedText, b_Bisharga, A_Bisharga); - fConvertedText := ReplaceStr(fConvertedText, b_Chandra, A_Chandra); - fConvertedText := ReplaceStr(fConvertedText, b_K + b_Hasanta + b_K, A_K_K); - fConvertedText := ReplaceStr(fConvertedText, b_K + b_Hasanta + b_tt, A_K_Tt); - fConvertedText := ReplaceStr(fConvertedText, b_K + b_Hasanta + b_ss + b_Hasanta + b_m, A_K_Ss_M); - fConvertedText := ReplaceStr(fConvertedText, b_K + b_Hasanta + b_t, A_K_T); - fConvertedText := ReplaceStr(fConvertedText, b_K + b_Hasanta + b_m, A_K_M); - fConvertedText := ReplaceStr(fConvertedText, b_K + b_Hasanta + b_ss, A_K_Ss); - fConvertedText := ReplaceStr(fConvertedText, b_K + b_Hasanta + b_s, A_K_S); - fConvertedText := ReplaceStr(fConvertedText, b_g + b_Hasanta + b_g, A_G_G); - fConvertedText := ReplaceStr(fConvertedText, b_g + b_Hasanta + b_d, A_G_D); - fConvertedText := ReplaceStr(fConvertedText, b_g + b_Hasanta + b_dh, A_G_Dh); - fConvertedText := ReplaceStr(fConvertedText, b_NGA + b_Hasanta + b_K, A_NGA_K); - fConvertedText := ReplaceStr(fConvertedText, b_NGA + b_Hasanta + b_g, A_NGA_G); - fConvertedText := ReplaceStr(fConvertedText, b_j + b_Hasanta + b_j, A_J_J); - fConvertedText := ReplaceStr(fConvertedText, b_j + b_Hasanta + b_jh, A_J_Jh); - fConvertedText := ReplaceStr(fConvertedText, b_j + b_Hasanta + b_nya, A_J_NYA); - fConvertedText := ReplaceStr(fConvertedText, b_nya + b_Hasanta + b_C, A_NYA_C); - fConvertedText := ReplaceStr(fConvertedText, b_nya + b_Hasanta + b_ch, A_NYA_CH); - fConvertedText := ReplaceStr(fConvertedText, b_nya + b_Hasanta + b_j, A_NYA_J); - fConvertedText := ReplaceStr(fConvertedText, b_nya + b_Hasanta + b_jh, A_NYA_Jh); - fConvertedText := ReplaceStr(fConvertedText, b_tt + b_Hasanta + b_tt, A_Tt_Tt); - fConvertedText := ReplaceStr(fConvertedText, b_dd + b_Hasanta + b_dd, A_Dd_Dd); - fConvertedText := ReplaceStr(fConvertedText, b_Nn + b_Hasanta + b_tt, A_Nn_Tt); - fConvertedText := ReplaceStr(fConvertedText, b_Nn + b_Hasanta + b_tth, A_Nn_Tth); - fConvertedText := ReplaceStr(fConvertedText, b_Nn + b_Hasanta + b_dd, A_NN_Dd); - fConvertedText := ReplaceStr(fConvertedText, b_t + b_Hasanta + b_t, A_T_T); - fConvertedText := ReplaceStr(fConvertedText, b_t + b_Hasanta + b_Th, A_T_Th); - fConvertedText := ReplaceStr(fConvertedText, b_t + b_Hasanta + b_m, A_T_M); - fConvertedText := ReplaceStr(fConvertedText, b_d + b_Hasanta + b_d, A_D_D); - fConvertedText := ReplaceStr(fConvertedText, b_d + b_Hasanta + b_dh, A_D_Dh); - fConvertedText := ReplaceStr(fConvertedText, b_d + b_Hasanta + b_b, A_D_B); - fConvertedText := ReplaceStr(fConvertedText, b_d + b_Hasanta + b_m, A_D_M); - fConvertedText := ReplaceStr(fConvertedText, b_n + b_Hasanta + b_tth, A_N_Tth); - fConvertedText := ReplaceStr(fConvertedText, b_n + b_Hasanta + b_dd, A_N_Dd); - fConvertedText := ReplaceStr(fConvertedText, b_n + b_Hasanta + b_dh, A_N_Dh); - fConvertedText := ReplaceStr(fConvertedText, b_n + b_Hasanta + b_s, A_N_S); - fConvertedText := ReplaceStr(fConvertedText, b_p + b_Hasanta + b_tt, A_P_Tt); - fConvertedText := ReplaceStr(fConvertedText, b_p + b_Hasanta + b_t, A_P_T); - fConvertedText := ReplaceStr(fConvertedText, b_p + b_Hasanta + b_p, A_P_P); - fConvertedText := ReplaceStr(fConvertedText, b_p + b_Hasanta + b_s, A_P_S); - fConvertedText := ReplaceStr(fConvertedText, b_b + b_Hasanta + b_j, A_B_J); - fConvertedText := ReplaceStr(fConvertedText, b_b + b_Hasanta + b_d, A_B_D); - fConvertedText := ReplaceStr(fConvertedText, b_b + b_Hasanta + b_dh, A_B_Dh); - fConvertedText := ReplaceStr(fConvertedText, b_m + b_Hasanta + b_n, A_M_N); - fConvertedText := ReplaceStr(fConvertedText, b_m + b_Hasanta + b_ph, A_M_Ph); - fConvertedText := ReplaceStr(fConvertedText, b_L + b_Hasanta + b_K, A_L_K); - fConvertedText := ReplaceStr(fConvertedText, b_L + b_Hasanta + b_g, A_L_G); - fConvertedText := ReplaceStr(fConvertedText, b_L + b_Hasanta + b_tt, A_L_Tt); - fConvertedText := ReplaceStr(fConvertedText, b_L + b_Hasanta + b_dd, A_L_Dd); - fConvertedText := ReplaceStr(fConvertedText, b_L + b_Hasanta + b_p, A_L_P); - fConvertedText := ReplaceStr(fConvertedText, b_L + b_Hasanta + b_ph, A_L_Ph); - fConvertedText := ReplaceStr(fConvertedText, b_sh + b_Hasanta + b_C, A_Sh_C); - fConvertedText := ReplaceStr(fConvertedText, b_sh + b_Hasanta + b_ch, A_Sh_Ch); - fConvertedText := ReplaceStr(fConvertedText, b_ss + b_Hasanta + b_Nn, A_Ss_Nn); - fConvertedText := ReplaceStr(fConvertedText, b_ss + b_Hasanta + b_tt, A_Ss_Tt); - fConvertedText := ReplaceStr(fConvertedText, b_ss + b_Hasanta + b_tth, A_Ss_Tth); - fConvertedText := ReplaceStr(fConvertedText, b_ss + b_Hasanta + b_ph, A_Ss_Ph); - fConvertedText := ReplaceStr(fConvertedText, b_s + b_Hasanta + b_kh, A_S_Kh); - fConvertedText := ReplaceStr(fConvertedText, b_s + b_Hasanta + b_tt, A_S_Tt); - fConvertedText := ReplaceStr(fConvertedText, b_s + b_Hasanta + b_n, A_S_N); - fConvertedText := ReplaceStr(fConvertedText, b_s + b_Hasanta + b_ph, A_S_Ph); - fConvertedText := ReplaceStr(fConvertedText, b_h + b_Hasanta + b_n, A_H_N); - fConvertedText := ReplaceStr(fConvertedText, b_h + b_Hasanta + b_m, A_H_M); - fConvertedText := ReplaceStr(fConvertedText, b_rr + b_Hasanta + b_g, A_Rr_G); + { Replace Numbers } + fConvertedText := ReplaceStr(fConvertedText, b_0, A_0); + fConvertedText := ReplaceStr(fConvertedText, b_1, A_1); + fConvertedText := ReplaceStr(fConvertedText, b_2, A_2); + fConvertedText := ReplaceStr(fConvertedText, b_3, A_3); + fConvertedText := ReplaceStr(fConvertedText, b_4, A_4); + fConvertedText := ReplaceStr(fConvertedText, b_5, A_5); + fConvertedText := ReplaceStr(fConvertedText, b_6, A_6); + fConvertedText := ReplaceStr(fConvertedText, b_7, A_7); + fConvertedText := ReplaceStr(fConvertedText, b_8, A_8); + fConvertedText := ReplaceStr(fConvertedText, b_9, A_9); + + { Replace Symbols } + fConvertedText := ReplaceStr(fConvertedText, b_Taka, A_Taka); + fConvertedText := ReplaceStr(fConvertedText, b_Dari, A_Dari); + fConvertedText := ReplaceStr(fConvertedText, String(#$965), A_DoubleDanda); + + { Replace Other Full Forms } + fConvertedText := ReplaceStr(fConvertedText, b_Khandatta, A_Khandata); + fConvertedText := ReplaceStr(fConvertedText, b_Anushar, A_Anushar); + fConvertedText := ReplaceStr(fConvertedText, b_Bisharga, A_Bisharga); + fConvertedText := ReplaceStr(fConvertedText, b_Chandra, A_Chandra); + fConvertedText := ReplaceStr(fConvertedText, b_K + b_Hasanta + b_K, A_K_K); + fConvertedText := ReplaceStr(fConvertedText, b_K + b_Hasanta + b_tt, A_K_Tt); + fConvertedText := ReplaceStr(fConvertedText, b_K + b_Hasanta + b_ss + + b_Hasanta + b_m, A_K_Ss_M); + fConvertedText := ReplaceStr(fConvertedText, b_K + b_Hasanta + b_t, A_K_T); + fConvertedText := ReplaceStr(fConvertedText, b_K + b_Hasanta + b_m, A_K_M); + fConvertedText := ReplaceStr(fConvertedText, b_K + b_Hasanta + b_ss, A_K_Ss); + fConvertedText := ReplaceStr(fConvertedText, b_K + b_Hasanta + b_s, A_K_S); + fConvertedText := ReplaceStr(fConvertedText, b_g + b_Hasanta + b_g, A_G_G); + fConvertedText := ReplaceStr(fConvertedText, b_g + b_Hasanta + b_d, A_G_D); + fConvertedText := ReplaceStr(fConvertedText, b_g + b_Hasanta + b_dh, A_G_Dh); + fConvertedText := ReplaceStr(fConvertedText, b_NGA + b_Hasanta + b_K, + A_NGA_K); + fConvertedText := ReplaceStr(fConvertedText, b_NGA + b_Hasanta + b_g, + A_NGA_G); + fConvertedText := ReplaceStr(fConvertedText, b_j + b_Hasanta + b_j, A_J_J); + fConvertedText := ReplaceStr(fConvertedText, b_j + b_Hasanta + b_jh, A_J_Jh); + fConvertedText := ReplaceStr(fConvertedText, b_j + b_Hasanta + b_nya, + A_J_NYA); + fConvertedText := ReplaceStr(fConvertedText, b_nya + b_Hasanta + b_C, + A_NYA_C); + fConvertedText := ReplaceStr(fConvertedText, b_nya + b_Hasanta + b_ch, + A_NYA_CH); + fConvertedText := ReplaceStr(fConvertedText, b_nya + b_Hasanta + b_j, + A_NYA_J); + fConvertedText := ReplaceStr(fConvertedText, b_nya + b_Hasanta + b_jh, + A_NYA_Jh); + fConvertedText := ReplaceStr(fConvertedText, b_tt + b_Hasanta + b_tt, + A_Tt_Tt); + fConvertedText := ReplaceStr(fConvertedText, b_dd + b_Hasanta + b_dd, + A_Dd_Dd); + fConvertedText := ReplaceStr(fConvertedText, b_Nn + b_Hasanta + b_tt, + A_Nn_Tt); + fConvertedText := ReplaceStr(fConvertedText, b_Nn + b_Hasanta + b_tth, + A_Nn_Tth); + fConvertedText := ReplaceStr(fConvertedText, b_Nn + b_Hasanta + b_dd, + A_NN_Dd); + fConvertedText := ReplaceStr(fConvertedText, b_t + b_Hasanta + b_t, A_T_T); + fConvertedText := ReplaceStr(fConvertedText, b_t + b_Hasanta + b_Th, A_T_Th); + fConvertedText := ReplaceStr(fConvertedText, b_t + b_Hasanta + b_m, A_T_M); + fConvertedText := ReplaceStr(fConvertedText, b_d + b_Hasanta + b_d, A_D_D); + fConvertedText := ReplaceStr(fConvertedText, b_d + b_Hasanta + b_dh, A_D_Dh); + fConvertedText := ReplaceStr(fConvertedText, b_d + b_Hasanta + b_b, A_D_B); + fConvertedText := ReplaceStr(fConvertedText, b_d + b_Hasanta + b_m, A_D_M); + fConvertedText := ReplaceStr(fConvertedText, b_n + b_Hasanta + b_tth, + A_N_Tth); + fConvertedText := ReplaceStr(fConvertedText, b_n + b_Hasanta + b_dd, A_N_Dd); + fConvertedText := ReplaceStr(fConvertedText, b_n + b_Hasanta + b_dh, A_N_Dh); + fConvertedText := ReplaceStr(fConvertedText, b_n + b_Hasanta + b_s, A_N_S); + fConvertedText := ReplaceStr(fConvertedText, b_p + b_Hasanta + b_tt, A_P_Tt); + fConvertedText := ReplaceStr(fConvertedText, b_p + b_Hasanta + b_t, A_P_T); + fConvertedText := ReplaceStr(fConvertedText, b_p + b_Hasanta + b_p, A_P_P); + fConvertedText := ReplaceStr(fConvertedText, b_p + b_Hasanta + b_s, A_P_S); + fConvertedText := ReplaceStr(fConvertedText, b_b + b_Hasanta + b_j, A_B_J); + fConvertedText := ReplaceStr(fConvertedText, b_b + b_Hasanta + b_d, A_B_D); + fConvertedText := ReplaceStr(fConvertedText, b_b + b_Hasanta + b_dh, A_B_Dh); + fConvertedText := ReplaceStr(fConvertedText, b_m + b_Hasanta + b_n, A_M_N); + fConvertedText := ReplaceStr(fConvertedText, b_m + b_Hasanta + b_ph, A_M_Ph); + fConvertedText := ReplaceStr(fConvertedText, b_L + b_Hasanta + b_K, A_L_K); + fConvertedText := ReplaceStr(fConvertedText, b_L + b_Hasanta + b_g, A_L_G); + fConvertedText := ReplaceStr(fConvertedText, b_L + b_Hasanta + b_tt, A_L_Tt); + fConvertedText := ReplaceStr(fConvertedText, b_L + b_Hasanta + b_dd, A_L_Dd); + fConvertedText := ReplaceStr(fConvertedText, b_L + b_Hasanta + b_p, A_L_P); + fConvertedText := ReplaceStr(fConvertedText, b_L + b_Hasanta + b_ph, A_L_Ph); + fConvertedText := ReplaceStr(fConvertedText, b_sh + b_Hasanta + b_C, A_Sh_C); + fConvertedText := ReplaceStr(fConvertedText, b_sh + b_Hasanta + b_ch, + A_Sh_Ch); + fConvertedText := ReplaceStr(fConvertedText, b_ss + b_Hasanta + b_Nn, + A_Ss_Nn); + fConvertedText := ReplaceStr(fConvertedText, b_ss + b_Hasanta + b_tt, + A_Ss_Tt); + fConvertedText := ReplaceStr(fConvertedText, b_ss + b_Hasanta + b_tth, + A_Ss_Tth); + fConvertedText := ReplaceStr(fConvertedText, b_ss + b_Hasanta + b_ph, + A_Ss_Ph); + fConvertedText := ReplaceStr(fConvertedText, b_s + b_Hasanta + b_kh, A_S_Kh); + fConvertedText := ReplaceStr(fConvertedText, b_s + b_Hasanta + b_tt, A_S_Tt); + fConvertedText := ReplaceStr(fConvertedText, b_s + b_Hasanta + b_n, A_S_N); + fConvertedText := ReplaceStr(fConvertedText, b_s + b_Hasanta + b_ph, A_S_Ph); + fConvertedText := ReplaceStr(fConvertedText, b_h + b_Hasanta + b_n, A_H_N); + fConvertedText := ReplaceStr(fConvertedText, b_h + b_Hasanta + b_m, A_H_M); + fConvertedText := ReplaceStr(fConvertedText, b_rr + b_Hasanta + b_g, A_Rr_G); End; @@ -524,10 +555,12 @@ Function TUnicodeToBijoy2000.BaseLineRightCharacter(Const wC: String): Boolean; Begin - Result := False; - If (wC = b_kh) Or (wC = b_g) Or (wC = b_gh) Or (wC = b_Nn) Or (wC = b_Th) Or (wC = b_d) Or (wC = b_dh) Or (wC = b_n) Or (wC = b_p) Or (wC = b_b) Or (wC = b_m) Or (wC = b_z) Or (wC = b_r) Or (wC = b_L) Or (wC = b_sh) Or (wC = b_ss) Or (wC = b_s) - Or (wC = b_h) Or (wC = b_y) Then - Result := True; + Result := False; + If (wC = b_kh) Or (wC = b_g) Or (wC = b_gh) Or (wC = b_Nn) Or (wC = b_Th) Or + (wC = b_d) Or (wC = b_dh) Or (wC = b_n) Or (wC = b_p) Or (wC = b_b) Or + (wC = b_m) Or (wC = b_z) Or (wC = b_r) Or (wC = b_L) Or (wC = b_sh) Or + (wC = b_ss) Or (wC = b_s) Or (wC = b_h) Or (wC = b_y) Then + Result := True; End; @@ -535,167 +568,189 @@ Function TUnicodeToBijoy2000.Convert(Const UniText: String): String; Begin - If UniText = '' Then Begin - Result := ''; - exit; - End; - - fUniText := UniText; - fConvertedText := ''; - DeNormalize; - ReArrangeKars; - ReArrangeReph; - ReplaceKarsVowels; - ConvertRFola_ZFola_Hasanta; - ReplaceFullForms; - FirstHalfForms; - SecondHalfForms; - Consonants; - FinalTouch; - Result := fConvertedText; + If UniText = '' Then + Begin + Result := ''; + exit; + End; + + fUniText := UniText; + fConvertedText := ''; + DeNormalize; + ReArrangeKars; + ReArrangeReph; + ReplaceKarsVowels; + ConvertRFola_ZFola_Hasanta; + ReplaceFullForms; + FirstHalfForms; + SecondHalfForms; + Consonants; + FinalTouch; + Result := fConvertedText; End; { =============================================================================== } Procedure TUnicodeToBijoy2000.ConvertRFola_ZFola_Hasanta; Var - I: Integer; + I: Integer; Begin - // Convert Z-Fola - fConvertedText := ReplaceStr(fConvertedText, b_Hasanta + b_z, A_ZFola); - // Convert Hasanta - fConvertedText := ReplaceStr(fConvertedText, b_Hasanta + zwnj, A_Hasanta); - // Convert R-Fola - Repeat - I := Pos(b_Hasanta + b_r, fConvertedText); - If I <= 0 Then - break; - { P/G + RoFola } - If ((MidStr(fConvertedText, I - 1, 1) = b_p) Or (MidStr(fConvertedText, I - 1, 1) = b_g)) Then - // MidStr(fConvertedText, I, 2) := A_RFola_3 - fConvertedText := WideStuffString(fConvertedText, I, 2, A_RFola_3) - { V+Rofola, 2nd Half V+Rofola } - Else If MidStr(fConvertedText, I - 1, 1) = b_Bh Then Begin - If MidStr(fConvertedText, I - 2, 1) = b_Hasanta Then - // MidStr(fConvertedText, I - 1, 3) := A_BH_R_2H - fConvertedText := WideStuffString(fConvertedText, I - 1, 3, A_BH_R_2H) - Else - // MidStr(fConvertedText, I - 1, 3) := A_BH_R; - fConvertedText := WideStuffString(fConvertedText, I - 1, 3, A_Bh_R); - End - { K+Rofola, 2nd Half K+Rofola } - Else If MidStr(fConvertedText, I - 1, 1) = b_K Then Begin - If MidStr(fConvertedText, I - 2, 1) = b_Hasanta Then - // MidStr(fConvertedText, I - 1, 3) := A_K_R_2H - fConvertedText := WideStuffString(fConvertedText, I - 1, 3, A_K_R_2H) - Else - // MidStr(fConvertedText, I - 1, 3) := A_K_R; - fConvertedText := WideStuffString(fConvertedText, I - 1, 3, A_K_R); - End - { T+Rofola, 2nd Half T+Rofola } - Else If MidStr(fConvertedText, I - 1, 1) = b_t Then Begin - If MidStr(fConvertedText, I - 2, 1) = b_Hasanta Then Begin - // MidStr(fConvertedText, I - 1, 3) := A_T_R_2H - If (MidStr(fConvertedText, I - 3, 1) = b_K) Or (MidStr(fConvertedText, I - 3, 1) = b_t) Then - fConvertedText := WideStuffString(fConvertedText, I, 2, A_RFola_2) - Else - fConvertedText := WideStuffString(fConvertedText, I - 1, 3, A_T_R_2H); - End - Else - // MidStr(fConvertedText, I - 1, 3) := A_T_R; - fConvertedText := WideStuffString(fConvertedText, I - 1, 3, A_T_R); - End - Else Begin - If MidStr(fConvertedText, I - 1, 1) = b_ph Then - // MidStr(fConvertedText, I, 2) := A_RFola_2 - fConvertedText := WideStuffString(fConvertedText, I, 2, A_RFola_2) - Else - // MidStr(fConvertedText, I, 2) := A_RFola_1; - fConvertedText := WideStuffString(fConvertedText, I, 2, A_RFola_1); - End; - - Until I <= 0; + // Convert Z-Fola + fConvertedText := ReplaceStr(fConvertedText, b_Hasanta + b_z, A_ZFola); + // Convert Hasanta + fConvertedText := ReplaceStr(fConvertedText, b_Hasanta + zwnj, A_Hasanta); + // Convert R-Fola + Repeat + I := Pos(b_Hasanta + b_r, fConvertedText); + If I <= 0 Then + break; + { P/G + RoFola } + If ((MidStr(fConvertedText, I - 1, 1) = b_p) Or + (MidStr(fConvertedText, I - 1, 1) = b_g)) Then + // MidStr(fConvertedText, I, 2) := A_RFola_3 + fConvertedText := WideStuffString(fConvertedText, I, 2, A_RFola_3) + { V+Rofola, 2nd Half V+Rofola } + Else If MidStr(fConvertedText, I - 1, 1) = b_Bh Then + Begin + If MidStr(fConvertedText, I - 2, 1) = b_Hasanta Then + // MidStr(fConvertedText, I - 1, 3) := A_BH_R_2H + fConvertedText := WideStuffString(fConvertedText, I - 1, 3, A_BH_R_2H) + Else + // MidStr(fConvertedText, I - 1, 3) := A_BH_R; + fConvertedText := WideStuffString(fConvertedText, I - 1, 3, A_Bh_R); + End + { K+Rofola, 2nd Half K+Rofola } + Else If MidStr(fConvertedText, I - 1, 1) = b_K Then + Begin + If MidStr(fConvertedText, I - 2, 1) = b_Hasanta Then + // MidStr(fConvertedText, I - 1, 3) := A_K_R_2H + fConvertedText := WideStuffString(fConvertedText, I - 1, 3, A_K_R_2H) + Else + // MidStr(fConvertedText, I - 1, 3) := A_K_R; + fConvertedText := WideStuffString(fConvertedText, I - 1, 3, A_K_R); + End + { T+Rofola, 2nd Half T+Rofola } + Else If MidStr(fConvertedText, I - 1, 1) = b_t Then + Begin + If MidStr(fConvertedText, I - 2, 1) = b_Hasanta Then + Begin + // MidStr(fConvertedText, I - 1, 3) := A_T_R_2H + If (MidStr(fConvertedText, I - 3, 1) = b_K) Or + (MidStr(fConvertedText, I - 3, 1) = b_t) Then + fConvertedText := WideStuffString(fConvertedText, I, 2, A_RFola_2) + Else + fConvertedText := WideStuffString(fConvertedText, I - 1, 3, A_T_R_2H); + End + Else + // MidStr(fConvertedText, I - 1, 3) := A_T_R; + fConvertedText := WideStuffString(fConvertedText, I - 1, 3, A_T_R); + End + Else + Begin + If MidStr(fConvertedText, I - 1, 1) = b_ph Then + // MidStr(fConvertedText, I, 2) := A_RFola_2 + fConvertedText := WideStuffString(fConvertedText, I, 2, A_RFola_2) + Else + // MidStr(fConvertedText, I, 2) := A_RFola_1; + fConvertedText := WideStuffString(fConvertedText, I, 2, A_RFola_1); + End; + + Until I <= 0; End; { =============================================================================== } Procedure TUnicodeToBijoy2000.DeNormalize; Begin - fConvertedText := ReplaceStr(fUniText, b_z + b_Nukta, b_y); - fConvertedText := ReplaceStr(fConvertedText, b_dd + b_Nukta, b_rr); - fConvertedText := ReplaceStr(fConvertedText, b_ddh + b_Nukta, b_rrh); + fConvertedText := ReplaceStr(fUniText, b_z + b_Nukta, b_y); + fConvertedText := ReplaceStr(fConvertedText, b_dd + b_Nukta, b_rr); + fConvertedText := ReplaceStr(fConvertedText, b_ddh + b_Nukta, b_rrh); End; { =============================================================================== } Procedure TUnicodeToBijoy2000.ReArrangeKars; Var - I: Integer; - fKar, wCTmp: Char; - wSTmp: String; + I: Integer; + fKar, wCTmp: Char; + wSTmp: String; - Function MoveAbleKar(Const wKar: Char): Boolean; - Begin - Result := False; - If ((wKar = b_Ekar) Or (wKar = b_IKar) Or (wKar = b_OIKar)) Then - Result := True; - End; + Function MoveAbleKar(Const wKar: Char): Boolean; + Begin + Result := False; + If ((wKar = b_Ekar) Or (wKar = b_IKar) Or (wKar = b_OIKar)) Then + Result := True; + End; Begin - // Break O-kar and OU-Kar - fConvertedText := ReplaceStr(fConvertedText, b_OKar, b_Ekar + b_AAKar); - fConvertedText := ReplaceStr(fConvertedText, b_OUKar, b_Ekar + b_LengthMark); - - // Bring IKar,EKar and OIkar to beginning of consonant/conjuncts - I := Length(fConvertedText); - wSTmp := ''; - fKar := #0; - Repeat - wCTmp := fConvertedText[I]; - If MoveAbleKar(wCTmp) Then Begin // Make this kar pending - fKar := wCTmp; - End - Else Begin - If fKar = #0 Then Begin // No Kar is pending - wSTmp := wCTmp + wSTmp; - End - Else Begin // Kar is pending - If (I - 1 < 1) Then Begin // This is begining of text, no need to search back - wSTmp := fKar + wCTmp + wSTmp; // Place pending kar at begining - fKar := #0; - End - Else Begin // Not begining of text, search backward more deeply - If ((IsPureConsonent(wCTmp) = False) And (wCTmp <> b_Hasanta) And (wCTmp <> zwj) And (wCTmp <> zwnj)) Then Begin - // We are at the beginning of a Consonant, place pending kar here - wSTmp := wCTmp + fKar + wSTmp; - fKar := #0; - End - Else Begin - If ((wCTmp = b_Hasanta) Or (wCTmp = zwj) Or (wCTmp = zwnj)) Then - wSTmp := wCTmp + wSTmp; - - If (IsPureConsonent(wCTmp) = True) Then Begin - If ((fConvertedText[I - 1] = b_Hasanta) Or (fConvertedText[I - 1] = zwj) Or (fConvertedText[I - 1] = zwnj)) Then - wSTmp := wCTmp + wSTmp - Else Begin - wSTmp := fKar + wCTmp + wSTmp; - // Place pending kar at begining - fKar := #0; - End; - End; - End; - End; - End; - - End; - - I := I - 1; - Until I < 1; - - fConvertedText := wSTmp; - - fConvertedText := ReplaceStr(fConvertedText, String('“'), A_StartDoubleQuote); - fConvertedText := ReplaceStr(fConvertedText, String('”'), A_EndDoubleQuote); + // Break O-kar and OU-Kar + fConvertedText := ReplaceStr(fConvertedText, b_OKar, b_Ekar + b_AAKar); + fConvertedText := ReplaceStr(fConvertedText, b_OUKar, b_Ekar + b_LengthMark); + + // Bring IKar,EKar and OIkar to beginning of consonant/conjuncts + I := Length(fConvertedText); + wSTmp := ''; + fKar := #0; + Repeat + wCTmp := fConvertedText[I]; + If MoveAbleKar(wCTmp) Then + Begin // Make this kar pending + fKar := wCTmp; + End + Else + Begin + If fKar = #0 Then + Begin // No Kar is pending + wSTmp := wCTmp + wSTmp; + End + Else + Begin // Kar is pending + If (I - 1 < 1) Then + Begin // This is begining of text, no need to search back + wSTmp := fKar + wCTmp + wSTmp; + // Place pending kar at begining + fKar := #0; + End + Else + Begin // Not begining of text, search backward more deeply + If ((IsPureConsonent(wCTmp) = False) And (wCTmp <> b_Hasanta) And + (wCTmp <> zwj) And (wCTmp <> zwnj)) Then + Begin + // We are at the beginning of a Consonant, place pending kar here + wSTmp := wCTmp + fKar + wSTmp; + fKar := #0; + End + Else + Begin + If ((wCTmp = b_Hasanta) Or (wCTmp = zwj) Or (wCTmp = zwnj)) Then + wSTmp := wCTmp + wSTmp; + + If (IsPureConsonent(wCTmp) = True) Then + Begin + If ((fConvertedText[I - 1] = b_Hasanta) Or + (fConvertedText[I - 1] = zwj) Or + (fConvertedText[I - 1] = zwnj)) Then + wSTmp := wCTmp + wSTmp + Else + Begin + wSTmp := fKar + wCTmp + wSTmp; + // Place pending kar at begining + fKar := #0; + End; + End; + End; + End; + End; + + End; + + I := I - 1; + Until I < 1; + + fConvertedText := wSTmp; + + fConvertedText := ReplaceStr(fConvertedText, String('“'), A_StartDoubleQuote); + fConvertedText := ReplaceStr(fConvertedText, String('”'), A_EndDoubleQuote); End; @@ -703,232 +758,299 @@ Procedure TUnicodeToBijoy2000.ReArrangeReph; Var - I: Integer; - wCTmp: Char; - wSTmp: String; - RephPending: Boolean; - - Function MoveAbleReph: Boolean; - Begin - Result := False; - If I + 2 > Length(fConvertedText) Then - exit; - If ((fConvertedText[I] = b_r) And (fConvertedText[I + 1] = b_Hasanta) And (fConvertedText[I + 2] <> zwj) And (fConvertedText[I + 2] <> zwnj)) Then - Result := True; - End; + I: Integer; + wCTmp: Char; + wSTmp: String; + RephPending: Boolean; + + Function MoveAbleReph: Boolean; + Begin + Result := False; + If I + 2 > Length(fConvertedText) Then + exit; + If ((fConvertedText[I] = b_r) And (fConvertedText[I + 1] = b_Hasanta) And + (fConvertedText[I + 2] <> zwj) And (fConvertedText[I + 2] <> zwnj)) Then + Result := True; + End; Begin - If Length(fConvertedText) < 3 Then - exit; - I := 1; - wSTmp := ''; - RephPending := False; - Repeat - wCTmp := fConvertedText[I]; - If MoveAbleReph = False Then Begin - If RephPending = False Then Begin - wSTmp := wSTmp + wCTmp; - End - Else Begin - If ((IsPureConsonent(wCTmp) = False) And (wCTmp <> b_Hasanta) And (wCTmp <> zwj) And (wCTmp <> zwnj)) Then Begin - wSTmp := wSTmp + A_Reph + wCTmp; - RephPending := False; - End - Else Begin - If I + 1 > Length(fConvertedText) Then Begin - wSTmp := wSTmp + wCTmp + A_Reph; - RephPending := False; - End - Else Begin - If ((wCTmp = b_Hasanta) Or (wCTmp = zwj) Or (wCTmp = zwnj)) Then - wSTmp := wSTmp + wCTmp; - - If (IsPureConsonent(wCTmp) = True) Then Begin - If ((fConvertedText[I + 1] = b_Hasanta) Or (fConvertedText[I + 1] = zwj) Or (fConvertedText[I + 1] = zwnj)) Then - wSTmp := wSTmp + wCTmp - Else Begin - wSTmp := wSTmp + wCTmp + A_Reph; - RephPending := False; - End; - End; - End; - End; - End; - End - Else Begin - RephPending := True; - I := I + 1; - End; - - I := I + 1; - Until I > Length(fConvertedText); - fConvertedText := wSTmp; + If Length(fConvertedText) < 3 Then + exit; + I := 1; + wSTmp := ''; + RephPending := False; + Repeat + wCTmp := fConvertedText[I]; + If MoveAbleReph = False Then + Begin + If RephPending = False Then + Begin + wSTmp := wSTmp + wCTmp; + End + Else + Begin + If ((IsPureConsonent(wCTmp) = False) And (wCTmp <> b_Hasanta) And + (wCTmp <> zwj) And (wCTmp <> zwnj)) Then + Begin + wSTmp := wSTmp + A_Reph + wCTmp; + RephPending := False; + End + Else + Begin + If I + 1 > Length(fConvertedText) Then + Begin + wSTmp := wSTmp + wCTmp + A_Reph; + RephPending := False; + End + Else + Begin + If ((wCTmp = b_Hasanta) Or (wCTmp = zwj) Or (wCTmp = zwnj)) Then + wSTmp := wSTmp + wCTmp; + + If (IsPureConsonent(wCTmp) = True) Then + Begin + If ((fConvertedText[I + 1] = b_Hasanta) Or + (fConvertedText[I + 1] = zwj) Or + (fConvertedText[I + 1] = zwnj)) Then + wSTmp := wSTmp + wCTmp + Else + Begin + wSTmp := wSTmp + wCTmp + A_Reph; + RephPending := False; + End; + End; + End; + End; + End; + End + Else + Begin + RephPending := True; + I := I + 1; + End; + + I := I + 1; + Until I > Length(fConvertedText); + fConvertedText := wSTmp; End; { =============================================================================== } Procedure TUnicodeToBijoy2000.ReplaceKarsVowels; Var - I: Integer; + I: Integer; Begin - // Convert Ekar - Repeat - I := Pos(b_Ekar, fConvertedText); - If I <= 0 Then - break; - If ((I = 1) Or (MidStr(fConvertedText, I - 1, 1) = ' ') Or (MidStr(fConvertedText, I - 1, 1) = #13) Or (MidStr(fConvertedText, I - 1, 1) = #10) Or (MidStr(fConvertedText, I - 1, 1) = #9)) Then - fConvertedText[I] := A_EKar1 - Else - fConvertedText[I] := A_EKar2; - Until I <= 0; - - // Convert OIKar - Repeat - I := Pos(b_OIKar, fConvertedText); - If I <= 0 Then - break; - If ((I = 1) Or (MidStr(fConvertedText, I - 1, 1) = ' ') Or (MidStr(fConvertedText, I - 1, 1) = #13) Or (MidStr(fConvertedText, I - 1, 1) = #10) Or (MidStr(fConvertedText, I - 1, 1) = #9)) Then - fConvertedText[I] := A_OIKar1 - Else - fConvertedText[I] := A_OIKar2; - Until I <= 0; - - // Convert UKar - fConvertedText := ReplaceStr(fConvertedText, b_g + b_Ukar, A_G_Ukar); - fConvertedText := ReplaceStr(fConvertedText, b_sh + b_Ukar, A_Sh_UKar); - fConvertedText := ReplaceStr(fConvertedText, b_h + b_Ukar, A_H_UKar); - fConvertedText := ReplaceStr(fConvertedText, b_Hasanta + b_t + b_Ukar, b_Hasanta + A_T_UKar_2H); - Repeat - I := Pos(b_Ukar, fConvertedText); - If I <= 0 Then - break; - If I - 1 >= 1 Then Begin - If BaseLineRightCharacter(fConvertedText[I - 1]) = True Then Begin - - If fConvertedText[I - 1] = b_r Then Begin - If ((MidStr(fConvertedText, I - 3, 3) = b_sh + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, 3) = b_d + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, 3) = b_g + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, - 3) = b_t + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, 3) = b_j + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, 3) = b_Th + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, - 3) = b_dh + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 5, 5) = b_n + b_Hasanta + b_d + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, 3) = b_p + b_Hasanta + b_r) Or (MidStr(fConvertedText, - I - 3, 3) = b_b + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, 3) = b_Bh + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, 3) = b_m + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, - 3) = b_s + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 5, 5) = b_m + b_Hasanta + b_p + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 5, 5) = b_ss + b_Hasanta + b_p + b_Hasanta + b_r) Or - (MidStr(fConvertedText, I - 5, 5) = b_s + b_Hasanta + b_p + b_Hasanta + b_r)) Then - fConvertedText[I] := A_UKar4 - Else If MidStr(fConvertedText, I - 2, 1) <> b_Hasanta Then - fConvertedText[I] := A_UKar4 - Else - fConvertedText[I] := A_UKar2; - End - Else If fConvertedText[I - 1] = b_L Then Begin - If ((MidStr(fConvertedText, I - 3, 3) = b_g + b_Hasanta + b_L) Or (MidStr(fConvertedText, I - 3, 3) = b_p + b_Hasanta + b_L) Or (MidStr(fConvertedText, I - 3, 3) = b_b + b_Hasanta + b_L) Or (MidStr(fConvertedText, I - 3, - 3) = b_sh + b_Hasanta + b_L) Or (MidStr(fConvertedText, I - 3, 3) = b_s + b_Hasanta + b_L) Or (MidStr(fConvertedText, I - 5, 5) = b_s + b_Hasanta + b_p + b_Hasanta + b_L)) Then - fConvertedText[I] := A_UKar4 - Else - fConvertedText[I] := A_UKar2; - End - Else - fConvertedText[I] := A_UKar2; - - If MidStr(fConvertedText, I - 3, 3) = b_ss + b_Hasanta + b_Nn Then - fConvertedText[I] := A_UKar1; - { Else - fConvertedText[I] := A_UKar2; } - - End - Else Begin - If ((fConvertedText[I - 1] = b_rr) Or (fConvertedText[I - 1] = b_rrh)) Then Begin - fConvertedText[I] := A_UKar3; - End - Else - fConvertedText[I] := A_UKar1; - End; - End - Else - fConvertedText[I] := A_UKar1; - Until I <= 0; - - // Convert UUKar - Repeat - I := Pos(b_UUKar, fConvertedText); - If I <= 0 Then - break; - If I - 1 >= 1 Then Begin - If BaseLineRightCharacter(fConvertedText[I - 1]) = True Then Begin - If fConvertedText[I - 1] = b_r Then Begin - If ((MidStr(fConvertedText, I - 3, 3) = b_sh + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, 3) = b_d + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, 3) = b_g + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, - 3) = b_t + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, 3) = b_j + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, 3) = b_Th + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, - 3) = b_dh + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 5, 5) = b_n + b_Hasanta + b_d + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, 3) = b_p + b_Hasanta + b_r) Or (MidStr(fConvertedText, - I - 3, 3) = b_b + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, 3) = b_Bh + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, 3) = b_m + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, - 3) = b_s + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 5, 5) = b_m + b_Hasanta + b_p + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 5, 5) = b_ss + b_Hasanta + b_p + b_Hasanta + b_r) Or - (MidStr(fConvertedText, I - 5, 5) = b_s + b_Hasanta + b_p + b_Hasanta + b_r)) Then - fConvertedText[I] := A_UUKar3 - Else If MidStr(fConvertedText, I - 2, 1) <> b_Hasanta Then - fConvertedText[I] := A_UUKar3 - Else - fConvertedText[I] := A_UUKar2; - End - Else If fConvertedText[I - 1] = b_L Then Begin - If ((MidStr(fConvertedText, I - 3, 3) = b_g + b_Hasanta + b_L) Or (MidStr(fConvertedText, I - 3, 3) = b_p + b_Hasanta + b_L) Or (MidStr(fConvertedText, I - 3, 3) = b_b + b_Hasanta + b_L) Or (MidStr(fConvertedText, I - 3, - 3) = b_sh + b_Hasanta + b_L) Or (MidStr(fConvertedText, I - 3, 3) = b_s + b_Hasanta + b_L) Or (MidStr(fConvertedText, I - 5, 5) = b_s + b_Hasanta + b_p + b_Hasanta + b_L)) Then - fConvertedText[I] := A_UUKar3 - Else - fConvertedText[I] := A_UUKar2; - End - Else - fConvertedText[I] := A_UUKar2; - End - Else - fConvertedText[I] := A_UUKar1; - End - Else - fConvertedText[I] := A_UUKar1; - Until I <= 0; - - // Convert RRIKar - fConvertedText := ReplaceStr(fConvertedText, b_h + b_Rrikar, A_H_RRIKar); - Repeat - I := Pos(b_Rrikar, fConvertedText); - If I <= 0 Then - break; - If I - 1 >= 1 Then Begin - If BaseLineRightCharacter(fConvertedText[I - 1]) = True Then Begin - fConvertedText[I] := A_RRIKar1; - End - Else - fConvertedText[I] := A_RRIKar2; - End - Else - fConvertedText[I] := A_RRIKar2; - Until I <= 0; - - // Convert rest of the Kars - fConvertedText := ReplaceStr(fConvertedText, b_AAKar, A_AAKar); - fConvertedText := ReplaceStr(fConvertedText, b_IKar, A_IKar); - fConvertedText := ReplaceStr(fConvertedText, b_IIKar, A_IIKar); - fConvertedText := ReplaceStr(fConvertedText, b_LengthMark, A_OUKar); - - // Convert Vowels - fConvertedText := ReplaceStr(fConvertedText, b_A, A_A); - fConvertedText := ReplaceStr(fConvertedText, b_AA, A_AA); - fConvertedText := ReplaceStr(fConvertedText, b_I, A_I); - fConvertedText := ReplaceStr(fConvertedText, b_II, A_II); - fConvertedText := ReplaceStr(fConvertedText, b_U, A_U); - fConvertedText := ReplaceStr(fConvertedText, b_UU, A_UU); - fConvertedText := ReplaceStr(fConvertedText, b_RRI, A_RRI); - fConvertedText := ReplaceStr(fConvertedText, b_E, A_E); - fConvertedText := ReplaceStr(fConvertedText, b_OI, A_OI); - fConvertedText := ReplaceStr(fConvertedText, b_O, A_O); - fConvertedText := ReplaceStr(fConvertedText, b_OU, A_OU); + // Convert Ekar + Repeat + I := Pos(b_Ekar, fConvertedText); + If I <= 0 Then + break; + If ((I = 1) Or (MidStr(fConvertedText, I - 1, 1) = ' ') Or + (MidStr(fConvertedText, I - 1, 1) = #13) Or (MidStr(fConvertedText, I - 1, + 1) = #10) Or (MidStr(fConvertedText, I - 1, 1) = #9)) Then + fConvertedText[I] := A_EKar1 + Else + fConvertedText[I] := A_EKar2; + Until I <= 0; + + // Convert OIKar + Repeat + I := Pos(b_OIKar, fConvertedText); + If I <= 0 Then + break; + If ((I = 1) Or (MidStr(fConvertedText, I - 1, 1) = ' ') Or + (MidStr(fConvertedText, I - 1, 1) = #13) Or (MidStr(fConvertedText, I - 1, + 1) = #10) Or (MidStr(fConvertedText, I - 1, 1) = #9)) Then + fConvertedText[I] := A_OIKar1 + Else + fConvertedText[I] := A_OIKar2; + Until I <= 0; + + // Convert UKar + fConvertedText := ReplaceStr(fConvertedText, b_g + b_Ukar, A_G_Ukar); + fConvertedText := ReplaceStr(fConvertedText, b_sh + b_Ukar, A_Sh_UKar); + fConvertedText := ReplaceStr(fConvertedText, b_h + b_Ukar, A_H_UKar); + fConvertedText := ReplaceStr(fConvertedText, b_Hasanta + b_t + b_Ukar, + b_Hasanta + A_T_UKar_2H); + Repeat + I := Pos(b_Ukar, fConvertedText); + If I <= 0 Then + break; + If I - 1 >= 1 Then + Begin + If BaseLineRightCharacter(fConvertedText[I - 1]) = True Then + Begin + + If fConvertedText[I - 1] = b_r Then + Begin + If ((MidStr(fConvertedText, I - 3, 3) = b_sh + b_Hasanta + b_r) Or + (MidStr(fConvertedText, I - 3, 3) = b_d + b_Hasanta + b_r) Or + (MidStr(fConvertedText, I - 3, 3) = b_g + b_Hasanta + b_r) Or + (MidStr(fConvertedText, I - 3, 3) = b_t + b_Hasanta + b_r) Or + (MidStr(fConvertedText, I - 3, 3) = b_j + b_Hasanta + b_r) Or + (MidStr(fConvertedText, I - 3, 3) = b_Th + b_Hasanta + b_r) Or + (MidStr(fConvertedText, I - 3, 3) = b_dh + b_Hasanta + b_r) Or + (MidStr(fConvertedText, I - 5, 5) = b_n + b_Hasanta + b_d + + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, 3) = b_p + + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, 3) = b_b + + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, 3) = b_Bh + + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, 3) = b_m + + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, 3) = b_s + + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 5, 5) = b_m + + b_Hasanta + b_p + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 5, + 5) = b_ss + b_Hasanta + b_p + b_Hasanta + b_r) Or + (MidStr(fConvertedText, I - 5, 5) = b_s + b_Hasanta + b_p + + b_Hasanta + b_r)) Then + fConvertedText[I] := A_UKar4 + Else If MidStr(fConvertedText, I - 2, 1) <> b_Hasanta Then + fConvertedText[I] := A_UKar4 + Else + fConvertedText[I] := A_UKar2; + End + Else If fConvertedText[I - 1] = b_L Then + Begin + If ((MidStr(fConvertedText, I - 3, 3) = b_g + b_Hasanta + b_L) Or + (MidStr(fConvertedText, I - 3, 3) = b_p + b_Hasanta + b_L) Or + (MidStr(fConvertedText, I - 3, 3) = b_b + b_Hasanta + b_L) Or + (MidStr(fConvertedText, I - 3, 3) = b_sh + b_Hasanta + b_L) Or + (MidStr(fConvertedText, I - 3, 3) = b_s + b_Hasanta + b_L) Or + (MidStr(fConvertedText, I - 5, 5) = b_s + b_Hasanta + b_p + + b_Hasanta + b_L)) Then + fConvertedText[I] := A_UKar4 + Else + fConvertedText[I] := A_UKar2; + End + Else + fConvertedText[I] := A_UKar2; + + If MidStr(fConvertedText, I - 3, 3) = b_ss + b_Hasanta + b_Nn Then + fConvertedText[I] := A_UKar1; + { Else + fConvertedText[I] := A_UKar2; } + + End + Else + Begin + If ((fConvertedText[I - 1] = b_rr) Or + (fConvertedText[I - 1] = b_rrh)) Then + Begin + fConvertedText[I] := A_UKar3; + End + Else + fConvertedText[I] := A_UKar1; + End; + End + Else + fConvertedText[I] := A_UKar1; + Until I <= 0; + + // Convert UUKar + Repeat + I := Pos(b_UUKar, fConvertedText); + If I <= 0 Then + break; + If I - 1 >= 1 Then + Begin + If BaseLineRightCharacter(fConvertedText[I - 1]) = True Then + Begin + If fConvertedText[I - 1] = b_r Then + Begin + If ((MidStr(fConvertedText, I - 3, 3) = b_sh + b_Hasanta + b_r) Or + (MidStr(fConvertedText, I - 3, 3) = b_d + b_Hasanta + b_r) Or + (MidStr(fConvertedText, I - 3, 3) = b_g + b_Hasanta + b_r) Or + (MidStr(fConvertedText, I - 3, 3) = b_t + b_Hasanta + b_r) Or + (MidStr(fConvertedText, I - 3, 3) = b_j + b_Hasanta + b_r) Or + (MidStr(fConvertedText, I - 3, 3) = b_Th + b_Hasanta + b_r) Or + (MidStr(fConvertedText, I - 3, 3) = b_dh + b_Hasanta + b_r) Or + (MidStr(fConvertedText, I - 5, 5) = b_n + b_Hasanta + b_d + + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, 3) = b_p + + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, 3) = b_b + + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, 3) = b_Bh + + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, 3) = b_m + + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 3, 3) = b_s + + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 5, 5) = b_m + + b_Hasanta + b_p + b_Hasanta + b_r) Or (MidStr(fConvertedText, I - 5, + 5) = b_ss + b_Hasanta + b_p + b_Hasanta + b_r) Or + (MidStr(fConvertedText, I - 5, 5) = b_s + b_Hasanta + b_p + + b_Hasanta + b_r)) Then + fConvertedText[I] := A_UUKar3 + Else If MidStr(fConvertedText, I - 2, 1) <> b_Hasanta Then + fConvertedText[I] := A_UUKar3 + Else + fConvertedText[I] := A_UUKar2; + End + Else If fConvertedText[I - 1] = b_L Then + Begin + If ((MidStr(fConvertedText, I - 3, 3) = b_g + b_Hasanta + b_L) Or + (MidStr(fConvertedText, I - 3, 3) = b_p + b_Hasanta + b_L) Or + (MidStr(fConvertedText, I - 3, 3) = b_b + b_Hasanta + b_L) Or + (MidStr(fConvertedText, I - 3, 3) = b_sh + b_Hasanta + b_L) Or + (MidStr(fConvertedText, I - 3, 3) = b_s + b_Hasanta + b_L) Or + (MidStr(fConvertedText, I - 5, 5) = b_s + b_Hasanta + b_p + + b_Hasanta + b_L)) Then + fConvertedText[I] := A_UUKar3 + Else + fConvertedText[I] := A_UUKar2; + End + Else + fConvertedText[I] := A_UUKar2; + End + Else + fConvertedText[I] := A_UUKar1; + End + Else + fConvertedText[I] := A_UUKar1; + Until I <= 0; + + // Convert RRIKar + fConvertedText := ReplaceStr(fConvertedText, b_h + b_Rrikar, A_H_RRIKar); + Repeat + I := Pos(b_Rrikar, fConvertedText); + If I <= 0 Then + break; + If I - 1 >= 1 Then + Begin + If BaseLineRightCharacter(fConvertedText[I - 1]) = True Then + Begin + fConvertedText[I] := A_RRIKar1; + End + Else + fConvertedText[I] := A_RRIKar2; + End + Else + fConvertedText[I] := A_RRIKar2; + Until I <= 0; + + // Convert rest of the Kars + fConvertedText := ReplaceStr(fConvertedText, b_AAKar, A_AAKar); + fConvertedText := ReplaceStr(fConvertedText, b_IKar, A_IKar); + fConvertedText := ReplaceStr(fConvertedText, b_IIKar, A_IIKar); + fConvertedText := ReplaceStr(fConvertedText, b_LengthMark, A_OUKar); + + // Convert Vowels + fConvertedText := ReplaceStr(fConvertedText, b_A, A_A); + fConvertedText := ReplaceStr(fConvertedText, b_AA, A_AA); + fConvertedText := ReplaceStr(fConvertedText, b_I, A_I); + fConvertedText := ReplaceStr(fConvertedText, b_II, A_II); + fConvertedText := ReplaceStr(fConvertedText, b_U, A_U); + fConvertedText := ReplaceStr(fConvertedText, b_UU, A_UU); + fConvertedText := ReplaceStr(fConvertedText, b_RRI, A_RRI); + fConvertedText := ReplaceStr(fConvertedText, b_E, A_E); + fConvertedText := ReplaceStr(fConvertedText, b_OI, A_OI); + fConvertedText := ReplaceStr(fConvertedText, b_O, A_O); + fConvertedText := ReplaceStr(fConvertedText, b_OU, A_OU); End; { =============================================================================== } -Function TUnicodeToBijoy2000.WideStuffString(Source: String; Start, Len: Integer; SubString: String): String; +Function TUnicodeToBijoy2000.WideStuffString(Source: String; + Start, Len: Integer; SubString: String): String; Var - FirstPart, LastPart: String; + FirstPart, LastPart: String; Begin - FirstPart := LeftStr(Source, Start - 1); - LastPart := MidStr(Source, Start + Len, Length(Source)); - Result := FirstPart + SubString + LastPart; + FirstPart := LeftStr(Source, Start - 1); + LastPart := MidStr(Source, Start + Len, Length(Source)); + Result := FirstPart + SubString + LastPart; End; { =============================================================================== } From 1774c295064caf74834414ee1af06d19227fb357 Mon Sep 17 00:00:00 2001 From: Jayed Ahsan Saad <42943920+JayedAhsan@users.noreply.github.com> Date: Mon, 31 Jan 2022 21:05:51 +0600 Subject: [PATCH 2/6] Update Readme.md Updated Compiling Instructions. Updated ICS weblink. --- Readme.md | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/Readme.md b/Readme.md index 3be82bc..b5f4a14 100644 --- a/Readme.md +++ b/Readme.md @@ -18,38 +18,20 @@ respective authors of that library. ## Required Delphi Version: ## -**Delphi 2010** +**Delphi 10.4** ## Required 3rd party libraries: ## -This source includes the following 3rd party libraries: - - - -1. **NativeXml**. -Open source. -Site: http://www.simdesign.nl/nativexml.html - -2. **PCRE Delphi wrapper**. -Open source. -Author: Renato Mancuso **Before compiling, you have to install the following 3rd party libraries in you Delphi environment:** -1. **DISQLite3**. -Freeware (Not open source). -Site: http://www.yunqa.de/ -2. **ICS**. +1. **ICS**. Freeware with Source Code. -Site: http://www.overbyte.be/ - -3. **Delphi Jedi (JVCL and JCL)**. -Open source. -Site: http://www.delphi-jedi.org/ +Site: http://www.overbyte.eu/ If you are ready with the above mentioned requirements, the delphi project files (*.dpr) should be compiled without any problem. From b35eb074bae94a24656d7ab3ef58539808e622a6 Mon Sep 17 00:00:00 2001 From: Jayed Ahsan Saad <42943920+JayedAhsan@users.noreply.github.com> Date: Mon, 31 Jan 2022 21:09:13 +0600 Subject: [PATCH 3/6] Fix Initial Form Position --- Skin Designer/ufrmSkinCreator.pas | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Skin Designer/ufrmSkinCreator.pas b/Skin Designer/ufrmSkinCreator.pas index 5dbd434..f40c10f 100644 --- a/Skin Designer/ufrmSkinCreator.pas +++ b/Skin Designer/ufrmSkinCreator.pas @@ -521,6 +521,8 @@ Index := 1; GroupBox1.BringToFront; + { Position Form to Screen Center } + Self.position := poScreenCenter; Self.Show; Application.ProcessMessages; EditSkinName.SetFocus; From 619a502662b4efeabd132d843929785d3a8863a5 Mon Sep 17 00:00:00 2001 From: Jayed Ahsan Saad <42943920+JayedAhsan@users.noreply.github.com> Date: Mon, 31 Jan 2022 21:13:06 +0600 Subject: [PATCH 4/6] Updated 3rd party components list --- Keyboard and Spell checker/Forms/ufrmAbout.dfm | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/Keyboard and Spell checker/Forms/ufrmAbout.dfm b/Keyboard and Spell checker/Forms/ufrmAbout.dfm index c85af91..c63385d 100644 --- a/Keyboard and Spell checker/Forms/ufrmAbout.dfm +++ b/Keyboard and Spell checker/Forms/ufrmAbout.dfm @@ -6369,27 +6369,10 @@ object frmAbout: TfrmAbout '3rd Party components:' '________________________' '' - 'NativeXml' - '(http://www.simdesign.nl/xml.html)' - '' - '' - 'PCRE Delphi wrapper by:' - 'Renato Mancuso ' - 'mancuso@renatomancuso.com' - '' - '' - 'DISQLite3' - '(http://www.yunqa.de/)' - '' - '' 'ICS' '(http://www.overbyte.be/)' '' '' - 'Delphi Jedi (JVCL and JCL)' - '(http://www.delphi-jedi.org/)' - '' - '' '----------------------------' '' '' From 00283900dead586eb6bdc3eb14c7a8d4a1d83a2a Mon Sep 17 00:00:00 2001 From: Jayed Ahsan Saad <42943920+JayedAhsan@users.noreply.github.com> Date: Mon, 31 Jan 2022 21:16:44 +0600 Subject: [PATCH 5/6] Updated ICS weblink --- Keyboard and Spell checker/Forms/ufrmAbout.dfm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Keyboard and Spell checker/Forms/ufrmAbout.dfm b/Keyboard and Spell checker/Forms/ufrmAbout.dfm index c63385d..f2a4c40 100644 --- a/Keyboard and Spell checker/Forms/ufrmAbout.dfm +++ b/Keyboard and Spell checker/Forms/ufrmAbout.dfm @@ -6366,11 +6366,11 @@ object frmAbout: TfrmAbout '' '' '' - '3rd Party components:' + '3rd party components:' '________________________' '' 'ICS' - '(http://www.overbyte.be/)' + '(http://www.overbyte.eu/)' '' '' '----------------------------' From b2f9ded78c119d5a8ad20d42083f81fa80a70eba Mon Sep 17 00:00:00 2001 From: Jayed Ahsan Saad <42943920+JayedAhsan@users.noreply.github.com> Date: Mon, 31 Jan 2022 21:50:53 +0600 Subject: [PATCH 6/6] Fixed IsElevated Function --- Keyboard and Spell checker/Units/u_Admin.pas | 80 ++++++++++---------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/Keyboard and Spell checker/Units/u_Admin.pas b/Keyboard and Spell checker/Units/u_Admin.pas index e947f8d..ba8431d 100644 --- a/Keyboard and Spell checker/Units/u_Admin.pas +++ b/Keyboard and Spell checker/Units/u_Admin.pas @@ -80,52 +80,52 @@ Function IsElevatedBasic: Boolean; Var - token: Cardinal; + token: NativeUInt; ElevationType: Integer; // Elevation : DWord; dwSize: Cardinal; Begin Result := False; - // If OpenProcessToken(GetCurrentProcess, TOKEN_QUERY, token) Then - // Try - // If GetTokenInformation(token, - // TTokenInformationClass(TokenElevationType), @ElevationType, - // SizeOf(ElevationType), dwSize) Then - // { * If already elevated returns TokenElevationTypeFull. - // - // * If it can be elevated simply by showing the elevation request - // dialog it returns TokenElevationTypeLimited. - // - // * If running on a non-administrator account that needs to show - // the elevation dialog and enter an admin password, - // it returns TokenElevationTypeDefault. } - // Case ElevationType Of - // TokenElevationTypeDefault: - // Result := False; - // TokenElevationTypeFull: - // Result := True; - // TokenElevationTypeLimited: - // Result := False; - // Else - // Result := False; - // End - // Else - // Result := False; - // - // { If GetTokenInformation(token, TTokenInformationClass(TokenElevation), @Elevation, SizeOf(Elevation), dwSize) Then Begin - // If Elevation = 0 Then - // ShowMessage('token does NOT have elevate privs') - // Else - // ShowMessage('token has elevate privs'); - // End - // Else - // Result := False; } - // Finally - // CloseHandle(token); - // End - // Else - // Result := False; + If OpenProcessToken(GetCurrentProcess, TOKEN_QUERY, token) Then + Try + If GetTokenInformation(token, + TTokenInformationClass(TokenElevationType), @ElevationType, + SizeOf(ElevationType), dwSize) Then + { * If already elevated returns TokenElevationTypeFull. + + * If it can be elevated simply by showing the elevation request + dialog it returns TokenElevationTypeLimited. + + * If running on a non-administrator account that needs to show + the elevation dialog and enter an admin password, + it returns TokenElevationTypeDefault. } + Case ElevationType Of + TokenElevationTypeDefault: + Result := False; + TokenElevationTypeFull: + Result := True; + TokenElevationTypeLimited: + Result := False; + Else + Result := False; + End + Else + Result := False; + + { If GetTokenInformation(token, TTokenInformationClass(TokenElevation), @Elevation, SizeOf(Elevation), dwSize) Then Begin + If Elevation = 0 Then + ShowMessage('token does NOT have elevate privs') + Else + ShowMessage('token has elevate privs'); + End + Else + Result := False; } + Finally + CloseHandle(token); + End + Else + Result := False; End; Begin